equal
deleted
inserted
replaced
15 * |
15 * |
16 */ |
16 */ |
17 #include <tstaskmonitorglobals.h> |
17 #include <tstaskmonitorglobals.h> |
18 #include "tsstorage.h" |
18 #include "tsstorage.h" |
19 #include "tsmodelitemkeymsg.h" |
19 #include "tsmodelitemkeymsg.h" |
|
20 |
|
21 const TInt KTsDataLimit(10); |
20 // ----------------------------------------------------------------------------- |
22 // ----------------------------------------------------------------------------- |
21 /** |
23 /** |
22 * Two phase construction. Create and initialize storage instance. |
24 * Two phase construction. Create and initialize storage instance. |
23 * @param aDataProviders - list of data providers |
25 * @param aDataProviders - list of data providers |
24 * @return storage instane |
26 * @return storage instane |
197 } |
199 } |
198 |
200 |
199 // ----------------------------------------------------------------------------- |
201 // ----------------------------------------------------------------------------- |
200 /** |
202 /** |
201 * Interface implementation |
203 * Interface implementation |
|
204 * @see MTsModel::IsMandatoryL(TInt) const |
|
205 */ |
|
206 TBool CTsStorage::IsMandatoryL( TInt aOffset ) const |
|
207 { |
|
208 return iData[aOffset].IsMandatoryL(); |
|
209 } |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 /** |
|
213 * Interface implementation |
202 * @see MTsModel::CloseL(TTsModelItemKey) |
214 * @see MTsModel::CloseL(TTsModelItemKey) |
203 */ |
215 */ |
204 TBool CTsStorage::CloseL( TTsModelItemKey aKey ) const |
216 TBool CTsStorage::CloseL( TTsModelItemKey aKey ) const |
205 { |
217 { |
206 return FindL(aKey).CloseL(); |
218 return FindL(aKey).CloseL(); |
280 for( TInt prev(0); prev < iData.Count(); ++prev ) |
292 for( TInt prev(0); prev < iData.Count(); ++prev ) |
281 { |
293 { |
282 for( TInt next(prev + 1); next < iData.Count(); ++next ) |
294 for( TInt next(prev + 1); next < iData.Count(); ++next ) |
283 { |
295 { |
284 const TTsModelItem prevItem(iData[prev]), nextItem(iData[next]); |
296 const TTsModelItem prevItem(iData[prev]), nextItem(iData[next]); |
285 if( prevItem.TimestampL() < nextItem.TimestampL() ) |
297 if( ( !prevItem.IsMandatoryL() && nextItem.IsMandatoryL() ) || |
|
298 ( prevItem.TimestampL() < nextItem.TimestampL() && prevItem.IsMandatoryL() == nextItem.IsMandatoryL() ) ) |
286 { |
299 { |
287 iData.Remove(prev); |
300 iData.Remove(prev); |
288 iData.InsertL(nextItem, prev); |
301 iData.InsertL(nextItem, prev); |
289 |
302 |
290 iData.Remove(next); |
303 iData.Remove(next); |
291 iData.InsertL(prevItem, next); |
304 iData.InsertL(prevItem, next); |
292 } |
305 } |
293 } |
306 } |
294 } |
307 } |
295 } |
308 TrimDataL(); |
|
309 } |
|
310 |
|
311 // ----------------------------------------------------------------------------- |
|
312 void CTsStorage::TrimDataL() |
|
313 { |
|
314 const TInt lastItemOffset(iData.Count() -1); |
|
315 if(KTsDataLimit <= lastItemOffset && !iData[lastItemOffset].IsMandatoryL()) |
|
316 { |
|
317 iData.Remove(lastItemOffset); |
|
318 TrimDataL(); |
|
319 } |
|
320 } |