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 // --------------------------------------------------------------------------- |
573 TPtrC errorMsg2 = iDatabase.LastErrorMessage(); |
579 TPtrC errorMsg2 = iDatabase.LastErrorMessage(); |
574 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
580 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
575 #endif |
581 #endif |
576 return KErrNotSupported; |
582 return KErrNotSupported; |
577 } |
583 } |
578 |
584 |
579 ret = stmt.Prepare( iDatabase, KGetInfoCount ); |
|
580 if(ret < 0) |
|
581 { |
|
582 stmt.Close(); |
|
583 TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoCount failed %d"); |
|
584 return KErrNotSupported; |
|
585 } |
|
586 rowStatus = stmt.Next(); |
|
587 |
|
588 if ( rowStatus == KSqlAtRow) |
|
589 { |
|
590 infocount = stmt.ColumnInt64( column ); |
|
591 } |
|
592 |
|
593 stmt.Close(); |
|
594 |
|
595 if(rowStatus < 0) |
|
596 { |
|
597 #ifdef _DEBUG |
|
598 TPtrC errorMsg2 = iDatabase.LastErrorMessage(); |
|
599 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
|
600 #endif |
|
601 return KErrNotSupported; |
|
602 } |
|
603 |
|
604 ret = stmt.Prepare( iDatabase, KGetDataRowID ); |
585 ret = stmt.Prepare( iDatabase, KGetDataRowID ); |
605 if(ret < 0) |
586 if(ret < 0) |
606 { |
587 { |
607 stmt.Close(); |
588 stmt.Close(); |
608 TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetDataRowID failed"); |
589 TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetDataRowID failed"); |
624 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
605 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
625 #endif |
606 #endif |
626 return KErrNotSupported; |
607 return KErrNotSupported; |
627 } |
608 } |
628 |
609 |
629 ret = stmt.Prepare( iDatabase, KGetInfoDataCount ); |
|
630 if(ret < 0) |
|
631 { |
|
632 stmt.Close(); |
|
633 TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoDataCount failed %d"); |
|
634 return KErrNotSupported; |
|
635 } |
|
636 rowStatus = stmt.Next(); |
|
637 |
|
638 if ( rowStatus == KSqlAtRow) |
|
639 { |
|
640 datacount = stmt.ColumnInt64( column ); |
|
641 } |
|
642 |
|
643 stmt.Close(); |
|
644 |
|
645 if(rowStatus < 0) |
|
646 { |
|
647 #ifdef _DEBUG |
|
648 TPtrC errorMsg2 = iDatabase.LastErrorMessage(); |
|
649 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
|
650 #endif |
|
651 return KErrNotSupported; |
|
652 } |
|
653 |
|
654 TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - inforows %Ld", inforows ); |
610 TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - inforows %Ld", inforows ); |
655 TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - infocount %Ld", infocount ); |
|
656 TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datarows %Ld", datarows ); |
611 TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datarows %Ld", datarows ); |
657 TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datacount %Ld", datacount ); |
612 |
658 |
613 if( inforows != datarows ) |
659 if( inforows != datarows || datacount != infocount) |
|
660 { |
614 { |
661 TN_DEBUG1( "CThumbnailStore::CheckRowIDsL() - tables out of sync" ); |
615 TN_DEBUG1( "CThumbnailStore::CheckRowIDsL() - tables out of sync" ); |
662 return KErrNotSupported; |
616 return KErrNotSupported; |
663 } |
617 } |
664 else |
618 else |
1119 void CThumbnailStore::StoreThumbnailL( const TDesC& aPath, const TDes8& aData, |
1073 void CThumbnailStore::StoreThumbnailL( const TDesC& aPath, const TDes8& aData, |
1120 const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, |
1074 const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, |
1121 const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath ) |
1075 const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath ) |
1122 { |
1076 { |
1123 TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) in" ); |
1077 TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) in" ); |
|
1078 |
|
1079 if(iReadOnly) |
|
1080 { |
|
1081 TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() read only, skip..." ); |
|
1082 return; |
|
1083 } |
1124 |
1084 |
1125 #ifdef _DEBUG |
1085 #ifdef _DEBUG |
1126 TTime aStart, aStop; |
1086 TTime aStart, aStop; |
1127 aStart.UniversalTime(); |
1087 aStart.UniversalTime(); |
1128 #endif |
1088 #endif |
1270 aThumbnail, const TSize& aOriginalSize, TBool /*aCropped*/, const TThumbnailSize aThumbnailSize, |
1230 aThumbnail, const TSize& aOriginalSize, TBool /*aCropped*/, const TThumbnailSize aThumbnailSize, |
1271 const TInt64 aModified, TBool aThumbFromPath, TBool aBlackListed ) |
1231 const TInt64 aModified, TBool aThumbFromPath, TBool aBlackListed ) |
1272 { |
1232 { |
1273 TSize thumbSize = aThumbnail->SizeInPixels(); |
1233 TSize thumbSize = aThumbnail->SizeInPixels(); |
1274 TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight ); |
1234 TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight ); |
|
1235 |
|
1236 if(iReadOnly) |
|
1237 { |
|
1238 TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() read only, skip..." ); |
|
1239 return; |
|
1240 } |
1275 |
1241 |
1276 __ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer )); |
1242 __ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer )); |
1277 |
1243 |
1278 User::LeaveIfError( CheckDbState() ); |
1244 User::LeaveIfError( CheckDbState() ); |
1279 |
1245 |
1317 |
1283 |
1318 HBufC8* data = NULL; |
1284 HBufC8* data = NULL; |
1319 CleanupStack::PushL( data ); |
1285 CleanupStack::PushL( data ); |
1320 |
1286 |
1321 CImageEncoder* encoder = NULL; |
1287 CImageEncoder* encoder = NULL; |
1322 TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::EHwImplementation, data, CImageEncoder::EOptionAlwaysThread ) ); |
1288 |
|
1289 CImageEncoder::TOptions options = ( CImageEncoder::TOptions )( CImageEncoder::EOptionAlwaysThread ); |
|
1290 |
|
1291 TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::EHwImplementation, data, options ) ); |
1323 if ( decErr != KErrNone ) |
1292 if ( decErr != KErrNone ) |
1324 { |
1293 { |
1325 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder failed %d", decErr); |
1294 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder failed %d", decErr); |
1326 |
1295 |
1327 TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::ESwImplementation, data, CImageEncoder::EOptionAlwaysThread ) ); |
1296 TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::ESwImplementation, data, options ) ); |
1328 if ( decErr != KErrNone ) |
1297 if ( decErr != KErrNone ) |
1329 { |
1298 { |
1330 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder failed %d", decErr); |
1299 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder failed %d", decErr); |
1331 |
1300 |
1332 TRAPD( decErr, encoder = CImageEncoder::DataNewL( data, KJpegMime(), CImageEncoder::EOptionAlwaysThread ) ); |
1301 TRAPD( decErr, encoder = CImageEncoder::DataNewL( data, KJpegMime(), options ) ); |
1333 if ( decErr != KErrNone ) |
1302 if ( decErr != KErrNone ) |
1334 { |
1303 { |
1335 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder failed %d", decErr); |
1304 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder failed %d", decErr); |
1336 |
1305 |
1337 User::Leave(decErr); |
1306 User::Leave(decErr); |
1360 TJpegImageData* imageData = new (ELeave) TJpegImageData(); |
1329 TJpegImageData* imageData = new (ELeave) TJpegImageData(); |
1361 CleanupStack::PushL( imageData ); |
1330 CleanupStack::PushL( imageData ); |
1362 |
1331 |
1363 // Set some format specific data |
1332 // Set some format specific data |
1364 imageData->iSampleScheme = TJpegImageData::EColor444; |
1333 imageData->iSampleScheme = TJpegImageData::EColor444; |
1365 imageData->iQualityFactor = 75; |
1334 imageData->iQualityFactor = 80; |
1366 |
1335 |
1367 // imageData - ownership passed to frameImageData after AppendImageData |
1336 // imageData - ownership passed to frameImageData after AppendImageData |
1368 User::LeaveIfError(frameImageData->AppendImageData(imageData)); |
1337 User::LeaveIfError(frameImageData->AppendImageData(imageData)); |
1369 CleanupStack::Pop( imageData ); |
1338 CleanupStack::Pop( imageData ); |
1370 |
1339 |
1430 // --------------------------------------------------------------------------- |
1399 // --------------------------------------------------------------------------- |
1431 // |
1400 // |
1432 TBool CThumbnailStore::FindDuplicateL( const TDesC& aPath, const TThumbnailSize& aThumbnailSize ) |
1401 TBool CThumbnailStore::FindDuplicateL( const TDesC& aPath, const TThumbnailSize& aThumbnailSize ) |
1433 { |
1402 { |
1434 TN_DEBUG1( "CThumbnailStore::FindDuplicateL()" ); |
1403 TN_DEBUG1( "CThumbnailStore::FindDuplicateL()" ); |
|
1404 |
|
1405 if(iReadOnly) |
|
1406 { |
|
1407 TN_DEBUG1( "CThumbnailStore::FindDuplicateL() read only, skip..." ); |
|
1408 return EFalse; |
|
1409 } |
1435 |
1410 |
1436 User::LeaveIfError( CheckDbState() ); |
1411 User::LeaveIfError( CheckDbState() ); |
1437 |
1412 |
1438 TInt rowStatus = 0; |
1413 TInt rowStatus = 0; |
1439 TInt paramIndex = 0; |
1414 TInt paramIndex = 0; |
1525 // |
1500 // |
1526 void CThumbnailStore::GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray < |
1501 void CThumbnailStore::GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray < |
1527 TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly ) |
1502 TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly ) |
1528 { |
1503 { |
1529 TN_DEBUG2( "CThumbnailStore::GetMissingSizesL() aSourceType == %d", aSourceType ); |
1504 TN_DEBUG2( "CThumbnailStore::GetMissingSizesL() aSourceType == %d", aSourceType ); |
|
1505 |
|
1506 if(iReadOnly) |
|
1507 { |
|
1508 TN_DEBUG1( "CThumbnailStore::GetMissingSizesL() read only, skip..." ); |
|
1509 return; |
|
1510 } |
1530 |
1511 |
1531 User::LeaveIfError( CheckDbState() ); |
1512 User::LeaveIfError( CheckDbState() ); |
1532 |
1513 |
1533 HBufC* path = aPath.AllocLC(); |
1514 HBufC* path = aPath.AllocLC(); |
1534 TPtr ptr(path->Des()); |
1515 TPtr ptr(path->Des()); |
1634 // |
1615 // |
1635 void CThumbnailStore::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* & |
1616 void CThumbnailStore::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* & |
1636 aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aThumbnailRealSize ) |
1617 aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aThumbnailRealSize ) |
1637 { |
1618 { |
1638 TN_DEBUG3( "CThumbnailStore::FetchThumbnailL(%S) aThumbnailSize==%d", &aPath, aThumbnailSize ); |
1619 TN_DEBUG3( "CThumbnailStore::FetchThumbnailL(%S) aThumbnailSize==%d", &aPath, aThumbnailSize ); |
|
1620 |
|
1621 if(iReadOnly) |
|
1622 { |
|
1623 TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() read only, skip..." ); |
|
1624 User::Leave( KErrNotFound ); |
|
1625 } |
1639 |
1626 |
1640 User::LeaveIfError( CheckDbState() ); |
1627 User::LeaveIfError( CheckDbState() ); |
1641 |
1628 |
1642 HBufC* path = aPath.AllocLC(); |
1629 HBufC* path = aPath.AllocLC(); |
1643 TPtr ptr(path->Des()); |
1630 TPtr ptr(path->Des()); |
1759 void CThumbnailStore::DeleteThumbnailsL( const TDesC& aPath, TBool aForce, |
1746 void CThumbnailStore::DeleteThumbnailsL( const TDesC& aPath, TBool aForce, |
1760 TBool aTransaction ) |
1747 TBool aTransaction ) |
1761 { |
1748 { |
1762 TN_DEBUG2( "CThumbnailStore::DeleteThumbnailsL(%S)", &aPath ); |
1749 TN_DEBUG2( "CThumbnailStore::DeleteThumbnailsL(%S)", &aPath ); |
1763 |
1750 |
|
1751 if(iReadOnly) |
|
1752 { |
|
1753 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsL() read only, skip..." ); |
|
1754 return; |
|
1755 } |
|
1756 |
1764 #ifdef _DEBUG |
1757 #ifdef _DEBUG |
1765 TTime aStart, aStop; |
1758 TTime aStart, aStop; |
1766 aStart.UniversalTime(); |
1759 aStart.UniversalTime(); |
1767 #endif |
1760 #endif |
1768 |
1761 |
1958 // |
1951 // |
1959 void CThumbnailStore::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath ) |
1952 void CThumbnailStore::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath ) |
1960 { |
1953 { |
1961 TN_DEBUG2( "CThumbnailStore::RenameThumbnailsL(%S)", &aCurrentPath ); |
1954 TN_DEBUG2( "CThumbnailStore::RenameThumbnailsL(%S)", &aCurrentPath ); |
1962 |
1955 |
|
1956 if(iReadOnly) |
|
1957 { |
|
1958 TN_DEBUG1( "CThumbnailStore::RenameThumbnailsL() read only, skip..." ); |
|
1959 return; |
|
1960 } |
|
1961 |
1963 #ifdef _DEBUG |
1962 #ifdef _DEBUG |
1964 TTime aStart, aStop; |
1963 TTime aStart, aStop; |
1965 aStart.UniversalTime(); |
1964 aStart.UniversalTime(); |
1966 #endif |
1965 #endif |
1967 |
1966 |
2046 void CThumbnailStore::FlushCacheTable( TBool aForce ) |
2045 void CThumbnailStore::FlushCacheTable( TBool aForce ) |
2047 { |
2046 { |
2048 TN_DEBUG1("CThumbnailStore::FlushCacheTable() in"); |
2047 TN_DEBUG1("CThumbnailStore::FlushCacheTable() in"); |
2049 |
2048 |
2050 StopAutoFlush(); |
2049 StopAutoFlush(); |
|
2050 |
|
2051 if(iReadOnly) |
|
2052 { |
|
2053 TN_DEBUG1( "CThumbnailStore::FlushCacheTable() read only, skip..." ); |
|
2054 return; |
|
2055 } |
2051 |
2056 |
2052 if(iBatchItemCount <= 0 || CheckDbState() != KErrNone) |
2057 if(iBatchItemCount <= 0 || CheckDbState() != KErrNone) |
2053 { |
2058 { |
2054 // cache empty or db unusable |
2059 // cache empty or db unusable |
2055 TN_DEBUG1( "CThumbnailStore::FlushCacheTable() error "); |
2060 TN_DEBUG1( "CThumbnailStore::FlushCacheTable() error "); |
2188 // |
2193 // |
2189 void CThumbnailStore::StartAutoFlush() |
2194 void CThumbnailStore::StartAutoFlush() |
2190 { |
2195 { |
2191 TN_DEBUG1( "CThumbnailStore::StartAutoFlush()" ); |
2196 TN_DEBUG1( "CThumbnailStore::StartAutoFlush()" ); |
2192 |
2197 |
|
2198 if(iReadOnly) |
|
2199 { |
|
2200 TN_DEBUG1( "CThumbnailStore::StartAutoFlush() read only, skip..." ); |
|
2201 return; |
|
2202 } |
|
2203 |
2193 TInt err = KErrNone; |
2204 TInt err = KErrNone; |
2194 |
2205 |
2195 if( iAutoFlushTimer ) |
2206 if( iAutoFlushTimer ) |
2196 { |
2207 { |
2197 iAutoFlushTimer->Cancel(); |
2208 iAutoFlushTimer->Cancel(); |
2369 |
2380 |
2370 TBool CThumbnailStore::CheckModifiedByPathL( const TDesC& aPath, const TInt64 aModified, TBool& modifiedChanged ) |
2381 TBool CThumbnailStore::CheckModifiedByPathL( const TDesC& aPath, const TInt64 aModified, TBool& modifiedChanged ) |
2371 { |
2382 { |
2372 TN_DEBUG2( "CThumbnailStore::CheckModifiedByPathL() %S", &aPath); |
2383 TN_DEBUG2( "CThumbnailStore::CheckModifiedByPathL() %S", &aPath); |
2373 |
2384 |
|
2385 if(iReadOnly) |
|
2386 { |
|
2387 TN_DEBUG1( "CThumbnailStore::CheckModifiedByPathL() read only, skip..." ); |
|
2388 modifiedChanged = EFalse; |
|
2389 return ETrue; |
|
2390 } |
|
2391 |
2374 User::LeaveIfError( CheckDbState() ); |
2392 User::LeaveIfError( CheckDbState() ); |
2375 |
2393 |
2376 HBufC* path = aPath.AllocLC(); |
2394 HBufC* path = aPath.AllocLC(); |
2377 TPtr ptr(path->Des()); |
2395 TPtr ptr(path->Des()); |
2378 StripDriveLetterL( ptr ); |
2396 StripDriveLetterL( ptr ); |
2448 CleanupStack::PopAndDestroy( path ); |
2466 CleanupStack::PopAndDestroy( path ); |
2449 |
2467 |
2450 return ret; |
2468 return ret; |
2451 } |
2469 } |
2452 |
2470 |
|
2471 |
|
2472 // ----------------------------------------------------------------------------- |
|
2473 // IsReadOnly() |
|
2474 // ----------------------------------------------------------------------------- |
|
2475 // |
|
2476 TBool CThumbnailStore::IsReadOnly() |
|
2477 { |
|
2478 return iReadOnly; |
|
2479 } |
|
2480 |
2453 // ----------------------------------------------------------------------------- |
2481 // ----------------------------------------------------------------------------- |
2454 // PrepareBlacklistedItemsForRetryL() |
2482 // PrepareBlacklistedItemsForRetryL() |
2455 // ----------------------------------------------------------------------------- |
2483 // ----------------------------------------------------------------------------- |
2456 // |
2484 // |
2457 void CThumbnailStore::PrepareBlacklistedItemsForRetryL() |
2485 void CThumbnailStore::PrepareBlacklistedItemsForRetryL() |
2478 // ----------------------------------------------------------------------------- |
2506 // ----------------------------------------------------------------------------- |
2479 // |
2507 // |
2480 TInt CThumbnailStore::DeleteMarkedL() |
2508 TInt CThumbnailStore::DeleteMarkedL() |
2481 { |
2509 { |
2482 TN_DEBUG1( "CThumbnailStore::DeleteMarkedL()" ); |
2510 TN_DEBUG1( "CThumbnailStore::DeleteMarkedL()" ); |
|
2511 |
|
2512 if(iReadOnly) |
|
2513 { |
|
2514 TN_DEBUG1( "CThumbnailStore::DeleteMarkedL() read only, skip..." ); |
|
2515 return KErrAccessDenied; |
|
2516 } |
2483 |
2517 |
2484 #ifdef _DEBUG |
2518 #ifdef _DEBUG |
2485 TTime aStart, aStop; |
2519 TTime aStart, aStop; |
2486 aStart.UniversalTime(); |
2520 aStart.UniversalTime(); |
2487 #endif |
2521 #endif |
2569 // ----------------------------------------------------------------------------- |
2603 // ----------------------------------------------------------------------------- |
2570 // |
2604 // |
2571 TInt CThumbnailStore::FileExistenceCheckL() |
2605 TInt CThumbnailStore::FileExistenceCheckL() |
2572 { |
2606 { |
2573 TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL()" ); |
2607 TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL()" ); |
|
2608 |
|
2609 if(iReadOnly) |
|
2610 { |
|
2611 TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL() read only, skip..." ); |
|
2612 return ETrue; |
|
2613 } |
2574 |
2614 |
2575 #ifdef _DEBUG |
2615 #ifdef _DEBUG |
2576 TTime aStart, aStop; |
2616 TTime aStart, aStop; |
2577 aStart.UniversalTime(); |
2617 aStart.UniversalTime(); |
2578 #endif |
2618 #endif |
2691 // CheckDbState |
2731 // CheckDbState |
2692 // ----------------------------------------------------------------------------- |
2732 // ----------------------------------------------------------------------------- |
2693 // |
2733 // |
2694 TInt CThumbnailStore::CheckDbState() |
2734 TInt CThumbnailStore::CheckDbState() |
2695 { |
2735 { |
2696 if (iUnrecoverable) |
2736 if (iUnrecoverable && !iReadOnly) |
2697 { |
2737 { |
2698 TN_DEBUG1( "CThumbnailStore::CheckDbState() - database in unrecoverable state" ); |
2738 TN_DEBUG1( "CThumbnailStore::CheckDbState() - database in unrecoverable state" ); |
2699 __ASSERT_DEBUG( !iUnrecoverable, ThumbnailPanic( EThumbnailDatabaseUnrecoverable )); |
2739 __ASSERT_DEBUG( !iUnrecoverable, ThumbnailPanic( EThumbnailDatabaseUnrecoverable )); |
2700 |
2740 |
2701 return KStoreUnrecoverableErr; |
2741 return KStoreUnrecoverableErr; |
2721 TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceError() aError = %d", aError ); |
2761 TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceError() aError = %d", aError ); |
2722 } |
2762 } |
2723 |
2763 |
2724 TBool CThumbnailStore::IsDiskFull() |
2764 TBool CThumbnailStore::IsDiskFull() |
2725 { |
2765 { |
|
2766 if(iReadOnly) |
|
2767 { |
|
2768 TN_DEBUG1( "CThumbnailStore::IsDiskFull() read only, skip..." ); |
|
2769 return EFalse; |
|
2770 } |
2726 return iDiskFull; |
2771 return iDiskFull; |
2727 } |
2772 } |
2728 |
2773 |
2729 // ----------------------------------------------------------------------------- |
2774 // ----------------------------------------------------------------------------- |
2730 // ActivityDetected() |
2775 // ActivityDetected() |
2731 // ----------------------------------------------------------------------------- |
2776 // ----------------------------------------------------------------------------- |
2732 // |
2777 // |
2733 void CThumbnailStore::ActivityChanged(const TBool aActive) |
2778 void CThumbnailStore::ActivityChanged(const TBool aActive) |
2734 { |
2779 { |
2735 TN_DEBUG2( "CThumbnailStore::ActivityChanged() aActive == %d", aActive); |
2780 TN_DEBUG2( "CThumbnailStore::ActivityChanged() aActive == %d", aActive); |
|
2781 |
|
2782 if( iReadOnly ) |
|
2783 { |
|
2784 TN_DEBUG1( "CThumbnailStore::ActivityChanged() read only, skip..." ); |
|
2785 return; |
|
2786 } |
2736 |
2787 |
2737 if( aActive ) |
2788 if( aActive ) |
2738 { |
2789 { |
2739 iIdle = EFalse; |
2790 iIdle = EFalse; |
2740 } |
2791 } |