imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp
branchRCL_3
changeset 38 2b4b06654caa
parent 37 f759b6186ab5
child 40 6257223ede8a
equal deleted inserted replaced
37:f759b6186ab5 38:2b4b06654caa
    41 
    41 
    42 _LIT8( KThumbnailMimeWildCard, "*" );
    42 _LIT8( KThumbnailMimeWildCard, "*" );
    43 _LIT8( KThumbnailMimeImage, "image" );
    43 _LIT8( KThumbnailMimeImage, "image" );
    44 _LIT8( KThumbnailMimeVideo, "video" );
    44 _LIT8( KThumbnailMimeVideo, "video" );
    45 _LIT8( KThumbnailMimeAudio, "audio" );
    45 _LIT8( KThumbnailMimeAudio, "audio" );
       
    46 _LIT8( KThumbnailMimeContact, "contact" );
    46 
    47 
    47 const TChar KThumbnailMimeSeparatorChar = '/';
    48 const TChar KThumbnailMimeSeparatorChar = '/';
    48 const TChar KThumbnailMimeWildCardChar = '*';
    49 const TChar KThumbnailMimeWildCardChar = '*';
    49 const TChar KThumbnailMimeTypeSeparatorChar = ' ';
    50 const TChar KThumbnailMimeTypeSeparatorChar = ' ';
    50 
    51 
   413         CActiveScheduler::Start();
   414         CActiveScheduler::Start();
   414         TN_DEBUG1( 
   415         TN_DEBUG1( 
   415             "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() out" );
   416             "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() out" );
   416         // Comes here if server gets shut down
   417         // Comes here if server gets shut down
   417         delete server;
   418         delete server;
       
   419         server = NULL;
   418         CleanupStack::PopAndDestroy( scheduler );
   420         CleanupStack::PopAndDestroy( scheduler );
   419         }
   421         }
   420     }
   422     }
   421 
   423 
   422 
   424 
   440     {
   442     {
   441     TN_DEBUG2( "CThumbnailServer::DropSession() iSessionCount was %d",
   443     TN_DEBUG2( "CThumbnailServer::DropSession() iSessionCount was %d",
   442         iSessionCount );
   444         iSessionCount );
   443     iSessionCount--;
   445     iSessionCount--;
   444     
   446     
   445     iProcessor->RemoveTasks(aSession);
   447     if(iProcessor)
       
   448         {
       
   449         iProcessor->RemoveTasks(aSession);
       
   450         }
   446     
   451     
   447     TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession );        
   452     TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession );        
   448     
   453     
   449     // clean-up bitmap pool    
   454     // clean-up bitmap pool    
   450     THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
   455     THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
   456         {        
   461         {        
   457         if ( ref->iSession == aSession )
   462         if ( ref->iSession == aSession )
   458             {
   463             {
   459             TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
   464             TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
   460         
   465         
   461             delete ref->iBitmap;            
   466             delete ref->iBitmap;
   462             bpiter.RemoveCurrent();
   467             bpiter.RemoveCurrent();
   463                         
   468                         
   464             TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count());
   469             TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count());
   465             }
   470             }
   466         
   471         
   553 #endif
   558 #endif
   554     
   559     
   555     if (!aCheckExist)
   560     if (!aCheckExist)
   556         {
   561         {
   557         StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
   562         StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
   558                        aCropped, aThumbnailSize, aModified, aThumbFromPath );
   563                        aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse );
   559         }    
   564         }    
   560     else if(BaflUtils::FileExists( iFs, aPath))
   565     else if(BaflUtils::FileExists( iFs, aPath))
   561         {
   566         {
   562         StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
   567         StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
   563                        aCropped, aThumbnailSize, aModified, aThumbFromPath );
   568                        aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse );
   564         }
   569         }
   565     else
   570     else
   566         {
   571         {
   567         TN_DEBUG1( "CThumbnailServer::StoreThumbnailL() - file doesn't exists anymore, skip store!");
   572         TN_DEBUG1( "CThumbnailServer::StoreThumbnailL() - file doesn't exists anymore, skip store!");
   568         }
   573         }
   569     
   574     
   570     if( iFetchedChecker )    
   575     if( iFetchedChecker )    
   571         {
   576         {
   572         iFetchedChecker->SetFetchResult( aPath, KErrNone );
   577         iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, KErrNone );
   573         }
   578         }
   574     }
   579     }
   575 
   580 
   576 
   581 
   577 // -----------------------------------------------------------------------------
   582 // -----------------------------------------------------------------------------
   582     aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize )
   587     aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize )
   583     {
   588     {
   584     TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize );
   589     TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize );
   585     if( iFetchedChecker )
   590     if( iFetchedChecker )
   586         {
   591         {
   587         TInt err( iFetchedChecker->LastFetchResult( aPath ) );
   592         TInt err( iFetchedChecker->LastFetchResult( aPath, aThumbnailSize ) );
   588         if ( err == KErrNone ) // To avoid useless sql gets that fails for sure
   593         if ( err == KErrNone ) // To avoid useless sql gets that fails for sure
   589             {
   594             {
   590             // custom sizes are not stored to db, skip fetching
   595             // custom sizes are not stored to db, skip fetching
   591             if ( aThumbnailSize == ECustomThumbnailSize )
   596             if ( aThumbnailSize == ECustomThumbnailSize )
   592                 {
   597                 {
   594                 }
   599                 }
   595         
   600         
   596             TRAP( err, StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize) );
   601             TRAP( err, StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize) );
   597             if ( err != KErrNone )
   602             if ( err != KErrNone )
   598                 {
   603                 {
   599                 iFetchedChecker->SetFetchResult( aPath, err );
   604                 iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, err );
   600                 }
   605                 }
   601             }
   606             }
   602         User::LeaveIfError( err );
   607         User::LeaveIfError( err );
   603         }
   608         }
   604     else
   609     else
   663     
   668     
   664     StoreForPathL( aPath )->DeleteThumbnailsL( aPath );
   669     StoreForPathL( aPath )->DeleteThumbnailsL( aPath );
   665     
   670     
   666     if( iFetchedChecker ) 
   671     if( iFetchedChecker ) 
   667         {
   672         {
   668         iFetchedChecker->SetFetchResult( aPath, KErrNone );
   673         iFetchedChecker->DeleteFetchResult( aPath );
   669         }
   674         }
   670     }
   675     }
   671 
   676 
   672 // -----------------------------------------------------------------------------
   677 // -----------------------------------------------------------------------------
   673 // CThumbnailServer::ResolveMimeTypeL()
   678 // CThumbnailServer::ResolveMimeTypeL()
   849         TN_DEBUG2( "CThumbnailServer::DequeTask() - ref->iRequestId = %d", ref->iRequestId );
   854         TN_DEBUG2( "CThumbnailServer::DequeTask() - ref->iRequestId = %d", ref->iRequestId );
   850 
   855 
   851         if ( ref->iSession == aRequestId.iSession && 
   856         if ( ref->iSession == aRequestId.iSession && 
   852              ref->iRequestId == aRequestId.iRequestId )
   857              ref->iRequestId == aRequestId.iRequestId )
   853             {            
   858             {            
   854             delete ref->iBitmap;            
   859             delete ref->iBitmap;
   855             bpiter.RemoveCurrent();                        
   860             bpiter.RemoveCurrent();                        
   856                         
   861                         
   857             TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d", 
   862             TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d", 
   858                     iBitmapPool.Count());
   863                     iBitmapPool.Count());
   859             }
   864             }
   941         {
   946         {
   942         res = * resPtr;
   947         res = * resPtr;
   943         }
   948         }
   944     else
   949     else
   945         {
   950         {
   946         if(iFormatting)
   951         if( iFormatting )
   947            {
   952            {
   948            TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT");
   953            TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT");
   949            User::Leave( KErrNotSupported );
   954            User::Leave( KErrNotSupported );
   950            } 
   955            } 
   951         
   956         
   952         TVolumeInfo volumeInfo;
   957         TVolumeInfo volumeInfo;
   953         TInt err = iFs.Volume( volumeInfo, aDrive );
   958         TInt err = iFs.Volume( volumeInfo, aDrive );
   954         
   959         
   955         if ( err || volumeInfo.iDrive.iDriveAtt& KDriveAttRom ||
   960         if ( err )
       
   961             {
       
   962             // Locked
       
   963             TN_DEBUG2( "CThumbnailServer::StoreForDriveL() - err %d", err);
       
   964             User::Leave( err);
       
   965             }
       
   966         else if( volumeInfo.iDrive.iMediaAtt& KMediaAttLocked )
       
   967             {
       
   968             TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - locked");
       
   969             User::Leave( KErrAccessDenied );
       
   970             }
       
   971 		else if ( volumeInfo.iDrive.iDriveAtt& KDriveAttRom ||
   956             volumeInfo.iDrive.iDriveAtt& KDriveAttRemote ||
   972             volumeInfo.iDrive.iDriveAtt& KDriveAttRemote ||
   957             volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected ||
   973             volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected )
   958             volumeInfo.iDrive.iMediaAtt& KMediaAttLocked )
   974             {
   959             {
   975             // We support ROM disks and remote disks in read only mode.
   960             // We don't support ROM disks or remote mounts. Media
   976             TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - rom/remote/write protected");
   961             // must be read-write and not locked.
   977             res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, ETrue );
   962             User::Leave( KErrAccessDenied);
   978             }
   963             }
   979         else
   964         
   980             {
   965         res = CThumbnailStore::NewL( iFs, aDrive, iImei, this );
   981             TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - normal");
       
   982             res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, EFalse );
       
   983             }
       
   984 			
   966         CleanupStack::PushL( res );
   985         CleanupStack::PushL( res );
   967         iStores.InsertL( aDrive, res );
   986         iStores.InsertL( aDrive, res );
   968         res->SetPersistentSizes(iPersistentSizes);
   987         res->SetPersistentSizes(iPersistentSizes);
   969         CleanupStack::Pop( res );
   988         CleanupStack::Pop( res );
   970         
   989         
  1054     StartUnmountTimeout( aDrive);
  1073     StartUnmountTimeout( aDrive);
  1055     
  1074     
  1056     if (store)
  1075     if (store)
  1057         {
  1076         {
  1058         delete *store;
  1077         delete *store;
       
  1078         *store = NULL;
  1059         iStores.Remove( aDrive );
  1079         iStores.Remove( aDrive );
  1060         }
  1080         }
  1061     }
  1081     }
  1062 
  1082 
  1063 
  1083 
  1142         if( !driveList[drive] ) 
  1162         if( !driveList[drive] ) 
  1143            {
  1163            {
  1144           // If drive-list entry is zero, drive is not available
  1164           // If drive-list entry is zero, drive is not available
  1145             continue;
  1165             continue;
  1146            }
  1166            }
  1147             
  1167 
  1148         TInt err = iFs.Volume(volumeInfo, drive);
  1168         TInt err = iFs.Volume(volumeInfo, drive);
  1149         TInt err_drive = iFs.Drive(driveInfo, drive);    
  1169         TInt err_drive = iFs.Drive(driveInfo, drive);    
  1150         
  1170         
  1151         // mount -- if removable drive, add new store
  1171         // mount -- if removable drive, add new store
  1152         if (!err && !err_drive 
  1172         if (!err && !err_drive 
  1164                 }
  1184                 }
  1165             
  1185             
  1166             // ignore errors
  1186             // ignore errors
  1167             TRAP_IGNORE( StoreForDriveL( drive ));
  1187             TRAP_IGNORE( StoreForDriveL( drive ));
  1168             
  1188             
  1169             TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() update KItemsleft == %d", KErrNotReady);
  1189             TUint driveStatus(0);
  1170             RProperty::Set(KTAGDPSNotification, KItemsleft, KErrNotReady );
  1190             DriveInfo::GetDriveStatus(iFs, drive, driveStatus);
       
  1191             TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() driveStatus = %d", driveStatus);
       
  1192             if (!(driveStatus & DriveInfo::EDriveUsbMemory) && 
       
  1193 			    !(driveStatus & DriveInfo::EDriveRemote))
       
  1194                 {
       
  1195                 TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() update KItemsleft = %d", KErrNotReady);
       
  1196                 RProperty::Set(KTAGDPSNotification, KItemsleft, KErrNotReady );
       
  1197                 }
  1171 			
  1198 			
  1172             TInt index = iUnmountedDrives.Find( drive );
  1199             TInt index = iUnmountedDrives.Find( drive );
  1173             
  1200             
  1174             if(index >= KErrNone)
  1201             if(index >= KErrNone)
  1175                 {
  1202                 {
  1250                                            const TInt /*aOrientation*/, const TInt64 aModified )
  1277                                            const TInt /*aOrientation*/, const TInt64 aModified )
  1251     {
  1278     {
  1252     TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL()");
  1279     TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL()");
  1253     
  1280     
  1254     // 1. check path change
  1281     // 1. check path change
  1255     // 2. check orientation change
  1282     // 2. check timestamp change
  1256     // 3. check timestamp change
       
  1257 
       
  1258     TBool orientationChanged = EFalse;
       
  1259     TBool modifiedChanged = EFalse;
  1283     TBool modifiedChanged = EFalse;
  1260     
  1284     
  1261     CThumbnailStore* store = StoreForPathL( aPath );
  1285     CThumbnailStore* store = StoreForPathL( aPath );
  1262    
  1286    
  1263     // placeholder for orientation check
  1287     TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exist");
  1264     orientationChanged = EFalse;
  1288         
  1265     
  1289     TBool exists = store->CheckModifiedByPathL(aPath, aModified, modifiedChanged);
  1266     if (orientationChanged)
  1290        
  1267         {
  1291     if(!exists)
  1268         TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - orientation updated");
  1292         {
  1269         
  1293         TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exists NO");
  1270         // orientation updated, no need to check further
  1294         //not found, needs to be generated
       
  1295         return EFalse;
       
  1296         }
       
  1297     
       
  1298     TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified ?");
       
  1299     
       
  1300     if (modifiedChanged)
       
  1301         {
       
  1302         TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified YES");
       
  1303             
       
  1304         // delete old thumbs
       
  1305         store->DeleteThumbnailsL(aPath, ETrue);
       
  1306             
       
  1307         if( iFetchedChecker ) 
       
  1308             {
       
  1309             iFetchedChecker->DeleteFetchResult( aPath );
       
  1310             }
       
  1311             
       
  1312         // need to create new thumbs
       
  1313         }
       
  1314     else
       
  1315         {
       
  1316         TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified NO");
       
  1317         
       
  1318         // not modified
  1271         return ETrue;
  1319         return ETrue;
  1272         }
  1320         }
  1273     else
       
  1274         {
       
  1275         TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exist");
       
  1276         
       
  1277         TBool exists = store->CheckModifiedByPathL(aPath, aModified, modifiedChanged);
       
  1278        
       
  1279         if(!exists)
       
  1280             {
       
  1281             TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exists NO");
       
  1282             //not found, needs to be generated
       
  1283             return EFalse;
       
  1284             }
       
  1285         
       
  1286         TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified ?");
       
  1287         
       
  1288         if (modifiedChanged)
       
  1289             {
       
  1290             TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified YES");
       
  1291             
       
  1292             // delete old thumbs
       
  1293             store->DeleteThumbnailsL(aPath, ETrue);
       
  1294             
       
  1295             if( iFetchedChecker ) 
       
  1296                 {
       
  1297                 iFetchedChecker->SetFetchResult( aPath, KErrNone );
       
  1298                 }
       
  1299             
       
  1300             // need to create new thumbs
       
  1301             }
       
  1302         else
       
  1303             {
       
  1304             TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified NO");
       
  1305             
       
  1306             // not modified
       
  1307             return ETrue;
       
  1308             }
       
  1309         }
       
  1310   
       
  1311     
  1321     
  1312     TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - no thumbs found, create new");
  1322     TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - no thumbs found, create new");
  1313     
  1323     
  1314     return EFalse;
  1324     return EFalse;
  1315     }
  1325     }
  1324     
  1334     
  1325     StoreForPathL( aCurrentPath )->RenameThumbnailsL( aCurrentPath, aNewPath );
  1335     StoreForPathL( aCurrentPath )->RenameThumbnailsL( aCurrentPath, aNewPath );
  1326     
  1336     
  1327     if( iFetchedChecker ) 
  1337     if( iFetchedChecker ) 
  1328         {
  1338         {
  1329         iFetchedChecker->SetFetchResult( aNewPath, iFetchedChecker->LastFetchResult(aCurrentPath) );
  1339         iFetchedChecker->RenameFetchResultL( aNewPath, aCurrentPath );
  1330         iFetchedChecker->SetFetchResult( aCurrentPath, KErrNone );
       
  1331         }
  1340         }
  1332     }
  1341     }
  1333 
  1342 
  1334 // -----------------------------------------------------------------------------
  1343 // -----------------------------------------------------------------------------
  1335 // CThumbnailServer::MimeTypeFromFileExt()
  1344 // CThumbnailServer::MimeTypeFromFileExt()
  1336 // -----------------------------------------------------------------------------
  1345 // -----------------------------------------------------------------------------
  1337 //
  1346 //
  1338 TInt CThumbnailServer::MimeTypeFromFileExt( const TDesC& aFileName, TDataType& aMimeType )
  1347 TInt CThumbnailServer::MimeTypeFromFileExt( const TDesC& aFileName, TDataType& aMimeType )
  1339     {
  1348     {
  1340     TBool found = ETrue;
  1349     TBool found = ETrue;
  1341     TParsePtrC parse( aFileName );
  1350     TPtrC ext( aFileName.Right(KExtLength) ); // tparse panics with virtual URI
  1342     TPtrC ext( parse.Ext() );
       
  1343     
  1351     
  1344     if ( ext.CompareF( KJpegExt ) == 0 || ext.CompareF( KJpgExt ) == 0)
  1352     if ( ext.CompareF( KJpegExt ) == 0 || ext.CompareF( KJpgExt ) == 0)
  1345         {
  1353         {
  1346         aMimeType = TDataType( KJpegMime );
  1354         aMimeType = TDataType( KJpegMime );
  1347         }
  1355         }
  1447         } 
  1455         } 
  1448     else if ( ext.CompareF( KMatroskaVideoExt ) == 0 )
  1456     else if ( ext.CompareF( KMatroskaVideoExt ) == 0 )
  1449         {
  1457         {
  1450         aMimeType = TDataType( KMatroskaVideoMime );
  1458         aMimeType = TDataType( KMatroskaVideoMime );
  1451         } 
  1459         } 
       
  1460     else if ( ext.CompareF( KContactExt ) == 0 )
       
  1461         {
       
  1462         aMimeType = TDataType( KContactMime );
       
  1463         } 
       
  1464     else if ( ext.CompareF( KAlbumArtExt ) == 0 )
       
  1465         {
       
  1466         aMimeType = TDataType( KAlbumArtMime );
       
  1467         }
  1452     else
  1468     else
  1453         {
  1469         {
  1454         aMimeType = TDataType( KNullDesC8 );
  1470         aMimeType = TDataType( KNullDesC8 );
  1455         found = EFalse;
  1471         found = EFalse;
  1456         }
  1472         }
  1483         return TThumbnailPersistentSize::EVideo;
  1499         return TThumbnailPersistentSize::EVideo;
  1484         }
  1500         }
  1485     else if (mediaType.Compare(KThumbnailMimeAudio) == 0)
  1501     else if (mediaType.Compare(KThumbnailMimeAudio) == 0)
  1486         {
  1502         {
  1487         return TThumbnailPersistentSize::EAudio;
  1503         return TThumbnailPersistentSize::EAudio;
       
  1504         }
       
  1505     else if (mediaType.Compare(KThumbnailMimeContact) == 0)
       
  1506         {
       
  1507         return TThumbnailPersistentSize::EContact;
  1488         }
  1508         }
  1489 
  1509 
  1490     return TThumbnailPersistentSize::EUnknownSourceType;        
  1510     return TThumbnailPersistentSize::EUnknownSourceType;        
  1491     }
  1511     }
  1492 
  1512 
  1513         case EAudioGridThumbnailSize:
  1533         case EAudioGridThumbnailSize:
  1514         case EAudioListThumbnailSize:
  1534         case EAudioListThumbnailSize:
  1515         case EAudioFullScreenThumbnailSize:
  1535         case EAudioFullScreenThumbnailSize:
  1516             sourceType = TThumbnailPersistentSize::EAudio;
  1536             sourceType = TThumbnailPersistentSize::EAudio;
  1517             break;
  1537             break;
       
  1538         case EContactListThumbnailSize:
       
  1539         case EContactGridThumbnailSize:
       
  1540         case EContactFullScreenThumbnailSize:
       
  1541             sourceType = TThumbnailPersistentSize::EContact;
       
  1542             break;
  1518         default:
  1543         default:
  1519             sourceType = TThumbnailPersistentSize::EUnknownSourceType;  
  1544             sourceType = TThumbnailPersistentSize::EUnknownSourceType;  
  1520         }
  1545         }
  1521     
  1546     
  1522     return sourceType;
  1547     return sourceType;
  1532     
  1557     
  1533     if ( mimeType.CompareF( KJpegMime ) == 0 || 
  1558     if ( mimeType.CompareF( KJpegMime ) == 0 || 
  1534          mimeType.CompareF( KJpeg2000Mime ) == 0 ||
  1559          mimeType.CompareF( KJpeg2000Mime ) == 0 ||
  1535          mimeType.CompareF( KGifMime ) == 0 ||
  1560          mimeType.CompareF( KGifMime ) == 0 ||
  1536          mimeType.CompareF( KPngMime ) == 0 ||
  1561          mimeType.CompareF( KPngMime ) == 0 ||
  1537          mimeType.CompareF( KBmpMime ) == 0 ||
  1562          mimeType.CompareF( KSvgMime ) == 0 ||
  1538          mimeType.CompareF( KMpgMime1 ) == 0 ||
  1563          mimeType.CompareF( KMpgMime1 ) == 0 ||
  1539          mimeType.CompareF( KMpeg4Mime ) == 0 ||
  1564          mimeType.CompareF( KMpeg4Mime ) == 0 ||
  1540          mimeType.CompareF( KMp4Mime ) == 0 ||
  1565          mimeType.CompareF( KMp4Mime ) == 0 ||
  1541          mimeType.CompareF( KAviMime ) == 0 ||
  1566          mimeType.CompareF( KAviMime ) == 0 ||
  1542          mimeType.CompareF( KVideo3gppMime ) == 0 ||
       
  1543          mimeType.CompareF( KVideoWmvMime ) == 0 ||
       
  1544          mimeType.CompareF( KRealVideoMime ) == 0 ||
       
  1545          mimeType.CompareF( KMp3Mime ) == 0 ||
  1567          mimeType.CompareF( KMp3Mime ) == 0 ||
       
  1568          mimeType.CompareF( KNonEmbeddArtMime ) == 0 ||
       
  1569          mimeType.CompareF( KM4aMime ) == 0  ||
  1546          mimeType.CompareF( KAacMime ) == 0 ||
  1570          mimeType.CompareF( KAacMime ) == 0 ||
  1547          mimeType.CompareF( KWmaMime ) == 0 ||
  1571          mimeType.CompareF( KWmaMime ) == 0 ||
       
  1572          mimeType.CompareF( KBmpMime ) == 0 ||         
       
  1573          mimeType.CompareF( KAudio3gppMime ) == 0 ||
       
  1574          mimeType.CompareF( KVideo3gppMime ) == 0 ||
  1548          mimeType.CompareF( KAudioAmrMime ) == 0 ||
  1575          mimeType.CompareF( KAudioAmrMime ) == 0 ||
       
  1576          mimeType.CompareF( KVideoWmvMime ) == 0 ||
  1549          mimeType.CompareF( KRealAudioMime ) == 0 ||
  1577          mimeType.CompareF( KRealAudioMime ) == 0 ||
  1550          mimeType.CompareF( KM4aMime ) == 0  ||
  1578          mimeType.CompareF( KPmRealAudioPluginMime ) == 0 ||
  1551          mimeType.CompareF( KFlashVideoMime ) == 0 ||
       
  1552          mimeType.CompareF( KPmRealVideoPluginMime ) == 0 ||
  1579          mimeType.CompareF( KPmRealVideoPluginMime ) == 0 ||
  1553          mimeType.CompareF( KPmRealVbVideoPluginMime ) == 0 ||
  1580          mimeType.CompareF( KPmRealVbVideoPluginMime ) == 0 ||
  1554          mimeType.CompareF( KPmRealAudioPluginMime ) == 0 )
  1581          mimeType.CompareF( KRealVideoMime ) == 0 ||
       
  1582          mimeType.CompareF( KFlashVideoMime ) == 0 ||
       
  1583          mimeType.CompareF( KMatroskaVideoMime ) == 0 ||
       
  1584          mimeType.CompareF( KContactMime ) == 0 ||
       
  1585          mimeType.CompareF( KAlbumArtMime ) == 0 )
  1555         {
  1586         {
  1556         return ETrue;
  1587         return ETrue;
  1557         }
  1588         }
  1558     
  1589     
  1559     return EFalse;
  1590     return EFalse;
  1583         TRAP( result, CThumbnailServer::ThreadFunctionL());
  1614         TRAP( result, CThumbnailServer::ThreadFunctionL());
  1584         TN_DEBUG2( 
  1615         TN_DEBUG2( 
  1585             "CThumbnailServer::E32Main() -- thread function out, result=%d",
  1616             "CThumbnailServer::E32Main() -- thread function out, result=%d",
  1586             result );
  1617             result );
  1587         delete cleanup;
  1618         delete cleanup;
       
  1619         cleanup = NULL;
  1588         }
  1620         }
  1589     if ( result != KErrNone )
  1621     if ( result != KErrNone )
  1590         {
  1622         {
  1591         // Signal the client that server creation failed
  1623         // Signal the client that server creation failed
  1592         TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() in" );
  1624         TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() in" );