imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp
changeset 31 d429f823a6b7
parent 30 b67379558a75
child 33 221be23823c5
equal deleted inserted replaced
30:b67379558a75 31:d429f823a6b7
   164 // ---------------------------------------------------------------------------
   164 // ---------------------------------------------------------------------------
   165 // CThumbnailStore::NewL()
   165 // CThumbnailStore::NewL()
   166 // Two-phased constructor.
   166 // Two-phased constructor.
   167 // ---------------------------------------------------------------------------
   167 // ---------------------------------------------------------------------------
   168 //
   168 //
   169 CThumbnailStore* CThumbnailStore::NewL( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer )
   169 CThumbnailStore* CThumbnailStore::NewL( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly )
   170     {
   170     {
   171     CThumbnailStore* self = new( ELeave )CThumbnailStore( aFs, aDrive, aImei, aServer );
   171     CThumbnailStore* self = new( ELeave )CThumbnailStore( aFs, aDrive, aImei, aServer, aReadOnly );
   172     CleanupStack::PushL( self );
   172     CleanupStack::PushL( self );
   173     self->ConstructL();
   173     self->ConstructL();
   174     CleanupStack::Pop( self );
   174     CleanupStack::Pop( self );
   175     return self;
   175     return self;
   176     }
   176     }
   220 // ---------------------------------------------------------------------------
   220 // ---------------------------------------------------------------------------
   221 // CThumbnailStore::CThumbnailStore()
   221 // CThumbnailStore::CThumbnailStore()
   222 // C++ default constructor can NOT contain any code, that might leave.
   222 // C++ default constructor can NOT contain any code, that might leave.
   223 // ---------------------------------------------------------------------------
   223 // ---------------------------------------------------------------------------
   224 //
   224 //
   225 CThumbnailStore::CThumbnailStore( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer ): 
   225 CThumbnailStore::CThumbnailStore( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly ): 
   226     iFs( aFs ), iDrive( aDrive ), iDriveChar( 0 ), iBatchItemCount(0), iImei(aImei), 
   226     iFs( aFs ), iDrive( aDrive ), iDriveChar( 0 ), iBatchItemCount(0), iImei(aImei), iServer(aServer), iDiskFullNotifier(NULL), 
   227     iServer(aServer), iDiskFull(EFalse), iUnrecoverable(ETrue), iBatchFlushItemCount(KMInBatchItems)
   227     iDiskFull(EFalse), iActivityManager(NULL), iUnrecoverable(ETrue), iBatchFlushItemCount(KMInBatchItems), iReadOnly(aReadOnly)
   228     {
   228     {
   229     // no implementation required
   229     // no implementation required
   230     }
   230     }
   231 
   231 
   232 // ---------------------------------------------------------------------------
   232 // ---------------------------------------------------------------------------
   239     TN_DEBUG1( "CThumbnailStore::ConstructL()" );
   239     TN_DEBUG1( "CThumbnailStore::ConstructL()" );
   240 
   240 
   241 #ifdef _DEBUG
   241 #ifdef _DEBUG
   242     iThumbCounter = 0;
   242     iThumbCounter = 0;
   243 #endif
   243 #endif
   244     
   244     if(!iReadOnly)
   245     HBufC* databasePath = HBufC::NewLC( KMaxFileName );
   245         {
   246     TPtr pathPtr = databasePath->Des();
   246         HBufC* databasePath = HBufC::NewLC( KMaxFileName );
   247     User::LeaveIfError( RFs::DriveToChar( iDrive, iDriveChar ));
   247         TPtr pathPtr = databasePath->Des();
   248     pathPtr.Append( iDriveChar );
   248         User::LeaveIfError( RFs::DriveToChar( iDrive, iDriveChar ));
   249     pathPtr.Append( KThumbnailDatabaseName );
   249         pathPtr.Append( iDriveChar );
   250     
   250         pathPtr.Append( KThumbnailDatabaseName );
   251 	//start disk space monitor
   251         
   252     iDiskFullNotifier = CThumbnailStoreDiskSpaceNotifierAO::NewL( *this, 
   252         //start disk space monitor
   253                                             KDiskFullThreshold,
   253         iDiskFullNotifier = CThumbnailStoreDiskSpaceNotifierAO::NewL( *this, 
   254                                             pathPtr );
   254                                                 KDiskFullThreshold,
   255 
   255                                                 pathPtr );
   256     CleanupStack::PopAndDestroy( databasePath );
   256 
   257     
   257         CleanupStack::PopAndDestroy( databasePath );
   258     TN_DEBUG2( "CThumbnailStore::ConstructL() drive: %d", iDrive );
   258     
   259     
   259         TN_DEBUG2( "CThumbnailStore::ConstructL() drive: %d", iDrive );
   260     OpenDatabaseL();
   260     
   261     
   261         OpenDatabaseL();
   262     // to monitor device activity
   262     
   263     iActivityManager = CTMActivityManager::NewL( this, KStoreMaintenanceIdle);
   263         // to monitor device activity
   264     iActivityManager->Start();
   264         iActivityManager = CTMActivityManager::NewL( this, KStoreMaintenanceIdle);
   265     
   265         iActivityManager->Start();
   266     iDeleteThumbs = ETrue;
   266     
   267     iCheckFilesExist = ETrue;
   267         iDeleteThumbs = ETrue;
   268     iLastCheckedRowID = -1;
   268         iCheckFilesExist = ETrue;
       
   269         }
       
   270     else
       
   271         {
       
   272 	    TN_DEBUG1( "CThumbnailStore::ConstructL() - read only, dymmy mode..." );
       
   273         iDeleteThumbs = EFalse;
       
   274         iCheckFilesExist = EFalse;
       
   275         iLastCheckedRowID = -1;
       
   276         }
   269     }
   277     }
   270 
   278 
   271 // ---------------------------------------------------------------------------
   279 // ---------------------------------------------------------------------------
   272 // OpenDatabaseL database file
   280 // OpenDatabaseL database file
   273 // ---------------------------------------------------------------------------
   281 // ---------------------------------------------------------------------------
  1119 void CThumbnailStore::StoreThumbnailL( const TDesC& aPath, const TDes8& aData,
  1127 void CThumbnailStore::StoreThumbnailL( const TDesC& aPath, const TDes8& aData,
  1120     const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, 
  1128     const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, 
  1121 	const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath )
  1129 	const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath )
  1122     {
  1130     {
  1123     TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) in" );
  1131     TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) in" );
       
  1132     
       
  1133     if(iReadOnly)
       
  1134         {
       
  1135         TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() read only, skip..." );
       
  1136         return;
       
  1137         }
  1124 
  1138 
  1125 #ifdef _DEBUG
  1139 #ifdef _DEBUG
  1126     TTime aStart, aStop;
  1140     TTime aStart, aStop;
  1127     aStart.UniversalTime();
  1141     aStart.UniversalTime();
  1128 #endif
  1142 #endif
  1270     aThumbnail, const TSize& aOriginalSize, TBool /*aCropped*/, const TThumbnailSize aThumbnailSize, 
  1284     aThumbnail, const TSize& aOriginalSize, TBool /*aCropped*/, const TThumbnailSize aThumbnailSize, 
  1271     const TInt64 aModified, TBool aThumbFromPath, TBool aBlackListed )
  1285     const TInt64 aModified, TBool aThumbFromPath, TBool aBlackListed )
  1272     {
  1286     {
  1273     TSize thumbSize = aThumbnail->SizeInPixels();
  1287     TSize thumbSize = aThumbnail->SizeInPixels();
  1274     TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
  1288     TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
       
  1289     
       
  1290     if(iReadOnly)
       
  1291         {
       
  1292         TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() read only, skip..." );
       
  1293         return;
       
  1294         }
  1275 
  1295 
  1276     __ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer ));
  1296     __ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer ));
  1277     
  1297     
  1278     User::LeaveIfError( CheckDbState() );
  1298     User::LeaveIfError( CheckDbState() );
  1279     
  1299     
  1317             
  1337             
  1318                 HBufC8* data = NULL;
  1338                 HBufC8* data = NULL;
  1319                 CleanupStack::PushL( data );
  1339                 CleanupStack::PushL( data );
  1320                 
  1340                 
  1321                 CImageEncoder* encoder = NULL;
  1341                 CImageEncoder* encoder = NULL;
  1322                 TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::EHwImplementation, data, CImageEncoder::EOptionAlwaysThread ) );
  1342 				
       
  1343 				CImageEncoder::TOptions options = ( CImageEncoder::TOptions )( CImageEncoder::EOptionAlwaysThread );
       
  1344 				
       
  1345                 TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::EHwImplementation, data, options ) );
  1323                 if ( decErr != KErrNone )
  1346                 if ( decErr != KErrNone )
  1324                     {
  1347                     {
  1325                     TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder failed %d", decErr);
  1348                     TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder failed %d", decErr);
  1326                 
  1349                 
  1327                     TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::ESwImplementation, data, CImageEncoder::EOptionAlwaysThread ) );
  1350                     TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::ESwImplementation, data, options ) );
  1328                     if ( decErr != KErrNone )
  1351                     if ( decErr != KErrNone )
  1329                         {
  1352                         {
  1330                         TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder failed %d", decErr);
  1353                         TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder failed %d", decErr);
  1331                     
  1354                     
  1332                         TRAPD( decErr, encoder = CImageEncoder::DataNewL( data,  KJpegMime(), CImageEncoder::EOptionAlwaysThread ) );
  1355                         TRAPD( decErr, encoder = CImageEncoder::DataNewL( data,  KJpegMime(), options ) );
  1333                         if ( decErr != KErrNone )
  1356                         if ( decErr != KErrNone )
  1334                             {
  1357                             {
  1335                             TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder failed %d", decErr);
  1358                             TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder failed %d", decErr);
  1336                             
  1359                             
  1337                             User::Leave(decErr);
  1360                             User::Leave(decErr);
  1360                 TJpegImageData* imageData = new (ELeave) TJpegImageData();
  1383                 TJpegImageData* imageData = new (ELeave) TJpegImageData();
  1361                 CleanupStack::PushL( imageData );
  1384                 CleanupStack::PushL( imageData );
  1362                 
  1385                 
  1363                 // Set some format specific data
  1386                 // Set some format specific data
  1364                 imageData->iSampleScheme = TJpegImageData::EColor444;
  1387                 imageData->iSampleScheme = TJpegImageData::EColor444;
  1365                 imageData->iQualityFactor = 75;
  1388                 imageData->iQualityFactor = 80;
  1366                 
  1389                 
  1367                 // imageData - ownership passed to frameImageData after AppendImageData
  1390                 // imageData - ownership passed to frameImageData after AppendImageData
  1368                 User::LeaveIfError(frameImageData->AppendImageData(imageData));
  1391                 User::LeaveIfError(frameImageData->AppendImageData(imageData));
  1369                 CleanupStack::Pop( imageData );
  1392                 CleanupStack::Pop( imageData );
  1370                 
  1393                 
  1430 // ---------------------------------------------------------------------------
  1453 // ---------------------------------------------------------------------------
  1431 //
  1454 //
  1432 TBool CThumbnailStore::FindDuplicateL( const TDesC& aPath, const TThumbnailSize& aThumbnailSize )
  1455 TBool CThumbnailStore::FindDuplicateL( const TDesC& aPath, const TThumbnailSize& aThumbnailSize )
  1433     {
  1456     {
  1434     TN_DEBUG1( "CThumbnailStore::FindDuplicateL()" );
  1457     TN_DEBUG1( "CThumbnailStore::FindDuplicateL()" );
       
  1458 	
       
  1459 	if(iReadOnly)
       
  1460 		{
       
  1461 		TN_DEBUG1( "CThumbnailStore::FindDuplicateL() read only, skip..." );
       
  1462 		return EFalse;
       
  1463 		}
  1435     
  1464     
  1436     User::LeaveIfError( CheckDbState() );
  1465     User::LeaveIfError( CheckDbState() );
  1437     
  1466     
  1438     TInt rowStatus = 0;
  1467     TInt rowStatus = 0;
  1439     TInt paramIndex = 0;
  1468     TInt paramIndex = 0;
  1525 //     
  1554 //     
  1526 void CThumbnailStore::GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray <
  1555 void CThumbnailStore::GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray <
  1527     TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly )
  1556     TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly )
  1528     {
  1557     {
  1529     TN_DEBUG2( "CThumbnailStore::GetMissingSizesL() aSourceType == %d", aSourceType );
  1558     TN_DEBUG2( "CThumbnailStore::GetMissingSizesL() aSourceType == %d", aSourceType );
       
  1559     
       
  1560     if(iReadOnly)
       
  1561         {
       
  1562         TN_DEBUG1( "CThumbnailStore::GetMissingSizesL() read only, skip..." );
       
  1563 		return;
       
  1564         }
  1530     
  1565     
  1531     User::LeaveIfError( CheckDbState() );
  1566     User::LeaveIfError( CheckDbState() );
  1532     
  1567     
  1533     HBufC* path = aPath.AllocLC();
  1568     HBufC* path = aPath.AllocLC();
  1534     TPtr ptr(path->Des());
  1569     TPtr ptr(path->Des());
  1634 //
  1669 //
  1635 void CThumbnailStore::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* &
  1670 void CThumbnailStore::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* &
  1636     aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aThumbnailRealSize )
  1671     aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aThumbnailRealSize )
  1637     {
  1672     {
  1638     TN_DEBUG3( "CThumbnailStore::FetchThumbnailL(%S) aThumbnailSize==%d", &aPath, aThumbnailSize );
  1673     TN_DEBUG3( "CThumbnailStore::FetchThumbnailL(%S) aThumbnailSize==%d", &aPath, aThumbnailSize );
       
  1674     
       
  1675     if(iReadOnly)
       
  1676         {
       
  1677         TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() read only, skip..." );
       
  1678         User::Leave( KErrNotFound );
       
  1679         }
  1639     
  1680     
  1640     User::LeaveIfError( CheckDbState() );
  1681     User::LeaveIfError( CheckDbState() );
  1641     
  1682     
  1642     HBufC* path = aPath.AllocLC();
  1683     HBufC* path = aPath.AllocLC();
  1643     TPtr ptr(path->Des());
  1684     TPtr ptr(path->Des());
  1759 void CThumbnailStore::DeleteThumbnailsL( const TDesC& aPath, TBool aForce, 
  1800 void CThumbnailStore::DeleteThumbnailsL( const TDesC& aPath, TBool aForce, 
  1760                                          TBool aTransaction )
  1801                                          TBool aTransaction )
  1761     {
  1802     {
  1762     TN_DEBUG2( "CThumbnailStore::DeleteThumbnailsL(%S)", &aPath );
  1803     TN_DEBUG2( "CThumbnailStore::DeleteThumbnailsL(%S)", &aPath );
  1763 
  1804 
       
  1805     if(iReadOnly)
       
  1806         {
       
  1807         TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsL() read only, skip..." );
       
  1808         return;
       
  1809         }
       
  1810     
  1764 #ifdef _DEBUG
  1811 #ifdef _DEBUG
  1765     TTime aStart, aStop;
  1812     TTime aStart, aStop;
  1766     aStart.UniversalTime();
  1813     aStart.UniversalTime();
  1767 #endif
  1814 #endif
  1768     
  1815     
  1958 //
  2005 //
  1959 void CThumbnailStore::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath )
  2006 void CThumbnailStore::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath )
  1960     {
  2007     {
  1961     TN_DEBUG2( "CThumbnailStore::RenameThumbnailsL(%S)", &aCurrentPath );
  2008     TN_DEBUG2( "CThumbnailStore::RenameThumbnailsL(%S)", &aCurrentPath );
  1962     
  2009     
       
  2010     if(iReadOnly)
       
  2011         {
       
  2012         TN_DEBUG1( "CThumbnailStore::RenameThumbnailsL() read only, skip..." );
       
  2013         return;
       
  2014         }
       
  2015     
  1963 #ifdef _DEBUG
  2016 #ifdef _DEBUG
  1964     TTime aStart, aStop;
  2017     TTime aStart, aStop;
  1965     aStart.UniversalTime();
  2018     aStart.UniversalTime();
  1966 #endif
  2019 #endif
  1967     
  2020     
  2046 void CThumbnailStore::FlushCacheTable( TBool aForce )
  2099 void CThumbnailStore::FlushCacheTable( TBool aForce )
  2047     {
  2100     {
  2048     TN_DEBUG1("CThumbnailStore::FlushCacheTable() in");
  2101     TN_DEBUG1("CThumbnailStore::FlushCacheTable() in");
  2049     
  2102     
  2050     StopAutoFlush();
  2103     StopAutoFlush();
       
  2104     
       
  2105     if(iReadOnly)
       
  2106         {
       
  2107         TN_DEBUG1( "CThumbnailStore::FlushCacheTable() read only, skip..." );
       
  2108         return;
       
  2109         }
  2051     
  2110     
  2052     if(iBatchItemCount <= 0 || CheckDbState() != KErrNone)
  2111     if(iBatchItemCount <= 0 || CheckDbState() != KErrNone)
  2053         {
  2112         {
  2054         // cache empty or db unusable
  2113         // cache empty or db unusable
  2055         TN_DEBUG1( "CThumbnailStore::FlushCacheTable() error ");
  2114         TN_DEBUG1( "CThumbnailStore::FlushCacheTable() error ");
  2188 //
  2247 //
  2189 void CThumbnailStore::StartAutoFlush()
  2248 void CThumbnailStore::StartAutoFlush()
  2190     {
  2249     {
  2191     TN_DEBUG1( "CThumbnailStore::StartAutoFlush()" );
  2250     TN_DEBUG1( "CThumbnailStore::StartAutoFlush()" );
  2192     
  2251     
       
  2252     if(iReadOnly)
       
  2253         {
       
  2254         TN_DEBUG1( "CThumbnailStore::StartAutoFlush() read only, skip..." );
       
  2255         return;
       
  2256         }
       
  2257     
  2193     TInt err = KErrNone;
  2258     TInt err = KErrNone;
  2194     
  2259     
  2195     if( iAutoFlushTimer )
  2260     if( iAutoFlushTimer )
  2196         {
  2261         {
  2197         iAutoFlushTimer->Cancel();
  2262         iAutoFlushTimer->Cancel();
  2369 
  2434 
  2370 TBool CThumbnailStore::CheckModifiedByPathL( const TDesC& aPath, const TInt64 aModified, TBool& modifiedChanged )
  2435 TBool CThumbnailStore::CheckModifiedByPathL( const TDesC& aPath, const TInt64 aModified, TBool& modifiedChanged )
  2371     {
  2436     {
  2372     TN_DEBUG2( "CThumbnailStore::CheckModifiedByPathL() %S", &aPath);
  2437     TN_DEBUG2( "CThumbnailStore::CheckModifiedByPathL() %S", &aPath);
  2373     
  2438     
       
  2439     if(iReadOnly)
       
  2440     	{
       
  2441     	TN_DEBUG1( "CThumbnailStore::CheckModifiedByPathL() read only, skip..." );
       
  2442 		modifiedChanged = EFalse;
       
  2443     	return ETrue;
       
  2444     	}
       
  2445 	
  2374     User::LeaveIfError( CheckDbState() );
  2446     User::LeaveIfError( CheckDbState() );
  2375     
  2447     
  2376     HBufC* path = aPath.AllocLC();
  2448     HBufC* path = aPath.AllocLC();
  2377     TPtr ptr(path->Des());
  2449     TPtr ptr(path->Des());
  2378     StripDriveLetterL( ptr );
  2450     StripDriveLetterL( ptr );
  2448     CleanupStack::PopAndDestroy( path );
  2520     CleanupStack::PopAndDestroy( path );
  2449    
  2521    
  2450     return ret;
  2522     return ret;
  2451 }
  2523 }
  2452 	
  2524 	
       
  2525 
       
  2526 // -----------------------------------------------------------------------------
       
  2527 // IsReadOnly()
       
  2528 // -----------------------------------------------------------------------------
       
  2529 //
       
  2530 TBool CThumbnailStore::IsReadOnly()
       
  2531     {
       
  2532     return iReadOnly;
       
  2533     }
       
  2534 
  2453 // -----------------------------------------------------------------------------
  2535 // -----------------------------------------------------------------------------
  2454 // PrepareBlacklistedItemsForRetryL()
  2536 // PrepareBlacklistedItemsForRetryL()
  2455 // -----------------------------------------------------------------------------
  2537 // -----------------------------------------------------------------------------
  2456 //
  2538 //
  2457 void CThumbnailStore::PrepareBlacklistedItemsForRetryL()
  2539 void CThumbnailStore::PrepareBlacklistedItemsForRetryL()
  2478 // -----------------------------------------------------------------------------
  2560 // -----------------------------------------------------------------------------
  2479 //
  2561 //
  2480 TInt CThumbnailStore::DeleteMarkedL()
  2562 TInt CThumbnailStore::DeleteMarkedL()
  2481     {
  2563     {
  2482     TN_DEBUG1( "CThumbnailStore::DeleteMarkedL()" );
  2564     TN_DEBUG1( "CThumbnailStore::DeleteMarkedL()" );
       
  2565     
       
  2566     if(iReadOnly)
       
  2567         {
       
  2568         TN_DEBUG1( "CThumbnailStore::DeleteMarkedL() read only, skip..." );
       
  2569         return KErrAccessDenied;
       
  2570         }
  2483    
  2571    
  2484 #ifdef _DEBUG
  2572 #ifdef _DEBUG
  2485     TTime aStart, aStop;
  2573     TTime aStart, aStop;
  2486     aStart.UniversalTime();
  2574     aStart.UniversalTime();
  2487 #endif
  2575 #endif
  2569 // -----------------------------------------------------------------------------
  2657 // -----------------------------------------------------------------------------
  2570 //
  2658 //
  2571 TInt CThumbnailStore::FileExistenceCheckL()
  2659 TInt CThumbnailStore::FileExistenceCheckL()
  2572     {
  2660     {
  2573     TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL()" );
  2661     TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL()" );
       
  2662 	
       
  2663     if(iReadOnly)
       
  2664 		{
       
  2665 		TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL() read only, skip..." );
       
  2666 		return ETrue;
       
  2667 		}
  2574     
  2668     
  2575 #ifdef _DEBUG
  2669 #ifdef _DEBUG
  2576     TTime aStart, aStop;
  2670     TTime aStart, aStop;
  2577     aStart.UniversalTime();
  2671     aStart.UniversalTime();
  2578 #endif
  2672 #endif
  2691 // CheckDbState
  2785 // CheckDbState
  2692 // -----------------------------------------------------------------------------
  2786 // -----------------------------------------------------------------------------
  2693 //
  2787 //
  2694 TInt CThumbnailStore::CheckDbState()
  2788 TInt CThumbnailStore::CheckDbState()
  2695     {
  2789     {
  2696     if (iUnrecoverable)
  2790     if (iUnrecoverable && !iReadOnly)
  2697         {
  2791         {
  2698         TN_DEBUG1( "CThumbnailStore::CheckDbState() - database in unrecoverable state" );
  2792         TN_DEBUG1( "CThumbnailStore::CheckDbState() - database in unrecoverable state" );
  2699         __ASSERT_DEBUG( !iUnrecoverable, ThumbnailPanic( EThumbnailDatabaseUnrecoverable ));
  2793         __ASSERT_DEBUG( !iUnrecoverable, ThumbnailPanic( EThumbnailDatabaseUnrecoverable ));
  2700         
  2794         
  2701         return KStoreUnrecoverableErr;
  2795         return KStoreUnrecoverableErr;
  2721     TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceError() aError = %d", aError );
  2815     TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceError() aError = %d", aError );
  2722     }
  2816     }
  2723 
  2817 
  2724 TBool CThumbnailStore::IsDiskFull()
  2818 TBool CThumbnailStore::IsDiskFull()
  2725     {
  2819     {
       
  2820     if(iReadOnly)
       
  2821         {
       
  2822         TN_DEBUG1( "CThumbnailStore::IsDiskFull() read only, skip..." );
       
  2823         return EFalse;
       
  2824         }
  2726     return iDiskFull;
  2825     return iDiskFull;
  2727     }
  2826     }
  2728 
  2827 
  2729 // -----------------------------------------------------------------------------
  2828 // -----------------------------------------------------------------------------
  2730 // ActivityDetected()
  2829 // ActivityDetected()
  2731 // -----------------------------------------------------------------------------
  2830 // -----------------------------------------------------------------------------
  2732 //
  2831 //
  2733 void CThumbnailStore::ActivityChanged(const TBool aActive)
  2832 void CThumbnailStore::ActivityChanged(const TBool aActive)
  2734     {
  2833     {
  2735     TN_DEBUG2( "CThumbnailStore::ActivityChanged() aActive == %d", aActive);
  2834     TN_DEBUG2( "CThumbnailStore::ActivityChanged() aActive == %d", aActive);
       
  2835     
       
  2836     if( iReadOnly )
       
  2837         {
       
  2838         TN_DEBUG1( "CThumbnailStore::ActivityChanged() read only, skip..." );
       
  2839         return;
       
  2840         }
  2736     
  2841     
  2737     if( aActive )
  2842     if( aActive )
  2738         {
  2843         {
  2739         iIdle = EFalse;
  2844         iIdle = EFalse;
  2740         }
  2845         }