101 |
101 |
102 CleanupStack::PopAndDestroy( &children ); |
102 CleanupStack::PopAndDestroy( &children ); |
103 } |
103 } |
104 |
104 |
105 // --------------------------------------------------------------------------- |
105 // --------------------------------------------------------------------------- |
106 // |
106 // |
107 // --------------------------------------------------------------------------- |
107 // --------------------------------------------------------------------------- |
108 // |
108 // |
109 CHnMdEventMapping* CHnMdEventMapping::NewL( TXmlEngElement aElement, |
109 CHnMdEventMapping* CHnMdEventMapping::NewL( TXmlEngElement aElement, |
110 THnMdCommonPointers* aCmnPtrs ) |
110 THnMdCommonPointers* aCmnPtrs ) |
111 { |
111 { |
112 CHnMdEventMapping* self = CHnMdEventMapping::NewLC( aElement, |
112 CHnMdEventMapping* self = CHnMdEventMapping::NewLC( aElement, |
113 aCmnPtrs ); |
113 aCmnPtrs ); |
114 CleanupStack::Pop( self ); |
114 CleanupStack::Pop( self ); |
115 return self; |
115 return self; |
116 } |
116 } |
117 |
117 |
118 // --------------------------------------------------------------------------- |
118 // --------------------------------------------------------------------------- |
119 // |
119 // |
120 // --------------------------------------------------------------------------- |
120 // --------------------------------------------------------------------------- |
121 // |
121 // |
122 TInt CHnMdEventMapping::Count() const |
122 TInt CHnMdEventMapping::Count() const |
123 { |
123 { |
124 return iMappings.Count(); |
124 return iMappings.Count(); |
125 } |
125 } |
126 |
126 |
127 // --------------------------------------------------------------------------- |
127 // --------------------------------------------------------------------------- |
128 // |
128 // |
129 // --------------------------------------------------------------------------- |
129 // --------------------------------------------------------------------------- |
130 // |
130 // |
131 CHnMdEventMapping* CHnMdEventMapping::NewLC( TXmlEngElement aElement, |
131 CHnMdEventMapping* CHnMdEventMapping::NewLC( TXmlEngElement aElement, |
132 THnMdCommonPointers* aCmnPtrs ) |
132 THnMdCommonPointers* aCmnPtrs ) |
133 { |
133 { |
134 CHnMdEventMapping* self = new( ELeave ) CHnMdEventMapping; |
134 CHnMdEventMapping* self = new( ELeave ) CHnMdEventMapping; |
135 CleanupStack::PushL( self ); |
135 CleanupStack::PushL( self ); |
136 self->ConstructL( aElement, aCmnPtrs ); |
136 self->ConstructL( aElement, aCmnPtrs ); |
137 return self; |
137 return self; |
138 } |
138 } |
139 |
139 |
140 // --------------------------------------------------------------------------- |
140 // --------------------------------------------------------------------------- |
141 // |
141 // |
142 // --------------------------------------------------------------------------- |
142 // --------------------------------------------------------------------------- |
143 // |
143 // |
144 CHnMdEventMapping::CHnMdEventMapping() |
144 CHnMdEventMapping::CHnMdEventMapping() |
145 { |
145 { |
146 } |
146 } |
147 |
147 |
148 // --------------------------------------------------------------------------- |
148 // --------------------------------------------------------------------------- |
149 // |
149 // |
150 // --------------------------------------------------------------------------- |
150 // --------------------------------------------------------------------------- |
151 // |
151 // |
152 CHnMdEventMapping::~CHnMdEventMapping() |
152 CHnMdEventMapping::~CHnMdEventMapping() |
153 { |
153 { |
154 iMappings.ResetAndDestroy(); |
154 iMappings.ResetAndDestroy(); |
155 } |
155 } |
156 |
156 |
157 // --------------------------------------------------------------------------- |
157 // --------------------------------------------------------------------------- |
158 // |
158 // |
159 // --------------------------------------------------------------------------- |
159 // --------------------------------------------------------------------------- |
160 // |
160 // |
161 void CHnMdEventMapping::AddActionL( |
161 void CHnMdEventMapping::AddActionL( |
162 RHashMap<TInt,CArrayPtr<CHnActionModel> *> & aActions, |
162 RHashMap<TInt,CArrayPtr<CHnActionModel> *> & aActions, |
163 CHnActionModel *& aActionModel, TInt aEventId ) |
163 CHnActionModel *& aActionModel, TInt aEventId ) |
164 { |
164 { |
165 CArrayPtr<CHnActionModel>** actionsContainer = aActions.Find( aEventId ); |
165 CArrayPtr<CHnActionModel>** actionsContainer = aActions.Find( aEventId ); |
166 if ( !actionsContainer ) |
166 if ( !actionsContainer ) |
167 { |
167 { |
168 CArrayPtr<CHnActionModel>* newActionsContainer = new( |
168 CArrayPtr<CHnActionModel>* newActionsContainer = new( |
169 ELeave ) CArrayPtrFlat<CHnActionModel>( KDefaultGranularity ); |
169 ELeave ) CArrayPtrFlat<CHnActionModel>( KDefaultGranularity ); |
170 CleanupStack::PushL( newActionsContainer ); |
170 CleanupStack::PushL( newActionsContainer ); |
171 aActions.InsertL( aEventId, newActionsContainer ); |
171 aActions.InsertL( aEventId, newActionsContainer ); |
172 actionsContainer = &newActionsContainer; |
172 actionsContainer = &newActionsContainer; |
173 CleanupStack::Pop( newActionsContainer ); |
173 CleanupStack::Pop( newActionsContainer ); |
174 } |
174 } |
175 ( *actionsContainer )->AppendL( aActionModel ); |
175 ( *actionsContainer )->AppendL( aActionModel ); |
176 } |
176 } |
177 |
177 |
178 // --------------------------------------------------------------------------- |
178 // --------------------------------------------------------------------------- |
179 // |
179 // |
180 // --------------------------------------------------------------------------- |
180 // --------------------------------------------------------------------------- |
181 // |
181 // |
182 void CHnMdEventMapping::FillActionsL( |
182 void CHnMdEventMapping::FillActionsL( |
183 RHashMap< TInt, CArrayPtr<CHnActionModel>* >& aActions, |
183 RHashMap< TInt, CArrayPtr<CHnActionModel>* >& aActions, |
184 const CLiwGenericParamList& aQueriesResultsList, TInt aPos ) |
184 const CLiwGenericParamList& aQueriesResultsList, TInt aPos ) |
185 { |
185 { |
186 RArray< TInt > eventIds; |
186 RArray< TInt > eventIds; |
187 CleanupClosePushL( eventIds ); |
187 CleanupClosePushL( eventIds ); |
188 GetEventIdsL( eventIds ); |
188 GetEventIdsL( eventIds ); |
189 |
189 |
190 for ( TInt i( 0 ); i < eventIds.Count(); i++ ) |
190 for ( TInt i( 0 ); i < eventIds.Count(); i++ ) |
191 { |
191 { |
192 RPointerArray< CHnMdAction > actions = GetActionsForEventId( |
192 RPointerArray< CHnMdAction > actions = GetActionsForEventId( |
193 eventIds[ i ] ); |
193 eventIds[ i ] ); |
194 for ( TInt j( 0 ); j < actions.Count(); j++ ) |
194 for ( TInt j( 0 ); j < actions.Count(); j++ ) |
195 { |
195 { |
196 if ( !actions[ j ] || !actions[ j ]->IsValidL( |
196 if ( !actions[ j ] || !actions[ j ]->IsValidL( |
197 aQueriesResultsList, aPos ) ) |
197 aQueriesResultsList, aPos ) ) |
198 { |
198 { |
199 continue; |
199 continue; |
200 } |
200 } |
201 CHnActionModel* actionModel = CHnActionModel::NewL(); |
201 CHnActionModel* actionModel = CHnActionModel::NewL(); |