45 |
45 |
46 // Database path without drive letter |
46 // Database path without drive letter |
47 //Symbian^3 v4 |
47 //Symbian^3 v4 |
48 _LIT( KThumbnailDatabaseName, ":[102830AB]thumbnail_v4.db" ); |
48 _LIT( KThumbnailDatabaseName, ":[102830AB]thumbnail_v4.db" ); |
49 |
49 |
|
50 _LIT( KDrv, ":"); |
50 |
51 |
51 // Allow access to database only for the server process |
52 // Allow access to database only for the server process |
52 const TSecurityPolicy KThumbnailDatabaseSecurityPolicy( TSecureId( |
53 const TSecurityPolicy KThumbnailDatabaseSecurityPolicy( TSecureId( |
53 THUMBNAIL_MANAGER_SERVER_UID )); |
54 THUMBNAIL_MANAGER_SERVER_UID )); |
54 |
55 |
164 // --------------------------------------------------------------------------- |
165 // --------------------------------------------------------------------------- |
165 // CThumbnailStore::NewL() |
166 // CThumbnailStore::NewL() |
166 // Two-phased constructor. |
167 // Two-phased constructor. |
167 // --------------------------------------------------------------------------- |
168 // --------------------------------------------------------------------------- |
168 // |
169 // |
169 CThumbnailStore* CThumbnailStore::NewL( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly ) |
170 CThumbnailStore* CThumbnailStore::NewL( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer ) |
170 { |
171 { |
171 CThumbnailStore* self = new( ELeave )CThumbnailStore( aFs, aDrive, aImei, aServer, aReadOnly ); |
172 CThumbnailStore* self = new( ELeave )CThumbnailStore( aFs, aDrive, aImei, aServer ); |
172 CleanupStack::PushL( self ); |
173 CleanupStack::PushL( self ); |
173 self->ConstructL(); |
174 self->ConstructL(); |
174 CleanupStack::Pop( self ); |
175 CleanupStack::Pop( self ); |
175 return self; |
176 return self; |
176 } |
177 } |
220 // --------------------------------------------------------------------------- |
221 // --------------------------------------------------------------------------- |
221 // CThumbnailStore::CThumbnailStore() |
222 // CThumbnailStore::CThumbnailStore() |
222 // C++ default constructor can NOT contain any code, that might leave. |
223 // C++ default constructor can NOT contain any code, that might leave. |
223 // --------------------------------------------------------------------------- |
224 // --------------------------------------------------------------------------- |
224 // |
225 // |
225 CThumbnailStore::CThumbnailStore( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly ): |
226 CThumbnailStore::CThumbnailStore( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer ): |
226 iFs( aFs ), iDrive( aDrive ), iDriveChar( 0 ), iBatchItemCount(0), iImei(aImei), iServer(aServer), iDiskFullNotifier(NULL), |
227 iFs( aFs ), iDrive( aDrive ), iDriveChar( 0 ), iBatchItemCount(0), iImei(aImei), |
227 iDiskFull(EFalse), iActivityManager(NULL), iUnrecoverable(ETrue), iBatchFlushItemCount(KMInBatchItems), iReadOnly(aReadOnly) |
228 iServer(aServer), iDiskFull(EFalse), iUnrecoverable(ETrue), iBatchFlushItemCount(KMInBatchItems) |
228 { |
229 { |
229 // no implementation required |
230 // no implementation required |
230 } |
231 } |
231 |
232 |
232 // --------------------------------------------------------------------------- |
233 // --------------------------------------------------------------------------- |
239 TN_DEBUG1( "CThumbnailStore::ConstructL()" ); |
240 TN_DEBUG1( "CThumbnailStore::ConstructL()" ); |
240 |
241 |
241 #ifdef _DEBUG |
242 #ifdef _DEBUG |
242 iThumbCounter = 0; |
243 iThumbCounter = 0; |
243 #endif |
244 #endif |
244 if(!iReadOnly) |
245 |
245 { |
246 HBufC* databasePath = HBufC::NewLC( KMaxFileName ); |
246 HBufC* databasePath = HBufC::NewLC( KMaxFileName ); |
247 TPtr pathPtr = databasePath->Des(); |
247 TPtr pathPtr = databasePath->Des(); |
248 User::LeaveIfError( RFs::DriveToChar( iDrive, iDriveChar )); |
248 User::LeaveIfError( RFs::DriveToChar( iDrive, iDriveChar )); |
249 pathPtr.Append( iDriveChar ); |
249 pathPtr.Append( iDriveChar ); |
250 pathPtr.Append( KThumbnailDatabaseName ); |
250 pathPtr.Append( KThumbnailDatabaseName ); |
251 |
251 |
252 //start disk space monitor |
252 //start disk space monitor |
253 iDiskFullNotifier = CThumbnailStoreDiskSpaceNotifierAO::NewL( *this, |
253 iDiskFullNotifier = CThumbnailStoreDiskSpaceNotifierAO::NewL( *this, |
254 KDiskFullThreshold, |
254 KDiskFullThreshold, |
255 pathPtr ); |
255 pathPtr ); |
256 |
256 |
257 CleanupStack::PopAndDestroy( databasePath ); |
257 CleanupStack::PopAndDestroy( databasePath ); |
258 |
258 |
259 TN_DEBUG2( "CThumbnailStore::ConstructL() drive: %d", iDrive ); |
259 TN_DEBUG2( "CThumbnailStore::ConstructL() drive: %d", iDrive ); |
260 |
260 |
261 OpenDatabaseL(); |
261 OpenDatabaseL(); |
262 |
262 |
263 // to monitor device activity |
263 // to monitor device activity |
264 iActivityManager = CTMActivityManager::NewL( this, KStoreMaintenanceIdle); |
264 iActivityManager = CTMActivityManager::NewL( this, KStoreMaintenanceIdle); |
265 iActivityManager->Start(); |
265 iActivityManager->Start(); |
266 |
266 |
267 iDeleteThumbs = ETrue; |
267 iDeleteThumbs = ETrue; |
268 iCheckFilesExist = ETrue; |
268 iCheckFilesExist = ETrue; |
269 iLastCheckedRowID = -1; |
269 } |
|
270 else |
|
271 { |
|
272 TN_DEBUG1( "CThumbnailStore::ConstructL() - read only, dymmy mode..." ); |
|
273 iDeleteThumbs = EFalse; |
|
274 iCheckFilesExist = EFalse; |
|
275 iLastCheckedRowID = -1; |
|
276 } |
|
277 } |
270 } |
278 |
271 |
279 // --------------------------------------------------------------------------- |
272 // --------------------------------------------------------------------------- |
280 // OpenDatabaseL database file |
273 // OpenDatabaseL database file |
281 // --------------------------------------------------------------------------- |
274 // --------------------------------------------------------------------------- |
330 { |
323 { |
331 // db found, check version and rowids |
324 // db found, check version and rowids |
332 checkError = CheckVersion(); |
325 checkError = CheckVersion(); |
333 if(checkError == KErrNone) |
326 if(checkError == KErrNone) |
334 { |
327 { |
|
328 #ifdef _DEBUG |
|
329 TN_DEBUG1( "CThumbnailStore::OpenDatabaseL() start CheckRowIDs"); |
|
330 TTime aStart, aStop; |
|
331 aStart.UniversalTime(); |
|
332 #endif |
335 checkError = CheckRowIDs(); |
333 checkError = CheckRowIDs(); |
|
334 #ifdef _DEBUG |
|
335 aStop.UniversalTime(); |
|
336 TN_DEBUG2( "CThumbnailStore::OpenDatabaseL() CheckRowIDs took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); |
|
337 #endif |
336 } |
338 } |
337 } |
339 } |
338 |
340 |
339 // if db file not found, wrong version, corrupted database or other error opening db |
341 // if db file not found, wrong version, corrupted database or other error opening db |
340 if ( err != KErrNone || checkError == KErrNotSupported ) |
342 if ( err != KErrNone || checkError == KErrNotSupported ) |
1073 void CThumbnailStore::StoreThumbnailL( const TDesC& aPath, const TDes8& aData, |
1075 void CThumbnailStore::StoreThumbnailL( const TDesC& aPath, const TDes8& aData, |
1074 const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, |
1076 const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, |
1075 const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath ) |
1077 const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath ) |
1076 { |
1078 { |
1077 TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) in" ); |
1079 TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) in" ); |
1078 |
|
1079 if(iReadOnly) |
|
1080 { |
|
1081 TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() read only, skip..." ); |
|
1082 return; |
|
1083 } |
|
1084 |
1080 |
1085 #ifdef _DEBUG |
1081 #ifdef _DEBUG |
1086 TTime aStart, aStop; |
1082 TTime aStart, aStop; |
1087 aStart.UniversalTime(); |
1083 aStart.UniversalTime(); |
1088 #endif |
1084 #endif |
1230 aThumbnail, const TSize& aOriginalSize, TBool /*aCropped*/, const TThumbnailSize aThumbnailSize, |
1226 aThumbnail, const TSize& aOriginalSize, TBool /*aCropped*/, const TThumbnailSize aThumbnailSize, |
1231 const TInt64 aModified, TBool aThumbFromPath, TBool aBlackListed ) |
1227 const TInt64 aModified, TBool aThumbFromPath, TBool aBlackListed ) |
1232 { |
1228 { |
1233 TSize thumbSize = aThumbnail->SizeInPixels(); |
1229 TSize thumbSize = aThumbnail->SizeInPixels(); |
1234 TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight ); |
1230 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 } |
|
1241 |
1231 |
1242 __ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer )); |
1232 __ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer )); |
1243 |
1233 |
1244 User::LeaveIfError( CheckDbState() ); |
1234 User::LeaveIfError( CheckDbState() ); |
1245 |
1235 |
1274 if( aBlackListed ) |
1264 if( aBlackListed ) |
1275 { |
1265 { |
1276 flags |= KThumbnailDbFlagBlacklisted; |
1266 flags |= KThumbnailDbFlagBlacklisted; |
1277 } |
1267 } |
1278 |
1268 |
1279 if( (aThumbnailSize == EImageFullScreenThumbnailSize || |
1269 if( (aThumbnailSize == EImageFullScreenThumbnailSize || aThumbnailSize == EVideoFullScreenThumbnailSize || |
1280 aThumbnailSize == EVideoFullScreenThumbnailSize || |
1270 aThumbnailSize == EAudioFullScreenThumbnailSize) && !aBlackListed ) |
1281 aThumbnailSize == EAudioFullScreenThumbnailSize || |
|
1282 aThumbnailSize == EContactFullScreenThumbnailSize) && !aBlackListed ) |
|
1283 { |
1271 { |
1284 TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - encode jpg" ); |
1272 TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - encode jpg" ); |
1285 |
1273 |
1286 HBufC8* data = NULL; |
1274 HBufC8* data = NULL; |
1287 CleanupStack::PushL( data ); |
1275 CleanupStack::PushL( data ); |
1288 |
1276 |
1289 CImageEncoder* encoder = NULL; |
1277 CImageEncoder* encoder = NULL; |
1290 |
1278 TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::EHwImplementation, data, CImageEncoder::EOptionAlwaysThread ) ); |
1291 CImageEncoder::TOptions options = ( CImageEncoder::TOptions )( CImageEncoder::EOptionAlwaysThread ); |
|
1292 |
|
1293 TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::EHwImplementation, data, options ) ); |
|
1294 if ( decErr != KErrNone ) |
1279 if ( decErr != KErrNone ) |
1295 { |
1280 { |
1296 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder failed %d", decErr); |
1281 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder failed %d", decErr); |
1297 |
1282 |
1298 TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::ESwImplementation, data, options ) ); |
1283 TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::ESwImplementation, data, CImageEncoder::EOptionAlwaysThread ) ); |
1299 if ( decErr != KErrNone ) |
1284 if ( decErr != KErrNone ) |
1300 { |
1285 { |
1301 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder failed %d", decErr); |
1286 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder failed %d", decErr); |
1302 |
1287 |
1303 TRAPD( decErr, encoder = CImageEncoder::DataNewL( data, KJpegMime(), options ) ); |
1288 TRAPD( decErr, encoder = CImageEncoder::DataNewL( data, KJpegMime(), CImageEncoder::EOptionAlwaysThread ) ); |
1304 if ( decErr != KErrNone ) |
1289 if ( decErr != KErrNone ) |
1305 { |
1290 { |
1306 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder failed %d", decErr); |
1291 TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder failed %d", decErr); |
1307 |
1292 |
1308 User::Leave(decErr); |
1293 User::Leave(decErr); |
1331 TJpegImageData* imageData = new (ELeave) TJpegImageData(); |
1316 TJpegImageData* imageData = new (ELeave) TJpegImageData(); |
1332 CleanupStack::PushL( imageData ); |
1317 CleanupStack::PushL( imageData ); |
1333 |
1318 |
1334 // Set some format specific data |
1319 // Set some format specific data |
1335 imageData->iSampleScheme = TJpegImageData::EColor444; |
1320 imageData->iSampleScheme = TJpegImageData::EColor444; |
1336 imageData->iQualityFactor = 80; |
1321 imageData->iQualityFactor = 75; |
1337 |
1322 |
1338 // imageData - ownership passed to frameImageData after AppendImageData |
1323 // imageData - ownership passed to frameImageData after AppendImageData |
1339 User::LeaveIfError(frameImageData->AppendImageData(imageData)); |
1324 User::LeaveIfError(frameImageData->AppendImageData(imageData)); |
1340 CleanupStack::Pop( imageData ); |
1325 CleanupStack::Pop( imageData ); |
1341 |
1326 |
1380 stream.Open( *buf ); |
1365 stream.Open( *buf ); |
1381 aThumbnail->ExternalizeL( stream ); |
1366 aThumbnail->ExternalizeL( stream ); |
1382 |
1367 |
1383 StoreThumbnailL( *path, buf->Ptr( 0 ), aThumbnail->SizeInPixels(), |
1368 StoreThumbnailL( *path, buf->Ptr( 0 ), aThumbnail->SizeInPixels(), |
1384 aOriginalSize, EThumbnailFormatFbsBitmap, flags, |
1369 aOriginalSize, EThumbnailFormatFbsBitmap, flags, |
1385 aThumbnailSize, aModified, aThumbFromPath); |
1370 aThumbnailSize, aModified); |
1386 |
1371 |
1387 CleanupStack::PopAndDestroy( buf ); |
1372 CleanupStack::PopAndDestroy( buf ); |
1388 } |
1373 } |
1389 |
1374 |
1390 break; |
1375 break; |
1401 // --------------------------------------------------------------------------- |
1386 // --------------------------------------------------------------------------- |
1402 // |
1387 // |
1403 TBool CThumbnailStore::FindDuplicateL( const TDesC& aPath, const TThumbnailSize& aThumbnailSize ) |
1388 TBool CThumbnailStore::FindDuplicateL( const TDesC& aPath, const TThumbnailSize& aThumbnailSize ) |
1404 { |
1389 { |
1405 TN_DEBUG1( "CThumbnailStore::FindDuplicateL()" ); |
1390 TN_DEBUG1( "CThumbnailStore::FindDuplicateL()" ); |
1406 |
|
1407 if(iReadOnly) |
|
1408 { |
|
1409 TN_DEBUG1( "CThumbnailStore::FindDuplicateL() read only, skip..." ); |
|
1410 return EFalse; |
|
1411 } |
|
1412 |
1391 |
1413 User::LeaveIfError( CheckDbState() ); |
1392 User::LeaveIfError( CheckDbState() ); |
1414 |
1393 |
1415 TInt rowStatus = 0; |
1394 TInt rowStatus = 0; |
1416 TInt paramIndex = 0; |
1395 TInt paramIndex = 0; |
1502 // |
1481 // |
1503 void CThumbnailStore::GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray < |
1482 void CThumbnailStore::GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray < |
1504 TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly ) |
1483 TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly ) |
1505 { |
1484 { |
1506 TN_DEBUG2( "CThumbnailStore::GetMissingSizesL() aSourceType == %d", aSourceType ); |
1485 TN_DEBUG2( "CThumbnailStore::GetMissingSizesL() aSourceType == %d", aSourceType ); |
1507 |
|
1508 if(iReadOnly) |
|
1509 { |
|
1510 TN_DEBUG1( "CThumbnailStore::GetMissingSizesL() read only, skip..." ); |
|
1511 return; |
|
1512 } |
|
1513 |
1486 |
1514 User::LeaveIfError( CheckDbState() ); |
1487 User::LeaveIfError( CheckDbState() ); |
1515 |
1488 |
1516 HBufC* path = aPath.AllocLC(); |
1489 HBufC* path = aPath.AllocLC(); |
1517 TPtr ptr(path->Des()); |
1490 TPtr ptr(path->Des()); |
1617 // |
1590 // |
1618 void CThumbnailStore::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* & |
1591 void CThumbnailStore::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* & |
1619 aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aThumbnailRealSize ) |
1592 aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aThumbnailRealSize ) |
1620 { |
1593 { |
1621 TN_DEBUG3( "CThumbnailStore::FetchThumbnailL(%S) aThumbnailSize==%d", &aPath, aThumbnailSize ); |
1594 TN_DEBUG3( "CThumbnailStore::FetchThumbnailL(%S) aThumbnailSize==%d", &aPath, aThumbnailSize ); |
1622 |
|
1623 if(iReadOnly) |
|
1624 { |
|
1625 TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() read only, skip..." ); |
|
1626 User::Leave( KErrNotFound ); |
|
1627 } |
|
1628 |
1595 |
1629 User::LeaveIfError( CheckDbState() ); |
1596 User::LeaveIfError( CheckDbState() ); |
1630 |
1597 |
1631 HBufC* path = aPath.AllocLC(); |
1598 HBufC* path = aPath.AllocLC(); |
1632 TPtr ptr(path->Des()); |
1599 TPtr ptr(path->Des()); |
1748 void CThumbnailStore::DeleteThumbnailsL( const TDesC& aPath, TBool aForce, |
1715 void CThumbnailStore::DeleteThumbnailsL( const TDesC& aPath, TBool aForce, |
1749 TBool aTransaction ) |
1716 TBool aTransaction ) |
1750 { |
1717 { |
1751 TN_DEBUG2( "CThumbnailStore::DeleteThumbnailsL(%S)", &aPath ); |
1718 TN_DEBUG2( "CThumbnailStore::DeleteThumbnailsL(%S)", &aPath ); |
1752 |
1719 |
1753 if(iReadOnly) |
|
1754 { |
|
1755 TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsL() read only, skip..." ); |
|
1756 return; |
|
1757 } |
|
1758 |
|
1759 #ifdef _DEBUG |
1720 #ifdef _DEBUG |
1760 TTime aStart, aStop; |
1721 TTime aStart, aStop; |
1761 aStart.UniversalTime(); |
1722 aStart.UniversalTime(); |
1762 #endif |
1723 #endif |
1763 |
1724 |
1953 // |
1914 // |
1954 void CThumbnailStore::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath ) |
1915 void CThumbnailStore::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath ) |
1955 { |
1916 { |
1956 TN_DEBUG2( "CThumbnailStore::RenameThumbnailsL(%S)", &aCurrentPath ); |
1917 TN_DEBUG2( "CThumbnailStore::RenameThumbnailsL(%S)", &aCurrentPath ); |
1957 |
1918 |
1958 if(iReadOnly) |
|
1959 { |
|
1960 TN_DEBUG1( "CThumbnailStore::RenameThumbnailsL() read only, skip..." ); |
|
1961 return; |
|
1962 } |
|
1963 |
|
1964 #ifdef _DEBUG |
1919 #ifdef _DEBUG |
1965 TTime aStart, aStop; |
1920 TTime aStart, aStop; |
1966 aStart.UniversalTime(); |
1921 aStart.UniversalTime(); |
1967 #endif |
1922 #endif |
1968 |
1923 |
2047 void CThumbnailStore::FlushCacheTable( TBool aForce ) |
2002 void CThumbnailStore::FlushCacheTable( TBool aForce ) |
2048 { |
2003 { |
2049 TN_DEBUG1("CThumbnailStore::FlushCacheTable() in"); |
2004 TN_DEBUG1("CThumbnailStore::FlushCacheTable() in"); |
2050 |
2005 |
2051 StopAutoFlush(); |
2006 StopAutoFlush(); |
2052 |
|
2053 if(iReadOnly) |
|
2054 { |
|
2055 TN_DEBUG1( "CThumbnailStore::FlushCacheTable() read only, skip..." ); |
|
2056 return; |
|
2057 } |
|
2058 |
2007 |
2059 if(iBatchItemCount <= 0 || CheckDbState() != KErrNone) |
2008 if(iBatchItemCount <= 0 || CheckDbState() != KErrNone) |
2060 { |
2009 { |
2061 // cache empty or db unusable |
2010 // cache empty or db unusable |
2062 TN_DEBUG1( "CThumbnailStore::FlushCacheTable() error "); |
2011 TN_DEBUG1( "CThumbnailStore::FlushCacheTable() error "); |
2382 |
2325 |
2383 TBool CThumbnailStore::CheckModifiedByPathL( const TDesC& aPath, const TInt64 aModified, TBool& modifiedChanged ) |
2326 TBool CThumbnailStore::CheckModifiedByPathL( const TDesC& aPath, const TInt64 aModified, TBool& modifiedChanged ) |
2384 { |
2327 { |
2385 TN_DEBUG2( "CThumbnailStore::CheckModifiedByPathL() %S", &aPath); |
2328 TN_DEBUG2( "CThumbnailStore::CheckModifiedByPathL() %S", &aPath); |
2386 |
2329 |
2387 if(iReadOnly) |
|
2388 { |
|
2389 TN_DEBUG1( "CThumbnailStore::CheckModifiedByPathL() read only, skip..." ); |
|
2390 modifiedChanged = EFalse; |
|
2391 return ETrue; |
|
2392 } |
|
2393 |
|
2394 User::LeaveIfError( CheckDbState() ); |
2330 User::LeaveIfError( CheckDbState() ); |
2395 |
2331 |
2396 HBufC* path = aPath.AllocLC(); |
2332 HBufC* path = aPath.AllocLC(); |
2397 TPtr ptr(path->Des()); |
2333 TPtr ptr(path->Des()); |
2398 StripDriveLetterL( ptr ); |
2334 StripDriveLetterL( ptr ); |
2468 CleanupStack::PopAndDestroy( path ); |
2404 CleanupStack::PopAndDestroy( path ); |
2469 |
2405 |
2470 return ret; |
2406 return ret; |
2471 } |
2407 } |
2472 |
2408 |
2473 |
|
2474 // ----------------------------------------------------------------------------- |
|
2475 // IsReadOnly() |
|
2476 // ----------------------------------------------------------------------------- |
|
2477 // |
|
2478 TBool CThumbnailStore::IsReadOnly() |
|
2479 { |
|
2480 return iReadOnly; |
|
2481 } |
|
2482 |
|
2483 // ----------------------------------------------------------------------------- |
2409 // ----------------------------------------------------------------------------- |
2484 // PrepareBlacklistedItemsForRetryL() |
2410 // PrepareBlacklistedItemsForRetryL() |
2485 // ----------------------------------------------------------------------------- |
2411 // ----------------------------------------------------------------------------- |
2486 // |
2412 // |
2487 void CThumbnailStore::PrepareBlacklistedItemsForRetryL() |
2413 void CThumbnailStore::PrepareBlacklistedItemsForRetryL() |
2508 // ----------------------------------------------------------------------------- |
2434 // ----------------------------------------------------------------------------- |
2509 // |
2435 // |
2510 TInt CThumbnailStore::DeleteMarkedL() |
2436 TInt CThumbnailStore::DeleteMarkedL() |
2511 { |
2437 { |
2512 TN_DEBUG1( "CThumbnailStore::DeleteMarkedL()" ); |
2438 TN_DEBUG1( "CThumbnailStore::DeleteMarkedL()" ); |
2513 |
|
2514 if(iReadOnly) |
|
2515 { |
|
2516 TN_DEBUG1( "CThumbnailStore::DeleteMarkedL() read only, skip..." ); |
|
2517 return KErrAccessDenied; |
|
2518 } |
|
2519 |
2439 |
2520 #ifdef _DEBUG |
2440 #ifdef _DEBUG |
2521 TTime aStart, aStop; |
2441 TTime aStart, aStop; |
2522 aStart.UniversalTime(); |
2442 aStart.UniversalTime(); |
2523 #endif |
2443 #endif |
2605 // ----------------------------------------------------------------------------- |
2525 // ----------------------------------------------------------------------------- |
2606 // |
2526 // |
2607 TInt CThumbnailStore::FileExistenceCheckL() |
2527 TInt CThumbnailStore::FileExistenceCheckL() |
2608 { |
2528 { |
2609 TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL()" ); |
2529 TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL()" ); |
2610 |
|
2611 if(iReadOnly) |
|
2612 { |
|
2613 TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL() read only, skip..." ); |
|
2614 return ETrue; |
|
2615 } |
|
2616 |
2530 |
2617 #ifdef _DEBUG |
2531 #ifdef _DEBUG |
2618 TTime aStart, aStop; |
2532 TTime aStart, aStop; |
2619 aStart.UniversalTime(); |
2533 aStart.UniversalTime(); |
2620 #endif |
2534 #endif |
2709 // ----------------------------------------------------------------------------- |
2623 // ----------------------------------------------------------------------------- |
2710 // |
2624 // |
2711 void CThumbnailStore::StripDriveLetterL( TDes& aPath ) |
2625 void CThumbnailStore::StripDriveLetterL( TDes& aPath ) |
2712 { |
2626 { |
2713 TInt pos = aPath.Find(KDrv); |
2627 TInt pos = aPath.Find(KDrv); |
2714 TInt pos2 = aPath.Find(KBackSlash); |
|
2715 |
2628 |
2716 // if URI contains drive letter |
2629 // if URI contains drive letter |
2717 if ( pos == 1 ) |
2630 if ( pos == 1 ) |
2718 { |
2631 { |
2719 // normal URI |
2632 aPath.Delete(0,pos+1); |
2720 if ( pos2 == 2 ) |
|
2721 { |
|
2722 aPath.Delete(0,pos+1); |
|
2723 } |
|
2724 // virtual URI |
|
2725 else |
|
2726 { |
|
2727 aPath.Replace(0,2,KBackSlash); |
|
2728 } |
|
2729 } |
2633 } |
2730 } |
2634 } |
2731 |
2635 |
2732 // ----------------------------------------------------------------------------- |
2636 // ----------------------------------------------------------------------------- |
2733 // CheckDbState |
2637 // CheckDbState |
2734 // ----------------------------------------------------------------------------- |
2638 // ----------------------------------------------------------------------------- |
2735 // |
2639 // |
2736 TInt CThumbnailStore::CheckDbState() |
2640 TInt CThumbnailStore::CheckDbState() |
2737 { |
2641 { |
2738 if (iUnrecoverable && !iReadOnly) |
2642 if (iUnrecoverable) |
2739 { |
2643 { |
2740 TN_DEBUG1( "CThumbnailStore::CheckDbState() - database in unrecoverable state" ); |
2644 TN_DEBUG1( "CThumbnailStore::CheckDbState() - database in unrecoverable state" ); |
2741 __ASSERT_DEBUG( !iUnrecoverable, ThumbnailPanic( EThumbnailDatabaseUnrecoverable )); |
2645 __ASSERT_DEBUG( !iUnrecoverable, ThumbnailPanic( EThumbnailDatabaseUnrecoverable )); |
2742 |
2646 |
2743 return KStoreUnrecoverableErr; |
2647 return KStoreUnrecoverableErr; |
2763 TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceError() aError = %d", aError ); |
2667 TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceError() aError = %d", aError ); |
2764 } |
2668 } |
2765 |
2669 |
2766 TBool CThumbnailStore::IsDiskFull() |
2670 TBool CThumbnailStore::IsDiskFull() |
2767 { |
2671 { |
2768 if(iReadOnly) |
|
2769 { |
|
2770 TN_DEBUG1( "CThumbnailStore::IsDiskFull() read only, skip..." ); |
|
2771 return EFalse; |
|
2772 } |
|
2773 return iDiskFull; |
2672 return iDiskFull; |
2774 } |
2673 } |
2775 |
2674 |
2776 // ----------------------------------------------------------------------------- |
2675 // ----------------------------------------------------------------------------- |
2777 // ActivityDetected() |
2676 // ActivityDetected() |
2778 // ----------------------------------------------------------------------------- |
2677 // ----------------------------------------------------------------------------- |
2779 // |
2678 // |
2780 void CThumbnailStore::ActivityChanged(const TBool aActive) |
2679 void CThumbnailStore::ActivityChanged(const TBool aActive) |
2781 { |
2680 { |
2782 TN_DEBUG2( "CThumbnailStore::ActivityChanged() aActive == %d", aActive); |
2681 TN_DEBUG2( "CThumbnailStore::ActivityChanged() aActive == %d", aActive); |
2783 |
|
2784 if( iReadOnly ) |
|
2785 { |
|
2786 TN_DEBUG1( "CThumbnailStore::ActivityChanged() read only, skip..." ); |
|
2787 return; |
|
2788 } |
|
2789 |
2682 |
2790 if( aActive ) |
2683 if( aActive ) |
2791 { |
2684 { |
2792 iIdle = EFalse; |
2685 iIdle = EFalse; |
2793 } |
2686 } |