226 * @param aCropped Enabled if image is cropped. |
229 * @param aCropped Enabled if image is cropped. |
227 * @param aThumbnailSize Prededined size of requested thumbnail. |
230 * @param aThumbnailSize Prededined size of requested thumbnail. |
228 * @param aThumbFromPath Thumbnail created from associated path. |
231 * @param aThumbFromPath Thumbnail created from associated path. |
229 */ |
232 */ |
230 void StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aThumbnail, const |
233 void StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aThumbnail, const |
231 TSize& aOriginalSize, TBool aCropped, const TThumbnailSize aThumbnailSize, |
234 TSize& aOriginalSize, TBool aCropped, const TThumbnailSize aThumbnailSize, |
232 const TThumbnailId aThumbnailId = 0, const TBool aThumbFromPath = ETrue, |
235 const TInt64 aModified, |
|
236 const TBool aThumbFromPath = ETrue, |
233 TBool aBlackListed = EFalse ); |
237 TBool aBlackListed = EFalse ); |
234 |
238 |
235 /** |
239 /** |
236 * Fetches thumbnail image. |
240 * Fetches thumbnail image. |
237 * |
241 * |
255 const TThumbnailSize aThumbnailSize, |
259 const TThumbnailSize aThumbnailSize, |
256 TSize &aThumbnailRealSize |
260 TSize &aThumbnailRealSize |
257 ); |
261 ); |
258 |
262 |
259 /** |
263 /** |
260 * Fetches thumbnail image. |
|
261 * |
|
262 * @since S60 v5.0 |
|
263 * @param aThumbnailId Path of the media object whose thumbnail is |
|
264 * to be retrieved. |
|
265 * @param aThumbnail Pointer to get the fetched thumbnail bitmap. |
|
266 * Caller assumes ownership. |
|
267 * @param aData Pointer to get the fetched thumbnail JPEG. |
|
268 * Caller assumes ownership. |
|
269 * @param aThumbnailSize Minimum size of the thumbnail |
|
270 * . |
|
271 * @param aThumbnailSize Reference to real size of TN. |
|
272 * |
|
273 * @return KErrNone, otherwise KErrNotFound if thumbnail not found from DB |
|
274 */ |
|
275 TInt FetchThumbnailL( TThumbnailId aThumbnailId, |
|
276 CFbsBitmap*& aThumbnail, |
|
277 TDesC8* & aData, |
|
278 TThumbnailSize aThumbnailSize, |
|
279 TSize &aThumbnailRealSize |
|
280 ); |
|
281 |
|
282 |
|
283 /** |
|
284 * Delete thumbnails. |
264 * Delete thumbnails. |
285 * |
265 * |
286 * @since S60 v5.0 |
266 * @since S60 v5.0 |
287 * @param aPath Path of the media object whose thumbnail is |
267 * @param aPath Path of the media object whose thumbnail is |
288 * to be deleted. |
268 * to be deleted. |
289 */ |
269 * @param aForce Force to delete instantly |
290 void DeleteThumbnailsL( const TDesC& aPath ); |
270 * @param aTransaction Create a transaction |
291 |
271 */ |
292 /** |
272 void DeleteThumbnailsL( const TDesC& aPath, TBool aForce = EFalse, |
293 * Delete thumbnails. |
273 TBool aTransaction = ETrue); |
294 * |
274 |
295 * @since S60 TB9.1 |
|
296 * @param aTNId Id of the media object whose thumbnail is |
|
297 * to be deleted. |
|
298 */ |
|
299 void DeleteThumbnailsL( const TThumbnailId& aTNId ); |
|
300 |
|
301 /** |
275 /** |
302 * Persistent sizes. |
276 * Persistent sizes. |
303 * |
277 * |
304 * @since S60 v5.0 |
278 * @since S60 v5.0 |
305 * @return List of thumbnail sizes (including othe parameters) which |
279 * @return List of thumbnail sizes (including othe parameters) which |
311 * Get persistent sizes not yet in database |
285 * Get persistent sizes not yet in database |
312 * |
286 * |
313 * @since S60 v5.0 |
287 * @since S60 v5.0 |
314 * @param aPath Path where missing sizes are associated |
288 * @param aPath Path where missing sizes are associated |
315 * @param aMissingSizes List of missing thumbnail sizes |
289 * @param aMissingSizes List of missing thumbnail sizes |
316 */ |
290 * @param aCheckGridSizeOnly check only is grid size missing |
317 void GetMissingSizesAndIDsL( const TDesC& aPath, TInt aSourceType, RArray < |
291 */ |
318 TThumbnailPersistentSize > & aMissingSizes, TBool& aMissingIDs ); |
292 void GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray < |
319 |
293 TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly ); |
320 /** |
294 |
321 * Get persistent sizes not yet in database |
295 /** |
322 * |
296 * Check IMEI (owner) of db |
323 * @since S60 TB9.1 |
297 * |
324 * @param aId Id of TN where missing sizes are associated |
298 * @since S60 v5.0 |
325 * @param aMissingSizes List of missing thumbnail sizes |
|
326 */ |
|
327 void GetMissingSizesL( const TThumbnailId aId, RArray < |
|
328 TThumbnailPersistentSize > & aMissingSizes ); |
|
329 |
|
330 /** |
|
331 * Find store for thumbnails. |
|
332 * |
|
333 * @since S60 TB9.1 |
|
334 * @param aThumbnailId Id of thumbnails to be updated. |
|
335 */ |
|
336 void FindStoreL(TThumbnailId aThumbnailId); |
|
337 |
|
338 /** |
|
339 * Updates path for thumbnails in current store. |
|
340 * |
|
341 * @since S60 v5.0 |
|
342 * @param aItemId Id for thumbnails to be updated. |
|
343 * @param aNewPath New path for thumbnails. |
|
344 * @return ETrue, if path was updated |
|
345 */ |
|
346 TBool UpdateStoreL( TThumbnailId aItemId, const TDesC& aNewPath ); |
|
347 |
|
348 /** |
|
349 * Updates path for thumbnails in current store. |
|
350 * |
|
351 * @since S60 v5.0 |
|
352 * @param aItemId Id for thumbnails to be updated. |
|
353 * @param aNewPath New path for thumbnails. |
|
354 */ |
|
355 void UpdateStoreL( const TDesC& aPath, TThumbnailId aNewId ); |
|
356 |
|
357 /** |
|
358 * Check modification timestamp |
|
359 * |
|
360 * @since S60 v5.0 |
|
361 * @param aItemId Id for thumbnails to be updated. |
|
362 * @param aModified new MDS timestamp |
|
363 * @return ETrue, if given timestamp was newer than in DB |
|
364 */ |
|
365 TBool CheckModifiedL( const TThumbnailId aItemId, const TInt64 aModified ); |
|
366 |
|
367 /** |
|
368 * Fetches thumbnails from store to be moved. |
|
369 * |
|
370 * @since S60 v5.0 |
|
371 * @param aItemId Id for thumbnails to be updated. |
|
372 * @param aThumbnails Array for thumbnails to be moved. |
|
373 */ |
|
374 void FetchThumbnailsL(TThumbnailId aItemId, RArray < TThumbnailDatabaseData* >& aThumbnails); |
|
375 |
|
376 /** |
|
377 * Stores thumbnails in to new store. |
|
378 * |
|
379 * @since S60 v5.0 |
|
380 * @param aNewPath New path for thumbnails. |
|
381 * @param aThumbnails Array for thumbnails to be moved. |
|
382 */ |
|
383 void StoreThumbnailsL(const TDesC& aNewPath, RArray < TThumbnailDatabaseData* >& aThumbnails); |
|
384 |
|
385 /** |
|
386 * Stores thumbnails in to new store. |
|
387 * |
|
388 * @since S60 v5.0 |
|
389 * @param aNewPath New path for thumbnails. |
|
390 * @param aThumbnails Array for thumbnails to be moved. |
|
391 */ |
299 */ |
392 TInt CheckImeiL(); |
300 TInt CheckImeiL(); |
393 |
301 |
394 /** |
302 /** |
395 * Stores thumbnails in to new store. |
303 * Check version of db |
396 * |
304 * |
397 * @since S60 v5.0 |
305 * @since S60 v5.0 |
398 * @param aNewPath New path for thumbnails. |
|
399 * @param aThumbnails Array for thumbnails to be moved. |
|
400 */ |
306 */ |
401 TInt CheckVersionL(); |
307 TInt CheckVersionL(); |
402 |
308 |
403 /** |
309 /** |
404 * Stores thumbnails in to new store. |
310 * Check mediaid of store |
405 * |
311 * |
406 * @since S60 v5.0 |
312 * @since S60 v5.0 |
407 * @param aNewPath New path for thumbnails. |
|
408 * @param aThumbnails Array for thumbnails to be moved. |
|
409 */ |
313 */ |
410 TInt CheckMediaIDL(); |
314 TInt CheckMediaIDL(); |
411 |
315 |
412 /** |
316 /** |
413 * Stores thumbnails in to new store. |
317 * Add version and IMEI to db |
414 * |
318 * |
415 * @since S60 v5.0 |
319 * @since S60 v5.0 |
416 * @param aNewPath New path for thumbnails. |
|
417 * @param aThumbnails Array for thumbnails to be moved. |
|
418 */ |
320 */ |
419 void AddVersionAndImeiL(); |
321 void AddVersionAndImeiL(); |
420 |
322 |
421 /** |
323 /** |
422 * Stores thumbnails in to new store. |
324 * Reset TNID column |
423 * |
325 * |
424 * @since S60 v5.0 |
326 * @since S60 v5.0 |
425 * @param aNewPath New path for thumbnails. |
|
426 * @param aThumbnails Array for thumbnails to be moved. |
|
427 */ |
327 */ |
428 void ResetThumbnailIDs(); |
328 TInt ResetThumbnailIDs(); |
429 |
329 |
430 /** |
330 /** |
431 * Stores thumbnails in to new store. |
331 * Update IMEI to db |
432 * |
332 * |
433 * @since S60 v5.0 |
333 * @since S60 v5.0 |
434 * @param aNewPath New path for thumbnails. |
334 */ |
435 * @param aThumbnails Array for thumbnails to be moved. |
335 TInt UpdateImeiL(); |
436 */ |
|
437 void UpdateImeiL(); |
|
438 |
336 |
439 /** |
337 /** |
440 * Checks that database rowids match. |
338 * Checks that database rowids match. |
441 * |
339 * |
442 * @since S60 v5.0 |
340 * @since S60 v5.0 |
443 */ |
341 */ |
444 |
342 |
445 TInt CheckRowIDsL(); |
343 TInt CheckRowIDsL(); |
446 |
344 |
|
345 /** |
|
346 * Check is disk full |
|
347 * |
|
348 * @since S60 v5.0 |
|
349 */ |
447 TBool IsDiskFull(); |
350 TBool IsDiskFull(); |
|
351 |
|
352 /** |
|
353 * Checks timestamp of blacklisted entry to timestamp of file, from |
|
354 * which thumbnail entry was created, in filesystem |
|
355 * |
|
356 * @param aPath Path from which thumbnail created |
|
357 * @param aModified current timestampt |
|
358 * @contains indication whether file modified |
|
359 */ |
|
360 TBool CheckModifiedByPathL( const TDesC& aPath, const TInt64 aModified, TBool& modifiedChanged); |
448 |
361 |
449 private: |
362 private: |
450 /** |
363 /** |
451 * C++ default constructor |
364 * C++ default constructor |
452 * |
365 * |
484 * @param aThumbnailSize Associated size of the thumbnail to be deleted |
425 * @param aThumbnailSize Associated size of the thumbnail to be deleted |
485 * @param aThumbFromPath Thumbnail created from associated path. |
426 * @param aThumbFromPath Thumbnail created from associated path. |
486 */ |
427 */ |
487 void StoreThumbnailL( const TDesC& aPath, const TDes8& aData, const TSize& |
428 void StoreThumbnailL( const TDesC& aPath, const TDes8& aData, const TSize& |
488 aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, |
429 aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, |
489 const TThumbnailSize& aThumbnailSize, const TThumbnailId aThumbnailId = 0, |
430 const TThumbnailSize& aThumbnailSize, const TInt64 aModified, |
490 const TBool aThumbFromPath = ETrue); |
431 const TBool aThumbFromPath = ETrue); |
491 |
432 |
492 /** |
433 /** |
493 * Finds possible existing duplicate thumbnail. |
434 * Finds possible existing duplicate thumbnail. |
494 * |
435 * |
495 * @since S60 v5.0 |
436 * @since S60 v5.0 |
496 * @param aPath Path of the image from which thumbnail was created. |
437 * @param aPath Path of the image from which thumbnail was created. |
497 * @param aThumbnailId ID of the thumbnail |
438 * @param aThumbnailId ID of the thumbnail |
498 * @param aThumbnailSize Associated size of the thumbnail to be deleted |
439 * @param aThumbnailSize Associated size of the thumbnail to be deleted |
499 */ |
440 */ |
500 TBool FindDuplicateL( const TDesC& aPath, const TThumbnailId aThumbnailId, |
441 TBool FindDuplicateL( const TDesC& aPath, const TThumbnailSize& aThumbnailSize ); |
501 const TThumbnailSize& aThumbnailSize ); |
|
502 |
442 |
503 /** |
443 /** |
504 * Flush RAM cache containing generated TNs to persistent storage. |
444 * Flush RAM cache containing generated TNs to persistent storage. |
505 * |
445 * |
506 * @since S60 TB9.1 |
446 * @since S60 TB9.1 |
520 * |
460 * |
521 * @since S60 TB9.1 |
461 * @since S60 TB9.1 |
522 */ |
462 */ |
523 void StopAutoFlush(); |
463 void StopAutoFlush(); |
524 |
464 |
|
465 void StartMaintenance(); |
|
466 |
525 /** |
467 /** |
526 * Callback for harvesting complete timer |
468 * Callback for harvesting complete timer |
527 * |
469 * |
528 * @since S60 v5.0 |
470 * @since S60 v5.0 |
529 */ |
471 */ |
530 static TInt AutoFlushTimerCallBack(TAny* aAny); |
472 static TInt AutoFlushTimerCallBack(TAny* aAny); |
531 |
473 |
532 /** |
474 /** |
533 * Checks timestamp of blacklisted entry to timestamp of file, from |
475 * Callback for maintenance timer |
534 * which thumbnail entry was created, in filesystem |
476 * |
535 * |
477 * @since S60 v5.0 |
536 * @param aPath Path from which thumbnail created |
478 */ |
537 * @param aTempTable Indication whether data in temp table |
479 static TInt MaintenanceTimerCallBack(TAny* aAny); |
538 * @param aModified On return contains indication whether file modified |
|
539 */ |
|
540 void CheckModifiedByPathL( const TDesC& aPath, TBool aTempTable, TBool& aModified ); |
|
541 |
|
542 /** |
|
543 * Checks timestamp of blacklisted entry to timestamp of file, from |
|
544 * which thumbnail entry was created, in filesystem |
|
545 * |
|
546 * @param aId Thumbnail id |
|
547 * @param aTempTable Indication whether data in temp table |
|
548 * @param aModified On return contains indication whether file modified |
|
549 */ |
|
550 void CheckModifiedByIdL( TUint32 aId, TBool aTempTable, TBool& aModified ); |
|
551 |
480 |
552 /** |
481 /** |
553 * Touches blacklisted items |
482 * Touches blacklisted items |
554 * |
483 * |
555 */ |
484 */ |
556 void PrepareBlacklistedItemsForRetry(); |
485 void PrepareBlacklistedItemsForRetryL(); |
|
486 |
|
487 /** |
|
488 * Deletes thumbs added to Deleted table |
|
489 * |
|
490 */ |
|
491 TInt DeleteMarkedL(); |
|
492 |
|
493 /** |
|
494 * Checks if thumbnail source files are still in the file system. |
|
495 * If not, delete corresponding thumbs. |
|
496 * |
|
497 * @return ETrue, if finished. |
|
498 */ |
|
499 TBool FileExistenceCheckL(); |
|
500 |
|
501 /** |
|
502 * Strips drive letter from URI. |
|
503 * |
|
504 * @since S60 v5.0 |
|
505 * @param aPath Path. |
|
506 */ |
|
507 void StripDriveLetterL( TDes& aPath ); |
557 |
508 |
558 public : // From MThumbnailStoreDiskSpaceNotifierObserver |
509 public : // From MThumbnailStoreDiskSpaceNotifierObserver |
559 void HandleDiskSpaceNotificationL(TBool aDiskFull); |
510 void HandleDiskSpaceNotificationL(TBool aDiskFull); |
560 |
511 |
561 void HandleDiskSpaceError(TInt aError); |
512 void HandleDiskSpaceError(TInt aError); |
|
513 |
|
514 private: //From MTMActivityManagerObserver |
|
515 void ActivityChanged(const TBool aActive); |
562 |
516 |
563 private: |
517 private: |
564 // data |
518 // data |
565 |
519 |
566 /** |
520 /** |
600 CThumbnailServer* iServer; |
554 CThumbnailServer* iServer; |
601 |
555 |
602 #ifdef _DEBUG |
556 #ifdef _DEBUG |
603 TUint32 iThumbCounter; |
557 TUint32 iThumbCounter; |
604 #endif |
558 #endif |
|
559 |
605 /** |
560 /** |
606 * Periodic timer handling automatic flushing of db cache |
561 * Periodic timer handling automatic flushing of db cache |
607 */ |
562 */ |
608 CPeriodic* iAutoFlushTimer; |
563 CPeriodic* iAutoFlushTimer; |
609 |
564 |
|
565 /** |
|
566 * Periodic timer handling db maintenance |
|
567 */ |
|
568 CPeriodic* iMaintenanceTimer; |
|
569 |
610 /** |
570 /** |
611 * Notifier for situations where free disk space runs out. |
571 * Notifier for situations where free disk space runs out. |
612 */ |
572 */ |
613 CThumbnailStoreDiskSpaceNotifierAO* iDiskFullNotifier; |
573 CThumbnailStoreDiskSpaceNotifierAO* iDiskFullNotifier; |
614 |
574 |
615 TBool iDiskFull; |
575 TBool iDiskFull; |
|
576 |
|
577 CTMActivityManager* iActivityManager; |
|
578 |
|
579 // device idle |
|
580 TBool iIdle; |
|
581 |
|
582 // delete thumbs |
|
583 TBool iDeleteThumbs; |
|
584 |
|
585 // check if thumb source files still exist |
|
586 TBool iCheckFilesExist; |
|
587 TInt64 iLastCheckedRowID; |
616 }; |
588 }; |
617 // End of File |
589 // End of File |
618 |
590 |
619 |
591 |
620 #endif // THUMBNAILSTORE_H |
592 #endif // THUMBNAILSTORE_H |