Revision: 201033 RCL_3 PDK_3.0.3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 14 Sep 2010 21:55:34 +0300
branchRCL_3
changeset 47 3d743e824514
parent 41 9d4d3445ce6e
child 50 60bb012f1157
Revision: 201033 Kit: 201035
imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h
imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp
imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h	Wed Sep 01 12:20:35 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h	Tue Sep 14 21:55:34 2010 +0300
@@ -95,7 +95,7 @@
      *                    ThumbnailReady callback.
      * @param aTargetUri         Target URI to which the imported thumbnail is linked.
      */
-    void GetThumbnailL( const RFile64& aFile, TThumbnailId aThumbnailId,
+    void GetThumbnailL( const RFile64& aFile, TThumbnailId aThumbnailId, const TDesC8& aMimeType,
         CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager::TThumbnailQualityPreference
         aQualityPreference, const TSize& aSize, const TDisplayMode aDisplayMode,
         const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri = KNullDesC,
@@ -117,7 +117,7 @@
      *                    ThumbnailReady callback.
      * @param aTargetUri         Target URI to which the imported thumbnail is linked.
      */
-    void GetThumbnailL( TThumbnailId aThumbnailId, const TDesC& aPath,
+    void GetThumbnailL( TThumbnailId aThumbnailId, const TDesC& aPath, const TDesC8& aMimeType,
         CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager::TThumbnailQualityPreference
         aQualityPreference, const TSize& aSize, const TDisplayMode aDisplayMode,
         const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri = KNullDesC,
@@ -142,7 +142,7 @@
      * @param aThumbnailSize Relative thumbnail size
      */
     void GetThumbnailL( const TDesC& aPath, TThumbnailId aThumbnailId,
-        CThumbnailManager::TThumbnailFlags aFlags, 
+        const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, 
         CThumbnailManager::TThumbnailQualityPreference aQualityPreference, 
         const TSize& aSize, const TDisplayMode aDisplayMode, const TInt aPriority, 
         TAny* aClientData, TBool aGeneratePersistentSizesOnly, 
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp	Wed Sep 01 12:20:35 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp	Tue Sep 14 21:55:34 2010 +0300
@@ -172,21 +172,21 @@
     
     if(aObjectSource.Id() > 0)
         {
-        getThumbnailActive->GetThumbnailL( aObjectSource.Uri(), aObjectSource.Id(), iFlags,
-            iQualityPreference, iSize, iDisplayMode, priority, aClientData, aGeneratePersistentSizesOnly,
-            KNullDesC, iThumbnailSize);
+        getThumbnailActive->GetThumbnailL( aObjectSource.Uri(), aObjectSource.Id(), 
+            aObjectSource.MimeType(),iFlags, iQualityPreference, iSize, iDisplayMode, 
+            priority, aClientData, aGeneratePersistentSizesOnly, KNullDesC, iThumbnailSize);
         }
     else if ( aObjectSource.Uri().Length())
         {
-        getThumbnailActive->GetThumbnailL( aObjectSource.Uri(), aObjectSource.Id(), iFlags,
-            iQualityPreference, iSize, iDisplayMode, priority, aClientData, aGeneratePersistentSizesOnly,
-            KNullDesC, iThumbnailSize );
+        getThumbnailActive->GetThumbnailL( aObjectSource.Uri(), aObjectSource.Id(),
+            aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode, 
+            priority, aClientData, aGeneratePersistentSizesOnly, KNullDesC, iThumbnailSize );
         }
     else
         {
-        getThumbnailActive->GetThumbnailL( aObjectSource.FileHandle(), aObjectSource.Id(), iFlags,
-            iQualityPreference, iSize, iDisplayMode, priority, aClientData, aGeneratePersistentSizesOnly,
-            KNullDesC, iThumbnailSize );
+        getThumbnailActive->GetThumbnailL( aObjectSource.FileHandle(), aObjectSource.Id(), 
+            aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode, 
+            priority, aClientData, aGeneratePersistentSizesOnly, KNullDesC, iThumbnailSize );
         }
     
     iRequestQueue->AddRequestL( getThumbnailActive );
@@ -231,9 +231,9 @@
         ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
     CleanupStack::PushL( getThumbnailActive );
     
-    getThumbnailActive->GetThumbnailL( KNullDesC, aThumbnailId, iFlags,
-                       iQualityPreference, iSize, iDisplayMode, priority, aClientData,
-                       EFalse, KNullDesC, iThumbnailSize );
+    getThumbnailActive->GetThumbnailL( KNullDesC, aThumbnailId, KNullDesC8,
+            iFlags, iQualityPreference, iSize, iDisplayMode, priority, aClientData,
+            EFalse, KNullDesC, iThumbnailSize );
     
     iRequestQueue->AddRequestL( getThumbnailActive );
     CleanupStack::Pop( getThumbnailActive );
@@ -267,15 +267,15 @@
 
     if ( aObjectSource.Uri().Length())
         {
-        getThumbnailActive->GetThumbnailL( aObjectSource.Uri(), aObjectSource.Id(), iFlags,
-            iQualityPreference, iSize, iDisplayMode, priority, aClientData,
-            EFalse, aTargetUri, iThumbnailSize );
+        getThumbnailActive->GetThumbnailL( aObjectSource.Uri(), aObjectSource.Id(), 
+            aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode, 
+            priority, aClientData, EFalse, aTargetUri, iThumbnailSize );
         }
     else
         {
         getThumbnailActive->GetThumbnailL( aObjectSource.FileHandle(), aObjectSource.Id(), 
-            iFlags, iQualityPreference, iSize, iDisplayMode, priority, aClientData,
-            EFalse, aTargetUri, iThumbnailSize );
+            aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode,
+            priority, aClientData, EFalse, aTargetUri, iThumbnailSize );
         }
     
     iRequestQueue->AddRequestL( getThumbnailActive );
@@ -374,9 +374,9 @@
 		else if( !aObjectSource.Buffer() )
 			{        
 			getThumbnailActive->GetThumbnailL( aObjectSource.Id(), 
-						 aObjectSource.Uri(), iFlags, iQualityPreference, iSize,
-						 iDisplayMode, priority, NULL, ETrue, aObjectSource.Uri(), 
-						 EUnknownThumbnailSize);      
+						 aObjectSource.Uri(), aObjectSource.MimeType(), iFlags, 
+						 iQualityPreference, iSize, iDisplayMode, priority, NULL, 
+						 ETrue, aObjectSource.Uri(), EUnknownThumbnailSize);      
 			}
 		else
 			{
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp	Wed Sep 01 12:20:35 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp	Tue Sep 14 21:55:34 2010 +0300
@@ -659,7 +659,7 @@
 // ---------------------------------------------------------------------------
 //
 void CThumbnailRequestActive::GetThumbnailL( const RFile64& aFile, TThumbnailId aThumbnailId,
-    CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
+    const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
     ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
     TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
     const TDesC& aTargetUri, TThumbnailSize aThumbnailSize)
@@ -680,6 +680,7 @@
     						EThumbnailGeneratePersistentSizesOnly :
     						EThumbnailNoControlFlags);    
     iParams.iOriginalControlFlags = iParams.iControlFlags;
+    iParams.iMimeType = TDataType( aMimeType );
     iParams.iBitmapHandle = 0;
     iParams.iSize = aSize;
     iParams.iDisplayMode = aDisplayMode;
@@ -714,8 +715,8 @@
 // ---------------------------------------------------------------------------
 //
 void CThumbnailRequestActive::GetThumbnailL( TThumbnailId aThumbnailId,
-    const TDesC& aPath, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
-    ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
+    const TDesC& aPath, const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, 
+    CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
     TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
     const TDesC& aTargetUri, TThumbnailSize aThumbnailSize)
     {
@@ -726,6 +727,7 @@
                             EThumbnailGeneratePersistentSizesOnly :
                             EThumbnailNoControlFlags);
     iParams.iOriginalControlFlags = iParams.iControlFlags;
+    iParams.iMimeType = TDataType( aMimeType );
     iParams.iBitmapHandle = 0;
     iParams.iSize = aSize;
     iParams.iDisplayMode = aDisplayMode;
@@ -758,7 +760,7 @@
 // ---------------------------------------------------------------------------
 //
 void CThumbnailRequestActive::GetThumbnailL( const TDesC& aPath, TThumbnailId aThumbnailId,
-    CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
+    const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
     ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
     TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
     const TDesC& aTargetUri, TThumbnailSize aThumbnailSize)
@@ -770,6 +772,7 @@
     						EThumbnailGeneratePersistentSizesOnly :
     						EThumbnailNoControlFlags);
     iParams.iOriginalControlFlags = iParams.iControlFlags;
+    iParams.iMimeType = TDataType( aMimeType );
     iParams.iBitmapHandle = 0;
     iParams.iSize = aSize;
     iParams.iDisplayMode = aDisplayMode;
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp	Wed Sep 01 12:20:35 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp	Tue Sep 14 21:55:34 2010 +0300
@@ -1408,10 +1408,14 @@
     else if ( ext.CompareF( K3gpExt ) == 0 )
         {
         aMimeType = TDataType( KVideo3gppMime );
+        return KErrNotFound; 
+        // 3gp can contain video or audio, should go to recognizer
         } 
     else if ( ext.CompareF( K3gppExt ) == 0 )
         {
         aMimeType = TDataType( KVideo3gppMime );
+        return KErrNotFound; 
+        // 3gp can contain video or audio, should go to recognizer
         }
     else if ( ext.CompareF( KAmrExt ) == 0 )
         {
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp	Wed Sep 01 12:20:35 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp	Tue Sep 14 21:55:34 2010 +0300
@@ -291,8 +291,26 @@
         TInt sourceType = 0;
         TInt err = Server()->MimeTypeFromFileExt( params.iFileName, mimeType );
         
+        // need to use recognizer
+        if (err == KErrNotFound)
+            {
+            Server()->Fs().ShareProtected();
+            RFile64 file;
+            CleanupClosePushL( file );
+          
+            User::LeaveIfError( file.Open( Server()->Fs(), params.iFileName, EFileShareReadersOrWriters )); 
+            TN_DEBUG2( "CThumbnailServerSession::UpdateThumbnailsL - file handle opened for %S", &params.iFileName );
+          
+            mimeType = Server()->ResolveMimeTypeL(file);
+          
+            file.Close();
+            TN_DEBUG1("CThumbnailServerSession::UpdateThumbnailsL - file handle closed");
+          
+            CleanupStack::Pop( &file );    
+            }
+        
         // get missing sizes
-        if ( err == KErrNone && ( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly ) != 0 )
+        if ( ( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly ) != 0 )
             {
             sourceType = Server()->SourceTypeFromMimeType( mimeType );