568 TN_DEBUG1( "CThumbnailServer::StoreThumbnailL() - file doesn't exists anymore, skip store!"); |
568 TN_DEBUG1( "CThumbnailServer::StoreThumbnailL() - file doesn't exists anymore, skip store!"); |
569 } |
569 } |
570 |
570 |
571 if( iFetchedChecker ) |
571 if( iFetchedChecker ) |
572 { |
572 { |
573 iFetchedChecker->SetFetchResult( aPath, KErrNone ); |
573 iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, KErrNone ); |
574 } |
574 } |
575 } |
575 } |
576 |
576 |
577 |
577 |
578 // ----------------------------------------------------------------------------- |
578 // ----------------------------------------------------------------------------- |
583 aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize ) |
583 aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize ) |
584 { |
584 { |
585 TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize ); |
585 TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize ); |
586 if( iFetchedChecker ) |
586 if( iFetchedChecker ) |
587 { |
587 { |
588 TInt err( iFetchedChecker->LastFetchResult( aPath ) ); |
588 TInt err( iFetchedChecker->LastFetchResult( aPath, aThumbnailSize ) ); |
589 if ( err == KErrNone ) // To avoid useless sql gets that fails for sure |
589 if ( err == KErrNone ) // To avoid useless sql gets that fails for sure |
590 { |
590 { |
591 // custom sizes are not stored to db, skip fetching |
591 // custom sizes are not stored to db, skip fetching |
592 if ( aThumbnailSize == ECustomThumbnailSize ) |
592 if ( aThumbnailSize == ECustomThumbnailSize ) |
593 { |
593 { |
595 } |
595 } |
596 |
596 |
597 TRAP( err, StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize) ); |
597 TRAP( err, StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize) ); |
598 if ( err != KErrNone ) |
598 if ( err != KErrNone ) |
599 { |
599 { |
600 iFetchedChecker->SetFetchResult( aPath, err ); |
600 iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, err ); |
601 } |
601 } |
602 } |
602 } |
603 User::LeaveIfError( err ); |
603 User::LeaveIfError( err ); |
604 } |
604 } |
605 else |
605 else |
664 |
664 |
665 StoreForPathL( aPath )->DeleteThumbnailsL( aPath ); |
665 StoreForPathL( aPath )->DeleteThumbnailsL( aPath ); |
666 |
666 |
667 if( iFetchedChecker ) |
667 if( iFetchedChecker ) |
668 { |
668 { |
669 iFetchedChecker->SetFetchResult( aPath, KErrNone ); |
669 iFetchedChecker->DeleteFetchResult( aPath ); |
670 } |
670 } |
671 } |
671 } |
672 |
672 |
673 // ----------------------------------------------------------------------------- |
673 // ----------------------------------------------------------------------------- |
674 // CThumbnailServer::ResolveMimeTypeL() |
674 // CThumbnailServer::ResolveMimeTypeL() |
942 { |
942 { |
943 res = * resPtr; |
943 res = * resPtr; |
944 } |
944 } |
945 else |
945 else |
946 { |
946 { |
947 if(iFormatting) |
947 if( iFormatting ) |
948 { |
948 { |
949 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT"); |
949 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT"); |
950 User::Leave( KErrNotSupported ); |
950 User::Leave( KErrNotSupported ); |
951 } |
951 } |
952 |
952 |
953 TVolumeInfo volumeInfo; |
953 TVolumeInfo volumeInfo; |
954 TInt err = iFs.Volume( volumeInfo, aDrive ); |
954 TInt err = iFs.Volume( volumeInfo, aDrive ); |
955 |
955 |
956 if ( err || volumeInfo.iDrive.iDriveAtt& KDriveAttRom || |
956 if ( err ) |
|
957 { |
|
958 // Locked |
|
959 TN_DEBUG2( "CThumbnailServer::StoreForDriveL() - err %d", err); |
|
960 User::Leave( err); |
|
961 } |
|
962 else if( volumeInfo.iDrive.iMediaAtt& KMediaAttLocked ) |
|
963 { |
|
964 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - locked"); |
|
965 User::Leave( KErrAccessDenied ); |
|
966 } |
|
967 else if ( volumeInfo.iDrive.iDriveAtt& KDriveAttRom || |
957 volumeInfo.iDrive.iDriveAtt& KDriveAttRemote || |
968 volumeInfo.iDrive.iDriveAtt& KDriveAttRemote || |
958 volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected || |
969 volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected ) |
959 volumeInfo.iDrive.iMediaAtt& KMediaAttLocked ) |
970 { |
960 { |
971 // We support ROM disks and remote disks in read only mode. |
961 // We don't support ROM disks or remote mounts. Media |
972 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - rom/remote/write protected"); |
962 // must be read-write and not locked. |
973 res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, ETrue ); |
963 User::Leave( KErrAccessDenied); |
974 } |
964 } |
975 else |
965 |
976 { |
966 res = CThumbnailStore::NewL( iFs, aDrive, iImei, this ); |
977 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - normal"); |
|
978 res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, EFalse ); |
|
979 } |
|
980 |
967 CleanupStack::PushL( res ); |
981 CleanupStack::PushL( res ); |
968 iStores.InsertL( aDrive, res ); |
982 iStores.InsertL( aDrive, res ); |
969 res->SetPersistentSizes(iPersistentSizes); |
983 res->SetPersistentSizes(iPersistentSizes); |
970 CleanupStack::Pop( res ); |
984 CleanupStack::Pop( res ); |
971 |
985 |
1293 // delete old thumbs |
1307 // delete old thumbs |
1294 store->DeleteThumbnailsL(aPath, ETrue); |
1308 store->DeleteThumbnailsL(aPath, ETrue); |
1295 |
1309 |
1296 if( iFetchedChecker ) |
1310 if( iFetchedChecker ) |
1297 { |
1311 { |
1298 iFetchedChecker->SetFetchResult( aPath, KErrNone ); |
1312 iFetchedChecker->DeleteFetchResult( aPath ); |
1299 } |
1313 } |
1300 |
1314 |
1301 // need to create new thumbs |
1315 // need to create new thumbs |
1302 } |
1316 } |
1303 else |
1317 else |
1325 |
1339 |
1326 StoreForPathL( aCurrentPath )->RenameThumbnailsL( aCurrentPath, aNewPath ); |
1340 StoreForPathL( aCurrentPath )->RenameThumbnailsL( aCurrentPath, aNewPath ); |
1327 |
1341 |
1328 if( iFetchedChecker ) |
1342 if( iFetchedChecker ) |
1329 { |
1343 { |
1330 iFetchedChecker->SetFetchResult( aNewPath, iFetchedChecker->LastFetchResult(aCurrentPath) ); |
1344 iFetchedChecker->RenameFetchResultL( aNewPath, aCurrentPath ); |
1331 iFetchedChecker->SetFetchResult( aCurrentPath, KErrNone ); |
|
1332 } |
1345 } |
1333 } |
1346 } |
1334 |
1347 |
1335 // ----------------------------------------------------------------------------- |
1348 // ----------------------------------------------------------------------------- |
1336 // CThumbnailServer::MimeTypeFromFileExt() |
1349 // CThumbnailServer::MimeTypeFromFileExt() |