192 TChar driveChar = 0; |
214 TChar driveChar = 0; |
193 User::LeaveIfError( RFs::DriveToChar( iDrive, driveChar )); |
215 User::LeaveIfError( RFs::DriveToChar( iDrive, driveChar )); |
194 pathPtr.Append( driveChar ); |
216 pathPtr.Append( driveChar ); |
195 pathPtr.Append( KThumbnailDatabaseName ); |
217 pathPtr.Append( KThumbnailDatabaseName ); |
196 |
218 |
|
219 //start disk space monitor |
197 iDiskFullNotifier = CThumbnailStoreDiskSpaceNotifierAO::NewL( *this, |
220 iDiskFullNotifier = CThumbnailStoreDiskSpaceNotifierAO::NewL( *this, |
198 KDiskFullThreshold, |
221 KDiskFullThreshold, |
199 pathPtr ); |
222 pathPtr ); |
200 |
223 |
|
224 CleanupStack::PopAndDestroy( databasePath ); |
|
225 |
|
226 OpenDatabaseL(); |
|
227 |
|
228 // to monitor device activity |
|
229 iActivityManager = CTMActivityManager::NewL( this, KStoreMaintenanceIdle); |
|
230 iActivityManager->Start(); |
|
231 |
|
232 // once in every mount |
|
233 iDeleteThumbs = ETrue; |
|
234 iCheckFilesExist = ETrue; |
|
235 iLastCheckedRowID = -1; |
|
236 } |
|
237 |
|
238 // --------------------------------------------------------------------------- |
|
239 // OpenDatabaseL database file |
|
240 // --------------------------------------------------------------------------- |
|
241 TInt CThumbnailStore::OpenDatabaseFileL() |
|
242 { |
|
243 TN_DEBUG1( "CThumbnailStore::OpenDatabaseFile()" ); |
|
244 HBufC* databasePath = HBufC::NewLC( KMaxFileName ); |
|
245 TPtr pathPtr = databasePath->Des(); |
|
246 TChar driveChar = 0; |
|
247 User::LeaveIfError( RFs::DriveToChar( iDrive, driveChar )); |
|
248 pathPtr.Append( driveChar ); |
|
249 pathPtr.Append( KThumbnailDatabaseName ); |
|
250 |
|
251 TInt ret = iDatabase.Open( pathPtr ); |
|
252 CleanupStack::PopAndDestroy( databasePath ); |
|
253 return ret; |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // OpenDatabaseL database |
|
258 // --------------------------------------------------------------------------- |
|
259 TInt CThumbnailStore::OpenDatabaseL() |
|
260 { |
|
261 TN_DEBUG1( "CThumbnailStore::OpenDatabaseL()" ); |
|
262 |
|
263 iDatabase.Close(); |
|
264 |
|
265 TBool newDatabase(EFalse); |
|
266 TInt error = KErrNone; |
|
267 |
|
268 TInt err = OpenDatabaseFileL(); |
|
269 |
|
270 if ( err == KErrNotFound ) |
|
271 { |
|
272 // db not found, create new |
|
273 RecreateDatabaseL( EFalse); |
|
274 newDatabase = ETrue; |
|
275 err = KErrNone; |
|
276 } |
|
277 else if ( err == KErrNone) |
|
278 { |
|
279 // db found, check version and rowids |
|
280 error = CheckVersionL(); |
|
281 if(error == KErrNone) |
|
282 { |
|
283 error = CheckRowIDsL(); |
|
284 } |
|
285 } |
|
286 |
|
287 TN_DEBUG3( "CThumbnailStore::ConstructL() -- error = %d, err = %d", error, err); |
|
288 |
|
289 // if wrong version, corrupted database or other error opening db |
|
290 if ( error == KErrNotSupported || (err != KErrNone && err != KErrNotFound) ) |
|
291 { |
|
292 RecreateDatabaseL( ETrue); |
|
293 } |
|
294 else if(!newDatabase) |
|
295 { |
|
296 if(ResetThumbnailIDs() == KSqlErrCorrupt) |
|
297 { |
|
298 RecreateDatabaseL( ETrue); |
|
299 } |
|
300 |
|
301 //check ownership |
|
302 error = CheckImeiL(); |
|
303 |
|
304 if(error != KErrNone) |
|
305 { |
|
306 if(error == KSqlErrCorrupt) |
|
307 { |
|
308 RecreateDatabaseL( ETrue); |
|
309 } |
|
310 //take ownership |
|
311 error = UpdateImeiL(); |
|
312 |
|
313 if(error == KSqlErrCorrupt) |
|
314 { |
|
315 RecreateDatabaseL( ETrue); |
|
316 } |
|
317 |
|
318 //Touch blacklisted items |
|
319 TRAP(error, PrepareBlacklistedItemsForRetryL( ) ); |
|
320 |
|
321 if(error == KSqlErrCorrupt) |
|
322 { |
|
323 RecreateDatabaseL( ETrue); |
|
324 } |
|
325 } |
|
326 |
|
327 //check is MMC known |
|
328 if(CheckMediaIDL() != KErrNone ) |
|
329 { |
|
330 //Touch blacklisted items |
|
331 TRAP(error, PrepareBlacklistedItemsForRetryL() ); |
|
332 |
|
333 if(error == KSqlErrCorrupt) |
|
334 { |
|
335 RecreateDatabaseL( ETrue); |
|
336 } |
|
337 } |
|
338 } |
|
339 |
|
340 PrepareDbL(); |
|
341 return KErrNone; |
|
342 } |
|
343 |
|
344 // --------------------------------------------------------------------------- |
|
345 // PrepareDbL database tables |
|
346 // --------------------------------------------------------------------------- |
|
347 // |
|
348 void CThumbnailStore::PrepareDbL() |
|
349 { |
|
350 TN_DEBUG1( "CThumbnailStore::PrepareDbL()" ); |
|
351 TInt err(KErrNone); |
|
352 |
|
353 // add tables |
|
354 TRAPD(tableError, CreateTablesL() ); |
|
355 |
|
356 if(!tableError) |
|
357 { |
|
358 TRAPD(err, AddVersionAndImeiL()); |
|
359 if (err == KSqlErrCorrupt) |
|
360 { |
|
361 RecreateDatabaseL( ETrue); |
|
362 } |
|
363 User::LeaveIfError(err); |
|
364 } |
|
365 |
|
366 err = iDatabase.Exec( KThumbnailCreateTempInfoTable ); |
|
367 #ifdef _DEBUG |
|
368 if(err < 0) |
|
369 { |
|
370 TPtrC errorMsg = iDatabase.LastErrorMessage(); |
|
371 TN_DEBUG2( "CThumbnailStore::ConstructL() KThumbnailCreateTempInfoTable %S" , &errorMsg); |
|
372 } |
|
373 #endif |
|
374 User::LeaveIfError( err ); |
|
375 |
|
376 err = iDatabase.Exec( KThumbnailCreateTempInfoDataTable ); |
|
377 #ifdef _DEBUG |
|
378 if(err < 0) |
|
379 { |
|
380 TPtrC errorMsg = iDatabase.LastErrorMessage(); |
|
381 TN_DEBUG2( "CThumbnailStore::ConstructL() KThumbnailCreateTempInfoDataTable %S" , &errorMsg); |
|
382 } |
|
383 #endif |
|
384 User::LeaveIfError( err ); |
|
385 } |
|
386 |
|
387 // --------------------------------------------------------------------------- |
|
388 // Create database tables |
|
389 // --------------------------------------------------------------------------- |
|
390 // |
|
391 void CThumbnailStore::CreateTablesL() |
|
392 { |
|
393 TN_DEBUG1( "CThumbnailStore::CreateTablesL()" ); |
|
394 |
|
395 TInt err = 0; |
|
396 err = iDatabase.Exec( KThumbnailCreateInfoTable ); |
|
397 TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailCreateInfoTable err=%d", err ); |
|
398 err = iDatabase.Exec( KThumbnailCreateInfoDataTable ); |
|
399 TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailCreateInfoDataTable err=%d", err ); |
|
400 |
|
401 err = iDatabase.Exec(KThumbnailDeletedTable); |
|
402 TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailDeletedTable err=%d", err ); |
|
403 |
|
404 err = iDatabase.Exec(KThumbnailVersionTable); |
|
405 TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailVersionTable err=%d", err ); |
|
406 |
|
407 err = iDatabase.Exec( KThumbnailCreateInfoTableIndex1 ); |
|
408 TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailCreateInfoTableIndex1 err=%d", err ); |
|
409 |
|
410 err = iDatabase.Exec( KThumbnailCreateDeletedTableIndex ); |
|
411 TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailCreateDeletedTableIndex err=%d", err ); |
|
412 |
|
413 User::LeaveIfError( err ); |
|
414 } |
|
415 |
|
416 void CThumbnailStore::RecreateDatabaseL(const TBool aDelete) |
|
417 { |
|
418 TN_DEBUG1( "CThumbnailStore::RecreateDatabaseL()" ); |
|
419 |
201 TVolumeInfo volumeinfo; |
420 TVolumeInfo volumeinfo; |
202 iFs.Volume(volumeinfo, iDrive); |
421 iFs.Volume(volumeinfo, iDrive); |
203 TUint id = volumeinfo.iUniqueID; |
422 TUint id = volumeinfo.iUniqueID; |
204 TBuf<50> mediaid; |
423 TBuf<50> mediaid; |
205 mediaid.Num(id); |
424 mediaid.Num(id); |
206 TBool newDatabase(EFalse); |
425 |
207 |
426 // delete db and create new |
208 TInt error = KErrNone; |
427 iDatabase.Close(); |
209 |
428 |
210 TInt err = iDatabase.Open( pathPtr ); |
429 HBufC* databasePath = HBufC::NewLC( KMaxFileName ); |
211 if ( err == KErrNotFound ) |
430 TPtr pathPtr = databasePath->Des(); |
212 { |
431 TChar driveChar = 0; |
213 // db not found, create new |
432 User::LeaveIfError( RFs::DriveToChar( iDrive, driveChar )); |
214 TN_DEBUG1( "CThumbnailStore::ConstructL() -- 1 creating database" ); |
433 pathPtr.Append( driveChar ); |
215 const TDesC8& config = KThumbnailSqlConfig; |
434 pathPtr.Append( KThumbnailDatabaseName ); |
216 |
435 |
217 RSqlSecurityPolicy securityPolicy; |
436 TInt err(KErrNone); |
218 CleanupClosePushL( securityPolicy ); |
437 |
219 securityPolicy.Create( KThumbnailDatabaseSecurityPolicy ); |
438 if(aDelete) |
220 |
439 { |
221 iDatabase.CreateL( pathPtr, securityPolicy, &config ); |
|
222 CleanupStack::PopAndDestroy( &securityPolicy ); |
|
223 |
|
224 TN_DEBUG1( "CThumbnailStore::ConstructL() -- 1 database created ok" ); |
|
225 |
|
226 RFile64 file; |
|
227 file.Create(iFs, mediaid, EFileShareReadersOrWriters ); |
|
228 file.Close(); |
|
229 newDatabase = ETrue; |
|
230 } |
|
231 else if ( err == KErrNone) |
|
232 { |
|
233 // db found, check version and rowids |
|
234 error = CheckVersionL(); |
|
235 if(error == KErrNone) |
|
236 { |
|
237 error = CheckRowIDsL(); |
|
238 } |
|
239 } |
|
240 |
|
241 // if wrong version, corrupted database or other error opening db |
|
242 if ( error == KErrNotSupported || (err != KErrNone && err != KErrNotFound) ) |
|
243 { |
|
244 TN_DEBUG1( "CThumbnailStore::ConstructL() -- delete databases" ); |
|
245 |
|
246 // delete db and create new |
|
247 iDatabase.Close(); |
|
248 iDatabase.Delete(pathPtr); |
440 iDatabase.Delete(pathPtr); |
249 |
441 } |
250 TN_DEBUG1( "CThumbnailStore::ConstructL() -- 2 creating database" ); |
442 |
251 |
443 const TDesC8& config = KThumbnailSqlConfig; |
252 const TDesC8& config = KThumbnailSqlConfig; |
444 |
253 |
445 RSqlSecurityPolicy securityPolicy; |
254 RSqlSecurityPolicy securityPolicy; |
446 CleanupClosePushL( securityPolicy ); |
255 CleanupClosePushL( securityPolicy ); |
447 securityPolicy.Create( KThumbnailDatabaseSecurityPolicy ); |
256 securityPolicy.Create( KThumbnailDatabaseSecurityPolicy ); |
448 |
257 |
449 TRAP(err, iDatabase.CreateL( pathPtr, securityPolicy, &config )); |
258 iDatabase.CreateL( pathPtr, securityPolicy, &config ); |
450 CleanupStack::PopAndDestroy( &securityPolicy ); |
259 CleanupStack::PopAndDestroy( &securityPolicy ); |
451 |
260 |
452 |
261 TN_DEBUG1( "CThumbnailStore::ConstructL() -- 2 database created ok" ); |
453 #ifdef _DEBUG |
262 |
454 if(err < 0) |
263 RFile64 file; |
455 { |
264 file.Create(iFs, mediaid, EFileShareReadersOrWriters ); |
456 TPtrC errorMsg = iDatabase.LastErrorMessage(); |
265 file.Close(); |
457 TN_DEBUG2( "CThumbnailStore::RecreateDatabaseL() KThumbnailInsertTempThumbnailInfoData %S" , &errorMsg); |
266 } |
458 } |
267 else if(!newDatabase) |
459 #endif |
268 { |
460 TN_DEBUG2( "CThumbnailStore::RecreateDatabaseL() -- database created err = %d", err ); |
269 //check ownership |
461 User::LeaveIfError( err ); |
270 if(CheckImeiL() != KErrNone) |
|
271 { |
|
272 ResetThumbnailIDs(); |
|
273 |
|
274 //take ownership |
|
275 UpdateImeiL(); |
|
276 |
|
277 //Remove blacklist markings |
|
278 TRAP_IGNORE( RemoveDbFlagL( KThumbnailDbFlagBlacklisted ) ); |
|
279 } |
|
280 |
|
281 //check is MMC known |
|
282 if(CheckMediaIDL() != KErrNone ) |
|
283 { |
|
284 ResetThumbnailIDs(); |
|
285 |
|
286 //Remove blacklist markings |
|
287 TRAP_IGNORE( RemoveDbFlagL( KThumbnailDbFlagBlacklisted ) ); |
|
288 } |
|
289 } |
|
290 |
|
291 CleanupStack::PopAndDestroy( databasePath ); |
462 CleanupStack::PopAndDestroy( databasePath ); |
292 |
463 |
293 // add tables |
464 RFile64 file; |
294 TRAPD(tableError, CreateTablesL() ); |
465 file.Create(iFs, mediaid, EFileShareReadersOrWriters ); |
295 |
466 file.Close(); |
296 if(!tableError) |
467 |
297 { |
468 OpenDatabaseFileL(); |
298 AddVersionAndImeiL(); |
469 } |
299 } |
|
300 |
|
301 err = iDatabase.Exec( KThumbnailCreateTempInfoTable ); |
|
302 TN_DEBUG2("CThumbnailStore::CreateTablesL() KThumbnailCreateTempInfoTable %d", err); |
|
303 User::LeaveIfError( err ); |
|
304 err = iDatabase.Exec( KThumbnailCreateTempInfoDataTable ); |
|
305 TN_DEBUG2("CThumbnailStore::CreateTablesL() KThumbnailCreateTempInfoDataTable %d", err); |
|
306 User::LeaveIfError( err ); |
|
307 } |
|
308 |
|
309 |
470 |
310 // --------------------------------------------------------------------------- |
471 // --------------------------------------------------------------------------- |
311 // CThumbnailStore::StoreThumbnailL() |
472 // CThumbnailStore::StoreThumbnailL() |
312 // Stores thumbnail image. |
473 // Stores thumbnail image. |
313 // --------------------------------------------------------------------------- |
474 // --------------------------------------------------------------------------- |
314 // |
475 // |
315 void CThumbnailStore::StoreThumbnailL( const TDesC& aPath, const TDes8& aData, |
476 void CThumbnailStore::StoreThumbnailL( const TDesC& aPath, const TDes8& aData, |
316 const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, |
477 const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, |
317 const TThumbnailSize& aThumbnailSize, TThumbnailId aThumbnailId, const TBool aThumbFromPath ) |
478 const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath ) |
318 { |
479 { |
319 TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( const TDes8& ) in" ); |
480 TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( const TDes8& ) in" ); |
320 |
481 |
321 #ifdef _DEBUG |
482 #ifdef _DEBUG |
322 TTime aStart, aStop; |
483 TTime aStart, aStop; |
614 TN_DEBUG1( "CThumbnailStore::FindDuplicateL() - duplicate in temp table" ); |
783 TN_DEBUG1( "CThumbnailStore::FindDuplicateL() - duplicate in temp table" ); |
615 |
784 |
616 found = ETrue; |
785 found = ETrue; |
617 } |
786 } |
618 |
787 |
|
788 // check if duplicate in Deleted |
|
789 if (found) |
|
790 { |
|
791 stmt.Close(); |
|
792 CleanupStack::PopAndDestroy( &stmt ); |
|
793 CleanupClosePushL( stmt ); |
|
794 |
|
795 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSqlFindDeleted )); |
|
796 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
|
797 User::LeaveIfError( paramIndex ); |
|
798 User::LeaveIfError( stmt.BindText( paramIndex, aPath )); |
|
799 |
|
800 rowStatus = stmt.Next(); |
|
801 |
|
802 if(rowStatus == KSqlAtRow) |
|
803 { |
|
804 TN_DEBUG1( "CThumbnailStore::FindDuplicateL() - duplicate marked deleted" ); |
|
805 |
|
806 DeleteThumbnailsL(aPath, ETrue); |
|
807 |
|
808 TN_DEBUG1( "CThumbnailStore::FindDuplicateL() - duplicate force-deleted" ); |
|
809 |
|
810 found = EFalse; |
|
811 } |
|
812 } |
|
813 |
619 stmt.Close(); |
814 stmt.Close(); |
620 CleanupStack::PopAndDestroy( &stmt ); |
815 CleanupStack::PopAndDestroy( &stmt ); |
621 |
816 |
622 return found; |
817 return found; |
623 } |
818 } |
624 |
819 |
625 |
|
626 // --------------------------------------------------------------------------- |
|
627 // Create database tables |
|
628 // --------------------------------------------------------------------------- |
|
629 // |
|
630 void CThumbnailStore::CreateTablesL() |
|
631 { |
|
632 TN_DEBUG1( "CThumbnailStore::CreateTablesL()" ); |
|
633 TInt err = 0; |
|
634 err = iDatabase.Exec( KThumbnailCreateInfoTable ); |
|
635 TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailCreateInfoTable err=%d", err ); |
|
636 err = iDatabase.Exec( KThumbnailCreateInfoDataTable ); |
|
637 TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailCreateInfoDataTable err=%d", err ); |
|
638 err = iDatabase.Exec( KThumbnailCreateInfoTableIndex1 ); |
|
639 TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailCreateInfoTableIndex1 err=%d", err ); |
|
640 err = iDatabase.Exec( KThumbnailCreateInfoTableIndex2 ); |
|
641 TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailCreateInfoTableIndex2 err=%d", err ); |
|
642 err = iDatabase.Exec(KThumbnailVersionTable); |
|
643 TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailVersionTable err=%d", err ); |
|
644 User::LeaveIfError( err ); |
|
645 } |
|
646 |
|
647 |
|
648 // --------------------------------------------------------------------------- |
820 // --------------------------------------------------------------------------- |
649 // Get missing sizes by Path |
821 // Get missing sizes by Path |
650 // --------------------------------------------------------------------------- |
822 // --------------------------------------------------------------------------- |
651 // |
823 // |
652 void CThumbnailStore::GetMissingSizesAndIDsL( const TDesC& aPath, TInt aSourceType, RArray < |
824 void CThumbnailStore::GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray < |
653 TThumbnailPersistentSize > & aMissingSizes, TBool& aMissingIDs ) |
825 TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly ) |
654 { |
826 { |
655 TN_DEBUG2( "CThumbnailStore::GetMissingSizesAndIDsL() aSourceType == %d", aSourceType ); |
827 TN_DEBUG2( "CThumbnailStore::GetMissingSizesL() aSourceType == %d", aSourceType ); |
|
828 |
|
829 HBufC* path = aPath.AllocLC(); |
|
830 TPtr ptr(path->Des()); |
|
831 StripDriveLetterL( ptr ); |
|
832 |
656 // define sizes to be checked |
833 // define sizes to be checked |
657 const TInt count = iPersistentSizes.Count(); |
834 const TInt count = iPersistentSizes.Count(); |
658 |
835 |
659 for ( TInt i = 0 ; i < count; i++ ) |
836 for ( TInt i = 0 ; i < count; i++ ) |
660 { |
837 { |
661 if ( iPersistentSizes[ i ].iSourceType == aSourceType && iPersistentSizes[ i ].iAutoCreate) |
838 if ( iPersistentSizes[ i ].iSourceType == aSourceType && iPersistentSizes[ i ].iAutoCreate) |
662 { |
839 { |
663 aMissingSizes.Append( iPersistentSizes[ i ] ); |
840 //if generating only grid size for image or video, other sizes are not missing |
|
841 if( aCheckGridSizeOnly ) |
|
842 { |
|
843 if( (iPersistentSizes[i].iSourceType == TThumbnailPersistentSize::EImage || iPersistentSizes[i].iSourceType == TThumbnailPersistentSize::EVideo )&& |
|
844 iPersistentSizes[i].iSizeType != TThumbnailPersistentSize::EGrid ) |
|
845 { |
|
846 TN_DEBUG4( "CThumbnailStore::GetMissingSizesL() skip, aCheckGridSizeOnly = %d and iPersistentSizes[%d].iSizeType == %d", |
|
847 aCheckGridSizeOnly, i, iPersistentSizes[i].iSizeType ); |
|
848 } |
|
849 else |
|
850 { |
|
851 aMissingSizes.Append( iPersistentSizes[ i ] ); |
|
852 } |
|
853 } |
|
854 else |
|
855 { |
|
856 aMissingSizes.Append( iPersistentSizes[ i ] ); |
|
857 } |
664 } |
858 } |
665 } |
859 } |
666 |
860 |
667 TInt missingSizeCount = aMissingSizes.Count(); |
861 TInt missingSizeCount = aMissingSizes.Count(); |
668 aMissingIDs = EFalse; |
862 |
669 |
863 TN_DEBUG2( "CThumbnailStore::GetMissingSizesL() missingSizeCount == %d", missingSizeCount ); |
670 TN_DEBUG3( "CThumbnailStore::GetMissingSizesAndIDsL() missingSizeCount == %d, missingIDs == %d", missingSizeCount, aMissingIDs ); |
|
671 |
864 |
672 // check temp table first |
865 // check temp table first |
673 RSqlStatement stmt; |
866 RSqlStatement stmt; |
674 CleanupClosePushL( stmt ); |
867 CleanupClosePushL( stmt ); |
675 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectTempSizeByPath )); |
868 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectTempSizeByPath )); |
676 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
869 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
677 User::LeaveIfError( paramIndex ); |
870 User::LeaveIfError( paramIndex ); |
678 User::LeaveIfError( stmt.BindText( paramIndex, aPath )); |
871 User::LeaveIfError( stmt.BindText( paramIndex, *path )); |
679 |
872 |
680 TInt rowStatus = stmt.Next(); |
873 TInt rowStatus = stmt.Next(); |
681 |
874 |
682 TInt round = 1; |
875 TInt round = 1; |
683 TInt size = 0; |
876 TInt size = 0; |
684 TInt id = 0; |
|
685 |
877 |
686 while (round <= 2) |
878 while (round <= 2) |
687 { |
879 { |
688 while ( rowStatus == KSqlAtRow && missingSizeCount > 0 ) |
880 while ( rowStatus == KSqlAtRow && missingSizeCount > 0 ) |
689 { |
881 { |
690 size = stmt.ColumnInt( 0 ); |
882 size = stmt.ColumnInt( 0 ); |
691 id = stmt.ColumnInt( 1 ); |
|
692 |
883 |
693 TN_DEBUG2( "CThumbnailStore::GetMissingSizesAndIDsL() id == %d", id ); |
|
694 |
|
695 //if TNId is not valid mark that some are missing so that UpdateDb is run later |
|
696 if ( id <= 0) |
|
697 { |
|
698 TN_DEBUG1( "CThumbnailStore::GetMissingSizesAndIDsL() missing ID"); |
|
699 aMissingIDs = ETrue; |
|
700 } |
|
701 |
|
702 missingSizeCount = aMissingSizes.Count(); |
884 missingSizeCount = aMissingSizes.Count(); |
703 for ( TInt i = 0; i < missingSizeCount; i++ ) |
885 for ( TInt i = 0; i < missingSizeCount; i++ ) |
704 { |
886 { |
705 if ( aMissingSizes[ i ].iType == size ) |
887 if ( aMissingSizes[ i ].iType == size ) |
706 { |
888 { |
717 CleanupStack::PopAndDestroy( &stmt ); |
899 CleanupStack::PopAndDestroy( &stmt ); |
718 |
900 |
719 // all found |
901 // all found |
720 if (missingSizeCount == 0) |
902 if (missingSizeCount == 0) |
721 { |
903 { |
|
904 CleanupStack::PopAndDestroy( path ); |
722 return; |
905 return; |
723 } |
906 } |
724 else if (round == 1) |
907 else if (round == 1) |
725 { |
908 { |
726 // change to real table |
909 // change to real table |
727 CleanupClosePushL( stmt ); |
910 CleanupClosePushL( stmt ); |
728 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectSizeByPath )); |
911 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectSizeByPath )); |
729 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
912 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
730 User::LeaveIfError( paramIndex ); |
913 User::LeaveIfError( paramIndex ); |
731 User::LeaveIfError( stmt.BindText( paramIndex, aPath )); |
914 User::LeaveIfError( stmt.BindText( paramIndex, *path )); |
732 rowStatus = stmt.Next(); |
915 rowStatus = stmt.Next(); |
733 } |
916 } |
734 |
917 |
735 round++; |
918 round++; |
736 } |
919 } |
737 } |
920 |
738 |
921 CleanupStack::PopAndDestroy( path ); |
739 |
922 } |
740 // --------------------------------------------------------------------------- |
|
741 // CThumbnailStore::FetchThumbnailL() |
|
742 // Fetches thumbnail image. |
|
743 // --------------------------------------------------------------------------- |
|
744 // |
|
745 TInt CThumbnailStore::FetchThumbnailL( TThumbnailId aThumbnailId, |
|
746 CFbsBitmap*& aThumbnail, TDesC8* & aData, TThumbnailSize aThumbnailSize, TSize &aThumbnailRealSize ) |
|
747 { |
|
748 TN_DEBUG3( "CThumbnailStore::FetchThumbnailL(%d) aThumbnailSize == %d", aThumbnailId, aThumbnailSize ); |
|
749 delete aThumbnail; |
|
750 aThumbnail = NULL; |
|
751 |
|
752 RSqlStatement stmt; |
|
753 CleanupClosePushL( stmt ); |
|
754 |
|
755 TInt paramIndex = 0; |
|
756 TInt found = KErrNotFound; |
|
757 TInt rowStatus = 0; |
|
758 TInt column = 0; |
|
759 TInt count = 0; |
|
760 TThumbnailSize thumbnailImage = EUnknownThumbnailSize; |
|
761 TThumbnailSize thumbnailVideo = EUnknownThumbnailSize; |
|
762 TThumbnailSize thumbnailAudio = EUnknownThumbnailSize; |
|
763 TBool inTempTable( ETrue ); |
|
764 |
|
765 if(aThumbnailSize == EFullScreenThumbnailSize) |
|
766 { |
|
767 thumbnailImage = EImageFullScreenThumbnailSize; |
|
768 thumbnailVideo = EVideoFullScreenThumbnailSize; |
|
769 thumbnailAudio = EAudioFullScreenThumbnailSize; |
|
770 } |
|
771 else if(aThumbnailSize == EGridThumbnailSize) |
|
772 { |
|
773 thumbnailImage = EImageGridThumbnailSize; |
|
774 thumbnailVideo = EVideoGridThumbnailSize; |
|
775 thumbnailAudio = EAudioGridThumbnailSize; |
|
776 } |
|
777 else if(aThumbnailSize == EListThumbnailSize) |
|
778 { |
|
779 thumbnailImage = EImageListThumbnailSize; |
|
780 thumbnailVideo = EVideoListThumbnailSize; |
|
781 thumbnailAudio = EAudioListThumbnailSize; |
|
782 } |
|
783 |
|
784 if(aThumbnailSize == EFullScreenThumbnailSize || |
|
785 aThumbnailSize == EGridThumbnailSize || |
|
786 aThumbnailSize == EListThumbnailSize ) |
|
787 { |
|
788 TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- No DataType -- TEMP TABLE lookup" ); |
|
789 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectTempInfoByIdv2 )); |
|
790 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
791 User::LeaveIfError( paramIndex ); |
|
792 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnailId )); |
|
793 |
|
794 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamSizeImage ); |
|
795 User::LeaveIfError( paramIndex ); |
|
796 User::LeaveIfError( stmt.BindInt( paramIndex, thumbnailImage )); |
|
797 |
|
798 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamSizeVideo ); |
|
799 User::LeaveIfError( paramIndex ); |
|
800 User::LeaveIfError( stmt.BindInt( paramIndex, thumbnailVideo )); |
|
801 |
|
802 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamSizeAudio ); |
|
803 User::LeaveIfError( paramIndex ); |
|
804 User::LeaveIfError( stmt.BindInt( paramIndex, thumbnailAudio )); |
|
805 |
|
806 rowStatus = stmt.Next(); |
|
807 //if not found from temp table, look from real table |
|
808 if(rowStatus != KSqlAtRow) |
|
809 { |
|
810 TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- No DataType -- MAIN TABLE lookup" ); |
|
811 inTempTable = EFalse; |
|
812 stmt.Close(); |
|
813 CleanupStack::PopAndDestroy( &stmt ); |
|
814 CleanupClosePushL( stmt ); |
|
815 |
|
816 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectInfoByIdv2 )); |
|
817 |
|
818 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
819 User::LeaveIfError( paramIndex ); |
|
820 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnailId )); |
|
821 |
|
822 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamSizeImage ); |
|
823 User::LeaveIfError( paramIndex ); |
|
824 User::LeaveIfError( stmt.BindInt( paramIndex, thumbnailImage )); |
|
825 |
|
826 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamSizeVideo ); |
|
827 User::LeaveIfError( paramIndex ); |
|
828 User::LeaveIfError( stmt.BindInt( paramIndex, thumbnailVideo )); |
|
829 |
|
830 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamSizeAudio ); |
|
831 User::LeaveIfError( paramIndex ); |
|
832 User::LeaveIfError( stmt.BindInt( paramIndex, thumbnailAudio )); |
|
833 |
|
834 rowStatus = stmt.Next(); |
|
835 } |
|
836 } |
|
837 else |
|
838 { |
|
839 TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- TEMP TABLE lookup" ); |
|
840 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectTempInfoById )); |
|
841 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
842 User::LeaveIfError( paramIndex ); |
|
843 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnailId )); |
|
844 |
|
845 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamSize ); |
|
846 User::LeaveIfError( paramIndex ); |
|
847 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnailSize )); |
|
848 |
|
849 rowStatus = stmt.Next(); |
|
850 |
|
851 //if not found from temp table, look from real table |
|
852 if(rowStatus != KSqlAtRow) |
|
853 { |
|
854 TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- MAIN TABLE lookup" ); |
|
855 inTempTable = EFalse; |
|
856 stmt.Close(); |
|
857 CleanupStack::PopAndDestroy( &stmt ); |
|
858 CleanupClosePushL( stmt ); |
|
859 |
|
860 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectInfoById )); |
|
861 |
|
862 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
863 User::LeaveIfError( paramIndex ); |
|
864 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnailId )); |
|
865 |
|
866 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamSize ); |
|
867 User::LeaveIfError( paramIndex ); |
|
868 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnailSize )); |
|
869 |
|
870 rowStatus = stmt.Next(); |
|
871 } |
|
872 } |
|
873 if(rowStatus == KSqlAtRow) |
|
874 { |
|
875 TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- thumbnail found" ); |
|
876 // Check whether blacklisted thumbnail entry modified. |
|
877 // If thumbnail is marked as blacklisted and timestamp has |
|
878 // changed, delete thumbnails from tables and leave with |
|
879 // KErrNotFound to get thumbnail regenerated. |
|
880 column = 4; |
|
881 TInt flags = stmt.ColumnInt( column ); |
|
882 if( flags & KThumbnailDbFlagBlacklisted ) |
|
883 { |
|
884 TBool modified = EFalse; |
|
885 CheckModifiedByIdL( aThumbnailId, inTempTable, modified ); |
|
886 if( modified ) |
|
887 { |
|
888 // Close db to get deletion of thumbnails executed. |
|
889 stmt.Close(); |
|
890 CleanupStack::PopAndDestroy( &stmt ); |
|
891 DeleteThumbnailsL( aThumbnailId ); |
|
892 User::Leave( KErrNotFound ); |
|
893 } |
|
894 else |
|
895 { |
|
896 User::Leave( KErrCompletion ); |
|
897 } |
|
898 } |
|
899 |
|
900 found = KErrNone; |
|
901 count = 0; |
|
902 count++; |
|
903 column = 0; |
|
904 TInt format = stmt.ColumnInt( column++ ); |
|
905 if(format == 1 /*TThumbnailFormat::EThumbnailFormatJpeg */ ) |
|
906 { |
|
907 TPtrC8 ptr = stmt.ColumnBinaryL( column++ ); |
|
908 HBufC8* data = ptr.AllocL() ; |
|
909 aThumbnail = NULL; |
|
910 aData = data; |
|
911 |
|
912 } else { |
|
913 TPtrC8 ptr = stmt.ColumnBinaryL( column ); |
|
914 RDesReadStream stream( ptr ); |
|
915 aThumbnail = new( ELeave )CFbsBitmap(); |
|
916 aThumbnail->InternalizeL( stream ); |
|
917 aData = NULL; |
|
918 } |
|
919 |
|
920 //fetch real size of TN |
|
921 column = 2; |
|
922 aThumbnailRealSize.iWidth = stmt.ColumnInt( column++ ); |
|
923 aThumbnailRealSize.iHeight = stmt.ColumnInt( column ); |
|
924 } |
|
925 else |
|
926 { |
|
927 TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- thumbnail NOT found" ); |
|
928 } |
|
929 |
|
930 stmt.Close(); |
|
931 CleanupStack::PopAndDestroy( &stmt ); |
|
932 |
|
933 User::LeaveIfError( found ); |
|
934 return found; |
|
935 } |
|
936 |
|
937 |
923 |
938 // --------------------------------------------------------------------------- |
924 // --------------------------------------------------------------------------- |
939 // CThumbnailStore::FetchThumbnailL() |
925 // CThumbnailStore::FetchThumbnailL() |
940 // Fetches thumbnail image. |
926 // Fetches thumbnail image. |
941 // --------------------------------------------------------------------------- |
927 // --------------------------------------------------------------------------- |
1055 TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- thumbnail NOT found" ); |
1045 TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- thumbnail NOT found" ); |
1056 } |
1046 } |
1057 |
1047 |
1058 stmt.Close(); |
1048 stmt.Close(); |
1059 CleanupStack::PopAndDestroy( &stmt ); |
1049 CleanupStack::PopAndDestroy( &stmt ); |
1060 |
1050 CleanupStack::PopAndDestroy( path ); |
|
1051 |
1061 User::LeaveIfError( found ); |
1052 User::LeaveIfError( found ); |
1062 } |
1053 } |
1063 |
1054 |
1064 // ----------------------------------------------------------------------------- |
1055 // ----------------------------------------------------------------------------- |
1065 // Delete thumbnails for given object file by Path |
1056 // Delete thumbnails for given object file by Path |
1066 // ----------------------------------------------------------------------------- |
1057 // ----------------------------------------------------------------------------- |
1067 // |
1058 // |
1068 void CThumbnailStore::DeleteThumbnailsL( const TDesC& aPath ) |
1059 void CThumbnailStore::DeleteThumbnailsL( const TDesC& aPath, TBool aForce, |
1069 { |
1060 TBool aTransaction ) |
1070 RThumbnailTransaction transaction( iDatabase ); |
1061 { |
1071 CleanupClosePushL( transaction ); |
1062 TN_DEBUG2( "CThumbnailStore::DeleteThumbnailsL(%S)", &aPath ); |
1072 transaction.BeginL(); |
1063 #ifdef _DEBUG |
1073 RSqlStatement stmt; |
1064 TTime aStart, aStop; |
1074 CleanupClosePushL( stmt ); |
1065 aStart.UniversalTime(); |
1075 |
1066 #endif |
1076 TInt paramIndex = 0; |
1067 TInt paramIndex = 0; |
1077 TInt paramIndex1 = 0; |
1068 TInt paramIndex1 = 0; |
1078 TInt paramIndex2 = 0; |
1069 TInt paramIndex2 = 0; |
1079 TInt rowStatus = 0; |
1070 TInt rowStatus = 0; |
1080 TInt column = 0; |
1071 TInt column = 0; |
1081 TInt rowid = 0; |
1072 TInt64 rowid = 0; |
1082 TInt deleteCount = 0; |
1073 TInt count = 0; |
1083 |
1074 |
|
1075 HBufC* path = aPath.AllocLC(); |
|
1076 TPtr ptr(path->Des()); |
|
1077 StripDriveLetterL( ptr ); |
|
1078 |
|
1079 RThumbnailTransaction transaction( iDatabase ); |
|
1080 if (aTransaction) |
|
1081 { |
|
1082 CleanupClosePushL( transaction ); |
|
1083 transaction.BeginL(); |
|
1084 } |
|
1085 |
|
1086 RSqlStatement stmt; |
|
1087 RSqlStatement stmt_info; |
|
1088 RSqlStatement stmt_infodata; |
|
1089 |
|
1090 CleanupClosePushL( stmt ); |
|
1091 CleanupClosePushL( stmt_info ); |
|
1092 CleanupClosePushL( stmt_infodata ); |
|
1093 |
1084 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsByPathL() -- TEMP TABLE lookup" ); |
1094 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsByPathL() -- TEMP TABLE lookup" ); |
1085 TInt err = stmt.Prepare( iDatabase, KTempThumbnailSqlSelectRowIDInfoByPath); |
1095 |
1086 User::LeaveIfError( err ); |
1096 User::LeaveIfError( stmt.Prepare( iDatabase, KTempThumbnailSqlSelectRowIDInfoByPath) ); |
|
1097 User::LeaveIfError( stmt_info.Prepare( iDatabase, KTempThumbnailSqlDeleteInfoByPath) ); |
|
1098 User::LeaveIfError( stmt_infodata.Prepare( iDatabase, KTempThumbnailSqlDeleteInfoDataByPath) ); |
1087 |
1099 |
1088 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
1100 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
1089 User::LeaveIfError( paramIndex ); |
1101 User::LeaveIfError( paramIndex ); |
1090 User::LeaveIfError( stmt.BindText( paramIndex, aPath )); |
1102 User::LeaveIfError( stmt.BindText( paramIndex, *path )); |
1091 |
1103 |
1092 rowStatus = stmt.Next(); |
1104 rowStatus = stmt.Next(); |
1093 RSqlStatement stmt_info; |
|
1094 CleanupClosePushL( stmt_info ); |
|
1095 err = stmt_info.Prepare( iDatabase, KTempThumbnailSqlDeleteInfoByPath); |
|
1096 RSqlStatement stmt_infodata; |
|
1097 CleanupClosePushL( stmt_infodata ); |
|
1098 err = stmt_infodata.Prepare( iDatabase, KTempThumbnailSqlDeleteInfoDataByPath); |
|
1099 |
|
1100 |
1105 |
1101 while(rowStatus == KSqlAtRow) |
1106 while(rowStatus == KSqlAtRow) |
1102 { |
1107 { |
1103 rowid = stmt.ColumnInt( column ); |
1108 rowid = stmt.ColumnInt64( column ); |
1104 paramIndex1 = stmt_info.ParameterIndex( KThumbnailSqlParamRowID ); |
1109 paramIndex1 = stmt_info.ParameterIndex( KThumbnailSqlParamRowID ); |
1105 User::LeaveIfError( paramIndex1 ); |
1110 User::LeaveIfError( paramIndex1 ); |
1106 User::LeaveIfError( stmt_info.BindInt( paramIndex1, rowid )); |
1111 User::LeaveIfError( stmt_info.BindInt64( paramIndex1, rowid )); |
1107 |
1112 |
1108 deleteCount = stmt_info.Exec(); |
1113 TInt err = stmt_info.Exec(); |
1109 stmt_info.Reset(); |
1114 stmt_info.Reset(); |
1110 User::LeaveIfError( deleteCount ); |
1115 User::LeaveIfError( err ); |
1111 |
1116 |
1112 paramIndex2 = stmt_infodata.ParameterIndex( KThumbnailSqlParamRowID ); |
1117 paramIndex2 = stmt_infodata.ParameterIndex( KThumbnailSqlParamRowID ); |
1113 User::LeaveIfError( paramIndex2 ); |
1118 User::LeaveIfError( paramIndex2 ); |
1114 User::LeaveIfError( stmt_infodata.BindInt( paramIndex2, rowid )); |
1119 User::LeaveIfError( stmt_infodata.BindInt64( paramIndex2, rowid )); |
1115 |
1120 |
1116 deleteCount = stmt_infodata.Exec(); |
1121 err = stmt_infodata.Exec(); |
1117 stmt_infodata.Reset(); |
1122 stmt_infodata.Reset(); |
1118 User::LeaveIfError( deleteCount ); |
1123 User::LeaveIfError( err ); |
|
1124 |
|
1125 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsByPathL() -- TEMP TABLE lookup - thumbnail deleted" ); |
1119 |
1126 |
1120 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsByPathL() -- TEMP TABLE lookup - thumbnail deleted" ); |
1127 // fetch another row (temp table rowIDs are updated immediately) |
|
1128 stmt.Reset(); |
1121 |
1129 |
1122 // fetch another row (temp table rowIDs are updated immediately) |
1130 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
1123 stmt.Reset(); |
1131 User::LeaveIfError( paramIndex ); |
|
1132 User::LeaveIfError( stmt.BindText( paramIndex, *path )); |
1124 |
1133 |
1125 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
1134 rowStatus = stmt.Next(); |
1126 User::LeaveIfError( paramIndex ); |
1135 } |
1127 User::LeaveIfError( stmt.BindText( paramIndex, aPath )); |
|
1128 |
|
1129 rowStatus = stmt.Next(); |
|
1130 } |
|
1131 stmt_infodata.Close(); |
|
1132 stmt_info.Close(); |
|
1133 CleanupStack::PopAndDestroy( &stmt_infodata ); |
|
1134 CleanupStack::PopAndDestroy( &stmt_info ); |
|
1135 |
|
1136 |
|
1137 //look from real table |
|
1138 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup" ); |
|
1139 stmt.Close(); |
|
1140 CleanupStack::PopAndDestroy( &stmt ); |
|
1141 CleanupClosePushL( stmt ); |
|
1142 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSqlSelectRowIDInfoByPath )); |
|
1143 |
|
1144 User::LeaveIfError( err ); |
|
1145 |
|
1146 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
|
1147 User::LeaveIfError( paramIndex ); |
|
1148 User::LeaveIfError( stmt.BindText( paramIndex, aPath )); |
|
1149 |
|
1150 rowStatus = stmt.Next(); |
|
1151 CleanupClosePushL( stmt_info ); |
|
1152 err = stmt_info.Prepare( iDatabase, KThumbnailSqlDeleteInfoByPath); |
|
1153 CleanupClosePushL( stmt_infodata ); |
|
1154 err = stmt_infodata.Prepare( iDatabase, KThumbnailSqlDeleteInfoDataByPath); |
|
1155 |
|
1156 |
|
1157 while(rowStatus == KSqlAtRow) |
|
1158 { |
|
1159 rowid = stmt.ColumnInt( column ); |
|
1160 paramIndex1 = stmt_info.ParameterIndex( KThumbnailSqlParamRowID ); |
|
1161 User::LeaveIfError( paramIndex1 ); |
|
1162 User::LeaveIfError( stmt_info.BindInt( paramIndex1, rowid )); |
|
1163 |
|
1164 deleteCount = stmt_info.Exec(); |
|
1165 stmt_info.Reset(); |
|
1166 User::LeaveIfError( deleteCount ); |
|
1167 |
|
1168 paramIndex2 = stmt_infodata.ParameterIndex( KThumbnailSqlParamRowID ); |
|
1169 User::LeaveIfError( paramIndex2 ); |
|
1170 User::LeaveIfError( stmt_infodata.BindInt( paramIndex2, rowid )); |
|
1171 |
|
1172 deleteCount = stmt_infodata.Exec(); |
|
1173 stmt_infodata.Reset(); |
|
1174 User::LeaveIfError( deleteCount ); |
|
1175 |
|
1176 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup - thumbnail deleted" ); |
|
1177 |
|
1178 rowStatus = stmt.Next(); |
|
1179 } |
|
1180 |
1136 |
1181 stmt_infodata.Close(); |
1137 stmt_infodata.Close(); |
1182 stmt_info.Close(); |
1138 stmt_info.Close(); |
1183 stmt.Close(); |
1139 stmt.Close(); |
|
1140 |
1184 CleanupStack::PopAndDestroy( &stmt_infodata ); |
1141 CleanupStack::PopAndDestroy( &stmt_infodata ); |
1185 CleanupStack::PopAndDestroy( &stmt_info ); |
1142 CleanupStack::PopAndDestroy( &stmt_info ); |
|
1143 CleanupStack::PopAndDestroy( &stmt ); |
|
1144 |
|
1145 // if forcing instant delete |
|
1146 if (aForce) |
|
1147 { |
|
1148 //look from real table |
|
1149 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup" ); |
|
1150 |
|
1151 CleanupClosePushL( stmt ); |
|
1152 CleanupClosePushL( stmt_info ); |
|
1153 CleanupClosePushL( stmt_infodata ); |
|
1154 |
|
1155 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSqlSelectRowIDInfoByPath )); |
|
1156 User::LeaveIfError( stmt_info.Prepare( iDatabase, KThumbnailSqlDeleteInfoByPath) ); |
|
1157 User::LeaveIfError( stmt_infodata.Prepare( iDatabase, KThumbnailSqlDeleteInfoDataByPath) ); |
|
1158 |
|
1159 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
|
1160 User::LeaveIfError( paramIndex ); |
|
1161 User::LeaveIfError( stmt.BindText( paramIndex, *path )); |
|
1162 |
|
1163 rowStatus = stmt.Next(); |
|
1164 |
|
1165 while(rowStatus == KSqlAtRow) |
|
1166 { |
|
1167 rowid = stmt.ColumnInt64( column ); |
|
1168 paramIndex1 = stmt_info.ParameterIndex( KThumbnailSqlParamRowID ); |
|
1169 User::LeaveIfError( paramIndex1 ); |
|
1170 User::LeaveIfError( stmt_info.BindInt64( paramIndex1, rowid )); |
|
1171 |
|
1172 TInt err = stmt_info.Exec(); |
|
1173 stmt_info.Reset(); |
|
1174 User::LeaveIfError( err ); |
|
1175 |
|
1176 paramIndex2 = stmt_infodata.ParameterIndex( KThumbnailSqlParamRowID ); |
|
1177 User::LeaveIfError( paramIndex2 ); |
|
1178 User::LeaveIfError( stmt_infodata.BindInt64( paramIndex2, rowid )); |
|
1179 |
|
1180 err = stmt_infodata.Exec(); |
|
1181 stmt_infodata.Reset(); |
|
1182 User::LeaveIfError( err ); |
|
1183 |
|
1184 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup - thumbnail deleted" ); |
|
1185 |
|
1186 rowStatus = stmt.Next(); |
|
1187 } |
|
1188 |
|
1189 stmt_infodata.Close(); |
|
1190 stmt_info.Close(); |
|
1191 CleanupStack::PopAndDestroy( &stmt_infodata ); |
|
1192 CleanupStack::PopAndDestroy( &stmt_info ); |
|
1193 } |
|
1194 else |
|
1195 { |
|
1196 // only add path to deleted table |
|
1197 CleanupClosePushL( stmt ); |
|
1198 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSqlInsertDeleted ) ); |
|
1199 |
|
1200 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
|
1201 User::LeaveIfError( paramIndex ); |
|
1202 User::LeaveIfError( stmt.BindText( paramIndex, *path )); |
|
1203 |
|
1204 count = stmt.Exec(); |
|
1205 } |
|
1206 |
|
1207 stmt.Close(); |
1186 CleanupStack::PopAndDestroy( &stmt ); |
1208 CleanupStack::PopAndDestroy( &stmt ); |
1187 transaction.CommitL(); |
1209 |
1188 CleanupStack::PopAndDestroy( &transaction ); |
1210 if (aTransaction) |
1189 } |
1211 { |
1190 |
1212 transaction.CommitL(); |
1191 // ----------------------------------------------------------------------------- |
1213 CleanupStack::PopAndDestroy( &transaction ); |
1192 // Delete thumbnails for given object file by Id |
1214 } |
1193 // ----------------------------------------------------------------------------- |
|
1194 // |
|
1195 void CThumbnailStore::DeleteThumbnailsL( const TThumbnailId& aTNId ) |
|
1196 { |
|
1197 #ifdef _DEBUG |
|
1198 TTime aStart, aStop; |
|
1199 aStart.UniversalTime(); |
|
1200 #endif |
|
1201 |
|
1202 TInt paramIndex = 0; |
|
1203 TInt paramIndex1 = 0; |
|
1204 TInt paramIndex2 = 0; |
|
1205 TInt rowStatus = 0; |
|
1206 TInt column = 0; |
|
1207 TInt rowid = 0; |
|
1208 TInt deleteCount = 0; |
|
1209 |
|
1210 RThumbnailTransaction transaction( iDatabase ); |
|
1211 CleanupClosePushL( transaction ); |
|
1212 transaction.BeginL(); |
|
1213 RSqlStatement stmt; |
|
1214 CleanupClosePushL( stmt ); |
|
1215 |
|
1216 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsByIdL() -- TEMP TABLE lookup" ); |
|
1217 TInt err = stmt.Prepare( iDatabase, KTempThumbnailSqlSelectRowIDInfoByID); |
|
1218 User::LeaveIfError( err ); |
|
1219 |
|
1220 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1221 User::LeaveIfError( paramIndex ); |
|
1222 User::LeaveIfError( stmt.BindInt( paramIndex, aTNId )); |
|
1223 |
|
1224 rowStatus = stmt.Next(); |
|
1225 RSqlStatement stmt_info; |
|
1226 CleanupClosePushL( stmt_info ); |
|
1227 err = stmt_info.Prepare( iDatabase, KTempThumbnailSqlDeleteInfoByID); |
|
1228 RSqlStatement stmt_infodata; |
|
1229 CleanupClosePushL( stmt_infodata ); |
|
1230 err = stmt_infodata.Prepare( iDatabase, KTempThumbnailSqlDeleteInfoDataByID); |
|
1231 |
|
1232 |
|
1233 while(rowStatus == KSqlAtRow) |
|
1234 { |
|
1235 rowid = stmt.ColumnInt( column ); |
|
1236 paramIndex1 = stmt_info.ParameterIndex( KThumbnailSqlParamRowID ); |
|
1237 User::LeaveIfError( paramIndex1 ); |
|
1238 User::LeaveIfError( stmt_info.BindInt( paramIndex1, rowid )); |
|
1239 |
|
1240 err = stmt_info.Exec(); |
|
1241 stmt_info.Reset(); |
|
1242 User::LeaveIfError( err ); |
|
1243 |
|
1244 paramIndex2 = stmt_infodata.ParameterIndex( KThumbnailSqlParamRowID ); |
|
1245 User::LeaveIfError( paramIndex2 ); |
|
1246 User::LeaveIfError( stmt_infodata.BindInt( paramIndex2, rowid )); |
|
1247 |
|
1248 err = stmt_infodata.Exec(); |
|
1249 stmt_infodata.Reset(); |
|
1250 User::LeaveIfError( err ); |
|
1251 deleteCount++; |
|
1252 |
|
1253 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsByIdL() -- TEMP TABLE lookup - thumbnail deleted" ); |
|
1254 |
|
1255 // fetch another row (temp table rowIDs are updated immediately) |
|
1256 stmt.Reset(); |
|
1257 |
|
1258 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1259 User::LeaveIfError( paramIndex ); |
|
1260 User::LeaveIfError( stmt.BindInt( paramIndex, aTNId )); |
|
1261 |
|
1262 rowStatus = stmt.Next(); |
|
1263 } |
|
1264 |
|
1265 stmt_infodata.Close(); |
|
1266 stmt_info.Close(); |
|
1267 CleanupStack::PopAndDestroy( &stmt_infodata ); |
|
1268 CleanupStack::PopAndDestroy( &stmt_info ); |
|
1269 |
|
1270 |
|
1271 //look from real table |
|
1272 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByIdL() -- MAIN TABLE lookup" ); |
|
1273 stmt.Close(); |
|
1274 CleanupStack::PopAndDestroy( &stmt ); |
|
1275 CleanupClosePushL( stmt ); |
|
1276 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSqlSelectRowIDInfoByID )); |
|
1277 |
|
1278 User::LeaveIfError( err ); |
|
1279 |
|
1280 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1281 User::LeaveIfError( paramIndex ); |
|
1282 User::LeaveIfError( stmt.BindInt( paramIndex, aTNId )); |
|
1283 |
|
1284 rowStatus = stmt.Next(); |
|
1285 CleanupClosePushL( stmt_info ); |
|
1286 err = stmt_info.Prepare( iDatabase, KThumbnailSqlDeleteInfoByID); |
|
1287 CleanupClosePushL( stmt_infodata ); |
|
1288 err = stmt_infodata.Prepare( iDatabase, KThumbnailSqlDeleteInfoDataByID); |
|
1289 |
|
1290 |
|
1291 while(rowStatus == KSqlAtRow) |
|
1292 { |
|
1293 rowid = stmt.ColumnInt( column ); |
|
1294 paramIndex1 = stmt_info.ParameterIndex( KThumbnailSqlParamRowID ); |
|
1295 User::LeaveIfError( paramIndex1 ); |
|
1296 User::LeaveIfError( stmt_info.BindInt( paramIndex1, rowid )); |
|
1297 |
|
1298 err = stmt_info.Exec(); |
|
1299 stmt_info.Reset(); |
|
1300 User::LeaveIfError( err ); |
|
1301 |
|
1302 paramIndex2 = stmt_infodata.ParameterIndex( KThumbnailSqlParamRowID ); |
|
1303 User::LeaveIfError( paramIndex2 ); |
|
1304 User::LeaveIfError( stmt_infodata.BindInt( paramIndex2, rowid )); |
|
1305 |
|
1306 err = stmt_infodata.Exec(); |
|
1307 stmt_infodata.Reset(); |
|
1308 User::LeaveIfError( err ); |
|
1309 deleteCount++; |
|
1310 |
|
1311 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByIdL() -- MAIN TABLE lookup - thumbnail deleted" ); |
|
1312 |
|
1313 rowStatus = stmt.Next(); |
|
1314 } |
|
1315 |
|
1316 stmt_infodata.Close(); |
|
1317 stmt_info.Close(); |
|
1318 stmt.Close(); |
|
1319 CleanupStack::PopAndDestroy( &stmt_infodata ); |
|
1320 CleanupStack::PopAndDestroy( &stmt_info ); |
|
1321 CleanupStack::PopAndDestroy( &stmt ); |
|
1322 transaction.CommitL(); |
|
1323 CleanupStack::PopAndDestroy( &transaction ); |
|
1324 |
1215 |
1325 #ifdef _DEBUG |
1216 #ifdef _DEBUG |
1326 aStop.UniversalTime(); |
1217 aStop.UniversalTime(); |
1327 TN_DEBUG2( "CThumbnailStore::DeleteThumbnailsByIdL() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); |
1218 TN_DEBUG2( "CThumbnailStore::DeleteThumbnailByPathL() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); |
1328 #endif |
1219 #endif |
1329 |
1220 |
1330 if(!deleteCount) |
1221 // start maintenance if rows in main table were marked |
1331 { |
1222 if (!aForce && count > 0) |
1332 User::Leave(KErrNotFound); |
1223 { |
1333 } |
1224 TN_DEBUG2( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup - %d rows marked deleted", count); |
1334 } |
1225 |
1335 |
1226 iDeleteThumbs = ETrue; |
|
1227 iActivityManager->Start(); |
|
1228 } |
|
1229 |
|
1230 CleanupStack::PopAndDestroy( path ); |
|
1231 } |
1336 |
1232 |
1337 // --------------------------------------------------------------------------- |
1233 // --------------------------------------------------------------------------- |
1338 // CThumbnailStore::PersistentSizes() |
1234 // CThumbnailStore::PersistentSizes() |
1339 // --------------------------------------------------------------------------- |
1235 // --------------------------------------------------------------------------- |
1340 // |
1236 // |
1406 aStop.UniversalTime(); |
1331 aStop.UniversalTime(); |
1407 TN_DEBUG2( "CThumbnailStore::FlushCacheTable() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); |
1332 TN_DEBUG2( "CThumbnailStore::FlushCacheTable() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); |
1408 #endif |
1333 #endif |
1409 |
1334 |
1410 TN_DEBUG1("CThumbnailStore::FlushCacheTable() out"); |
1335 TN_DEBUG1("CThumbnailStore::FlushCacheTable() out"); |
1411 } |
|
1412 |
|
1413 |
|
1414 // ----------------------------------------------------------------------------- |
|
1415 // Find store for thumbnails by Id |
|
1416 // ----------------------------------------------------------------------------- |
|
1417 // |
|
1418 void CThumbnailStore::FindStoreL(TThumbnailId aThumbnailId) |
|
1419 { |
|
1420 TN_DEBUG2( "CThumbnailStore::FindStore( %d )", aThumbnailId ); |
|
1421 RSqlStatement stmt; |
|
1422 CleanupClosePushL( stmt ); |
|
1423 |
|
1424 TInt paramIndex = 0; |
|
1425 TInt found = KErrNotFound; |
|
1426 TInt rowStatus = 0; |
|
1427 |
|
1428 TN_DEBUG1( "CThumbnailStore::FindStore() -- TEMP TABLE lookup" ); |
|
1429 User::LeaveIfError( stmt.Prepare( iDatabase, KTempThumbnailSqlSelectRowIDInfoByID )); |
|
1430 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1431 User::LeaveIfError( paramIndex ); |
|
1432 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnailId )); |
|
1433 |
|
1434 rowStatus = stmt.Next(); |
|
1435 |
|
1436 //if not found from temp table, look from real table |
|
1437 if(rowStatus != KSqlAtRow) |
|
1438 { |
|
1439 TN_DEBUG1( "CThumbnailStore::FindStore() -- MAIN TABLE lookup" ); |
|
1440 stmt.Close(); |
|
1441 CleanupStack::PopAndDestroy( &stmt ); |
|
1442 CleanupClosePushL( stmt ); |
|
1443 |
|
1444 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSqlSelectRowIDInfoByID )); |
|
1445 |
|
1446 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1447 User::LeaveIfError( paramIndex ); |
|
1448 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnailId )); |
|
1449 |
|
1450 rowStatus = stmt.Next(); |
|
1451 } |
|
1452 |
|
1453 if( rowStatus == KSqlAtRow ) |
|
1454 { |
|
1455 TN_DEBUG1( "CThumbnailStore::FindStore() -- thumbnail found" ); |
|
1456 found = KErrNone; |
|
1457 } |
|
1458 else |
|
1459 { |
|
1460 TN_DEBUG1( "CThumbnailStore::FindStore() -- thumbnail NOT found" ); |
|
1461 } |
|
1462 |
|
1463 stmt.Close(); |
|
1464 CleanupStack::PopAndDestroy( &stmt ); |
|
1465 |
|
1466 User::LeaveIfError( found ); |
|
1467 } |
|
1468 |
|
1469 // ----------------------------------------------------------------------------- |
|
1470 // Updates path in current store by Id |
|
1471 // ----------------------------------------------------------------------------- |
|
1472 // |
|
1473 TBool CThumbnailStore::UpdateStoreL( TThumbnailId aItemId, const TDesC& aNewPath ) |
|
1474 { |
|
1475 TN_DEBUG3( "CThumbnailStore::UpdateStore( %d, %S) by ID", aItemId, &aNewPath); |
|
1476 |
|
1477 TBool doUpdate(EFalse); |
|
1478 TPath oldPath; |
|
1479 TInt column = 0; |
|
1480 |
|
1481 RSqlStatement stmt; |
|
1482 CleanupClosePushL( stmt ); |
|
1483 |
|
1484 //check if path needs updating in temp table |
|
1485 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectTempPathByID )); |
|
1486 |
|
1487 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1488 User::LeaveIfError( paramIndex ); |
|
1489 User::LeaveIfError( stmt.BindInt( paramIndex, aItemId )); |
|
1490 |
|
1491 TInt rowStatus = stmt.Next(); |
|
1492 |
|
1493 //if not found from temp table, look from real table |
|
1494 if(rowStatus != KSqlAtRow) |
|
1495 { |
|
1496 stmt.Close(); |
|
1497 CleanupStack::PopAndDestroy( &stmt ); |
|
1498 CleanupClosePushL( stmt ); |
|
1499 |
|
1500 //check if path needs updating in main table |
|
1501 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectPathByID )); |
|
1502 |
|
1503 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1504 User::LeaveIfError( paramIndex ); |
|
1505 User::LeaveIfError( stmt.BindInt( paramIndex, aItemId )); |
|
1506 |
|
1507 rowStatus = stmt.Next(); |
|
1508 } |
|
1509 |
|
1510 if(rowStatus == KSqlAtRow) |
|
1511 { |
|
1512 TN_DEBUG1( "CThumbnailStore::UpdateStore() -- matching TN ID found" ); |
|
1513 oldPath = stmt.ColumnTextL(column); |
|
1514 |
|
1515 if(oldPath.CompareF(aNewPath) != 0) |
|
1516 { |
|
1517 TN_DEBUG1( "CThumbnailStore::UpdateStore() -- path no match" ); |
|
1518 doUpdate = ETrue; |
|
1519 } |
|
1520 else |
|
1521 { |
|
1522 TN_DEBUG1( "CThumbnailStore::UpdateStore() -- path match, skip..." ); |
|
1523 } |
|
1524 } |
|
1525 |
|
1526 stmt.Close(); |
|
1527 CleanupStack::PopAndDestroy( &stmt ); |
|
1528 |
|
1529 if(!doUpdate) |
|
1530 { |
|
1531 TN_DEBUG2( "CThumbnailStore::UpdateStore() -- no need to update old path=%S", &oldPath ); |
|
1532 return EFalse; |
|
1533 } |
|
1534 |
|
1535 //Encapsulate update to Transaction |
|
1536 RThumbnailTransaction transaction( iDatabase ); |
|
1537 CleanupClosePushL( transaction ); |
|
1538 transaction.BeginL(); |
|
1539 |
|
1540 CleanupClosePushL( stmt ); |
|
1541 |
|
1542 TN_DEBUG1( "CThumbnailStore::UpdateStore() -- do temp path update" ); |
|
1543 |
|
1544 User::LeaveIfError( stmt.Prepare( iDatabase, KTempThumbnailSqlUpdateById )); |
|
1545 |
|
1546 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
|
1547 User::LeaveIfError( paramIndex ); |
|
1548 User::LeaveIfError( stmt.BindText( paramIndex, aNewPath )); |
|
1549 |
|
1550 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1551 User::LeaveIfError( paramIndex ); |
|
1552 User::LeaveIfError( stmt.BindInt( paramIndex, aItemId )); |
|
1553 User::LeaveIfError( stmt.Exec()); |
|
1554 |
|
1555 stmt.Close(); |
|
1556 CleanupStack::PopAndDestroy( &stmt ); |
|
1557 CleanupClosePushL( stmt ); |
|
1558 |
|
1559 TN_DEBUG1( "CThumbnailStore::UpdateStore() -- do main table path update" ); |
|
1560 |
|
1561 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSqlUpdateById )); |
|
1562 |
|
1563 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
|
1564 User::LeaveIfError( paramIndex ); |
|
1565 User::LeaveIfError( stmt.BindText( paramIndex, aNewPath )); |
|
1566 |
|
1567 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1568 User::LeaveIfError( paramIndex ); |
|
1569 User::LeaveIfError( stmt.BindInt( paramIndex, aItemId )); |
|
1570 |
|
1571 User::LeaveIfError( stmt.Exec()); |
|
1572 CleanupStack::PopAndDestroy( &stmt ); |
|
1573 |
|
1574 // Commit transaction |
|
1575 transaction.CommitL(); |
|
1576 CleanupStack::PopAndDestroy( &transaction ); |
|
1577 |
|
1578 return ETrue; |
|
1579 } |
|
1580 |
|
1581 // ----------------------------------------------------------------------------- |
|
1582 // Update IDs by Path |
|
1583 // ----------------------------------------------------------------------------- |
|
1584 // |
|
1585 void CThumbnailStore::UpdateStoreL( const TDesC& aPath, TThumbnailId aNewId ) |
|
1586 { |
|
1587 TN_DEBUG3( "CThumbnailStore::UpdateStore( %S, %d ) by Path", &aPath, aNewId); |
|
1588 |
|
1589 #ifdef _DEBUG |
|
1590 TTime aStart, aStop; |
|
1591 aStart.UniversalTime(); |
|
1592 #endif |
|
1593 |
|
1594 //Encapsulate update to Transaction |
|
1595 RThumbnailTransaction transaction( iDatabase ); |
|
1596 CleanupClosePushL( transaction ); |
|
1597 transaction.BeginL(); |
|
1598 |
|
1599 RSqlStatement stmt; |
|
1600 CleanupClosePushL( stmt ); |
|
1601 |
|
1602 TN_DEBUG1( "CThumbnailStore::UpdateStoreL() -- do temp ID update" ); |
|
1603 |
|
1604 TInt err = stmt.Prepare( iDatabase, KTempThumbnailUpdateIdByPath ); |
|
1605 |
|
1606 #ifdef _DEBUG |
|
1607 TPtrC errorMsg = iDatabase.LastErrorMessage(); |
|
1608 TN_DEBUG2( "CThumbnailStore::UpdateStoreL() KTempThumbnailUpdateIdByPath %S" , &errorMsg); |
|
1609 #endif |
|
1610 |
|
1611 User::LeaveIfError( err ); |
|
1612 |
|
1613 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1614 User::LeaveIfError( paramIndex ); |
|
1615 User::LeaveIfError( stmt.BindInt( paramIndex, aNewId )); |
|
1616 |
|
1617 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
|
1618 User::LeaveIfError( paramIndex ); |
|
1619 User::LeaveIfError( stmt.BindText( paramIndex, aPath )); |
|
1620 |
|
1621 err = stmt.Exec(); |
|
1622 |
|
1623 TN_DEBUG2( "CThumbnailStore::UpdateStoreL() err==%d", err ); |
|
1624 |
|
1625 stmt.Close(); |
|
1626 CleanupStack::PopAndDestroy( &stmt ); |
|
1627 CleanupClosePushL( stmt ); |
|
1628 |
|
1629 TN_DEBUG1( "CThumbnailStore::UpdateStoreL() -- do main table ID update" ); |
|
1630 |
|
1631 err = stmt.Prepare( iDatabase, KThumbnailUpdateIdByPath ); |
|
1632 |
|
1633 #ifdef _DEBUG |
|
1634 TPtrC errorMsg2 = iDatabase.LastErrorMessage(); |
|
1635 TN_DEBUG2( "CThumbnailStore::UpdateStoreL() KThumbnailUpdateIdByPath %S" , &errorMsg2); |
|
1636 #endif |
|
1637 |
|
1638 User::LeaveIfError( err ); |
|
1639 |
|
1640 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1641 User::LeaveIfError( paramIndex ); |
|
1642 User::LeaveIfError( stmt.BindInt( paramIndex, aNewId )); |
|
1643 |
|
1644 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
|
1645 User::LeaveIfError( paramIndex ); |
|
1646 User::LeaveIfError( stmt.BindText( paramIndex, aPath )); |
|
1647 |
|
1648 err = stmt.Exec(); |
|
1649 |
|
1650 TN_DEBUG2( "CThumbnailStore::UpdateStoreL() err==%d", err ); |
|
1651 |
|
1652 stmt.Close(); |
|
1653 CleanupStack::PopAndDestroy( &stmt ); |
|
1654 |
|
1655 // Commit transaction |
|
1656 transaction.CommitL(); |
|
1657 CleanupStack::PopAndDestroy( &transaction ); |
|
1658 |
|
1659 #ifdef _DEBUG |
|
1660 aStop.UniversalTime(); |
|
1661 TN_DEBUG2( "CThumbnailStore::UpdateStoreL() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); |
|
1662 #endif |
|
1663 } |
|
1664 |
|
1665 // ----------------------------------------------------------------------------- |
|
1666 // Checks if given modification timestamp is newer than in DB |
|
1667 // ----------------------------------------------------------------------------- |
|
1668 // |
|
1669 TBool CThumbnailStore::CheckModifiedL( const TThumbnailId aItemId, const TInt64 aModified ) |
|
1670 { |
|
1671 TN_DEBUG2( "CThumbnailStore::CheckModifiedL( %d )", aItemId); |
|
1672 |
|
1673 TInt column = 0; |
|
1674 |
|
1675 RSqlStatement stmt; |
|
1676 CleanupClosePushL( stmt ); |
|
1677 |
|
1678 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectTempModifiedByID )); |
|
1679 |
|
1680 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1681 User::LeaveIfError( paramIndex ); |
|
1682 User::LeaveIfError( stmt.BindInt( paramIndex, aItemId )); |
|
1683 |
|
1684 TInt rowStatus = stmt.Next(); |
|
1685 |
|
1686 //if not found from temp table, look from real table |
|
1687 if(rowStatus != KSqlAtRow) |
|
1688 { |
|
1689 stmt.Close(); |
|
1690 CleanupStack::PopAndDestroy( &stmt ); |
|
1691 CleanupClosePushL( stmt ); |
|
1692 |
|
1693 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectModifiedByID )); |
|
1694 |
|
1695 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1696 User::LeaveIfError( paramIndex ); |
|
1697 User::LeaveIfError( stmt.BindInt( paramIndex, aItemId )); |
|
1698 |
|
1699 rowStatus = stmt.Next(); |
|
1700 } |
|
1701 |
|
1702 TBool modified = EFalse; |
|
1703 |
|
1704 if(rowStatus == KSqlAtRow) |
|
1705 { |
|
1706 TInt64 oldModified = stmt.ColumnInt64( column ); |
|
1707 |
|
1708 if (oldModified < aModified) |
|
1709 { |
|
1710 TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is newer than original" ); |
|
1711 modified = ETrue; |
|
1712 } |
|
1713 else if (oldModified > aModified) |
|
1714 { |
|
1715 TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is older than original" ); |
|
1716 } |
|
1717 else if (oldModified == aModified) |
|
1718 { |
|
1719 TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is the same as original" ); |
|
1720 } |
|
1721 } |
|
1722 |
|
1723 stmt.Close(); |
|
1724 CleanupStack::PopAndDestroy( &stmt ); |
|
1725 |
|
1726 return modified; |
|
1727 } |
|
1728 |
|
1729 // ----------------------------------------------------------------------------- |
|
1730 // Fetches thumbnails from store by Id |
|
1731 // ----------------------------------------------------------------------------- |
|
1732 // |
|
1733 void CThumbnailStore::FetchThumbnailsL(TThumbnailId aItemId, RArray < TThumbnailDatabaseData* >& aThumbnails) |
|
1734 { |
|
1735 TN_DEBUG1( "CThumbnailStore::FetchThumbnails()" ); |
|
1736 RSqlStatement stmt; |
|
1737 CleanupClosePushL( stmt ); |
|
1738 |
|
1739 // first temp table |
|
1740 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectTempById )); |
|
1741 |
|
1742 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1743 User::LeaveIfError( paramIndex ); |
|
1744 User::LeaveIfError( stmt.BindInt( paramIndex, aItemId )); |
|
1745 |
|
1746 TInt rowStatus = stmt.Next(); |
|
1747 |
|
1748 TPath path; |
|
1749 TPath tnPath; |
|
1750 while ( rowStatus == KSqlAtRow) |
|
1751 { |
|
1752 TN_DEBUG1( "CThumbnailStore::FetchThumbnails() -- thumbnail found from temp table" ); |
|
1753 |
|
1754 TInt column = 0; |
|
1755 |
|
1756 TThumbnailDatabaseData* newRow = new(ELeave) TThumbnailDatabaseData; |
|
1757 |
|
1758 TInt err = stmt.ColumnText( column++, newRow->iPath ); |
|
1759 newRow->iTnId = stmt.ColumnInt( column++ ); |
|
1760 newRow->iSize = stmt.ColumnInt( column++ ); |
|
1761 newRow->iFormat = stmt.ColumnInt( column++ ); |
|
1762 err = stmt.ColumnText( column++, newRow->iTnPath); |
|
1763 newRow->iWidth = stmt.ColumnInt( column++ ); |
|
1764 newRow->iHeight = stmt.ColumnInt( column++ ); |
|
1765 newRow->iOrigWidth = stmt.ColumnInt( column++ ); |
|
1766 newRow->iOrigHeight = stmt.ColumnInt( column++ ); |
|
1767 newRow->iFlags = stmt.ColumnInt( column++ ); |
|
1768 newRow->iVideoPosition = stmt.ColumnInt( column++ ); |
|
1769 newRow->iOrientation = stmt.ColumnInt( column++ ); |
|
1770 newRow->iThumbFromPath = stmt.ColumnInt( column++ ); |
|
1771 newRow->iModified = stmt.ColumnInt64( column++ ); |
|
1772 |
|
1773 if(newRow->iFormat == 0) |
|
1774 { |
|
1775 TPtrC8 ptr = stmt.ColumnBinaryL( column++ ); |
|
1776 RDesReadStream stream( ptr ); |
|
1777 newRow->iBlob = new( ELeave )CFbsBitmap(); |
|
1778 newRow->iBlob->InternalizeL( stream ); |
|
1779 } |
|
1780 else if(newRow->iFormat == 1) |
|
1781 { |
|
1782 TPtrC8 ptr = stmt.ColumnBinaryL( column++ ); |
|
1783 HBufC8* data = ptr.AllocL() ; |
|
1784 newRow->iBlob = NULL; |
|
1785 newRow->iData = data; |
|
1786 } |
|
1787 |
|
1788 aThumbnails.Append( newRow ); |
|
1789 |
|
1790 rowStatus = stmt.Next(); |
|
1791 } |
|
1792 |
|
1793 // then real table |
|
1794 stmt.Close(); |
|
1795 CleanupStack::PopAndDestroy(&stmt); |
|
1796 CleanupClosePushL( stmt ); |
|
1797 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectById )); |
|
1798 |
|
1799 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1800 User::LeaveIfError( paramIndex ); |
|
1801 User::LeaveIfError( stmt.BindInt( paramIndex, aItemId )); |
|
1802 |
|
1803 rowStatus = stmt.Next(); |
|
1804 while ( rowStatus == KSqlAtRow) |
|
1805 { |
|
1806 TN_DEBUG1( "CThumbnailStore::FetchThumbnails() -- thumbnail found from real table" ); |
|
1807 |
|
1808 TInt column = 0; |
|
1809 |
|
1810 TThumbnailDatabaseData* newRow = new(ELeave) TThumbnailDatabaseData; |
|
1811 |
|
1812 TInt err = stmt.ColumnText( column++, newRow->iPath ); |
|
1813 newRow->iTnId = stmt.ColumnInt( column++ ); |
|
1814 newRow->iSize = stmt.ColumnInt( column++ ); |
|
1815 newRow->iFormat = stmt.ColumnInt( column++ ); |
|
1816 err = stmt.ColumnText( column++, newRow->iTnPath); |
|
1817 newRow->iWidth = stmt.ColumnInt( column++ ); |
|
1818 newRow->iHeight = stmt.ColumnInt( column++ ); |
|
1819 newRow->iOrigWidth = stmt.ColumnInt( column++ ); |
|
1820 newRow->iOrigHeight = stmt.ColumnInt( column++ ); |
|
1821 newRow->iFlags = stmt.ColumnInt( column++ ); |
|
1822 newRow->iVideoPosition = stmt.ColumnInt( column++ ); |
|
1823 newRow->iOrientation = stmt.ColumnInt( column++ ); |
|
1824 newRow->iThumbFromPath = stmt.ColumnInt( column++ ); |
|
1825 newRow->iModified = stmt.ColumnInt64( column++ ); |
|
1826 |
|
1827 if(newRow->iFormat == 0) |
|
1828 { |
|
1829 TPtrC8 ptr = stmt.ColumnBinaryL( column++ ); |
|
1830 RDesReadStream stream( ptr ); |
|
1831 newRow->iBlob = new( ELeave )CFbsBitmap(); |
|
1832 newRow->iBlob->InternalizeL( stream ); |
|
1833 } |
|
1834 else if(newRow->iFormat == 1) |
|
1835 { |
|
1836 TPtrC8 ptr = stmt.ColumnBinaryL( column++ ); |
|
1837 HBufC8* data = ptr.AllocL() ; |
|
1838 newRow->iBlob = NULL; |
|
1839 newRow->iData = data; |
|
1840 } |
|
1841 |
|
1842 aThumbnails.Append( newRow ); |
|
1843 |
|
1844 rowStatus = stmt.Next(); |
|
1845 } |
|
1846 |
|
1847 stmt.Close(); |
|
1848 CleanupStack::PopAndDestroy( &stmt ); |
|
1849 } |
|
1850 |
|
1851 // ----------------------------------------------------------------------------- |
|
1852 // Stores thumbnails to store |
|
1853 // ----------------------------------------------------------------------------- |
|
1854 // |
|
1855 |
|
1856 void CThumbnailStore::StoreThumbnailsL(const TDesC& aNewPath, RArray < TThumbnailDatabaseData* >& aThumbnails) |
|
1857 { |
|
1858 TN_DEBUG1( "CThumbnailStore::StoreThumbnails()" ); |
|
1859 |
|
1860 TInt ThumbnailCount = aThumbnails.Count(); |
|
1861 RSqlStatement stmt; |
|
1862 for ( TInt i = 0; i < ThumbnailCount; i++ ) |
|
1863 { |
|
1864 RThumbnailTransaction transaction( iDatabase ); |
|
1865 CleanupClosePushL( transaction ); |
|
1866 transaction.BeginL(); |
|
1867 |
|
1868 CleanupClosePushL( stmt ); |
|
1869 |
|
1870 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailInsertThumbnailInfoByPathAndId )); |
|
1871 |
|
1872 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
|
1873 User::LeaveIfError( paramIndex ); |
|
1874 User::LeaveIfError( stmt.BindText( paramIndex, aNewPath )); |
|
1875 |
|
1876 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamWidth ); |
|
1877 User::LeaveIfError( paramIndex ); |
|
1878 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnails[ i ]->iWidth )); |
|
1879 |
|
1880 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamHeight ); |
|
1881 User::LeaveIfError( paramIndex ); |
|
1882 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnails[ i ]->iHeight )); |
|
1883 |
|
1884 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamOriginalWidth ); |
|
1885 User::LeaveIfError( paramIndex ); |
|
1886 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnails[ i ]->iOrigWidth )); |
|
1887 |
|
1888 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamOriginalHeight ); |
|
1889 User::LeaveIfError( paramIndex ); |
|
1890 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnails[ i ]->iOrigHeight )); |
|
1891 |
|
1892 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamFormat ); |
|
1893 User::LeaveIfError( paramIndex ); |
|
1894 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnails[ i ]->iFormat )); |
|
1895 |
|
1896 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamFlags ); |
|
1897 User::LeaveIfError( paramIndex ); |
|
1898 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnails[ i ]->iFlags )); |
|
1899 |
|
1900 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamSize ); |
|
1901 User::LeaveIfError( paramIndex ); |
|
1902 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnails[ i ]->iSize )); |
|
1903 |
|
1904 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
|
1905 User::LeaveIfError( paramIndex ); |
|
1906 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnails[ i ]->iTnId )); |
|
1907 |
|
1908 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamOrientation ); |
|
1909 User::LeaveIfError( paramIndex ); |
|
1910 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnails[ i ]->iOrientation )); |
|
1911 |
|
1912 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamThumbFromPath ); |
|
1913 User::LeaveIfError( paramIndex ); |
|
1914 User::LeaveIfError( stmt.BindInt( paramIndex, aThumbnails[ i ]->iThumbFromPath )); |
|
1915 |
|
1916 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamModified ); |
|
1917 User::LeaveIfError( paramIndex ); |
|
1918 User::LeaveIfError( stmt.BindInt64( paramIndex, aThumbnails[ i ]->iModified )); |
|
1919 |
|
1920 User::LeaveIfError( stmt.Exec()); |
|
1921 CleanupStack::PopAndDestroy( &stmt ); |
|
1922 |
|
1923 RSqlStatement stmtData; |
|
1924 CleanupClosePushL( stmtData ); |
|
1925 TInt err = stmtData.Prepare( iDatabase, KThumbnailInsertTempThumbnailInfoData ); |
|
1926 |
|
1927 if(aThumbnails[ i ]->iFormat == 0) |
|
1928 { |
|
1929 CBufFlat* buf = CBufFlat::NewL( KStreamBufferSize ); |
|
1930 CleanupStack::PushL( buf ); |
|
1931 RBufWriteStream stream; |
|
1932 stream.Open( *buf ); |
|
1933 aThumbnails[ i ]->iBlob->ExternalizeL( stream ); |
|
1934 paramIndex = stmtData.ParameterIndex( KThumbnailSqlParamData ); |
|
1935 User::LeaveIfError( paramIndex ); |
|
1936 User::LeaveIfError( stmtData.BindBinary( paramIndex, buf->Ptr( 0 ) )); |
|
1937 CleanupStack::PopAndDestroy( buf ); |
|
1938 delete aThumbnails[i]->iBlob; |
|
1939 aThumbnails[i]->iBlob = NULL; |
|
1940 } |
|
1941 else if(aThumbnails[ i ]->iFormat == 1) |
|
1942 { |
|
1943 paramIndex = stmtData.ParameterIndex( KThumbnailSqlParamData ); |
|
1944 User::LeaveIfError( paramIndex ); |
|
1945 User::LeaveIfError( stmtData.BindBinary( paramIndex, *aThumbnails[ i ]->iData )); |
|
1946 delete aThumbnails[i]->iData; |
|
1947 aThumbnails[i]->iData = NULL; |
|
1948 } |
|
1949 |
|
1950 User::LeaveIfError( stmtData.Exec()); |
|
1951 CleanupStack::PopAndDestroy( &stmtData ); |
|
1952 |
|
1953 // Commit transaction |
|
1954 transaction.CommitL(); |
|
1955 CleanupStack::PopAndDestroy( &transaction ); |
|
1956 |
|
1957 delete aThumbnails[i]; |
|
1958 aThumbnails[i] = NULL; |
|
1959 iBatchItemCount++; |
|
1960 } |
|
1961 |
|
1962 FlushCacheTable(); |
|
1963 } |
1336 } |
1964 |
1337 |
1965 // ----------------------------------------------------------------------------- |
1338 // ----------------------------------------------------------------------------- |
1966 // CheckVersionAndImeiL() |
1339 // CheckVersionAndImeiL() |
1967 // ----------------------------------------------------------------------------- |
1340 // ----------------------------------------------------------------------------- |
2196 { |
1616 { |
2197 iAutoFlushTimer->Cancel(); |
1617 iAutoFlushTimer->Cancel(); |
2198 } |
1618 } |
2199 } |
1619 } |
2200 |
1620 |
|
1621 // ----------------------------------------------------------------------------- |
|
1622 // StartMaintenance() |
|
1623 // ----------------------------------------------------------------------------- |
|
1624 // |
|
1625 void CThumbnailStore::StartMaintenance() |
|
1626 { |
|
1627 TN_DEBUG1( "CThumbnailStore::StartMaintenance()"); |
|
1628 TInt err = KErrNone; |
|
1629 |
|
1630 if( iMaintenanceTimer && iMaintenanceTimer->IsActive() ) |
|
1631 { |
|
1632 return; |
|
1633 } |
|
1634 else if (!iMaintenanceTimer) |
|
1635 { |
|
1636 TRAP(err, iMaintenanceTimer = CPeriodic::NewL(CActive::EPriorityIdle) ); |
|
1637 } |
|
1638 |
|
1639 if (err != KErrNone && !iMaintenanceTimer) |
|
1640 { |
|
1641 TN_DEBUG2( "CThumbnailStore::StartMaintenanceTimer() - Error creating timer (%d)", err ); |
|
1642 } |
|
1643 else |
|
1644 { |
|
1645 iMaintenanceTimer->Start( KStoreMaintenancePeriodic, KStoreMaintenancePeriodic, |
|
1646 TCallBack(MaintenanceTimerCallBack, this)); |
|
1647 } |
|
1648 } |
|
1649 |
2201 // --------------------------------------------------------------------------- |
1650 // --------------------------------------------------------------------------- |
2202 // CThumbnailStore::AutoFlushTimerCallBack() |
1651 // CThumbnailStore::AutoFlushTimerCallBack() |
2203 // --------------------------------------------------------------------------- |
1652 // --------------------------------------------------------------------------- |
2204 // |
1653 // |
2205 TInt CThumbnailStore::AutoFlushTimerCallBack(TAny* aAny) |
1654 TInt CThumbnailStore::AutoFlushTimerCallBack(TAny* aAny) |
2206 { |
1655 { |
2207 TN_DEBUG1( "CThumbnailStore::AutoFlushTimerCallBack()"); |
1656 TN_DEBUG1( "CThumbnailStore::AutoFlushTimerCallBack()"); |
2208 CThumbnailStore* self = static_cast<CThumbnailStore*>( aAny ); |
1657 CThumbnailStore* self = static_cast<CThumbnailStore*>( aAny ); |
2209 |
1658 |
2210 self->FlushCacheTable(ETrue); |
1659 self->FlushCacheTable(ETrue); |
|
1660 |
|
1661 return KErrNone; // Return value ignored by CPeriodic |
|
1662 } |
|
1663 |
|
1664 // --------------------------------------------------------------------------- |
|
1665 // CThumbnailStore::MaintenanceTimerCallBack() |
|
1666 // --------------------------------------------------------------------------- |
|
1667 // |
|
1668 TInt CThumbnailStore::MaintenanceTimerCallBack(TAny* aAny) |
|
1669 { |
|
1670 CThumbnailStore* self = static_cast<CThumbnailStore*>( aAny ); |
|
1671 |
|
1672 self->iMaintenanceTimer->Cancel(); |
|
1673 |
|
1674 if (self->iIdle) |
|
1675 { |
|
1676 TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - maintenance, store %d", self->iDrive); |
|
1677 |
|
1678 // thumbmnail deletion |
|
1679 if (self->iDeleteThumbs) |
|
1680 { |
|
1681 TInt deleteCount = 0; |
|
1682 |
|
1683 // delete marked rows from database |
|
1684 TRAPD( err, deleteCount = self->DeleteMarkedL() ); |
|
1685 if (err != KErrNone) |
|
1686 { |
|
1687 TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - cleanup failed, err %d", err); |
|
1688 return err; |
|
1689 } |
|
1690 |
|
1691 // no more marked rows |
|
1692 if (deleteCount < KStoreMaintenanceDeleteLimit || deleteCount == 0) |
|
1693 { |
|
1694 TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - cleanup finished, store %d", self->iDrive); |
|
1695 self->iDeleteThumbs = EFalse; |
|
1696 } |
|
1697 } |
|
1698 |
|
1699 // file existance check |
|
1700 else if (self->iCheckFilesExist) |
|
1701 { |
|
1702 TBool finished = EFalse; |
|
1703 |
|
1704 TRAPD( err, finished = self->FileExistenceCheckL() ); |
|
1705 if (err != KErrNone) |
|
1706 { |
|
1707 TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existance check failed, err %d", err); |
|
1708 return err; |
|
1709 } |
|
1710 |
|
1711 // all files checked. |
|
1712 if (finished) |
|
1713 { |
|
1714 TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existance check finished, store %d", self->iDrive); |
|
1715 self->iCheckFilesExist = EFalse; |
|
1716 } |
|
1717 } |
|
1718 |
|
1719 // next round |
|
1720 if (self->iIdle && ( self->iDeleteThumbs || self->iCheckFilesExist) ) |
|
1721 { |
|
1722 self->StartMaintenance(); |
|
1723 } |
|
1724 else |
|
1725 { |
|
1726 // no need to monitor activity anymore |
|
1727 self->iActivityManager->Cancel(); |
|
1728 } |
|
1729 } |
|
1730 else |
|
1731 { |
|
1732 TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - device not idle"); |
|
1733 } |
2211 |
1734 |
2212 return KErrNone; // Return value ignored by CPeriodic |
1735 return KErrNone; // Return value ignored by CPeriodic |
2213 } |
1736 } |
2214 |
1737 |
2215 TInt CThumbnailStore::CheckRowIDsL() |
1738 TInt CThumbnailStore::CheckRowIDsL() |
2267 { |
1810 { |
2268 return KErrNone; |
1811 return KErrNone; |
2269 } |
1812 } |
2270 } |
1813 } |
2271 |
1814 |
2272 void CThumbnailStore::CheckModifiedByIdL( TUint32 aId, TBool aTempTable, |
1815 TBool CThumbnailStore::CheckModifiedByPathL( const TDesC& aPath, const TInt64 aModified, TBool& modifiedChanged ) |
2273 TBool& aModified ) |
1816 { |
2274 { |
1817 TN_DEBUG2( "CThumbnailStore::CheckModifiedByPathL() %S", &aPath); |
2275 TN_DEBUG1( "CThumbnailStore::CheckModifiedByIdL()"); |
1818 |
|
1819 HBufC* path = aPath.AllocLC(); |
|
1820 TPtr ptr(path->Des()); |
|
1821 StripDriveLetterL( ptr ); |
|
1822 |
|
1823 TBool ret(EFalse); |
|
1824 |
|
1825 modifiedChanged = EFalse; |
|
1826 |
|
1827 TInt column = 0; |
|
1828 |
|
1829 RSqlStatement stmt; |
|
1830 CleanupClosePushL( stmt ); |
|
1831 |
|
1832 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectTempModifiedByPath )); |
|
1833 |
|
1834 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
|
1835 User::LeaveIfError( paramIndex ); |
|
1836 User::LeaveIfError( stmt.BindText( paramIndex, *path )); |
|
1837 |
|
1838 TInt rowStatus = stmt.Next(); |
|
1839 |
|
1840 TBool checkMain = EFalse; |
|
1841 |
|
1842 TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- temp" ); |
|
1843 |
|
1844 while(rowStatus == KSqlAtRow || !checkMain) |
|
1845 { |
|
1846 if(rowStatus == KSqlAtRow) |
|
1847 { |
|
1848 ret = ETrue; |
|
1849 TInt64 oldModified = stmt.ColumnInt64( column ); |
|
1850 |
|
1851 TN_DEBUG2( "CThumbnailStore::CheckModifiedL() -- timestamp old %Ld", oldModified); |
|
1852 TN_DEBUG2( "CThumbnailStore::CheckModifiedL() -- timestamp mds %Ld", aModified); |
|
1853 |
|
1854 if (oldModified < aModified) |
|
1855 { |
|
1856 TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is newer than original" ); |
|
1857 modifiedChanged = ETrue; |
|
1858 break; |
|
1859 } |
|
1860 else if (oldModified > aModified) |
|
1861 { |
|
1862 TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is older than original" ); |
|
1863 } |
|
1864 else if (oldModified == aModified) |
|
1865 { |
|
1866 TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is the same as original" ); |
|
1867 } |
|
1868 } |
|
1869 |
|
1870 rowStatus = stmt.Next(); |
|
1871 |
|
1872 //switch to main table if modified not found from temp |
|
1873 if(rowStatus != KSqlAtRow && !checkMain && !modifiedChanged) |
|
1874 { |
|
1875 TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- main" ); |
|
1876 //come here only once |
|
1877 checkMain = ETrue; |
|
1878 |
|
1879 stmt.Close(); |
|
1880 CleanupStack::PopAndDestroy( &stmt ); |
|
1881 CleanupClosePushL( stmt ); |
|
1882 |
|
1883 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectModifiedByPath )); |
|
1884 |
|
1885 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
|
1886 User::LeaveIfError( paramIndex ); |
|
1887 User::LeaveIfError( stmt.BindText( paramIndex, *path )); |
|
1888 |
|
1889 rowStatus = stmt.Next(); |
|
1890 } |
|
1891 } |
|
1892 |
|
1893 stmt.Close(); |
|
1894 CleanupStack::PopAndDestroy( &stmt ); |
|
1895 |
|
1896 CleanupStack::PopAndDestroy( path ); |
|
1897 |
|
1898 return ret; |
|
1899 } |
|
1900 |
|
1901 // ----------------------------------------------------------------------------- |
|
1902 // PrepareBlacklistedItemsForRetryL() |
|
1903 // ----------------------------------------------------------------------------- |
|
1904 // |
|
1905 void CThumbnailStore::PrepareBlacklistedItemsForRetryL() |
|
1906 { |
|
1907 TN_DEBUG1( "CThumbnailStore::PrepareBlacklistedItemsForRetry()" ); |
2276 |
1908 |
2277 RSqlStatement stmt; |
1909 RSqlStatement stmt; |
2278 CleanupClosePushL( stmt ); |
1910 CleanupClosePushL( stmt ); |
2279 TInt column( 0 ); |
1911 |
2280 |
1912 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailTouchBlacklistedRows )); |
2281 if( aTempTable ) |
1913 |
2282 { |
1914 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamFlag ); |
2283 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectTempPathModifiedByID ) ); |
1915 User::LeaveIfError( paramIndex ); |
2284 } |
1916 User::LeaveIfError( stmt.BindInt( paramIndex, KThumbnailDbFlagBlacklisted )); |
2285 else |
1917 TInt err = stmt.Exec(); |
2286 { |
1918 |
2287 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectPathModifiedByID ) ); |
1919 TN_DEBUG2( "CThumbnailStore::PrepareBlacklistedItemsForRetryL() - main table, err=%d", err ); |
2288 } |
1920 |
2289 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId ); |
1921 CleanupStack::PopAndDestroy( &stmt ); |
2290 User::LeaveIfError( paramIndex ); |
1922 } |
2291 User::LeaveIfError( stmt.BindInt( paramIndex, aId )); |
1923 |
2292 |
1924 // ----------------------------------------------------------------------------- |
2293 TInt rowStatus = stmt.Next(); |
1925 // DeleteMarkedL() |
2294 |
1926 // ----------------------------------------------------------------------------- |
2295 if(rowStatus == KSqlAtRow) |
1927 // |
2296 { |
1928 TInt CThumbnailStore::DeleteMarkedL() |
2297 TPath path = stmt.ColumnTextL(column++); |
1929 { |
|
1930 #ifdef _DEBUG |
|
1931 TTime aStart, aStop; |
|
1932 aStart.UniversalTime(); |
|
1933 #endif |
|
1934 |
|
1935 TN_DEBUG1( "CThumbnailStore::DeleteMarkedL()" ); |
|
1936 |
|
1937 TInt paramIndex = 0; |
|
1938 TInt paramIndex1 = 0; |
|
1939 TInt paramIndex2 = 0; |
|
1940 TInt rowStatus = 0; |
|
1941 TInt column = 0; |
|
1942 TInt64 rowid = 0; |
|
1943 TInt deleteCount = 0; |
|
1944 |
|
1945 RThumbnailTransaction transaction( iDatabase ); |
|
1946 CleanupClosePushL( transaction ); |
|
1947 transaction.BeginL(); |
|
1948 |
|
1949 RSqlStatement stmt; |
|
1950 RSqlStatement stmt_info; |
|
1951 RSqlStatement stmt_infodata; |
|
1952 CleanupClosePushL( stmt ); |
|
1953 |
|
1954 // select marked rows |
|
1955 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSqlSelectMarked )); |
|
1956 |
|
1957 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamLimit ); |
|
1958 User::LeaveIfError( paramIndex ); |
|
1959 User::LeaveIfError( stmt.BindInt( paramIndex, KStoreMaintenanceDeleteLimit )); |
|
1960 |
|
1961 rowStatus = stmt.Next(); |
|
1962 |
|
1963 CleanupClosePushL( stmt_info ); |
|
1964 User::LeaveIfError( stmt_info.Prepare( iDatabase, KThumbnailSqlDeleteInfoByRowID) ); |
|
1965 CleanupClosePushL( stmt_infodata ); |
|
1966 User::LeaveIfError( stmt_infodata.Prepare( iDatabase, KThumbnailSqlDeleteInfoDataByRowID) ); |
2298 |
1967 |
2299 if (path.Length()) |
1968 while(rowStatus == KSqlAtRow) |
2300 { |
1969 { |
2301 TInt64 modified = stmt.ColumnInt64( column ); |
1970 rowid = stmt.ColumnInt64( column ); |
2302 TTime timeStamp; |
1971 paramIndex1 = stmt_info.ParameterIndex( KThumbnailSqlParamRowID ); |
2303 iFs.Modified( path, timeStamp ); |
1972 User::LeaveIfError( paramIndex1 ); |
2304 |
1973 User::LeaveIfError( stmt_info.BindInt64( paramIndex1, rowid )); |
2305 if( modified != timeStamp.Int64() ) |
1974 |
2306 { |
1975 TInt err = stmt_info.Exec(); |
2307 aModified = ETrue; |
1976 stmt_info.Reset(); |
2308 } |
1977 User::LeaveIfError( err ); |
2309 } |
1978 |
2310 } |
1979 paramIndex2 = stmt_infodata.ParameterIndex( KThumbnailSqlParamRowID ); |
2311 |
1980 User::LeaveIfError( paramIndex2 ); |
|
1981 User::LeaveIfError( stmt_infodata.BindInt64( paramIndex2, rowid )); |
|
1982 |
|
1983 err = stmt_infodata.Exec(); |
|
1984 stmt_infodata.Reset(); |
|
1985 User::LeaveIfError( err ); |
|
1986 deleteCount++; |
|
1987 |
|
1988 TN_DEBUG1( "CThumbnailStore::DeleteMarkedL() - thumbnail deleted" ); |
|
1989 |
|
1990 rowStatus = stmt.Next(); |
|
1991 } |
|
1992 |
|
1993 stmt_infodata.Close(); |
|
1994 stmt_info.Close(); |
2312 stmt.Close(); |
1995 stmt.Close(); |
2313 CleanupStack::PopAndDestroy( &stmt ); |
1996 CleanupStack::PopAndDestroy( &stmt_infodata ); |
2314 } |
1997 CleanupStack::PopAndDestroy( &stmt_info ); |
2315 |
1998 CleanupStack::PopAndDestroy( &stmt ); |
2316 void CThumbnailStore::CheckModifiedByPathL( const TDesC& aPath, TBool aTempTable, |
1999 |
2317 TBool& aModified ) |
2000 // remove successfully deleted paths from Deleted table |
2318 { |
2001 if (deleteCount > 0) |
2319 TN_DEBUG1( "CThumbnailStore::CheckModifiedByPathL()"); |
2002 { |
|
2003 CleanupClosePushL( stmt ); |
|
2004 User::LeaveIfError( iDatabase.Exec( KThumbnailSqlDeleteFromDeleted ) ); |
|
2005 |
|
2006 stmt.Close(); |
|
2007 CleanupStack::PopAndDestroy( &stmt ); |
|
2008 } |
|
2009 |
|
2010 transaction.CommitL(); |
|
2011 CleanupStack::PopAndDestroy( &transaction ); |
|
2012 |
|
2013 #ifdef _DEBUG |
|
2014 aStop.UniversalTime(); |
|
2015 TN_DEBUG2( "CThumbnailStore::DeleteMarkedL() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); |
|
2016 #endif |
|
2017 |
|
2018 return deleteCount; |
|
2019 } |
|
2020 |
|
2021 // ----------------------------------------------------------------------------- |
|
2022 // FileExistenceCheckL() |
|
2023 // ----------------------------------------------------------------------------- |
|
2024 // |
|
2025 TInt CThumbnailStore::FileExistenceCheckL() |
|
2026 { |
|
2027 #ifdef _DEBUG |
|
2028 TTime aStart, aStop; |
|
2029 aStart.UniversalTime(); |
|
2030 #endif |
|
2031 |
|
2032 TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL()" ); |
|
2033 |
|
2034 TInt paramIndex = 0; |
|
2035 TInt rowStatus = 0; |
|
2036 TInt column = 0; |
|
2037 TInt64 rowid = 0; |
|
2038 TFileName path; |
|
2039 TFileName prevPath; |
|
2040 TFileName full; |
|
2041 TInt count = 0; |
|
2042 |
|
2043 TBool finished = EFalse; |
|
2044 |
|
2045 TChar dChar = 0; |
|
2046 User::LeaveIfError( iFs.DriveToChar( iDrive, dChar )); |
|
2047 |
|
2048 RThumbnailTransaction transaction( iDatabase ); |
|
2049 CleanupClosePushL( transaction ); |
|
2050 transaction.BeginL(); |
2320 |
2051 |
2321 RSqlStatement stmt; |
2052 RSqlStatement stmt; |
2322 CleanupClosePushL( stmt ); |
2053 CleanupClosePushL( stmt ); |
2323 TInt column( 0 ); |
2054 |
2324 |
2055 // get rows |
2325 if( aTempTable ) |
2056 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectAllPaths )); |
2326 { |
2057 |
2327 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectTempModifiedByPath ) ); |
2058 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamRowID ); |
2328 } |
2059 User::LeaveIfError( paramIndex ); |
2329 else |
2060 User::LeaveIfError( stmt.BindInt64( paramIndex, iLastCheckedRowID )); |
2330 { |
2061 |
2331 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectModifiedByPath ) ); |
2062 paramIndex = stmt.ParameterIndex( KThumbnailSqlParamLimit ); |
2332 } |
2063 User::LeaveIfError( paramIndex ); |
2333 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamPath ); |
2064 User::LeaveIfError( stmt.BindInt( paramIndex, KStoreMaintenanceExistLimit )); |
2334 User::LeaveIfError( paramIndex ); |
2065 |
2335 User::LeaveIfError( stmt.BindText( paramIndex, aPath )); |
2066 rowStatus = stmt.Next(); |
2336 |
2067 |
2337 TInt rowStatus = stmt.Next(); |
2068 while(rowStatus == KSqlAtRow) |
2338 |
2069 { |
2339 if(rowStatus == KSqlAtRow) |
2070 column = 0; |
2340 { |
2071 path.Zero(); |
2341 TInt64 modified = stmt.ColumnInt64( column ); |
2072 |
2342 TTime timeStamp; |
2073 rowid = stmt.ColumnInt64( column++ ); |
2343 iFs.Modified( aPath, timeStamp ); |
2074 stmt.ColumnText( column, path ); |
2344 |
2075 |
2345 if( modified != timeStamp.Int64() ) |
2076 full.Zero(); |
|
2077 full.Append(dChar); |
|
2078 full.Append(KDrv); |
|
2079 full.Append(path); |
|
2080 |
|
2081 // if path matches previous one, skip |
|
2082 if (path.CompareF(prevPath) != 0) |
2346 { |
2083 { |
2347 aModified = ETrue; |
2084 // file doesn't exist anymore, mark thumbs deleted |
|
2085 if(!BaflUtils::FileExists( iFs, full )) |
|
2086 { |
|
2087 TN_DEBUG2( "CThumbnailStore::FileExistenceCheckL(%S) - not found", &full ); |
|
2088 DeleteThumbnailsL(path, EFalse, EFalse); |
|
2089 } |
|
2090 |
|
2091 prevPath.Zero(); |
|
2092 prevPath.Append(path); |
2348 } |
2093 } |
2349 } |
2094 |
2350 |
2095 iLastCheckedRowID = rowid; |
|
2096 count++; |
|
2097 |
|
2098 // get next |
|
2099 rowStatus = stmt.Next(); |
|
2100 } |
|
2101 |
|
2102 if (count < KStoreMaintenanceExistLimit) |
|
2103 { |
|
2104 // all rows checked |
|
2105 finished = ETrue; |
|
2106 } |
|
2107 |
2351 stmt.Close(); |
2108 stmt.Close(); |
2352 CleanupStack::PopAndDestroy( &stmt ); |
2109 CleanupStack::PopAndDestroy( &stmt ); |
2353 } |
2110 |
2354 |
2111 transaction.CommitL(); |
2355 // ----------------------------------------------------------------------------- |
2112 CleanupStack::PopAndDestroy( &transaction ); |
2356 // RemoveDbFlagL() |
2113 |
2357 // ----------------------------------------------------------------------------- |
2114 #ifdef _DEBUG |
2358 // |
2115 aStop.UniversalTime(); |
2359 void CThumbnailStore::RemoveDbFlagL(TThumbnailDbFlags aFlag) |
2116 TN_DEBUG2( "CThumbnailStore::FileExistenceCheckL() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); |
2360 { |
2117 #endif |
2361 TN_DEBUG1( "CThumbnailStore::RemoveBlacklistedFlag()" ); |
2118 |
2362 |
2119 return finished; |
2363 RSqlStatement stmt; |
2120 } |
2364 CleanupClosePushL( stmt ); |
2121 |
2365 |
2122 // ----------------------------------------------------------------------------- |
2366 User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailRemoveBlacklistedFlag )); |
2123 // StripDriveLetter |
2367 |
2124 // ----------------------------------------------------------------------------- |
2368 TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamFlag ); |
2125 // |
2369 User::LeaveIfError( paramIndex ); |
2126 void CThumbnailStore::StripDriveLetterL( TDes& aPath ) |
2370 User::LeaveIfError( stmt.BindInt( paramIndex, aFlag )); |
2127 { |
2371 |
2128 TInt pos = aPath.Find(KDrv); |
2372 TInt err = stmt.Exec(); |
2129 |
2373 |
2130 // if URI contains drive letter |
2374 TN_DEBUG2( "CThumbnailStore::RemoveBlacklistedFlag() - main table, err=%d", err ); |
2131 if ( pos == 1 ) |
2375 |
2132 { |
2376 CleanupStack::PopAndDestroy( &stmt ); |
2133 aPath.Delete(0,pos+1); |
|
2134 } |
2377 } |
2135 } |
2378 |
2136 |
2379 void CThumbnailStore::HandleDiskSpaceNotificationL( TBool aDiskFull ) |
2137 void CThumbnailStore::HandleDiskSpaceNotificationL( TBool aDiskFull ) |
2380 { |
2138 { |
2381 TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceNotificationL() aDiskFull = %d", aDiskFull ); |
2139 TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceNotificationL() aDiskFull = %d", aDiskFull ); |
2382 iDiskFull = aDiskFull; |
2140 iDiskFull = aDiskFull; |
2383 } |
2141 } |
2384 |
2142 |
2385 |
2143 #ifdef _DEBUG |
2386 void CThumbnailStore::HandleDiskSpaceError(TInt aError ) |
2144 void CThumbnailStore::HandleDiskSpaceError(TInt aError ) |
2387 { |
2145 #else |
2388 if (aError != KErrNone) |
2146 void CThumbnailStore::HandleDiskSpaceError(TInt /*aError*/ ) |
2389 { |
2147 #endif |
2390 TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceError() aError = %d", aError ); |
2148 { |
2391 } |
2149 TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceError() aError = %d", aError ); |
2392 } |
2150 } |
2393 |
2151 |
2394 TBool CThumbnailStore::IsDiskFull() |
2152 TBool CThumbnailStore::IsDiskFull() |
2395 { |
2153 { |
2396 return iDiskFull; |
2154 return iDiskFull; |
2397 } |
2155 } |
|
2156 |
|
2157 // ----------------------------------------------------------------------------- |
|
2158 // ActivityDetected() |
|
2159 // ----------------------------------------------------------------------------- |
|
2160 // |
|
2161 void CThumbnailStore::ActivityChanged(const TBool aActive) |
|
2162 { |
|
2163 TN_DEBUG2( "CThumbnailStore::ActivityChanged() aActive == %d", aActive); |
|
2164 |
|
2165 if( aActive ) |
|
2166 { |
|
2167 iIdle = EFalse; |
|
2168 } |
|
2169 else |
|
2170 { |
|
2171 TInt MPXHarvesting(0); |
|
2172 TInt DaemonProcessing(0); |
|
2173 TInt ret = RProperty::Get(KTAGDPSNotification, KMPXHarvesting, MPXHarvesting); |
|
2174 if(!ret) |
|
2175 return; |
|
2176 |
|
2177 TN_DEBUG2( "CThumbnailStore::ActivityChanged() KMPXHarvesting == %d", KMPXHarvesting); |
|
2178 |
|
2179 ret = RProperty::Get(KTAGDPSNotification, KDaemonProcessing, DaemonProcessing); |
|
2180 |
|
2181 if(!ret) |
|
2182 return; |
|
2183 |
|
2184 TN_DEBUG2( "CThumbnailStore::ActivityChanged() DaemonProcessing == %d", DaemonProcessing); |
|
2185 |
|
2186 if(!MPXHarvesting && !DaemonProcessing) |
|
2187 { |
|
2188 TN_DEBUG1( "CThumbnailStore::ActivityChanged() - starting maintenance"); |
|
2189 iIdle = ETrue; |
|
2190 StartMaintenance(); |
|
2191 } |
|
2192 } |
|
2193 } |
|
2194 |
|
2195 // CThumbnailStoreDiskSpaceNotifierAO class |
2398 |
2196 |
2399 CThumbnailStoreDiskSpaceNotifierAO* CThumbnailStoreDiskSpaceNotifierAO::NewL( |
2197 CThumbnailStoreDiskSpaceNotifierAO* CThumbnailStoreDiskSpaceNotifierAO::NewL( |
2400 MThumbnailStoreDiskSpaceNotifierObserver& aObserver, TInt64 aThreshold, const TDesC& aFilename) |
2198 MThumbnailStoreDiskSpaceNotifierObserver& aObserver, TInt64 aThreshold, const TDesC& aFilename) |
2401 { |
2199 { |
2402 CThumbnailStoreDiskSpaceNotifierAO* self = |
2200 CThumbnailStoreDiskSpaceNotifierAO* self = |