32 CleanupStack::Pop( self ); |
32 CleanupStack::Pop( self ); |
33 return self; |
33 return self; |
34 } |
34 } |
35 |
35 |
36 // --------------------------------------------------------------------------- |
36 // --------------------------------------------------------------------------- |
37 // |
37 // |
38 // --------------------------------------------------------------------------- |
38 // --------------------------------------------------------------------------- |
39 // |
39 // |
40 EXPORT_C void CHnItemsOrder::MarkSuiteUninitialized() |
40 EXPORT_C void CHnItemsOrder::MarkSuiteUninitialized() |
41 { |
41 { |
42 for (TInt i(0); i < iItemsEvaluated.Count(); i++) |
42 for (TInt i(0); i < iItemsEvaluated.Count(); i++) |
43 { |
43 { |
44 iItemsEvaluated[i] = EFalse; |
44 iItemsEvaluated[i] = EFalse; |
45 } |
45 } |
46 |
46 |
47 iSuiteEvaluated = EFalse; |
47 iSuiteEvaluated = EFalse; |
48 } |
48 } |
49 // --------------------------------------------------------------------------- |
49 // --------------------------------------------------------------------------- |
50 // |
50 // |
51 // --------------------------------------------------------------------------- |
51 // --------------------------------------------------------------------------- |
52 // |
52 // |
53 EXPORT_C CHnItemsOrder* CHnItemsOrder::NewLC() |
53 EXPORT_C CHnItemsOrder* CHnItemsOrder::NewLC() |
54 { |
54 { |
55 CHnItemsOrder* self = new( ELeave ) CHnItemsOrder(); |
55 CHnItemsOrder* self = new( ELeave ) CHnItemsOrder(); |
56 CleanupStack::PushL( self ); |
56 CleanupStack::PushL( self ); |
57 return self; |
57 return self; |
58 } |
58 } |
59 |
59 |
60 // --------------------------------------------------------------------------- |
60 // --------------------------------------------------------------------------- |
61 // |
61 // |
62 // --------------------------------------------------------------------------- |
62 // --------------------------------------------------------------------------- |
63 // |
63 // |
64 CHnItemsOrder::~CHnItemsOrder() |
64 CHnItemsOrder::~CHnItemsOrder() |
65 { |
65 { |
66 iItemsOrderCounts.Reset(); |
66 iItemsOrderCounts.Reset(); |
67 iComplexItemsOrder.Reset(); |
67 iComplexItemsOrder.Reset(); |
68 iItemsEvaluated.Reset(); |
68 iItemsEvaluated.Reset(); |
69 } |
69 } |
70 |
70 |
71 // --------------------------------------------------------------------------- |
71 // --------------------------------------------------------------------------- |
72 // |
72 // |
73 // --------------------------------------------------------------------------- |
73 // --------------------------------------------------------------------------- |
74 // |
74 // |
75 EXPORT_C void CHnItemsOrder::SetSuiteId( TInt aId ) |
75 EXPORT_C void CHnItemsOrder::SetSuiteId( TInt aId ) |
76 { |
76 { |
77 iSuiteId = aId; |
77 iSuiteId = aId; |
78 } |
78 } |
79 |
79 |
80 // --------------------------------------------------------------------------- |
80 // --------------------------------------------------------------------------- |
81 // |
81 // |
82 // --------------------------------------------------------------------------- |
82 // --------------------------------------------------------------------------- |
83 // |
83 // |
84 EXPORT_C TInt CHnItemsOrder::GetSuiteId() const |
84 EXPORT_C TInt CHnItemsOrder::GetSuiteId() const |
85 { |
85 { |
86 return iSuiteId; |
86 return iSuiteId; |
87 } |
87 } |
88 |
88 |
89 // --------------------------------------------------------------------------- |
89 // --------------------------------------------------------------------------- |
90 // |
90 // |
91 // --------------------------------------------------------------------------- |
91 // --------------------------------------------------------------------------- |
92 // |
92 // |
93 EXPORT_C void CHnItemsOrder::RemoveItemId( TInt aId ) |
93 EXPORT_C void CHnItemsOrder::RemoveItemId( TInt aId ) |
94 { |
94 { |
95 TInt position = iComplexItemsOrder.Find( aId ); |
95 TInt position = iComplexItemsOrder.Find( aId ); |
96 if (position != KErrNotFound) |
96 if (position != KErrNotFound) |
97 { |
97 { |
98 TInt modelNumber = CountModelNumberFor( position ); |
98 TInt modelNumber = CountModelNumberFor( position ); |
99 --iItemsOrderCounts[ modelNumber ] ; |
99 --iItemsOrderCounts[ modelNumber ] ; |
100 iComplexItemsOrder.Remove( position ); |
100 iComplexItemsOrder.Remove( position ); |
101 } |
101 } |
102 } |
102 } |
103 |
103 |
104 // --------------------------------------------------------------------------- |
104 // --------------------------------------------------------------------------- |
105 // |
105 // |
106 // --------------------------------------------------------------------------- |
106 // --------------------------------------------------------------------------- |
107 // |
107 // |
108 EXPORT_C void CHnItemsOrder::InsertItemIdToL( TInt aDataModelItem, |
108 EXPORT_C void CHnItemsOrder::InsertItemIdToL( TInt aDataModelItem, |
109 TInt aIndex, TInt aId ) |
109 TInt aIndex, TInt aId ) |
110 { |
110 { |
111 TInt position = CountStartIndexFor( aDataModelItem ) + aIndex; |
111 TInt position = CountStartIndexFor( aDataModelItem ) + aIndex; |
112 if (position < iComplexItemsOrder.Count() ) |
112 if (position < iComplexItemsOrder.Count() ) |
113 { |
113 { |
114 iComplexItemsOrder.InsertL( aId, position ); |
114 iComplexItemsOrder.InsertL( aId, position ); |
115 } |
115 } |
116 else |
116 else |
117 { |
117 { |
118 iComplexItemsOrder.AppendL( aId ); |
118 iComplexItemsOrder.AppendL( aId ); |
119 } |
119 } |
120 |
120 |
121 TInt modelsCount = iItemsOrderCounts.Count(); |
121 TInt modelsCount = iItemsOrderCounts.Count(); |
122 if (modelsCount <= aDataModelItem) |
122 if (modelsCount <= aDataModelItem) |
123 { |
123 { |
124 for (TInt i(modelsCount); i <= aDataModelItem; i++) |
124 for (TInt i(modelsCount); i <= aDataModelItem; i++) |
125 { |
125 { |
128 } |
128 } |
129 ++iItemsOrderCounts[ aDataModelItem ] ; |
129 ++iItemsOrderCounts[ aDataModelItem ] ; |
130 } |
130 } |
131 |
131 |
132 // --------------------------------------------------------------------------- |
132 // --------------------------------------------------------------------------- |
133 // |
133 // |
134 // --------------------------------------------------------------------------- |
134 // --------------------------------------------------------------------------- |
135 // |
135 // |
136 EXPORT_C TInt CHnItemsOrder::GetItemIdAt( TInt aDataModelItem, TInt aIndex ) |
136 EXPORT_C TInt CHnItemsOrder::GetItemIdAt( TInt aDataModelItem, TInt aIndex ) |
137 { |
137 { |
138 TInt globalItemPosition = CountStartIndexFor( aDataModelItem ) + aIndex; |
138 TInt globalItemPosition = CountStartIndexFor( aDataModelItem ) + aIndex; |
139 return (iComplexItemsOrder.Count() > globalItemPosition) |
139 return (iComplexItemsOrder.Count() > globalItemPosition) |
140 ? iComplexItemsOrder[globalItemPosition] : KErrNotFound; |
140 ? iComplexItemsOrder[globalItemPosition] : KErrNotFound; |
141 } |
141 } |
142 |
142 |
143 // --------------------------------------------------------------------------- |
143 // --------------------------------------------------------------------------- |
144 // |
144 // |
145 // --------------------------------------------------------------------------- |
145 // --------------------------------------------------------------------------- |
146 // |
146 // |
147 EXPORT_C TInt CHnItemsOrder::GetItemIdAt( TInt aPosition ) |
147 EXPORT_C TInt CHnItemsOrder::GetItemIdAt( TInt aPosition ) |
148 { |
148 { |
149 return (iComplexItemsOrder.Count() > aPosition) |
149 return (iComplexItemsOrder.Count() > aPosition) |
150 ? iComplexItemsOrder[aPosition] : KErrNotFound; |
150 ? iComplexItemsOrder[aPosition] : KErrNotFound; |
151 } |
151 } |
152 |
152 |
153 // --------------------------------------------------------------------------- |
153 // --------------------------------------------------------------------------- |
154 // |
154 // |
155 // --------------------------------------------------------------------------- |
155 // --------------------------------------------------------------------------- |
156 // |
156 // |
157 EXPORT_C void CHnItemsOrder::GetIdsForL( TInt aDataModelItem, |
157 EXPORT_C void CHnItemsOrder::GetIdsForL( TInt aDataModelItem, |
158 RArray< TInt >& aIds ) |
158 RArray< TInt >& aIds ) |
159 { |
159 { |
160 if ( CountStartIndexFor( aDataModelItem ) == KErrNotFound |
160 if ( CountStartIndexFor( aDataModelItem ) == KErrNotFound |
161 || iItemsOrderCounts.Count() <= aDataModelItem ) |
161 || iItemsOrderCounts.Count() <= aDataModelItem ) |
162 { |
162 { |
163 return; |
163 return; |
164 } |
164 } |
165 |
165 |
166 TInt startIndex = CountStartIndexFor( aDataModelItem ); |
166 TInt startIndex = CountStartIndexFor( aDataModelItem ); |
167 |
167 |
168 for ( TInt i = 0; |
168 for ( TInt i = 0; |
169 i < iItemsOrderCounts[ aDataModelItem ]; i++ ) |
169 i < iItemsOrderCounts[ aDataModelItem ]; i++ ) |
170 { |
170 { |
171 aIds.AppendL( iComplexItemsOrder[ startIndex + i ] ); |
171 aIds.AppendL( iComplexItemsOrder[ startIndex + i ] ); |
172 } |
172 } |
173 } |
173 } |
174 |
174 |
175 // --------------------------------------------------------------------------- |
175 // --------------------------------------------------------------------------- |
176 // |
176 // |
177 // --------------------------------------------------------------------------- |
177 // --------------------------------------------------------------------------- |
178 // |
178 // |
179 EXPORT_C void CHnItemsOrder::SetItemIdAtL( TInt aPosition, TInt aId ) |
179 EXPORT_C void CHnItemsOrder::SetItemIdAtL( TInt aPosition, TInt aId ) |
180 { |
180 { |
181 if ( aPosition >= iComplexItemsOrder.Count() ) |
181 if ( aPosition >= iComplexItemsOrder.Count() ) |
205 } |
205 } |
206 } |
206 } |
207 } |
207 } |
208 |
208 |
209 // --------------------------------------------------------------------------- |
209 // --------------------------------------------------------------------------- |
210 // |
210 // |
211 // --------------------------------------------------------------------------- |
211 // --------------------------------------------------------------------------- |
212 // |
212 // |
213 EXPORT_C void CHnItemsOrder::SuiteEvaluated() |
213 EXPORT_C void CHnItemsOrder::SuiteEvaluated() |
214 { |
214 { |
215 iSuiteEvaluated = ETrue; |
215 iSuiteEvaluated = ETrue; |
216 } |
216 } |
217 |
217 |
218 // --------------------------------------------------------------------------- |
218 // --------------------------------------------------------------------------- |
219 // |
219 // |
220 // --------------------------------------------------------------------------- |
220 // --------------------------------------------------------------------------- |
221 // |
221 // |
222 EXPORT_C void CHnItemsOrder::ItemEvaluated( TInt aIndex ) |
222 EXPORT_C void CHnItemsOrder::ItemEvaluated( TInt aIndex ) |
223 { |
223 { |
224 iItemsEvaluated[aIndex] = ETrue; |
224 iItemsEvaluated[aIndex] = ETrue; |
225 } |
225 } |
226 |
226 |
227 // --------------------------------------------------------------------------- |
227 // --------------------------------------------------------------------------- |
228 // |
228 // |
229 // --------------------------------------------------------------------------- |
229 // --------------------------------------------------------------------------- |
230 // |
230 // |
231 EXPORT_C TBool CHnItemsOrder::IsSuiteReadyToShow() |
231 EXPORT_C TBool CHnItemsOrder::IsSuiteReadyToShow() |
232 { |
232 { |
233 TBool ready = ETrue; |
233 TBool ready = ETrue; |
234 for (TInt i(0); ready && i < iItemsEvaluated.Count(); i++) |
234 for (TInt i(0); ready && i < iItemsEvaluated.Count(); i++) |
235 { |
235 { |
236 ready = iItemsEvaluated[i]; |
236 ready = iItemsEvaluated[i]; |
237 } |
237 } |
238 |
238 |
239 return ready && iSuiteEvaluated; |
239 return ready && iSuiteEvaluated; |
240 } |
240 } |
241 // --------------------------------------------------------------------------- |
241 // --------------------------------------------------------------------------- |
242 // |
242 // |
243 // --------------------------------------------------------------------------- |
243 // --------------------------------------------------------------------------- |
244 // |
244 // |
245 EXPORT_C TInt CHnItemsOrder::GetModelItemCount( ) |
245 EXPORT_C TInt CHnItemsOrder::GetModelItemCount( ) |
246 { |
246 { |
247 return iItemsOrderCounts.Count(); |
247 return iItemsOrderCounts.Count(); |
248 } |
248 } |
249 |
249 |
250 // --------------------------------------------------------------------------- |
250 // --------------------------------------------------------------------------- |
251 // |
251 // |
252 // --------------------------------------------------------------------------- |
252 // --------------------------------------------------------------------------- |
253 // |
253 // |
254 EXPORT_C TInt CHnItemsOrder::operator[]( TInt aPosition ) |
254 EXPORT_C TInt CHnItemsOrder::operator[]( TInt aPosition ) |
255 { |
255 { |
256 return GetItemIdAt( aPosition ); |
256 return GetItemIdAt( aPosition ); |
257 } |
257 } |
258 |
258 |
259 // --------------------------------------------------------------------------- |
259 // --------------------------------------------------------------------------- |
260 // |
260 // |
261 // --------------------------------------------------------------------------- |
261 // --------------------------------------------------------------------------- |
262 // |
262 // |
263 EXPORT_C TInt CHnItemsOrder::GetItemPosition( TInt aId ) |
263 EXPORT_C TInt CHnItemsOrder::GetItemPosition( TInt aId ) |
264 { |
264 { |
265 return iComplexItemsOrder.Find( aId ); |
265 return iComplexItemsOrder.Find( aId ); |
266 } |
266 } |
267 |
267 |
268 // --------------------------------------------------------------------------- |
268 // --------------------------------------------------------------------------- |
269 // |
269 // |
270 // --------------------------------------------------------------------------- |
270 // --------------------------------------------------------------------------- |
271 // |
271 // |
272 TInt CHnItemsOrder::CountStartIndexFor( TInt aDataModelItem ) |
272 TInt CHnItemsOrder::CountStartIndexFor( TInt aDataModelItem ) |
273 { |
273 { |
274 TInt startIndex( 0 ); |
274 TInt startIndex( 0 ); |
299 } |
299 } |
300 return modelNumber; |
300 return modelNumber; |
301 } |
301 } |
302 |
302 |
303 // --------------------------------------------------------------------------- |
303 // --------------------------------------------------------------------------- |
304 // |
304 // |
305 // --------------------------------------------------------------------------- |
305 // --------------------------------------------------------------------------- |
306 // |
306 // |
307 EXPORT_C TInt CHnItemsOrder::Count() |
307 EXPORT_C TInt CHnItemsOrder::Count() |
308 { |
308 { |
309 return iComplexItemsOrder.Count(); |
309 return iComplexItemsOrder.Count(); |
310 } |
310 } |
311 |
311 |
312 // --------------------------------------------------------------------------- |
312 // --------------------------------------------------------------------------- |
313 // |
313 // |
314 // --------------------------------------------------------------------------- |
314 // --------------------------------------------------------------------------- |
315 // |
315 // |
316 CHnItemsOrder::CHnItemsOrder() : iSuiteId( KErrNotFound ) |
316 CHnItemsOrder::CHnItemsOrder() : iSuiteId( KErrNotFound ) |
317 { |
317 { |
318 |
318 |
319 } |
319 } |
320 |
320 |
321 // --------------------------------------------------------------------------- |
321 // --------------------------------------------------------------------------- |
322 // |
322 // |
323 // --------------------------------------------------------------------------- |
323 // --------------------------------------------------------------------------- |
324 // |
324 // |
325 void CHnItemsOrder::ConstructL() |
325 void CHnItemsOrder::ConstructL() |
326 { |
326 { |
327 |
327 |
328 } |
328 } |
329 |
329 |