Revision: 201021
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 13:58:45 +0300
changeset 25 cb86b71cae0a
parent 22 a67f74060682
child 29 4bdfb6b5c9b4
Revision: 201021 Kit: 2010123
imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h
imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h
imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp
imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp
imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp
imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp
imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimageprovider.cpp
imagehandlingutilities/thumbnailmanager/plugins/video/src/thumbnailvideoprovider.cpp
imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp
imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp
imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h
imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h
imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp
imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h	Fri Jun 11 13:58:45 2010 +0300
@@ -18,9 +18,9 @@
 #ifndef THUMBNAILMANAGER_QT_H
 #define THUMBNAILMANAGER_QT_H
 
-#include <qobject.h>
-#include <qpixmap.h>
-#include <qimage.h>
+#include <QObject>
+#include <QPixmap>
+#include <QImage>
 
 #include <QtGlobal>
 
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h	Fri Jun 11 13:58:45 2010 +0300
@@ -173,6 +173,9 @@
 _LIT( KM4vExt,  ".m4v" );
 _LIT( KNonEmbeddedArtExt, ".alb" );
 
+_LIT( KPrivateFolder, ":\\private\\");
+_LIT( KSysFolder, ":\\sys\\");
+
 /**
  *  Control flags set by the server for handling specific situations
  *  (for example for distinguishing between preview thumbnails and
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -102,10 +102,6 @@
       User::Leave( KErrNotFound );            
       }
     
-    CleanupStack::Pop( data );
-    CleanupStack::PopAndDestroy(&wantedFields);
-    CleanupStack::PopAndDestroy(metaDataUtil);
-
     if ( !iImageDecoderv3 )
         {
         iImageDecoderv3 = new( ELeave )CThumbnailImageDecoderv3( aFs );
@@ -115,13 +111,13 @@
     iFlags = aFlags;
 	//set default mode displaymode from global constants
     iDisplayMode = KStoreDisplayMode;
-	
-//TODO currently only ARM platforms supports MAP mode
-#if !(defined(__CC_ARM) || defined(__ARMCC__))
-    iDisplayMode = EColor16M;
-#endif		
     
     iImageDecoderv3->CreateL( data, *iObserver, iFlags, iMimeType, iTargetSize );
+    
+    CleanupStack::Pop( data );
+    CleanupStack::PopAndDestroy(&wantedFields);
+    CleanupStack::PopAndDestroy(metaDataUtil);
+    
     iOriginalSize = iImageDecoderv3->OriginalSize();
     iImageDecoderv3->DecodeL( iDisplayMode );
     }
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -39,8 +39,8 @@
 // C++ default constructor can NOT contain any code, that might leave.
 // ---------------------------------------------------------------------------
 //
-CThumbnailImageDecoderv3::CThumbnailImageDecoderv3( RFs& aFs ): CActive(
-    EPriorityStandard ), iFs( aFs )
+CThumbnailImageDecoderv3::CThumbnailImageDecoderv3( RFs& aFs ): 
+    CActive(EPriorityStandard ), iBitmap( NULL ), iFs( aFs ), iBuffer( NULL )
     {
     CActiveScheduler::Add( this );
     }
@@ -158,8 +158,14 @@
 void CThumbnailImageDecoderv3::Release()
     {
     Cancel();
+    
     delete iDecoder;
     iDecoder = NULL;
+    
+    delete iBitmap;
+    iBitmap = NULL;
+    delete iBuffer; // we own the buffer
+    iBuffer = NULL;
     }
 
 
@@ -175,6 +181,11 @@
         delete iDecoder;
         iDecoder = NULL;
         }
+    
+    delete iBitmap;
+    iBitmap = NULL;
+    delete iBuffer; // we own the buffer
+    iBuffer = NULL;
     }
 
 
@@ -188,8 +199,9 @@
     iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse );
 
     iBitmap = NULL; // owned by server now
-    delete iBuffer;
+    delete iBuffer; // we own the buffer
     iBuffer = NULL;
+    
     Release();
     }
 
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -52,8 +52,9 @@
 // C++ default constructor can NOT contain any code, that might leave.
 // ---------------------------------------------------------------------------
 //
-CThumbnailImageDecoder::CThumbnailImageDecoder( RFs& aFs ): CActive(
-    EPriorityStandard ), iFs( aFs )
+CThumbnailImageDecoder::CThumbnailImageDecoder( RFs& aFs ): 
+    CActive(EPriorityStandard ), iBitmap( NULL ), iJpegReadBuffer( NULL ),  
+    iExifThumbImage( NULL ), iFs( aFs ), iBuffer( NULL )
     {
     CActiveScheduler::Add( this );
     }
@@ -248,12 +249,18 @@
 void CThumbnailImageDecoder::Release()
     {
     Cancel();
+   
+    delete iDecoder;
+    iDecoder = NULL;
+    
+    delete iBitmap;
+    iBitmap = NULL;
     delete iJpegReadBuffer;
     iJpegReadBuffer = NULL;
     delete iExifThumbImage;
     iExifThumbImage = NULL;
-    delete iDecoder;
-    iDecoder = NULL;
+    
+    iBuffer = NULL; // we don't own the buffer
     }
 
 
@@ -266,13 +273,18 @@
     if ( iDecoder )
         {
         iDecoder->Cancel();
-        delete iJpegReadBuffer;
-        iJpegReadBuffer = NULL;
-        delete iExifThumbImage;
-        iExifThumbImage = NULL;
         delete iDecoder;
         iDecoder = NULL;
         }
+    
+    delete iBitmap;
+    iBitmap = NULL;
+    delete iJpegReadBuffer;
+    iJpegReadBuffer = NULL;
+    delete iExifThumbImage;
+    iExifThumbImage = NULL;
+    
+    iBuffer = NULL; // we don't own the buffer
     }
 
 
@@ -286,6 +298,8 @@
     iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, iEXIF, iPortrait );
 
     iBitmap = NULL; // owned by server now
+    iBuffer = NULL; // we don't own the buffer
+    
     Release();
     }
 
@@ -570,8 +584,7 @@
             CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
         }
 
-    TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( iFs, * iExifThumbImage,
-        options ));
+    TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( iFs, * iExifThumbImage, options ));
 
     if ( err == KErrNotFound || err == KErrNotSupported )
         {
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -33,8 +33,8 @@
 // C++ default constructor can NOT contain any code, that might leave.
 // ---------------------------------------------------------------------------
 //
-CThumbnailImageDecoderv2::CThumbnailImageDecoderv2( RFs& aFs): CActive(
-    EPriorityStandard ), iFs( aFs )
+CThumbnailImageDecoderv2::CThumbnailImageDecoderv2( RFs& aFs): 
+    CActive(EPriorityStandard ), iBitmap( NULL ), iFs( aFs ), iBuffer( NULL )
     {
     CActiveScheduler::Add( this );
     }
@@ -93,10 +93,7 @@
         }
     
     iDecoder->Convert( &iStatus, * iBitmap );
-    while ( iStatus == KErrUnderflow )
-        {
-        iDecoder->ContinueConvert( &iStatus );
-        }
+
     SetActive();  
     
     TN_DEBUG1( "CThumbnailImageDecoderv2::DecodeL() end" );
@@ -111,8 +108,14 @@
 void CThumbnailImageDecoderv2::Release()
     {
     Cancel();
+    
     delete iDecoder;
     iDecoder = NULL;
+    
+    delete iBitmap;
+    iBitmap = NULL;
+    
+    iBuffer = NULL; // we don't own the buffer
     }
 
 
@@ -128,6 +131,11 @@
         delete iDecoder;
         iDecoder = NULL;
         }
+    
+    delete iBitmap;
+    iBitmap = NULL;
+    
+    iBuffer = NULL; // we don't own the buffer
     }
 
 
@@ -143,7 +151,8 @@
     iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse);
 
     iBitmap = NULL; // owned by server now
-    iBuffer = NULL;
+    iBuffer = NULL; // we don't own the buffer
+    
     Release();
     }
 
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimageprovider.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimageprovider.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -93,7 +93,8 @@
     iQualityPreference = aQualityPreference;
 	//set default mode displaymode from global constants
     iDisplayMode = KStoreDisplayMode;
-    
+
+//Symbian^4 specific
     if ( KJpegMime() != iMimeType.Des8() ) 
         {
         iDisplayMode = EColor16M;
@@ -132,6 +133,8 @@
     iQualityPreference = aQualityPreference;
 	//set default mode displaymode from global constants
     iDisplayMode = KStoreDisplayMode;
+	
+//Symbian^4 specific
     if ( KJpegMime() != iMimeType.Des8() ) 
         {
         iDisplayMode = EColor16M;
--- a/imagehandlingutilities/thumbnailmanager/plugins/video/src/thumbnailvideoprovider.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/video/src/thumbnailvideoprovider.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -134,7 +134,8 @@
     iFlags = aFlags;
 	//set default mode displaymode from global constants
     iDisplayMode = KStoreDisplayMode;
-	
+
+//Symbian^4 specific	
 //TODO currently only ARM platforms supports MAP mode
 #if !(defined(__CC_ARM) || defined(__ARMCC__))
     iDisplayMode = EColor16M;
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -95,12 +95,6 @@
     iActivityManager = CTMActivityManager::NewL( this, KBackgroundGenerationIdle);
 
     UpdatePSValues(ETrue);
-
-    if(iForegroundGenerationObserver)
-        {
-        delete iForegroundGenerationObserver;
-        iForegroundGenerationObserver = NULL;
-        }
     
     RProperty::Define(KTAGDPSNotification, KMPXHarvesting, RProperty::EInt);
     
@@ -167,6 +161,12 @@
         iForegroundGenerationObserver = NULL;
         }
     
+    if(iFormatObserver)
+        {
+        delete iFormatObserver;
+        iFormatObserver = NULL;
+        }
+    
     if ( iCollectionUtility )
         {
         iCollectionUtility->Close();
@@ -188,8 +188,6 @@
         iTMSession = NULL;
         }
     
-    delete iFormatObserver;
-    
     TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - end" );
     }
 
@@ -684,13 +682,14 @@
                     }
                 }
             
-		   // Symbian^4 specific
+		   // Symbian^4 specific --->
            if( imageObjectDef.Id() != aObject->Def().Id()  )
                 {
                 TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round not image");
                 ActivateAO();
                 return;
                 }
+			//Symbian^4 specific <---
             }
 
         // run as lower priority than getting but higher that creating thumbnails
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -153,7 +153,7 @@
                 iFile.Close();
                 User::LeaveIfError( iFile.Open( iFs, iPath, EFileShareReadersOrWriters ) );  
                 
-                TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iTargetUri );
+                TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iPath );
                 
                 CleanupClosePushL( iFile );
                 iSession.RequestThumbnailL( iFile, iPath, iParamsPckg, iStatus );
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h	Fri Jun 11 13:58:45 2010 +0300
@@ -192,16 +192,6 @@
 
 private:
     /**
-     * Copy CFbsBitmap into a QImage.
-     */
-    QImage fromBitmap( CFbsBitmap* bitmap );
-    
-    /**
-     * Copy CFbsBitmap into a QPixmap.
-     */
-    QPixmap fromImage( CFbsBitmap* bitmap );
-    
-    /**
      * Limit priority to presumed range.
      */
     int convertPriority(int basePriority);
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -251,20 +251,6 @@
     return ( iThumbnailManager->ChangePriority( id, newPriority ) == KErrNone );
 }
 
-QImage ThumbnailManagerPrivate::fromBitmap( CFbsBitmap* bitmap )
-{
-    TSize size = bitmap->SizeInPixels();
-    int bytesPerLine = bitmap->ScanLineLength( size.iWidth, bitmap->DisplayMode() );
-    const uchar* dataPtr = ( const uchar* ) bitmap->DataAddress();
-    QImage image = QImage(dataPtr, size.iWidth, size.iHeight, bytesPerLine, QImage::Format_RGB16);
-    return image.copy();
-}
-
-QPixmap ThumbnailManagerPrivate::fromImage( CFbsBitmap* bitmap )
-{
-    return QPixmap::fromImage(fromBitmap(bitmap));
-}
-
 int ThumbnailManagerPrivate::convertPriority(int basePriority)
 {
     return qBound(ThumbnailMangerPriorityLowest, basePriority, ThumbnailMangerPriorityHighest);    
@@ -284,20 +270,19 @@
     }
     
     if (connectionCounterImage || connectionCounterPixmap) {
-        QImage image;
+		QPixmap pixmap;
 
         if (aError == KErrNone) {
-            image = fromBitmap(aThumbnail.Bitmap());
+            pixmap = QPixmap::fromSymbianCFbsBitmap(aThumbnail.Bitmap());
         } else {
-            image = QImage(); 
+            pixmap = QPixmap(); 
         }
 
         if (connectionCounterImage) {
-            emit q_ptr->thumbnailReady(image, aThumbnail.ClientData(), aId, aError);
+            emit q_ptr->thumbnailReady(pixmap.toImage(), aThumbnail.ClientData(), aId, aError);
         }
         
         if (connectionCounterPixmap) {
-            QPixmap pixmap = QPixmap::fromImage(image);
             emit q_ptr->thumbnailReady(pixmap, aThumbnail.ClientData(), aId, aError);
         }
     }
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h	Fri Jun 11 13:58:45 2010 +0300
@@ -143,7 +143,7 @@
      * @param aOriginalSize Original size of bitmap.
      */
     void DoBlacklisting( const TInt aError, const TSize& aOriginalSize );
-
+    
 private:
     // Data
 
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h	Fri Jun 11 13:58:45 2010 +0300
@@ -462,6 +462,15 @@
     TBool IsFormatting();
   
     inline CThumbnailFetchedChecker& FetchedChecker() const { return *iFetchedChecker; }
+    
+    /**
+     * Check is path in public folder
+     *
+     * @param aPath
+     * @ret 
+     */
+    TBool IsPublicPath( const TDesC& aPath );
+    
 protected: // Functions from base classes
 
     /**
@@ -528,7 +537,7 @@
      * @since S60 v5.0
      */
     static TInt ReconnectCallBack(TAny* aAny);
-
+    
 private:
 
     /**
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -51,6 +51,7 @@
 //
 CThumbnailDecodeTask::~CThumbnailDecodeTask()
     {
+    TN_DEBUG2( "CThumbnailDecodeTask(0x%08x)::~CThumbnailDecodeTask()", this );
     if ( iProvider )
         {
         iProvider->CancelGetThumbnail();
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -124,8 +124,7 @@
 #ifdef _DEBUG
     aStart.UniversalTime();
 #endif
-
-      
+   
     TParsePtrC parse(iFilename);
     TPtrC ext(parse.Ext());
     TBuf8< KMaxDataTypeLength > mimeType;                
@@ -357,19 +356,21 @@
                     }
                 }
             
-            CThumbnailScaleTask* scaleTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename,
+            CThumbnailScaleTask* complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename,
                 aBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode,
                 KMaxPriority, iTargetUri, (*iMissingSizes)[ i ].iType, iModified, iScaledBitmapToPool, iEXIF,
                 iRequestId);
-            CleanupStack::PushL( scaleTask );
+            CleanupStack::PushL( complTask );
             
             TInt err1 = KErrNone;
             TInt err2 = KErrNone;
+            
             if(iFilename != KNullDesC)
                 {
                 TRAP(err1, iServer.StoreForPathL(iFilename));
                 }
-            if(iTargetUri != KNullDesC)
+            
+            if(iTargetUri != KNullDesC )
                 {
                 TRAP(err2, iServer.StoreForPathL(iTargetUri));
                 }
@@ -379,22 +380,30 @@
                     (*iMissingSizes)[ i ].iType == ECustomThumbnailSize || 
                     (*iMissingSizes)[ i ].iType == EUnknownThumbnailSize )
                 {
-                scaleTask->SetDoStore( EFalse );
+                complTask->SetDoStore( EFalse );
                 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this );
                 }
             else
                 {
-                scaleTask->SetDoStore( ETrue );
+                if(iFilename != KNullDesC)
+                    {
+                    complTask->SetDoStore(iServer.IsPublicPath( iFilename ));
+                    }
+                
+                if(iTargetUri != KNullDesC)
+                    {
+                    complTask->SetDoStore(iServer.IsPublicPath( iTargetUri ));
+                    }
                 }
             
-            iProcessor.AddTaskL( scaleTask );
-            CleanupStack::Pop( scaleTask );
+            iProcessor.AddTaskL( complTask );
+            CleanupStack::Pop( complTask );
             
             // completion to first task, because task processor works like stack
             if( i == 0 )
                 {
                 // compTask is now responsible for completing the RMessage
-                scaleTask->SetMessageData( iRequestId, iMessage, iClientThread );
+                complTask->SetMessageData( iRequestId, iMessage, iClientThread );
                 ResetMessageData();
                 }
             }
@@ -441,7 +450,15 @@
             }
         else
             {
-            complTask->SetDoStore( ETrue );
+            if(iFilename != KNullDesC)
+                {
+                complTask->SetDoStore(iServer.IsPublicPath( iFilename ));
+                }
+             
+             if(iTargetUri != KNullDesC)
+                {
+                complTask->SetDoStore(iServer.IsPublicPath( iTargetUri ));
+                }
             }
         
         iProcessor.AddTaskL( complTask );
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -1640,3 +1640,28 @@
     return KErrNone;
     }
 
+// -----------------------------------------------------------------------------
+// CThumbnailServer::IsPublicPath
+// -----------------------------------------------------------------------------
+//
+
+TBool CThumbnailServer::IsPublicPath( const TDesC& aPath )
+    {
+    TInt pos = aPath.FindF(KPrivateFolder);
+    
+    if ( pos == 1 )
+        {
+        TN_DEBUG1( "CThumbnailServer::IsPublicPath() NO");
+        return EFalse;
+        }
+    
+    pos = aPath.FindF(KSysFolder);
+    if ( pos == 1 )
+        {
+        TN_DEBUG1( "CThumbnailServer::IsPublicPath() NO");
+        return EFalse;
+        }
+    
+    return ETrue;
+    }
+
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -44,6 +44,7 @@
 const TInt KStoreUnrecoverableErr = KErrCorrupt;
 
 // Database path without drive letter
+//Symbian^4 v5
 _LIT( KThumbnailDatabaseName, ":[102830AB]thumbnail_v5.db" );
 
 _LIT( KDrv, ":");
@@ -1068,7 +1069,7 @@
     const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, 
 	const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath )
     {
-    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( const TDes8& ) in" );
+    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) in" );
 
 #ifdef _DEBUG
     TTime aStart, aStop;
@@ -1131,7 +1132,7 @@
     // try getting modification time from file
     TTime timeStamp;
     
-    TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp aModified %Ld", aModified );
+    TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp aModified %Ld", aModified );
         
     if( aModified )
         {
@@ -1153,11 +1154,11 @@
             
             if (timeErr != KErrNone)
                 {
-                TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() error getting timeStamp: %d", timeErr );
+                TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) error getting timeStamp: %d", timeErr );
                 }
             else
                 {
-                TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp       iFs %Ld", timeStamp.Int64() );
+                TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp       iFs %Ld", timeStamp.Int64() );
                 }
             }
         
@@ -1165,11 +1166,11 @@
             {
             // otherwise current time
             timeStamp.UniversalTime();
-            TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp   current %Ld", timeStamp.Int64() );
+            TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp   current %Ld", timeStamp.Int64() );
             }
         }
         
-   TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp       set %Ld", timeStamp.Int64());
+   TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp       set %Ld", timeStamp.Int64());
    
     paramIndex = stmt->ParameterIndex( KThumbnailSqlParamModified );
     User::LeaveIfError( paramIndex );
@@ -1203,9 +1204,9 @@
     TN_DEBUG2( "CThumbnailStore::THUMBSTORE-COUNTER----------, Thumbs = %d", iThumbCounter );
     
     aStop.UniversalTime();
-    TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() insert to table %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
+    TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) insert to table %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
 #endif 
-    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( const TDes8& ) out" );
+    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) out" );
     }
 
 
@@ -1219,7 +1220,7 @@
     const TInt64 aModified, TBool aThumbFromPath, TBool aBlackListed )
     {
     TSize thumbSize = aThumbnail->SizeInPixels();
-    TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( CFbsBitmap ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
+    TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
 
     __ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer ));
     
@@ -1229,7 +1230,7 @@
     if(aThumbnailSize == ECustomThumbnailSize || aThumbnailSize == EUnknownThumbnailSize 
             || thumbSize.iWidth <= 0 || thumbSize.iHeight <= 0 )
         {
-        TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() not stored");
+        TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) not stored");
         return;
         }
     
@@ -1261,6 +1262,8 @@
             if( (aThumbnailSize == EImageFullScreenThumbnailSize || aThumbnailSize == EVideoFullScreenThumbnailSize ||
                  aThumbnailSize == EAudioFullScreenThumbnailSize) && !aBlackListed )
                 {
+                TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - encode jpg" );
+            
                 HBufC8* data = NULL;
                 CleanupStack::PushL( data );
                 
@@ -1282,9 +1285,8 @@
                 User::LeaveIfError(frameImageData->AppendImageData(imageData));
                 CleanupStack::Pop( imageData );
                 
-                
 #ifdef _DEBUG
-        TN_DEBUG4( "CThumbnailStore::StoreThumbnailL() size %d x %d displaymode %d ", 
+        TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) - size: %d x %d, displaymode: %d ", 
                 aThumbnail->SizeInPixels().iWidth, 
                 aThumbnail->SizeInPixels().iHeight, 
                 aThumbnail->DisplayMode());
@@ -1298,7 +1300,9 @@
                 CleanupStack::PopAndDestroy( encoder );
                 
                 if(request == KErrNone)
-                    {
+                    {           
+                    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - encoding ok" );    
+                
                     CleanupStack::PushL( data );
                     TPtr8 ptr = data->Des(); 
                     StoreThumbnailL( *path, ptr, aThumbnail->SizeInPixels(), 
@@ -1306,6 +1310,10 @@
                                      aThumbnailSize, aModified, aThumbFromPath  );
                     CleanupStack::Pop( data );
                     }
+                else
+                    {
+                    TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - encoding failed: %d", request.Int() );
+                    }
                 
                 delete data;
                 data = NULL;
@@ -1331,7 +1339,7 @@
     
     CleanupStack::PopAndDestroy( path );
     
-    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( CFbsBitmap* ) out" );
+    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) out" );
     }
 
 // ---------------------------------------------------------------------------
@@ -2212,6 +2220,8 @@
         // thumbmnail deletion
         if (self->iDeleteThumbs)
             {
+            TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - cleanup");
+        
             TInt deleteCount = 0;
             
             // delete marked rows from database
@@ -2233,6 +2243,8 @@
         // file existence check
         else if (self->iCheckFilesExist)
             {
+            TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check");
+        
             TBool finished = EFalse;
         
             TRAPD( err, finished = self->FileExistenceCheckL() );
@@ -2253,10 +2265,13 @@
         // next round
         if (self->iIdle && ( self->iDeleteThumbs || self->iCheckFilesExist) )
             {
+            TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - continue maintenance");
             self->StartMaintenance();
             }  
         else if (!self->iDeleteThumbs && !self->iCheckFilesExist)
             {
+            TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - no more maintenance");
+        
             // no need to monitor activity anymore
             self->iActivityManager->Cancel();
             }
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -351,13 +351,13 @@
                     }
                 }
             
-            if ( processingDaemonTasksOnly && task->GetMessageData().Handle())
+            if ( processingDaemonTasksOnly && task->ClientThreadAlive() )
                 {
-                    if(task->GetMessageData().Identity() != KDaemonUid )
-                        {
-                        TN_DEBUG1( "CThumbnailTaskProcessor::RunL() processingDaemonTasksOnly = EFalse" );
-                        processingDaemonTasksOnly = EFalse; 
-                        }
+                if(task->GetMessageData().Identity() != KDaemonUid )
+                    {
+                    TN_DEBUG1( "CThumbnailTaskProcessor::RunL() processingDaemonTasksOnly = EFalse" );
+                    processingDaemonTasksOnly = EFalse; 
+                    }
                 }
             }
         }
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp	Thu May 27 13:11:20 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp	Fri Jun 11 13:58:45 2010 +0300
@@ -25,6 +25,7 @@
 CTMActivityManager* CTMActivityManager::NewL(MTMActivityManagerObserver* aObserver, TInt aTimeout)
     {
     TN_DEBUG1( "CTMActivityManager::NewL()");
+    
     CTMActivityManager* self = new (ELeave) CTMActivityManager(aObserver, aTimeout);
     CleanupStack::PushL(self);
     self->ConstructL();
@@ -40,6 +41,7 @@
 : CActive(CActive::EPriorityHigh), iObserver(aObserver), iTimeout(aTimeout), iPreviousStatus(KErrNotFound)
     {
     TN_DEBUG1( "CTMActivityManager::CTMActivityManager()");
+    
     CActiveScheduler::Add(this);
     }
 
@@ -50,10 +52,12 @@
 CTMActivityManager::~CTMActivityManager()
     {
     TN_DEBUG1( "CTMActivityManager::~CTMActivityManager()");
+    
 #ifdef MONITOR_LIGHTS
     delete iLight;
     iLight = NULL;
 #endif
+    
     Cancel();
     iTimer.Close();
     }
@@ -65,6 +69,7 @@
 void CTMActivityManager::ConstructL()
     {
     TN_DEBUG1( "CTMActivityManager::ConstructL()");
+    
     iTimer.CreateLocal();
     iWatch = ENone;
     }
@@ -76,6 +81,7 @@
 void CTMActivityManager::SetTimeout(TInt aTimeout)
     {
     TN_DEBUG1( "CTMActivityManager::SetTimeout()");
+    
     iTimeout = aTimeout;
     Reset();
     }
@@ -87,10 +93,12 @@
 void CTMActivityManager::Reset()
     {
     TN_DEBUG1( "CTMActivityManager::Reset()");
+
 #ifdef MONITOR_LIGHTS
     delete iLight;
     iLight = NULL;
 #endif
+    
     Cancel();
     Start();
     }
@@ -101,6 +109,12 @@
 void CTMActivityManager::DoCancel()
     {
     TN_DEBUG1( "CTMActivityManager::DoCancel()");
+    
+#ifdef MONITOR_LIGHTS
+    delete iLight;
+    iLight = NULL;
+#endif
+    
     iTimer.Cancel();
     iWatch = ENone;
     }
@@ -279,6 +293,7 @@
 void CTMActivityManager::NotifyObserver()
     {
     TN_DEBUG1( "void CTMAActivityManager::NotifyObserver()");
+    
     TBool status = IsInactive();
     
     if( iPreviousStatus != status )