Revision: 201031 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 10:13:51 +0300
branchRCL_3
changeset 38 2b4b06654caa
parent 37 f759b6186ab5
child 40 6257223ede8a
Revision: 201031 Kit: 201033
imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h
imagehandling_plat/thumbnailmanager_api/inc/thumbnailobjectsource.h
imagehandling_plat/thumbnailmanager_api/tsrc/conf/ThumbnailManagerTest.cfg
imagehandling_plat/thumbnailmanager_api/tsrc/group/ThumbnailManagerTest.pkg
imagehandling_plat/thumbnailmanager_api/tsrc/inc/ThumbnailManagerTest.h
imagehandling_plat/thumbnailmanager_api/tsrc/inc/thumbnailcenrep.h
imagehandling_plat/thumbnailmanager_api/tsrc/src/ThumbnailManagerTestBlocks.cpp
imagehandling_plat/thumbnailmanager_api/tsrc/src/thumbnailcenrep.cpp
imagehandlinglib/Src/IHLDebugPrint.h
imagehandlingutilities/thumbnailmanager/conf/102830B0.txt
imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager.confml
imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager_102830B0.crml
imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h
imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerprivatecrkeys.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/thumbagdaemon/inc/thumbagprocessor.h
imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagaudioobserver.cpp
imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagcameraobserver.cpp
imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp
imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagimageobserver.cpp
imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp
imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagvideoobserver.cpp
imagehandlingutilities/thumbnailmanager/thumbnailclient/bwins/thumbnailmanageru.def
imagehandlingutilities/thumbnailmanager/thumbnailclient/eabi/thumbnailmanageru.def
imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h
imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnaildataimpl.cpp
imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp
imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp
imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp
imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestqueue.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailcenrep.h
imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailfetchedchecker.h
imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h
imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailscaletask.h
imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h
imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h
imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailcenrep.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailmdsquerytask.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/tmgetimei.cpp
imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h	Thu Aug 19 10:13:51 2010 +0300
@@ -47,6 +47,9 @@
 EGridThumbnailSize,
 EListThumbnailSize,
 EFullScreenThumbnailSize,
+EContactGridThumbnailSize,
+EContactListThumbnailSize,
+EContactFullScreenThumbnailSize,
 EThumbnailSizeCount //last item, don't remove
 } TThumbnailSize;
 /**
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailobjectsource.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailobjectsource.h	Thu Aug 19 10:13:51 2010 +0300
@@ -134,6 +134,45 @@
      */
     void ConstructL( const RFile64& aFile, const TDesC& aMimeType );
 
+    /**
+     * Symbian 2nd phase constructor can leave.
+     *
+     * @since S60 v5.0
+     * @param aURI URI.
+     * @param aMimeType MimeType.
+     * @param aThumbnailId ThumbnailId
+     */
+    void ConstructL( const TDesC& aUri, const TDesC& aMimeType, TThumbnailId aThumbnailId );
+
+    /**
+     * Symbian 2nd phase constructor can leave.
+     *
+     * @since S60 v5.0
+     * @param aBitmap Bitmap.
+     * @param aURI URI.
+     */   
+    void ConstructL( CFbsBitmap* aBitmap, const TDesC& aUri );
+
+    /**
+     * Symbian 2nd phase constructor can leave.
+     *
+     * @since S60 v5.0
+     * @param aBuffer Buffer.
+     * @param aMimeType MIME type. Optional, but should be specified if known.
+     * @param aURI URI.
+     */
+    void ConstructL( TDesC8* aBuffer, const TDesC& aMimeType, const TDesC& aUri );    
+    
+    /**
+     * Symbian 2nd phase constructor can leave.
+     *
+     * @since Symbian^3
+     * @param aUri Object URI or a full path to a file in the file system.
+     * @param aTargetUri      For linking the thumbnail to a different URI.
+     * @param aMimeType MIME type. Optional, but should be specified if known.
+     */
+    void ConstructL( const TDesC& aUri, const TDesC& aTargetUri, const TDesC& aMimeType );
+    
 private:
     // data
 
@@ -160,25 +199,19 @@
     /**
      * Bitmap
      */
-
     CFbsBitmap* iBitmap; // own
     
     /**
      * ThumbnailId
-     */
+     */    
+    TThumbnailId iThumbnailId; //own
     
-    TThumbnailId iThumbnailId; //own
+    /**
+     * Uri
+     */
+    HBufC* iTargetUri; // own
 	
 public:
-    /**
-     * Symbian 2nd phase constructor can leave.
-     *
-     * @since S60 v5.0
-     * @param aURI URI.
-     * @param aMimeType MimeType.
-     * @param aThumbnailId ThumbnailId
-     */
-	void ConstructL( const TDesC& aUri, const TDesC& aMimeType, TThumbnailId aThumbnailId );
 	    
     /**
      * Construct a new CThumbnailObjectSource referring to a buffer 
@@ -211,7 +244,8 @@
      * @since S60 v5.0
      * @return New CThumbnailObjectSource instance.
      */       
-    IMPORT_C static CThumbnailObjectSource* NewL( TDesC8* aBuffer,  TDesC& aMimeType, const TDesC& aUri );
+    IMPORT_C static CThumbnailObjectSource* NewL( TDesC8* aBuffer,  TDesC& aMimeType, 
+        const TDesC& aUri );
     
     /**
      * Construct a new CThumbnailObjectSource referring to a buffer 
@@ -223,7 +257,8 @@
      * @since S60 v5.0
      * @return New CThumbnailObjectSource instance.
      */       
-    IMPORT_C static CThumbnailObjectSource* NewLC( TDesC8* aBuffer,  TDesC& aMimeType, const TDesC& aUri);
+    IMPORT_C static CThumbnailObjectSource* NewLC( TDesC8* aBuffer,  TDesC& aMimeType, 
+        const TDesC& aUri);
 
     /**
      * Construct a new CThumbnailObjectSource referring to an URI.
@@ -233,7 +268,7 @@
      * @return New CThumbnailObjectSource instance.
      */
     IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri, 
-            TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
+        TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
 
     /**
      * Construct a new CThumbnailObjectSource referring to an URI.
@@ -243,9 +278,8 @@
      * @return New CThumbnailObjectSource instance.
      */
     IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri,
-            TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
-    
-	 
+        TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
+    	 
     /**
      * Returns source buffer.
      *
@@ -276,30 +310,8 @@
      *
      * @since S60 v5.0
      * @return ThumbnailId 
-     */ 
-    
-    IMPORT_C TThumbnailId Id(); 
-	    
-    /**
-     * Symbian 2nd phase constructor can leave.
-     *
-     * @since S60 v5.0
-     * @param aBitmap Bitmap.
-     * @param aURI URI.
-     */   
-    void ConstructL( CFbsBitmap* aBitmap, const TDesC&
-            aUri );
-
-    /**
-     * Symbian 2nd phase constructor can leave.
-     *
-     * @since S60 v5.0
-     * @param aBuffer Buffer.
-     * @param aMimeType MIME type. Optional, but should be specified if known.
-     * @param aURI URI.
-     */
-    void ConstructL( TDesC8* aBuffer, const TDesC&
-        aMimeType, const TDesC& aUri );
+     */     
+    IMPORT_C TThumbnailId Id(); 	    
     
     /**
      * Returns source bitmap.
@@ -317,6 +329,36 @@
      * @return bitmap
      */
     IMPORT_C CFbsBitmap* GetBitmapOwnership();
+    
+    /**
+     * Construct a new CThumbnailObjectSource referring to an URI.
+     * @param aUri      Object URI or a full path to a file in the file system.
+     * @param aTargetUri      For linking the thumbnail to a different URI.
+     * @param aMimeType MIME type. Optional, but should be specified if known.
+     * @since Symbian^3
+     * @return New CThumbnailObjectSource instance.
+     */
+    IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri, 
+            const TDesC& aTargetUri, const TDesC& aMimeType );
+
+    /**
+     * Construct a new CThumbnailObjectSource referring to an URI.
+     * @param aUri      Object URI or a full path to a file in the file system.
+     * @param aTargetUri      For linking the thumbnail to a different URI.
+     * @param aMimeType MIME type. 
+     * @since Symbian^3
+     * @return New CThumbnailObjectSource instance.
+     */
+    IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri, 
+            const TDesC& aTargetUri, const TDesC& aMimeType );
+    
+    /**
+     * Returns target uri.
+     *
+     * @since Symbian^3
+     * @return uri
+     */
+    IMPORT_C const TDesC& TargetUri();
 };
 
 #endif // THUMBNAILOBJECTSOURCE_H
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/conf/ThumbnailManagerTest.cfg	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/conf/ThumbnailManagerTest.cfg	Thu Aug 19 10:13:51 2010 +0300
@@ -15,6 +15,7 @@
 *
 */
 
+
 [StifSettings]
 TestThreadStackSize= 32768
 TestThreadMinHeap= 4096
@@ -87,6 +88,9 @@
 EGridThumbnailSize = 11
 EListThumbnailSize = 12
 EFullScreenThumbnailSize = 13
+EContactGridThumbnailSize = 14
+EContactListThumbnailSize = 15
+EContactFullScreenThumbnailSize = 16
 
 // Custom sizes
 KCustomSizeX 111
@@ -605,12 +609,128 @@
 pause KTestDelay
 [Endtest]
 
+// ---------------------------------------------------------------------------
+// Create MP3 thumbnail with PNG album art
+// ---------------------------------------------------------------------------
+[Test]
+title Create MP3 thumbnail with PNG album art
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetDisplayModeL EColor16M
+
+// using path
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\mp3_png.mp3
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
 
 // ---------------------------------------------------------------------------
-// Thumbs from buffer
+// Create thumbnail preview from JPG with EXIF 
 // ---------------------------------------------------------------------------
 [Test]
-title Thumbs from buffer
+title Create thumbnail preview from JPG with EXIF 
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetDisplayModeL EColor16M
+
+// jpg with exif
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn SetQualityPreferenceL EOptimizeForQualityWithPreview
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance 
+
+// png with exif
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\exif.png
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn SetQualityPreferenceL EOptimizeForQualityWithPreview
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance 
+
+// no exif
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\no_exif.jpg
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn SetQualityPreferenceL EOptimizeForQualityWithPreview
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance 
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
+
+// ---------------------------------------------------------------------------
+// Create thumbnail from WMA PNG & empty album arts
+// ---------------------------------------------------------------------------
+[Test]
+title Create thumbnail from WMA PNG & empty album arts
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetDisplayModeL EColor16M
+
+// try to create thumbnail from PNG
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\wma_png.wma
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteThumbnails
+tn DeleteSourceInstance  
+
+// try to create thumbnail without album art
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\wma_empty.wma
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteThumbnails
+tn DeleteSourceInstance 
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
+
+
+// ---------------------------------------------------------------------------
+// Create thumbs from buffer
+// ---------------------------------------------------------------------------
+[Test]
+title Create thumbs from buffer
 create ThumbnailManagerTest tn
 tn CreateInstanceL
 tn SetDisplayModeL EColor16M
@@ -701,6 +821,77 @@
 [Endtest]
 
 // ---------------------------------------------------------------------------
+// Create thumbs from CFbsBitmap
+// ---------------------------------------------------------------------------
+[Test]
+title Create thumbs from CFbsBitmap
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetDisplayModeL EColor16M
+
+tn SetFlagsL EDefaultFlags
+tn CreateSourceInstanceBitmapL \data\ThumbnailManagerTest\TestMBM.mbm \data\ThumbnailManagerTest\camera.jpg
+tn DeleteThumbnails
+tn CreateThumbnails
+waittestclass tn
+
+pause KTenSecondDelay
+
+tn DeleteSourceInstance
+
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\camera.jpg
+tn SetFlagsL EDoNotCreate
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
+
+
+// ---------------------------------------------------------------------------
+// Create image/audio/video thumbs
+// ---------------------------------------------------------------------------
+[Test]
+title Create image/audio/video thumbs
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetDisplayModeL EColor16M
+
+// try to create thumbnail from image
+tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\RGB_VGA.jpg
+waittestclass tn
+tn DeleteThumbnails
+tn DeleteSourceInstance  
+
+// try to create thumbnail from music
+tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\mp3_png.mp3
+waittestclass tn
+tn DeleteThumbnails
+tn DeleteSourceInstance  
+
+// try to create thumbnail from video
+tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\Videoclip.mp4
+waittestclass tn
+tn DeleteThumbnails
+tn DeleteSourceInstance  
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
+
+
+// ---------------------------------------------------------------------------
 // Create thumbnails for each persistent size
 // ---------------------------------------------------------------------------
 [Test]
@@ -834,80 +1025,6 @@
 pause KTestDelay
 [Endtest]
 
-
-// ---------------------------------------------------------------------------
-// Thumbnail from missing or unsupported file
-// ---------------------------------------------------------------------------
-[Test]
-title Thumbnail from missing or unsupported file
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\does_not_exist.jpg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Unsupported.txt
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\Unsupported.txt
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\Unsupported.txt plain/text
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Thumbnail from corrupt file
-// ---------------------------------------------------------------------------
-[Test]
-title Thumbnail from corrupt file
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_jpg.jpg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\not_jpg.jpg image/jpeg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_3gp.3gp
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
 // ---------------------------------------------------------------------------
 // Custom size thumbs
 // ---------------------------------------------------------------------------
@@ -1597,28 +1714,79 @@
 
 
 // ---------------------------------------------------------------------------
-// Create thumbnail with id
+// Thumbnail from missing or unsupported file
 // ---------------------------------------------------------------------------
 [Test]
-title Create thumbnail with id
+title Thumbnail from missing or unsupported file
 create ThumbnailManagerTest tn
 tn CreateInstanceL
-tn SetDisplayModeL EColor16M
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
 
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg 99999
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\does_not_exist.jpg
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteSourceInstance
+
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Unsupported.txt
 tn GetThumbnailL
+allownextresult KErrNotSupported
 waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
+tn DeleteSourceInstance
 
+tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\Unsupported.txt
+tn GetThumbnailL
+allownextresult KErrNotSupported
+waittestclass tn
 tn DeleteSourceInstance
+
+tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\Unsupported.txt plain/text
+tn GetThumbnailL
+allownextresult KErrNotSupported
+waittestclass tn
+tn DeleteSourceInstance
+
 tn DeleteInstance
 delete tn
 pause KTestDelay
 [Endtest]
 
 // ---------------------------------------------------------------------------
+// Thumbnail from corrupt file
+// ---------------------------------------------------------------------------
+[Test]
+title Thumbnail from corrupt file
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
+
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_jpg.jpg
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteSourceInstance
+
+tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\not_jpg.jpg image/jpeg
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteSourceInstance
+
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_3gp.3gp
+tn GetThumbnailL
+allownextresult KErrNotSupported
+waittestclass tn
+tn DeleteSourceInstance
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
+
+
+// ---------------------------------------------------------------------------
 // Set thumbnail from buffer
 // ---------------------------------------------------------------------------
 [Test]
@@ -1676,72 +1844,47 @@
 [Endtest]
 
 // ---------------------------------------------------------------------------
-// Import thumbnail
+// Set thumbnail from path
 // ---------------------------------------------------------------------------
 [Test]
-title Import thumbnail
+title Set thumbnail from path
 create ThumbnailManagerTest tn
 tn CreateInstanceL
 tn SetDisplayModeL EColor16M
 
+// normal uri
 tn SetFlagsL EDefaultFlags
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn ImportThumbnailL \data\ThumbnailManagerTest\imported.jpg
+tn CreateSourceInstancePathTargetL \data\ThumbnailManagerTest\RGB_VGA.jpg \data\ThumbnailManagerTest\target.jpg image/jpeg 0 0
+tn SetThumbnailL
+
 waittestclass tn
+
 tn DeleteSourceInstance
-
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\target.jpg
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
 tn SetFlagsL EDoNotCreate
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\imported.jpg
 tn GetThumbnailL
+
 waittestclass tn
 tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
 tn DeleteThumbnails
 tn DeleteSourceInstance
 
+// virtual uri
 tn SetFlagsL EDefaultFlags
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_400x300.bmp
-tn DeleteThumbnails
-tn ImportThumbnailL \data\ThumbnailManagerTest\imported.bmp
-waittestclass tn
-tn DeleteSourceInstance
+tn CreateSourceInstancePathTargetL \data\ThumbnailManagerTest\RGB_VGA.jpg \data\ThumbnailManagerTest\target.vcf contact/x-vcard 0 1
+tn SetThumbnailL
 
-tn SetFlagsL EDoNotCreate
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\imported.bmp
-tn GetThumbnailL
 waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
 
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn DeleteThumbnails
-tn ImportThumbnailL \data\ThumbnailManagerTest\imported.gif
-waittestclass tn
 tn DeleteSourceInstance
-
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\target.vcf
+tn SetThumbnailEnumSizeL EContactGridThumbnailSize
 tn SetFlagsL EDoNotCreate
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\imported.gif
 tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
 
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\video.3gp
-tn DeleteThumbnails
-tn ImportThumbnailL \data\ThumbnailManagerTest\imported.3gp
 waittestclass tn
-tn DeleteSourceInstance
-
-tn SetFlagsL EDoNotCreate
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\imported.3gp
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn CheckThumbnailCenrepL EContactGridThumbnailSize EColor16M
 tn DeleteThumbnails
 tn DeleteSourceInstance
 
@@ -1790,19 +1933,7 @@
 tn GetThumbnailL
 allownextresult KErrNotFound
 waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance
 
-// delete thumbnail which is not in database yet
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn CreateThumbnails
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Videoclip.mp4
-tn CreateThumbnails
 tn DeleteThumbnails
 tn DeleteSourceInstance
 
@@ -1811,11 +1942,116 @@
 pause KTestDelay
 [Endtest]
 
+
 // ---------------------------------------------------------------------------
-// Delete thumbnail when requests are pending
+// Run multiple tests
 // ---------------------------------------------------------------------------
 [Test]
-title Delete thumbnail when requests are pending
+title Run misc multiple tests
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetDisplayModeL EColor16M
+
+// using path
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance 
+
+// mp3 using handle
+tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\mp3.mp3
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EAudioGridThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EAudioGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EAudioFullScreenThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+// corrupted file
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_jpg.jpg
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteSourceInstance
+tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\not_jpg.jpg image/jpeg
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteSourceInstance
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_3gp.3gp
+tn GetThumbnailL
+allownextresult KErrNotSupported
+waittestclass tn
+tn DeleteSourceInstance
+
+// delete one thumbnail
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
+tn DeleteThumbnails
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+pause KTenSecondDelay
+tn SetFlagsL EDoNotCreate
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+
+// delete all persistent thumbnails created
+tn SetFlagsL EDefaultFlags
+tn CreateThumbnails
+waittestclass tn
+pause KTenSecondDelay
+tn DeleteThumbnails
+pause KTenSecondDelay
+tn SetFlagsL EDoNotCreate
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
+
+
+// ---------------------------------------------------------------------------
+// Delete engine when requests are pending
+// ---------------------------------------------------------------------------
+[Test]
+title Delete engine when requests are pending
 create ThumbnailManagerTest tn
 tn CreateInstanceL
 
@@ -2030,319 +2266,3 @@
 pause KTestDelay
 [Endtest] 
 
-// ---------------------------------------------------------------------------
-// Create thumbnails using CFbsBitmap
-// ---------------------------------------------------------------------------
-[Test]
-title Create thumbnails using CFbsBitmap
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstanceBitmapL \data\ThumbnailManagerTest\TestMBM.mbm \data\ThumbnailManagerTest\camera.jpg
-tn DeleteThumbnails
-tn CreateThumbnails
-waittestclass tn
-
-pause KTenSecondDelay
-
-tn DeleteSourceInstance
-
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\camera.jpg
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Load MP3 thumbnail with PNG album art
-// ---------------------------------------------------------------------------
-[Test]
-title Create MP3 PNG album art thumbnail
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\mp3_png.mp3
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EAudioFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance 
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
-// ---------------------------------------------------------------------------
-// Test WMA png & empty album arts
-// ---------------------------------------------------------------------------
-[Test]
-title Test WMA png & empty album arts
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// try to create thumbnail from PNG
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\wma_png.wma
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance  
-
-// try to create thumbnail without album art
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\wma_empty.wma
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance 
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create thumbnail preview with EXIF 
-// ---------------------------------------------------------------------------
-[Test]
-title Create thumbnail preview with EXIF
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// jpg with exif
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn SetQualityPreferenceL EOptimizeForQualityWithPreview
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance 
-
-// png with exif
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\exif.png
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn SetQualityPreferenceL EOptimizeForQualityWithPreview
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance 
-
-// no exif
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\no_exif.jpg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn SetQualityPreferenceL EOptimizeForQualityWithPreview
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance 
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create thumbnails by Url
-// ---------------------------------------------------------------------------
-[Test]
-title Create thumbnails by Url
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// try to create thumbnail from image
-tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\RGB_VGA.jpg
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance  
-
-// try to create thumbnail from music
-tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\mp3_png.mp3
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance  
-
-// try to create thumbnail from video
-tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\Videoclip.mp4
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance  
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Get thumbnails
-// ---------------------------------------------------------------------------
-[Test]
-title Get thumbnails
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// Get thumbnail with url
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn CreateThumbnails
-waittestclass tn
-
-pause KTenSecondDelay
-
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// Get thumbnail with EDoNotCreate flag on
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn SetFlagsL EDoNotCreate
-tn DeleteThumbnails
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteThumbnails
-
-tn DeleteSourceInstance
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Run multiple tests
-// ---------------------------------------------------------------------------
-[Test]
-title Run multiple tests
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// using path
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance 
-
-// mp3 using handle
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\mp3.mp3
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EAudioGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EAudioFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// corrupted file
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_jpg.jpg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\not_jpg.jpg image/jpeg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_3gp.3gp
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-// delete one thumbnail
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-pause KTenSecondDelay
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-
-// delete all persistent thumbnails created
-tn SetFlagsL EDefaultFlags
-tn CreateThumbnails
-waittestclass tn
-pause KTenSecondDelay
-tn DeleteThumbnails
-pause KTenSecondDelay
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
\ No newline at end of file
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/group/ThumbnailManagerTest.pkg	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/group/ThumbnailManagerTest.pkg	Thu Aug 19 10:13:51 2010 +0300
@@ -46,4 +46,9 @@
 "..\data\mmc\ThumbnailManagerTest\TestMBM.mbm" - "e:\testing\data\ThumbnailManagerTest\TestMBM.mbm"
 "..\data\mmc\ThumbnailManagerTest\mp3.mp3" - "e:\testing\data\ThumbnailManagerTest\mp3.mp3"
 "..\data\mmc\ThumbnailManagerTest\camera.jpg" - "e:\testing\data\ThumbnailManagerTest\camera.jpg"
-
+"..\data\mmc\ThumbnailManagerTest\mp3_png.mp3" - "e:\testing\data\ThumbnailManagerTest\mp3_png.mp3"
+"..\data\mmc\ThumbnailManagerTest\no_exif.jpg" - "e:\testing\data\ThumbnailManagerTest\no_exif.jpg"
+"..\data\mmc\ThumbnailManagerTest\wma.wma" - "e:\testing\data\ThumbnailManagerTest\wma.wma"
+"..\data\mmc\ThumbnailManagerTest\wma_empty.wma" - "e:\testing\data\ThumbnailManagerTest\wma_empty.wma"
+"..\data\mmc\ThumbnailManagerTest\wma_png.wma" - "e:\testing\data\ThumbnailManagerTest\wma_png.wma"
+"..\data\mmc\ThumbnailManagerTest\exif.jpg" - "e:\testing\data\ThumbnailManagerTest\exif.jpg"
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/inc/ThumbnailManagerTest.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/inc/ThumbnailManagerTest.h	Thu Aug 19 10:13:51 2010 +0300
@@ -117,6 +117,7 @@
         virtual TInt DeleteInstance( CStifItemParser& aItem );
         
         virtual TInt CreateSourceInstancePathL( CStifItemParser& aItem );
+        virtual TInt CreateSourceInstancePathTargetL( CStifItemParser& aItem );
         virtual TInt CreateSourceInstanceHandleL( CStifItemParser& aItem );
         virtual TInt CreateSourceInstanceBufferL( CStifItemParser& aItem );
         virtual TInt CreateSourceInstanceBitmapL( CStifItemParser& aItem );
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/inc/thumbnailcenrep.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/inc/thumbnailcenrep.h	Thu Aug 19 10:13:51 2010 +0300
@@ -142,7 +142,7 @@
     };
     
 public:
-    enum { EUnknownSourceType, EImage, EVideo, EAudio };
+    enum { EUnknownSourceType, EImage, EVideo, EAudio, EContact };
     enum { EUnknownSizeType, EGrid, EList, EFullscreen }; 
     
 public:
@@ -205,7 +205,10 @@
     TBool iVideoFullscreen;
     TBool iAudioGrid;
     TBool iAudioList;
-    TBool iAudioFullscreen;    
+    TBool iAudioFullscreen;
+    TBool iContactGrid;
+    TBool iContactList;
+    TBool iContactFullscreen; 
 };
 
 #endif // THUMBNAILCENREP_H
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/src/ThumbnailManagerTestBlocks.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/src/ThumbnailManagerTestBlocks.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -67,6 +67,7 @@
         ENTRY( "CheckThumbnailSizeL", CThumbnailManagerTest::CheckThumbnailSizeL ),
         ENTRY( "SetThumbnailEnumSizeL", CThumbnailManagerTest::SetThumbnailEnumSizeL ),
         ENTRY( "CreateSourceInstancePathL", CThumbnailManagerTest::CreateSourceInstancePathL ),
+        ENTRY( "CreateSourceInstancePathTargetL", CThumbnailManagerTest::CreateSourceInstancePathTargetL ),
         ENTRY( "CreateSourceInstanceHandleL", CThumbnailManagerTest::CreateSourceInstanceHandleL ),
         ENTRY( "CreateSourceInstanceBufferL", CThumbnailManagerTest::CreateSourceInstanceBufferL ),
         ENTRY( "CreateSourceInstanceBitmapL", CThumbnailManagerTest::CreateSourceInstanceBitmapL ),
@@ -300,6 +301,53 @@
     return KErrNone;
     }
 
+TInt CThumbnailManagerTest::CreateSourceInstancePathTargetL( CStifItemParser& aItem )
+    {
+    _LIT( KPanicTxt, "CreateSrcPathTarget" );
+    __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
+
+    TPtrC path;
+    User::LeaveIfError( aItem.GetNextString( path ));
+
+    TPtrC target;
+    User::LeaveIfError( aItem.GetNextString( target ));
+    
+    TPtrC mimeType;
+    User::LeaveIfError( aItem.GetNextString( mimeType ));
+    
+    TInt virtual1 = 0;
+    aItem.GetNextInt( virtual1 );
+    
+    TInt virtual2 = 0;
+    aItem.GetNextInt( virtual2 );
+    
+    TFileName filePath( iDataPath );
+    filePath.Append( path );
+    filePath.ZeroTerminate();
+    
+    if (virtual1)
+        {
+        filePath.Delete(2,1);
+        }
+    
+    TFileName targetPath( iDataPath );
+    targetPath.Append( target );
+    targetPath.ZeroTerminate();
+    
+    if (virtual2)
+        {
+        targetPath.Delete(2,1);
+        }
+    
+    iLog->Log( _L( "CreateSourceInstancePathTargetL - path = %S, target = %S" ), &filePath );
+    
+    delete iObjectSource;
+    iObjectSource = NULL;
+    
+    iObjectSource = CThumbnailObjectSource::NewL( filePath, targetPath, mimeType );
+    return KErrNone;
+    }
+
 TInt CThumbnailManagerTest::CreateSourceInstanceHandleL( CStifItemParser& aItem )
     {
     _LIT( KPanicTxt, "CreateSrcHandle" );
@@ -773,48 +821,7 @@
     
     return KErrNone;
     }
-
-/*
-TInt CThumbnailManagerTest::GetThumbnailsByUrlL( CStifItemParser&  aItem )
-    {
-    _LIT( KPanicTxt, "CreateSrcPath" );
-    __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
-
-    TPtrC path;
-    User::LeaveIfError( aItem.GetNextString( path ));
-
-    TInt id = 0;
-    aItem.GetNextInt( id );
     
-    TFileName filePath( iDataPath );
-    filePath.Append( path );
-    filePath.ZeroTerminate();
-    
-    iLog->Log( _L( "CreateSourceInstancePathL - path = %S" ), &filePath );
-    
-    delete iObjectSource;
-    iObjectSource = NULL;
-    
-    iObjectSource = CThumbnailObjectSource::NewL( filePath, id );
-    
-    id = iEngine->GetThumbnailL( *iObjectSource );
-    if (id < 0)
-        {
-        iLog->Log( _L( "GetThumbnails - error %d" ), id );
-        return id;  
-        }
-    else
-        {
-        iPreviousRequestId = id;
-        iLog->Log( _L( "GetThumbnails - request id %d" ), iPreviousRequestId );
-        }
-    
-    iCreateThumbnails = ETrue;
-    
-    return KErrNone;
-    }
-
-*/
     
 TInt CThumbnailManagerTest::CreateThumbnails( CStifItemParser& aItem )
     {
@@ -844,7 +851,6 @@
     return KErrNone;
     }
 
-
 TInt CThumbnailManagerTest::UpdatePathL( CStifItemParser& aItem )
     {
     _LIT( KPanicTxt, "UpdatePath" );
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/src/thumbnailcenrep.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/src/thumbnailcenrep.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -42,6 +42,12 @@
 const TUint32 KSizeAudioListHeight = 0x15;
 const TUint32 KSizeAudioFullscreenWidth = 0x16;
 const TUint32 KSizeAudioFullscreenHeight = 0x17;
+const TUint32 KSizeContactListWidth = 0x18;
+const TUint32 KSizeContactListHeight = 0x19;
+const TUint32 KSizeContactGridWidth = 0x20;
+const TUint32 KSizeContactGridHeight = 0x21;
+const TUint32 KSizeContactFullscreenWidth = 0x22;
+const TUint32 KSizeContactFullscreenHeight = 0x23;
 
 const TUint32 KAutoCreateImageGrid = 0x100;
 const TUint32 KAutoCreateImageList = 0x101;
@@ -52,6 +58,9 @@
 const TUint32 KAutoCreateAudioGrid = 0x106;
 const TUint32 KAutoCreateAudioList = 0x107;
 const TUint32 KAutoCreateAudioFullscreen = 0x108;
+const TUint32 KAutoCreateContactGrid = 0x109;
+const TUint32 KAutoCreateContactList = 0x110;
+const TUint32 KAutoCreateContactFullscreen = 0x111;
 
 
 // ---------------------------------------------------------------------------
@@ -94,6 +103,11 @@
         case EAudioFullScreenThumbnailSize:
             iSourceType = EAudio;
             break;
+        case EContactGridThumbnailSize:
+        case EContactListThumbnailSize:
+        case EContactFullScreenThumbnailSize:
+            iSourceType = EContact;
+            break;
         default:
             iSourceType = EUnknownSourceType;        
         }
@@ -107,7 +121,8 @@
 TThumbnailAutoCreate::TThumbnailAutoCreate()
     : iImageGrid(EFalse), iImageList(EFalse), iImageFullscreen(EFalse),
       iVideoGrid(EFalse), iVideoList(EFalse), iVideoFullscreen(EFalse),
-      iAudioGrid(EFalse), iAudioList(EFalse), iAudioFullscreen(EFalse)
+      iAudioGrid(EFalse), iAudioList(EFalse), iAudioFullscreen(EFalse),
+      iContactGrid(EFalse), iContactList(EFalse), iContactFullscreen(EFalse)
     {
     // No implementation required
     }
@@ -230,6 +245,27 @@
     
     iPersistentSizes.AppendL( TThumbnailPersistentSize( EAudioFullScreenThumbnailSize, TSize( xSize, ySize ),
                               flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));     
+
+    User::LeaveIfError( iRepository->Get( KSizeContactGridWidth, xSize ));
+    User::LeaveIfError( iRepository->Get( KSizeContactGridHeight, ySize ));
+    User::LeaveIfError( iRepository->Get( KAutoCreateContactGrid, autoCreate ));
+
+    iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactGridThumbnailSize, TSize( xSize, ySize ),
+            KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
+    
+    User::LeaveIfError( iRepository->Get( KSizeContactListWidth, xSize ));
+    User::LeaveIfError( iRepository->Get( KSizeContactListHeight, ySize ));
+    User::LeaveIfError( iRepository->Get( KAutoCreateContactList, autoCreate ));
+
+    iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactListThumbnailSize, TSize( xSize, ySize ),
+            KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
+    
+    User::LeaveIfError( iRepository->Get( KSizeContactFullscreenWidth, xSize ));
+    User::LeaveIfError( iRepository->Get( KSizeContactFullscreenHeight, ySize ));
+    User::LeaveIfError( iRepository->Get( KAutoCreateContactFullscreen, autoCreate ));
+    
+    iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactFullScreenThumbnailSize, TSize( xSize, ySize ),
+                              flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));     
     
     iAutoCreate = new (ELeave) TThumbnailAutoCreate();
     
@@ -242,6 +278,9 @@
     User::LeaveIfError( iRepository->Get( KAutoCreateAudioGrid, iAutoCreate->iAudioGrid ));
     User::LeaveIfError( iRepository->Get( KAutoCreateAudioList, iAutoCreate->iAudioList ));
     User::LeaveIfError( iRepository->Get( KAutoCreateAudioFullscreen, iAutoCreate->iAudioFullscreen ));    
+    User::LeaveIfError( iRepository->Get( KAutoCreateContactGrid, iAutoCreate->iContactGrid ));
+    User::LeaveIfError( iRepository->Get( KAutoCreateContactList, iAutoCreate->iContactList ));
+    User::LeaveIfError( iRepository->Get( KAutoCreateContactFullscreen, iAutoCreate->iContactFullscreen )); 
     }
 
 // ---------------------------------------------------------------------------
--- a/imagehandlinglib/Src/IHLDebugPrint.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlinglib/Src/IHLDebugPrint.h	Thu Aug 19 10:13:51 2010 +0300
@@ -59,7 +59,7 @@
     /**
      * Macro for defining debug-only literal strings (empty release version)
      */
-    #define IHL_DEBUG_STRING(name, s) const TIHLEmptyDebugString name
+    #define IHL_DEBUG_STRING(name, s) const TIHLEmptyDebugString name = {}
 
     /**
      * Output to debugger output (empty)
Binary file imagehandlingutilities/thumbnailmanager/conf/102830B0.txt has changed
Binary file imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager.confml has changed
Binary file imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager_102830B0.crml has changed
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h	Thu Aug 19 10:13:51 2010 +0300
@@ -149,43 +149,52 @@
 const TInt KImeiBufferSize = CTelephony::KPhoneSerialNumberSize;
 const TInt KCheckValue = 123456;
 
-_LIT8( KJpegMime,    "image/jpeg" );            _LIT( KJpegExt, ".jpeg" );
-_LIT8( KJpeg2000Mime,    "image/jp2" );            _LIT( KJpeg2000Ext, ".jp2" );
-_LIT8( KJpgMime,    "image/jpeg" );            _LIT( KJpgExt, ".jpg" );
-_LIT8( KGifMime,     "image/gif" );             _LIT( KGifExt,  ".gif" );
-_LIT8( KPngMime,     "image/png" );             _LIT( KPngExt,  ".png" ); 
-_LIT8( KSvgMime,     "image/svg+xml" );             _LIT( KSvgExt,  ".svg" ); 
-_LIT8( KMpgMime1,    "video/mpeg");             _LIT( KMpgExt1,  ".mpg" );
-_LIT8( KMpeg4Mime,   "video/mpeg4" );           _LIT( KMpeg4Ext,".mpeg4" );
-_LIT8( KMp4Mime,     "video/mp4" );             _LIT( KMp4Ext,  ".mp4" );
-_LIT8( KAviMime,    "video/x-msvideo" );       _LIT( KAviExt,  ".avi" );
-_LIT8( KMp3Mime,    "audio/mpeg" );           _LIT( KMp3Ext,  ".mp3" );
-_LIT8( KNonEmbeddArtMime,    "audio/mpeg" );           _LIT( KNonEmbeddArtExt,  ".alb" );
-_LIT8( KM4aMime,    "audio/mp4" );           _LIT( KM4aExt,  ".m4a" );
-_LIT8( KAacMime,     "audio/aac" );             _LIT( KAacExt,  ".aac" );
-_LIT8( KWmaMime,     "audio/x-ms-wma" );        _LIT( KWmaExt,  ".wma" );
-_LIT8( KBmpMime,     "image/bmp" );             _LIT( KBmpExt,  ".bmp" );
-_LIT8( KAudio3gppMime,     "audio/3gpp" ); 
-_LIT8( KVideo3gppMime,     "video/3gpp" );  _LIT( K3gpExt,  ".3gp" ); _LIT( K3gppExt,  ".3gpp" );
-_LIT8( KAudioAmrMime,     "audio/AMR" );     _LIT( KAmrExt,  ".amr" );
-_LIT8( KVideoWmvMime, "video/x-ms-wmv" );     _LIT( KWmvExt,    ".wmv" );
-_LIT8( KRealAudioMime, "audio/vnd.rn-realaudio" );        _LIT( KRealAudioExt,    ".ra" );
-_LIT8( KPmRealAudioPluginMime, "audio/x-pn-realaudio-plugin" ); _LIT( KPmRealAudioPluginExt,    ".rpm" );
-_LIT8( KPmRealVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVideoPluginExt,    ".rm" );
-_LIT8( KPmRealVbVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVbVideoPluginExt,    ".rmvb" );
-_LIT8( KPmRealAudioMime, "audio/x-pn-realaudio" );        _LIT( KPmRealAudioExt,    ".ra" );
-_LIT8( KRealVideoMime, "video/vnd.rn-realvideo" );        _LIT( KRealVideoExt,    ".rv" );
-_LIT8( KFlashVideoMime,    "video/x-flv" );       _LIT( KFlashVideoExt,  ".flv" );
-_LIT8( KMatroskaVideoMime,    "video/x-matroska" );       _LIT( KMatroskaVideoExt,  ".mkv" );
+_LIT8( KJpegMime, "image/jpeg" ); _LIT( KJpegExt, ".jpeg" );            
+_LIT8( KJpeg2000Mime, "image/jp2" ); _LIT( KJpeg2000Ext, ".jp2" );
+_LIT8( KJpgMime, "image/jpeg" ); _LIT( KJpgExt, ".jpg" );
+_LIT8( KGifMime, "image/gif" ); _LIT( KGifExt, ".gif" );
+_LIT8( KPngMime, "image/png" ); _LIT( KPngExt, ".png" ); 
+_LIT8( KSvgMime, "image/svg+xml" ); _LIT( KSvgExt, ".svg" ); 
+_LIT8( KMpgMime1, "video/mpeg"); _LIT( KMpgExt1, ".mpg" );
+_LIT8( KMpeg4Mime, "video/mpeg4" ); _LIT( KMpeg4Ext,".mpeg4" );
+_LIT8( KMp4Mime, "video/mp4" ); _LIT( KMp4Ext, ".mp4" ); _LIT( KM4vExt, ".m4v" );
+_LIT8( KAviMime, "video/x-msvideo" ); _LIT( KAviExt, ".avi" );
+_LIT8( KMp3Mime, "audio/mpeg" ); _LIT( KMp3Ext, ".mp3" );
+_LIT8( KNonEmbeddArtMime, "audio/mpeg" ); _LIT( KNonEmbeddArtExt, ".alb" );
+_LIT8( KM4aMime, "audio/mp4" ); _LIT( KM4aExt, ".m4a" );
+_LIT8( KAacMime, "audio/aac" ); _LIT( KAacExt, ".aac" );
+_LIT8( KWmaMime, "audio/x-ms-wma" ); _LIT( KWmaExt, ".wma" );
+_LIT8( KBmpMime, "image/bmp" ); _LIT( KBmpExt, ".bmp" );
+_LIT8( KAudio3gppMime, "audio/3gpp" ); 
+_LIT8( KVideo3gppMime, "video/3gpp" ); _LIT( K3gpExt, ".3gp" ); _LIT( K3gppExt, ".3gpp" );
+_LIT8( KAudioAmrMime, "audio/AMR" ); _LIT( KAmrExt, ".amr" );
+_LIT8( KVideoWmvMime, "video/x-ms-wmv" ); _LIT( KWmvExt, ".wmv" );
+_LIT8( KRealAudioMime, "audio/vnd.rn-realaudio" ); _LIT( KRealAudioExt, ".ra" );
+_LIT8( KPmRealAudioPluginMime, "audio/x-pn-realaudio-plugin" ); _LIT( KPmRealAudioPluginExt, ".rpm" );
+_LIT8( KPmRealVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVideoPluginExt, ".rm" );
+_LIT8( KPmRealVbVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVbVideoPluginExt, ".rmvb" );
+_LIT8( KPmRealAudioMime, "audio/x-pn-realaudio" ); _LIT( KPmRealAudioExt, ".ra" );
+_LIT8( KRealVideoMime, "video/vnd.rn-realvideo" ); _LIT( KRealVideoExt, ".rv" );
+_LIT8( KFlashVideoMime, "video/x-flv" ); _LIT( KFlashVideoExt, ".flv" );
+_LIT8( KMatroskaVideoMime, "video/x-matroska" ); _LIT( KMatroskaVideoExt, ".mkv" );
+_LIT8( KContactMime, "contact/x-vcard" ); _LIT( KContactExt, ".vcf" );
+
+_LIT( KNonEmbeddedArtExt, ".alb" );
+
+_LIT8( KAlbumArtMime, "audio/albumart" ); _LIT( KAlbumArtExt, ".maa" );
+
 _LIT( KImageMime, "image/*" );
 _LIT( KVideoMime, "video/*" );
 _LIT( KAudioMime, "audio/*" );
-_LIT( KM4vExt,  ".m4v" );
-_LIT( KNonEmbeddedArtExt, ".alb" );
 
 _LIT( KPrivateFolder, ":\\private\\");
 _LIT( KSysFolder, ":\\sys\\");
 
+_LIT( KDrv, ":");
+_LIT( KBackSlash, "\\");
+
+const TInt KExtLength = 4;
+
 /**
  *  Control flags set by the server for handling specific situations
  *  (for example for distinguishing between preview thumbnails and
@@ -316,6 +325,16 @@
      * Overwrite old thumbs (SetThumbnailL)
      */
     TBool iOverwrite;
+    
+    /**
+     * URI is virtual
+     */
+    TBool iVirtualUri;
+    
+    /**
+     * Target differs from source
+     */
+    TBool iImport;
     };
 
 
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerprivatecrkeys.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerprivatecrkeys.h	Thu Aug 19 10:13:51 2010 +0300
@@ -44,6 +44,12 @@
 const TUint32 KSizeAudioListHeight = 0x15;
 const TUint32 KSizeAudioFullscreenWidth = 0x16;
 const TUint32 KSizeAudioFullscreenHeight = 0x17;
+const TUint32 KSizeContactListWidth = 0x18;
+const TUint32 KSizeContactListHeight = 0x19;
+const TUint32 KSizeContactGridWidth = 0x20;
+const TUint32 KSizeContactGridHeight = 0x21;
+const TUint32 KSizeContactFullscreenWidth = 0x22;
+const TUint32 KSizeContactFullscreenHeight = 0x23;
 
 const TUint32 KAutoCreateImageGrid = 0x100;
 const TUint32 KAutoCreateImageList = 0x101;
@@ -54,6 +60,9 @@
 const TUint32 KAutoCreateAudioGrid = 0x106;
 const TUint32 KAutoCreateAudioList = 0x107;
 const TUint32 KAutoCreateAudioFullscreen = 0x108;
+const TUint32 KAutoCreateContactGrid = 0x109;
+const TUint32 KAutoCreateContactList = 0x110;
+const TUint32 KAutoCreateContactFullscreen = 0x111;
 
 const TUint32 KColorDepthGrid = 0x200;
 const TUint32 KColorDepthList = 0x201;
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -69,6 +69,7 @@
     {
     TN_DEBUG1( "CThumbnailAudioProvider::~CThumbnailAudioProvider()" );
     delete iImageDecoderv3;
+    iImageDecoderv3 = NULL;
     REComSession::DestroyedImplementation( iDtor_ID_Key );
     }
 
@@ -152,6 +153,7 @@
     {
     TN_DEBUG1( "CThumbnailAudioProvider::GetThumbnailL() - buffer no mime" );
 	__ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbnailAudioProvider::GetThumbnailL"), KErrNotSupported));
+	User::Leave( KErrNotSupported );
     }
 
 // ---------------------------------------------------------------------------
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -216,7 +216,7 @@
     iDecoder = NULL;
 	
     CImageDecoder::TOptions options = ( CImageDecoder::TOptions )( 
-            CImageDecoder::EOptionNoDither | CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
+            CImageDecoder::EOptionNoDither );
  
     TRAPD( decErr, iDecoder = CExtJpegDecoder::DataNewL(
             CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options ));
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -377,12 +377,12 @@
         if ( aFlags == CThumbnailManager::EOptimizeForQuality )
             {
             options = ( CImageDecoder::TOptions )( CImageDecoder
-                ::EOptionNoDither | CImageDecoder::EOptionAlwaysThread );
+                ::EOptionNoDither );
             }
         else
             {
             options  = ( CImageDecoder::TOptions )( CImageDecoder
-                ::EOptionNoDither | CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
+                ::EOptionNoDither | CImageDecoder::EPreferFastDecode );
             }
 
         if ( IsSvg())
@@ -576,12 +576,12 @@
     CImageDecoder::TOptions options;
     if ( aFlags == CThumbnailManager::EOptimizeForQuality )
         {
-        options = ( CImageDecoder::TOptions )( CImageDecoder::EOptionNoDither | CImageDecoder::EOptionAlwaysThread );
+        options = ( CImageDecoder::TOptions )( CImageDecoder::EOptionNoDither );
         }
     else
         {
         options = ( CImageDecoder::TOptions )( CImageDecoder::EOptionNoDither |
-            CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
+            CImageDecoder::EPreferFastDecode  );
         }
 
     TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( iFs, * iExifThumbImage, options ));
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -170,7 +170,7 @@
     iDecoder = NULL;
     
     CImageDecoder::TOptions options = ( CImageDecoder::TOptions )( 
-            CImageDecoder::EOptionNoDither | CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
+            CImageDecoder::EOptionNoDither );
 
     TRAPD( decErr, iDecoder = CExtJpegDecoder::DataNewL( 
             CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options ));
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimageprovider.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimageprovider.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -67,7 +67,9 @@
     {
     TN_DEBUG1( "CThumbnailImageProvider::~CThumbnailImageProvider()" );
     delete iImageDecoder;
+    iImageDecoder = NULL;
     delete iImageDecoderv2;
+    iImageDecoderv2 = NULL;
     REComSession::DestroyedImplementation( iDtor_ID_Key );
     }
 
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h	Thu Aug 19 10:13:51 2010 +0300
@@ -62,7 +62,8 @@
 
   struct TThumbnailGenerationItem
       {
-      inline TThumbnailGenerationItem(): iItemId( KErrNotFound ), iItemType(EGenerationItemTypeUnknown), iItemAction(EGenerationItemActionAdd), iPlaceholder(EFalse), iUri(NULL){}
+      inline TThumbnailGenerationItem(): iItemId( KErrNotFound ), iItemType(EGenerationItemTypeUnknown), 
+              iItemAction(EGenerationItemActionAdd), iPlaceholder(EFalse), iUri(NULL){}
       inline ~TThumbnailGenerationItem(){delete iUri; iUri = NULL;}
       
       TItemId iItemId;
@@ -166,7 +167,9 @@
      * @param aIDArray IDs for thumbnail creation
      * @param aForce pass ETrue if processor is forced to run without waiting harvesting complete
      */
-    void AddToQueueL( TObserverNotificationType aType, TThumbnailGenerationItemType aItemType, const RArray<TItemId>& aIDArray, const RPointerArray<HBufC>& aObjectUriArray, TBool aPresent );
+    void AddToQueueL( TObserverNotificationType aType, TThumbnailGenerationItemType aItemType, 
+            const RArray<TItemId>& aIDArray, const RPointerArray<HBufC>& aObjectUriArray, 
+            TBool aPresent );
     
     /**
      * Calls Thumbnail Manager to create thumbnails
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagaudioobserver.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagaudioobserver.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -308,18 +308,20 @@
     
     // set observing conditions
     CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
-    addCondition->AddObjectConditionL( audioDef );
-    CleanupStack::Pop( addCondition );  
+    CMdEObjectCondition& addObjectCondition = addCondition->AddObjectConditionL( audioDef );
+    CleanupStack::PushL( &addObjectCondition );
     
     CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
-    modifyCondition->AddObjectConditionL( audioDef );
-    CleanupStack::Pop( modifyCondition );
+    CMdEObjectCondition& modifyObjectCondition = modifyCondition->AddObjectConditionL( audioDef );
+    CleanupStack::PushL( &modifyObjectCondition );
     
     // add observer
     iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd ); 
 
    // modify observer
    iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
+   
+   CleanupStack::Pop( 4, addCondition );
      
     TN_DEBUG1( "CThumbAGAudioObserver::AddObserversL() - end" );
     }
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagcameraobserver.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagcameraobserver.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -147,7 +147,10 @@
     iShutdown = ETrue;    
     
     delete iMDSShutdownObserver;
+    iMDSShutdownObserver = NULL;
+    
     delete iShutdownObserver;
+    iShutdownObserver = NULL;
     
     if(iReconnect)
         {
@@ -300,18 +303,20 @@
     
     // set observing conditions
     CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
-    addCondition->AddPropertyConditionL( originPropDef, TMdEUintEqual(MdeConstants::Object::ECamera));
-    CleanupStack::Pop( addCondition );  
+    CMdEPropertyCondition& addPropertyCondition = addCondition->AddPropertyConditionL( originPropDef, TMdEUintEqual(MdeConstants::Object::ECamera));
+    CleanupStack::PushL( &addPropertyCondition );
     
     CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
-    modifyCondition->AddPropertyConditionL( originPropDef, TMdEUintEqual(MdeConstants::Object::ECamera));
-    CleanupStack::Pop( modifyCondition );
+    CMdEPropertyCondition& modifyPropertyCondition = modifyCondition->AddPropertyConditionL( originPropDef, TMdEUintEqual(MdeConstants::Object::ECamera));
+    CleanupStack::PushL( &modifyPropertyCondition );
     
     // add observer
     iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd ); 
 
    // modify observer
    iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
+   
+    CleanupStack::Pop( 4, addCondition );  
      
     TN_DEBUG1( "CThumbAGCameraObserver::AddObserversL() - end" );
     }
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -194,7 +194,10 @@
     iAudioObserver = NULL;
     
     delete iMDSShutdownObserver;
+    iMDSShutdownObserver = NULL;
+    
     delete iShutdownObserver;
+    iShutdownObserver = NULL;
     
     if(iReconnect)
         {
@@ -267,6 +270,7 @@
        
         // comes here if server gets shut down
         delete server;
+        server = NULL;
         
         CleanupStack::PopAndDestroy( scheduler );
         }
@@ -538,6 +542,8 @@
     TInt ret = rep->Get( KEnableDaemon, val );
     
     delete rep;
+    rep = NULL;
+    
     TN_DEBUG3( "CThumbAGDaemon::DaemonEnabledL() - val == %d, ret == %d", val, ret );
     return val;
     }
@@ -579,6 +585,7 @@
         {
         TRAP( result, CThumbAGDaemon::ThreadFunctionL());
         delete cleanup;
+        cleanup = NULL;
         }
     
     if ( result != KErrNone )
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagimageobserver.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagimageobserver.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -147,7 +147,10 @@
     iShutdown = ETrue;    
     
     delete iMDSShutdownObserver;
+    iMDSShutdownObserver = NULL;
+    
     delete iShutdownObserver;
+    iShutdownObserver = NULL;
     
     if(iReconnect)
         {
@@ -287,21 +290,28 @@
     
     // set observing conditions
     CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
-    addCondition->AddObjectConditionL( imageDef );
-    addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
-    CleanupStack::Pop( addCondition );  
+
+    CMdEObjectCondition& addObjectCondition = addCondition->AddObjectConditionL( imageDef );
+	CleanupStack::PushL( &addObjectCondition );
+	
+	CMdEPropertyCondition& addPropertyCondition = addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+   	CleanupStack::PushL( &addPropertyCondition );
     
     CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
-    modifyCondition->AddObjectConditionL( imageDef );
-    addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
-    CleanupStack::Pop( modifyCondition );
-   
+	CMdEObjectCondition& modifyObjectCondition = modifyCondition->AddObjectConditionL( imageDef );
+	CleanupStack::PushL( &modifyObjectCondition );
+	
+	CMdEPropertyCondition& modifyPropertyCondition = modifyCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+   	CleanupStack::PushL( &modifyPropertyCondition );
+	
     // add observers
     iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd ); 
 
     // modify observer
     iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
-     
+	
+    CleanupStack::Pop( 6, addCondition );
+
     TN_DEBUG1( "CThumbAGImageObserver::AddObserversL() - end" );
     }
 
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -958,39 +958,43 @@
     
     CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
     iQuery = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this );
-    iQuery->SetResultMode( EQueryResultModeItem );
+	
+	if(iQuery)
+		{
+	    iQuery->SetResultMode( EQueryResultModeItem );
 
-    CMdELogicCondition& rootCondition = iQuery->Conditions();
-    rootCondition.SetOperator( ELogicConditionOperatorAnd );
+	    CMdELogicCondition& rootCondition = iQuery->Conditions();
+	    rootCondition.SetOperator( ELogicConditionOperatorAnd );
     
-    // add IDs
-    CleanupClosePushL( iQueryQueue );
-    rootCondition.AddObjectConditionL( iQueryQueue );
-    CleanupStack::Pop( &iQueryQueue );
+	    // add IDs
+	    CleanupClosePushL( iQueryQueue );
+	    rootCondition.AddObjectConditionL( iQueryQueue );
+	    CleanupStack::Pop( &iQueryQueue );
     
-    // add object type conditions 
-    if (!(iModify || iUnknown))
-        {
-        CMdELogicCondition& objDefCondition = rootCondition.AddLogicConditionL( ELogicConditionOperatorOr );
+	    // add object type conditions 
+	    if (!(iModify || iUnknown))
+	        {
+	        CMdELogicCondition& objDefCondition = rootCondition.AddLogicConditionL( ELogicConditionOperatorOr );
         
-        if (iAutoImage)
-            {
-            CMdEObjectDef& imageDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
-            objDefCondition.AddObjectConditionL( imageDef );
-            }
-        if (iAutoVideo)
-            {
-            CMdEObjectDef& videoDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
-            objDefCondition.AddObjectConditionL( videoDef );
-            }
-        if (iAutoAudio)
-            {
-            CMdEObjectDef& audioDef = iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject );
-            objDefCondition.AddObjectConditionL( audioDef );
-            }    
-        }
+	        if (iAutoImage)
+	            {
+	            CMdEObjectDef& imageDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
+	            objDefCondition.AddObjectConditionL( imageDef );
+	            }
+	        if (iAutoVideo)
+	            {
+	            CMdEObjectDef& videoDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
+	            objDefCondition.AddObjectConditionL( videoDef );
+	            }
+	        if (iAutoAudio)
+	            {
+	            CMdEObjectDef& audioDef = iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject );
+	            objDefCondition.AddObjectConditionL( audioDef );
+	            }    
+	        }
     
-    iQuery->FindL();
+	    iQuery->FindL();
+		}
     
     TN_DEBUG1( "CThumbAGProcessor::QueryL() - end" );
     }
@@ -1036,25 +1040,33 @@
     CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject);
     iQueryPlaceholders = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this );
         
-    iQueryPlaceholders->SetResultMode( EQueryResultModeItem );
-    
-    CMdELogicCondition& rootCondition = iQueryPlaceholders->Conditions();
-    rootCondition.SetOperator( ELogicConditionOperatorOr );
-    
-    CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
-    imagePHObjectCondition.SetPlaceholderOnly( ETrue );
-    imagePHObjectCondition.SetNotPresent( aPresent );
-    
-    CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
-    videoPHObjectCondition.SetPlaceholderOnly( ETrue );
-    videoPHObjectCondition.SetNotPresent( aPresent );
-    
-    CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
-    audioPHObjectCondition.SetPlaceholderOnly( ETrue );
-    audioPHObjectCondition.SetNotPresent( aPresent );
-    
-    iQueryPlaceholders->FindL(KMaxTInt, KMaxQueryBatchSize);   
-   
+    if(iQueryPlaceholders)
+        {
+        iQueryPlaceholders->SetResultMode( EQueryResultModeItem );
+        
+        CMdELogicCondition& rootCondition = iQueryPlaceholders->Conditions();
+        rootCondition.SetOperator( ELogicConditionOperatorOr );
+        
+        CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
+        CleanupStack::PushL( &imagePHObjectCondition );
+        imagePHObjectCondition.SetPlaceholderOnly( ETrue );
+        imagePHObjectCondition.SetNotPresent( aPresent );
+        
+        CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
+        CleanupStack::PushL( &videoPHObjectCondition );
+        videoPHObjectCondition.SetPlaceholderOnly( ETrue );
+        videoPHObjectCondition.SetNotPresent( aPresent );
+        
+        CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
+        CleanupStack::PushL( &audioPHObjectCondition );
+        audioPHObjectCondition.SetPlaceholderOnly( ETrue );
+        audioPHObjectCondition.SetNotPresent( aPresent );
+        
+        iQueryPlaceholders->FindL(KMaxTInt, KMaxQueryBatchSize);   
+       
+        CleanupStack::Pop(3, &imagePHObjectCondition );
+        }
+	
     TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL - end" );
     }
 
@@ -1183,7 +1195,7 @@
         }
 #endif
 	
-  	if( iForceRun || iForegroundRun )
+  	if( (iForceRun || iForegroundRun ) && !iMountTimer->IsActive() )
       	{
         TN_DEBUG1( "void CThumbAGProcessor::RunL() skip idle detection!");
       	CancelTimeout();
@@ -1288,6 +1300,52 @@
 
         QueryL( EGenerationItemActionResolveType );
        }
+    else if ( iDeleteItemCount > 0 )
+       {
+       TN_DEBUG1( "void CThumbAGProcessor::RunL() delete thumbnails");
+       // delete thumbs by URI
+       __ASSERT_DEBUG((iTMSession), User::Panic(_L("CThumbAGProcessor::RunL() !iTMSession "), KErrBadHandle));
+       if(iTMSession)
+           {
+           TInt itemIndex(KErrNotFound);
+                               
+           for(TInt i=0;i<iGenerationQueue.Count() || itemIndex == KErrNotFound;i++)
+               {
+               if(iGenerationQueue[i].iItemAction == EGenerationItemActionDelete)
+                   {
+                   itemIndex = i;
+                   }
+               }
+       
+           if(itemIndex >= 0)
+               {
+               if(!iGenerationQueue[itemIndex].iUri)
+                   {
+                   //URI is invalid
+                   TN_DEBUG1( "void CThumbAGProcessor::RunL() unable to delete URI inbalid");
+                   iGenerationQueue.Remove( itemIndex );
+                   ActivateAO();
+                   return;
+                   }
+
+               TN_DEBUG2( "void CThumbAGProcessor::RunL() delete %S",  iGenerationQueue[itemIndex].iUri);
+               CThumbnailObjectSource* source = NULL;                
+               TRAPD(err,  source = CThumbnailObjectSource::NewL( *iGenerationQueue[itemIndex].iUri, KNullDesC));
+                  
+               if(err == KErrNone)
+                   {
+                   iTMSession->DeleteThumbnails( *source );
+                   }
+               delete source;
+               
+               delete iGenerationQueue[itemIndex].iUri;
+               iGenerationQueue[itemIndex].iUri = NULL;
+               iGenerationQueue.Remove( itemIndex );
+               
+               iActiveCount++;
+               }
+           }
+       }
     // no items in query queue, start new
     // select queue to process, priority by type
     else if ( iModifyItemCount > 0 )
@@ -1313,54 +1371,6 @@
         
         QueryL( EGenerationItemActionAdd );     
         }
-    else if ( iDeleteItemCount > 0 )
-        {
-        TN_DEBUG1( "void CThumbAGProcessor::RunL() delete thumbnails");
-        i2ndRound = EFalse;
-        iUnknown = EFalse;
-        // delete thumbs by URI
-        __ASSERT_DEBUG((iTMSession), User::Panic(_L("CThumbAGProcessor::RunL() !iTMSession "), KErrBadHandle));
-        if(iTMSession)
-            {
-            TInt itemIndex(KErrNotFound);
-                                
-            for(TInt i=0;i<iGenerationQueue.Count() || itemIndex == KErrNotFound;i++)
-                {
-                if(iGenerationQueue[i].iItemAction == EGenerationItemActionDelete)
-                    {
-                    itemIndex = i;
-                    }
-                }
-        
-            if(itemIndex >= 0)
-                {
-                if(!iGenerationQueue[itemIndex].iUri)
-                    {
-                    //URI is invalid
-                    TN_DEBUG1( "void CThumbAGProcessor::RunL() unable to delete URI inbalid");
-                    iGenerationQueue.Remove( itemIndex );
-                    ActivateAO();
-                    return;
-                    }
-
-                TN_DEBUG2( "void CThumbAGProcessor::RunL() delete %S",  iGenerationQueue[itemIndex].iUri);
-                CThumbnailObjectSource* source = NULL;                
-                TRAPD(err,  source = CThumbnailObjectSource::NewL( *iGenerationQueue[itemIndex].iUri, KNullDesC));
-                   
-                if(err == KErrNone)
-                    {
-                    iTMSession->DeleteThumbnails( *source );
-                    }
-                delete source;
-                
-                delete iGenerationQueue[itemIndex].iUri;
-                iGenerationQueue[itemIndex].iUri = NULL;
-                iGenerationQueue.Remove( itemIndex );
-                
-                iActiveCount++;
-                }
-            }
-        }
     else if( i2ndAddItemCount > 0)
         {
         TN_DEBUG1( "void CThumbAGProcessor::RunL() update 2nd round thumbnails");
@@ -1687,8 +1697,9 @@
         }
     
     //check if forced run needs to continue
-    if ( iModifyItemCount || iUnknownItemCount > 0 )
+    if ( (iModifyItemCount > 0 || iDeleteItemCount > 0 ||  iUnknownItemCount > 0) && !iMountTimer->IsActive())
         {
+        TN_DEBUG1( "CThumbAGProcessor::ActivateAO() -  forced run");
         SetForceRun( ETrue );
         }
     else
@@ -1697,7 +1708,7 @@
         SetForceRun( EFalse );
         }
     
-    if( !IsActive() && !iShutdown && ((iActiveCount == 0 && !iQueryActive) || iForceRun ))
+    if( !IsActive() && !iShutdown && ((iActiveCount < KMaxDaemonRequests && !iQueryActive) || iForceRun ))
         {
         TN_DEBUG1( "CThumbAGProcessor::ActivateAO() - Activated");
         SetActive();
@@ -1880,12 +1891,17 @@
     rootCondition.SetOperator( ELogicConditionOperatorOr );
     
     CMdEObjectCondition& imageObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
+	CleanupStack::PushL( &imageObjectCondition );
     
     CMdEObjectCondition& videoObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
+	CleanupStack::PushL( &videoObjectCondition );
     
     CMdEObjectCondition& audioObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
+	CleanupStack::PushL( &audioObjectCondition );
     
     iQueryAllItems->FindL(KMaxTInt, KMaxQueryBatchSize);  
+	
+	CleanupStack::Pop(3, &imageObjectCondition);
     
     TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL - end" );
     }
@@ -2018,8 +2034,11 @@
     TN_DEBUG2( "CThumbAGProcessor::FormatNotification(%d)", aFormat );
     
     iFormatting = aFormat;
+    
     if(!aFormat)
         {
+        //force update
+        UpdatePSValues(EFalse, ETrue);
         ActivateAO();
         }
     }
@@ -2128,9 +2147,11 @@
                 }
             }
         
+        TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() iPreviousItemsLeft == %d", iPreviousItemsLeft);
+        
         if( itemsLeft != iPreviousItemsLeft)
             {
-            TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() update KItemsleft == %d", itemsLeft);
+            TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() Set KItemsleft == %d", itemsLeft);
             iPreviousItemsLeft = itemsLeft;
             TInt ret = RProperty::Set(KTAGDPSNotification, KItemsleft, itemsLeft );
             
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagvideoobserver.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagvideoobserver.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -301,20 +301,27 @@
     
     // set observing conditions
     CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
-    addCondition->AddObjectConditionL( videoDef );
-    addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
-    CleanupStack::Pop( addCondition );  
+	
+	CMdEObjectCondition& addObjectCondition =  addCondition->AddObjectConditionL( videoDef );
+	CleanupStack::PushL( &addObjectCondition );
+	
+	CMdEPropertyCondition& addPropertyCondition  = addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+	CleanupStack::PushL( &addPropertyCondition );
     
     CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
-    modifyCondition->AddObjectConditionL( videoDef );
-    addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
-    CleanupStack::Pop( modifyCondition );
+	CMdEObjectCondition& modifyObjectCondition =  modifyCondition->AddObjectConditionL( videoDef );
+	CleanupStack::PushL( &modifyObjectCondition );
+	
+	CMdEPropertyCondition& modifyPropertyCondition =  modifyCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+	CleanupStack::PushL( &modifyPropertyCondition );
     
     // add observer
     iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd ); 
 
     // modify observer
     iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
+	
+	CleanupStack::Pop( 6, addCondition );
      
     TN_DEBUG1( "CThumbAGVideoObserver::AddObserversL() - end" );
     }
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/bwins/thumbnailmanageru.def	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/bwins/thumbnailmanageru.def	Thu Aug 19 10:13:51 2010 +0300
@@ -19,4 +19,7 @@
 	?Uri@CThumbnailObjectSource@@QAEABVTDesC16@@XZ @ 18 NONAME ; class TDesC16 const & CThumbnailObjectSource::Uri(void)
 	?Bitmap@CThumbnailObjectSource@@QAEPAVCFbsBitmap@@XZ @ 19 NONAME ; class CFbsBitmap * CThumbnailObjectSource::Bitmap(void)
 	?GetBitmapOwnership@CThumbnailObjectSource@@QAEPAVCFbsBitmap@@XZ @ 20 NONAME ; class CFbsBitmap * CThumbnailObjectSource::GetBitmapOwnership(void)
+	?NewLC@CThumbnailObjectSource@@SAPAV1@ABVTDesC16@@00@Z @ 21 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewLC(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+	?TargetUri@CThumbnailObjectSource@@QAEABVTDesC16@@XZ @ 22 NONAME ; class TDesC16 const & CThumbnailObjectSource::TargetUri(void)
+	?NewL@CThumbnailObjectSource@@SAPAV1@ABVTDesC16@@00@Z @ 23 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
 	
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/eabi/thumbnailmanageru.def	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/eabi/thumbnailmanageru.def	Thu Aug 19 10:13:51 2010 +0300
@@ -21,4 +21,7 @@
 	_ZN22CThumbnailObjectSource6BitmapEv @ 20 NONAME
 	_ZTI22CThumbnailRequestQueue @ 21 NONAME
 	_ZTV22CThumbnailRequestQueue @ 22 NONAME
+	_ZN22CThumbnailObjectSource4NewLERK7TDesC16S2_S2_ @ 23 NONAME
+	_ZN22CThumbnailObjectSource5NewLCERK7TDesC16S2_S2_ @ 24 NONAME
+	_ZN22CThumbnailObjectSource9TargetUriEv @ 25 NONAME
 
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h	Thu Aug 19 10:13:51 2010 +0300
@@ -41,7 +41,8 @@
     EReqUpdateThumbnails = 4,
     EReqGetThumbnailHandleLater = 5,
     EReqDeleteThumbnails = 6,
-    EReqRenameThumbnails = 7
+    EReqRenameThumbnails = 7,
+    EReqSetThumbnailPath = 8
 };
 
 /**
@@ -238,6 +239,32 @@
         const TInt aPriority );    
     
     /**
+     * Set thumbnail from file path.
+     *
+     * @param aPath Path to file from which the thumbnail is to be created.
+     * @param aFile File from which the thumbnail is to be created.
+     * @param aFlags Flags that control the creation of thumbnail.
+     * @param aQualityPreference Quality preference value
+     * @param aSize Requested size of the thumbnail.
+     * @param aDisplayMode Display mode.
+     * @param aPriority Priority of the request.
+     * @param aClientData Pointer to arbitrary client data.
+     *                    This pointer is not used by the API for
+     *                    anything other than returning it in the
+     *                    ThumbnailReady callback.
+     * @param aGeneratePersistentSizesOnly 
+     * @param aOverwrite Overwrite old existing thumbs
+     * @param aTargetUri         Target URI to which the imported thumbnail is linked.
+     * @param aThumbnailSize Relative thumbnail size
+     */
+    void SetThumbnailL( 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, TBool aOverwrite);    
+    
+    /**
      * Start active request.
      *
      * @since S60 v5.0
@@ -366,6 +393,11 @@
      * @since S60 v5.0
      */
     static TInt TimerCallBack(TAny* aAny);
+    
+    /**
+     * Checks if URI is virtual.
+     */
+    TBool IsVirtualUri( const TDesC& aPath ); 
 
 private:
     // data
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnaildataimpl.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnaildataimpl.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -41,6 +41,7 @@
 CThumbnailDataImpl::~CThumbnailDataImpl()
     {
     delete iBitmap;
+    iBitmap = NULL;
     iClientData = NULL;
     }
 
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -307,13 +307,20 @@
     CleanupStack::PushL( getThumbnailActive );
     
     if (aObjectSource.Uri().Length() &&
-        aObjectSource.Bitmap() != NULL)
+        aObjectSource.TargetUri().Length())
+        {
+        // from path
+        getThumbnailActive->SetThumbnailL( aObjectSource.Uri(),
+            aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode, 
+            priority, aClientData, ETrue, aObjectSource.TargetUri(), iThumbnailSize, ETrue);
+        } 
+    else if (aObjectSource.Uri().Length() &&
+             aObjectSource.Bitmap() != NULL)
         {
         // from bitmap
         getThumbnailActive->SetThumbnailL( aObjectSource.GetBitmapOwnership(),
-                     aObjectSource.Id(), KBmpMime, iFlags, iQualityPreference,
-                     iSize, iDisplayMode, priority, aClientData, ETrue,
-                     aObjectSource.Uri(), iThumbnailSize, ETrue);
+            aObjectSource.Id(), KBmpMime, iFlags, iQualityPreference, iSize, iDisplayMode,
+            priority, aClientData, ETrue, aObjectSource.Uri(), iThumbnailSize, ETrue);
         } 
     else if (aObjectSource.Uri().Length() &&
              aObjectSource.Buffer() != NULL &&
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -24,6 +24,7 @@
 
 // ---------------------------------------------------------------------------
 // CThumbnailObjectSource::NewL()
+// CThumbnailObjectSource::NewLC()
 // Two-phased constructor.
 // ---------------------------------------------------------------------------
 //
@@ -36,12 +37,6 @@
     return self;
     }
 
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::NewLC()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
 EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const TDesC&
     aUri, const TDesC& aMimeType )
     {
@@ -51,11 +46,6 @@
     return self;
     }
 
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
 EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const RFile64&
     aFile, const TDesC& aMimeType )
     {
@@ -65,12 +55,6 @@
     return self;
     }
 
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::NewLC()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
 EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const RFile64&
     aFile, const TDesC& aMimeType )
     {
@@ -80,15 +64,16 @@
     return self;
     }
 
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( CFbsBitmap*  aBitmap, const TDesC& aUri )
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( CFbsBitmap*  aBitmap, 
+    const TDesC& aUri )
     {
     CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aBitmap, aUri );
     CleanupStack::Pop( self );
     return self;   
     }
 
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( CFbsBitmap*  aBitmap, const TDesC& aUri )
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( CFbsBitmap*  aBitmap,
+    const TDesC& aUri )
     {
     CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
     CleanupStack::PushL( self );
@@ -96,21 +81,60 @@
     return self;
     }
 
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( TDesC8* aBuffer,  TDesC& aMimeType, const TDesC& aUri)
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( TDesC8* aBuffer,
+    TDesC& aMimeType, const TDesC& aUri)
     {
-    CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aBuffer, aMimeType, aUri );
+    CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aBuffer, 
+        aMimeType, aUri );
     CleanupStack::Pop( self );
     return self;   
     }
 
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( TDesC8* aBuffer,  TDesC& aMimeType, const TDesC& aUri)
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( TDesC8* aBuffer, 
+    TDesC& aMimeType, const TDesC& aUri)
     {
     CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
     CleanupStack::PushL( self );
     self->ConstructL( aBuffer, aMimeType, aUri );
     return self;
     }
-   
+
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const TDesC& 
+    aUri, const TThumbnailId aThumbnailId, const TDesC& aMimeType )
+    {
+    CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aUri,
+        aThumbnailId, aMimeType );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const TDesC& aUri, 
+    const TThumbnailId aThumbnailId, const TDesC& aMimeType )
+    {
+    CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
+    CleanupStack::PushL( self );
+    self->ConstructL( aUri, aMimeType, aThumbnailId );
+    return self;
+    }
+
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const TDesC& aUri, 
+    const TDesC& aTargetUri, const TDesC& aMimeType )
+    {
+    CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aUri, aTargetUri,
+        aMimeType );
+    CleanupStack::Pop( self );
+    return self;   
+    }
+
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const TDesC& aUri, 
+    const TDesC& aTargetUri, const TDesC& aMimeType )
+    {
+    CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
+    CleanupStack::PushL( self );
+    self->ConstructL( aUri, aTargetUri, aMimeType );
+    return self;
+    }
+
 
 // ---------------------------------------------------------------------------
 // CThumbnailObjectSource::CThumbnailObjectSource()
@@ -134,15 +158,11 @@
     iUri = aUri.AllocL();
     iMimeType = HBufC8::NewL( aMimeType.Length() );
     iMimeType->Des().Copy( aMimeType );
+    iThumbnailId = 0;
     iBitmap = NULL;
+    iTargetUri = NULL;
     }
 
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
 void CThumbnailObjectSource::ConstructL( const RFile64& aFile, const TDesC&
     aMimeType )
     {
@@ -151,26 +171,18 @@
     iMimeType->Des().Copy( aMimeType );
     iThumbnailId = 0;
     iBitmap = NULL;
+    iTargetUri = NULL;
     }
 
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailObjectSource::ConstructL( CFbsBitmap* aBitmap, const TDesC&
-        aUri )
+void CThumbnailObjectSource::ConstructL( CFbsBitmap* aBitmap, const TDesC& 
+    aUri )
     {
     iBitmap = aBitmap;
     iUri = aUri.AllocL();
     iThumbnailId = 0;
+    iTargetUri = NULL;
     }
 
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
 void CThumbnailObjectSource::ConstructL( TDesC8* aBuffer, const TDesC&
     aMimeType, const TDesC& aUri )
     {
@@ -180,13 +192,9 @@
     iUri = aUri.AllocL(); 
     iThumbnailId = 0;
     iBitmap = NULL;
+    iTargetUri = NULL;
     }
 
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
 void CThumbnailObjectSource::ConstructL( const TDesC& aUri, const TDesC&
     aMimeType, TThumbnailId aThumbnailId )
     {
@@ -194,6 +202,18 @@
     iMimeType = HBufC8::NewL( aMimeType.Length() );
     iMimeType->Des().Copy( aMimeType );
     iThumbnailId = aThumbnailId;
+    iTargetUri = NULL;
+    }
+
+void CThumbnailObjectSource::ConstructL( const TDesC& aUri, const TDesC& 
+    aTargetUri, const TDesC& aMimeType )
+    {
+    iUri = aUri.AllocL();
+    iTargetUri = aTargetUri.AllocL();
+    iMimeType = HBufC8::NewL( aMimeType.Length() );
+    iMimeType->Des().Copy( aMimeType );
+    iThumbnailId = 0;
+    iBitmap = NULL;
     }
 
 
@@ -219,12 +239,11 @@
 // CThumbnailObjectSourceImpl::FileHandle()
 // ---------------------------------------------------------------------------
 //
-EXPORT_C  RFile64& CThumbnailObjectSource::FileHandle()
+EXPORT_C RFile64& CThumbnailObjectSource::FileHandle()
     {
     return iFile;
     }
 
-
 // ---------------------------------------------------------------------------
 // CThumbnailObjectSourceImpl::Uri()
 // ---------------------------------------------------------------------------
@@ -271,35 +290,15 @@
     return KNullDesC8;
     }
 
+// ---------------------------------------------------------------------------
+// CThumbnailObjectSourceImpl::Id()
+// ---------------------------------------------------------------------------
+//
 EXPORT_C TThumbnailId CThumbnailObjectSource::Id()
     {
     return iThumbnailId;
     }
 	
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const TDesC&
-aUri, const TThumbnailId aThumbnailId, const TDesC& aMimeType )
-{
-CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aUri,
-        aThumbnailId, aMimeType );
-CleanupStack::Pop( self );
-return self;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::NewLC()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const TDesC& aUri, 
-	const TThumbnailId aThumbnailId, const TDesC& aMimeType )
-    {
-    CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
-    CleanupStack::PushL( self );
-    self->ConstructL( aUri, aMimeType, aThumbnailId );
-    return self;
-    }
-
 // ---------------------------------------------------------------------------
 // CThumbnailObjectSourceImpl::Bitmap()
 // ---------------------------------------------------------------------------
@@ -320,4 +319,18 @@
     return temp;
     }
 
+// ---------------------------------------------------------------------------
+// CThumbnailObjectSourceImpl::TargetUri()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CThumbnailObjectSource::TargetUri()
+    {
+    if ( iTargetUri )
+        {
+        return * iTargetUri;
+        }
+    return KNullDesC;
+    }
+
+
 // End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -47,6 +47,7 @@
         {
         iTimer->Cancel();
         }
+    
     delete iTimer;
     iTimer = NULL;
     
@@ -163,6 +164,14 @@
                 TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iPath );
                 
                 CleanupClosePushL( iFile );
+                
+                if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
+                    {
+                    // We may need the file handle later for the 2nd phase thumbnail
+                    iMyFileHandle.Close();
+                    User::LeaveIfError( iMyFileHandle.Duplicate( iFile ));
+                    }
+                
                 iSession.RequestThumbnailL( iFile, iPath, iParamsPckg, iStatus );
                 CleanupStack::PopAndDestroy( &iFile );   
                 }
@@ -197,6 +206,14 @@
             TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iTargetUri );
             
             CleanupClosePushL( iFile );
+            
+            if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
+                {
+                // We may need the file handle later for the 2nd phase thumbnail
+                iMyFileHandle.Close();
+                User::LeaveIfError( iMyFileHandle.Duplicate( iFile ));
+                }
+            
             iSession.RequestThumbnailL( iFile, iTargetUri, iParamsPckg, iStatus );
             CleanupStack::PopAndDestroy( &iFile );
             break;
@@ -220,6 +237,29 @@
             iSession.RenameThumbnails( iParamsPckg, iStatus );
             break;
             }  
+        case EReqSetThumbnailPath:
+            {
+            // open file handle
+            iFile.Close();
+            User::LeaveIfError( iFile.Open( iFs, iParams.iFileName, EFileShareReadersOrWriters ) );  
+            
+            TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iParams.iFileName );
+            
+            CleanupClosePushL( iFile );
+            
+            if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
+                {
+                // We may need the file handle later for the 2nd phase thumbnail
+                iMyFileHandle.Close();
+                User::LeaveIfError( iMyFileHandle.Duplicate( iFile ));
+                }
+            
+            iSession.RequestThumbnailL( iFile, iTargetUri, iParamsPckg, iStatus );
+            CleanupStack::PopAndDestroy( &iFile );
+
+            break;
+            } 
+            
         default:
             {
             break;
@@ -594,7 +634,7 @@
                     }
 	            }
 #endif
-	        TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady %d", iParams.iRequestId );
+	        TN_DEBUG3( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady req=%d err=%d", iParams.iRequestId, iError );
 	        iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId );
 	            
             }
@@ -651,10 +691,20 @@
     iParams.iThumbnailSize = aThumbnailSize;
     iParams.iThumbnailId = aThumbnailId;
     iParams.iOverwrite = EFalse;
+    iParams.iImport = EFalse;
     
     User::LeaveIfError( iFile.Duplicate( aFile ));
     
     iTargetUri = aTargetUri;
+    
+    if (iParams.iFileName.Length() && IsVirtualUri(iParams.iFileName))
+        {
+        iParams.iVirtualUri = ETrue;
+        }
+    else
+        {
+        iParams.iVirtualUri = EFalse;
+        }
     }
 
 
@@ -687,8 +737,18 @@
     iParams.iThumbnailSize = aThumbnailSize;
     iParams.iThumbnailId = aThumbnailId;
     iParams.iOverwrite = EFalse;
+    iParams.iImport = EFalse;
     
     iTargetUri = aTargetUri;
+    
+    if (iPath.Length() && IsVirtualUri(iPath))
+        {
+        iParams.iVirtualUri = ETrue;
+        }
+    else
+        {
+        iParams.iVirtualUri = EFalse;
+        }
     }
 
 
@@ -721,9 +781,19 @@
     iParams.iThumbnailId = aThumbnailId;
     iParams.iFileName = aPath;
     iParams.iOverwrite = EFalse;
+    iParams.iImport = EFalse;
     
     iPath = aPath;
     iTargetUri = aTargetUri;
+    
+    if (iPath.Length() && IsVirtualUri(iPath))
+        {
+        iParams.iVirtualUri = ETrue;
+        }
+    else
+        {
+        iParams.iVirtualUri = EFalse;
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -757,8 +827,18 @@
     iParams.iQualityPreference = aQualityPreference;
     iParams.iThumbnailId = aThumbnailId;
     iParams.iOverwrite = aOverwrite;
+    iParams.iImport = EFalse;
     
     iTargetUri = aTargetUri;
+    
+    if (iTargetUri.Length() && IsVirtualUri(iTargetUri))
+        {
+        iParams.iVirtualUri = ETrue;
+        }
+    else
+        {
+        iParams.iVirtualUri = EFalse;
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -789,9 +869,19 @@
     iParams.iThumbnailId = aThumbnailId;
     iParams.iFileName = aTargetUri;
     iParams.iOverwrite = aOverwrite;
+    iParams.iImport = EFalse;
     
     iTargetUri = aTargetUri;
     
+    if (iTargetUri.Length() && IsVirtualUri(iTargetUri))
+        {
+        iParams.iVirtualUri = ETrue;
+        }
+    else
+        {
+        iParams.iVirtualUri = EFalse;
+        }
+    
     TInt memoryFree( 0 );
     HAL::Get( HALData::EMemoryRAMFree, memoryFree );
     
@@ -804,7 +894,7 @@
         iParams.iMimeType = TDataType( aMimeType );
         iRequestType = EReqSetThumbnailBitmap;
         }
-    else
+    else if (!iParams.iVirtualUri)
         {
         // memory low, create thumbs using filehandle
         TN_DEBUG1( "CThumbnaiRequestActive::SetThumbnailbyBitmap() - memory low, create thumbs using filehandle!" );
@@ -813,6 +903,10 @@
         iParams.iPriority = aPriority - 1;
         iRequestType = EReqGetThumbnailHandleLater;
         }
+    else
+        {
+        User::Leave(KErrNoMemory);
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -838,6 +932,8 @@
     iParams.iQualityPreference = aQualityPreference;
     iParams.iThumbnailId = aThumbnailId;
     iParams.iOverwrite = EFalse;
+    iParams.iVirtualUri = EFalse;
+    iParams.iImport = EFalse;
     
     iPath = aPath;
     iOrientation = aOrientation;
@@ -878,6 +974,51 @@
     }
 
 // ---------------------------------------------------------------------------
+// CThumbnailRequestActive::SetThumbnailL()
+// Set thumbnail from file path.
+// ---------------------------------------------------------------------------
+//
+void CThumbnailRequestActive::SetThumbnailL( 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, TBool aOverwrite)
+    {
+    iRequestType = EReqSetThumbnailPath;
+    
+    iClientData = aClientData;
+    iParams.iControlFlags = (aGeneratePersistentSizesOnly ?
+                            EThumbnailGeneratePersistentSizesOnly :
+                            EThumbnailNoControlFlags);
+    iParams.iOriginalControlFlags = iParams.iControlFlags;
+    iParams.iMimeType = TDataType( aMimeType );
+    iParams.iBitmapHandle = 0;
+    iParams.iSize = aSize;
+    iParams.iDisplayMode = aDisplayMode;
+    iParams.iFileName = aPath;
+    iParams.iRequestId = iRequestId;
+    iParams.iPriority = aPriority;
+    iParams.iFlags = aFlags;
+    iParams.iQualityPreference = aQualityPreference;
+    iParams.iThumbnailSize = aThumbnailSize;
+    iParams.iOverwrite = aOverwrite;
+    
+    iTargetUri = aTargetUri;
+    
+    if (iTargetUri.Length() && IsVirtualUri(iTargetUri))
+        {
+        iParams.iVirtualUri = ETrue;
+        }
+    else
+        {
+        iParams.iVirtualUri = EFalse;
+        }
+    
+    iParams.iImport = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
 // Request 2nd phase thumbnail
 // ---------------------------------------------------------------------------
 //
@@ -970,4 +1111,26 @@
     return KErrNone;
     }
 
+// ---------------------------------------------------------------------------
+// CThumbnailRequestActive::IsVirtualUri()
+// Checks if URI is virtual.
+// ---------------------------------------------------------------------------
+//
+TBool CThumbnailRequestActive::IsVirtualUri( const TDesC& aPath )
+    {
+    TInt pos = aPath.Find(KBackSlash);
+    
+    // normal URI
+    if ( pos == 2 )
+        {
+        return EFalse;
+        }
+    // virtual URI
+    else
+        {
+        TN_DEBUG1( "CThumbnailRequestActive::IsVirtualUri() - yes");
+        return ETrue;
+        }    
+    }
+
 // End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestqueue.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestqueue.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -163,6 +163,7 @@
              // delete completed task
              TN_DEBUG3( "CThumbnailRequestQueue::RemoveCompleted() - deleted id = %d (0x%08x)", request->RequestId(), request);
              delete request;
+             request = NULL;
              iRequests.Remove( i );
              }
          }
@@ -203,6 +204,7 @@
             else
                 {
                 delete request;
+                request = NULL;
                 iRequests.Remove( i );
                           
                 TN_DEBUG2( "CThumbnailRequestQueue::CancelRequest() - removed request ID: %d", aRequestId);
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailcenrep.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailcenrep.h	Thu Aug 19 10:13:51 2010 +0300
@@ -142,7 +142,7 @@
     };
     
 public:
-    enum TThumbnailSourceType { EUnknownSourceType, EImage, EVideo, EAudio };
+    enum TThumbnailSourceType { EUnknownSourceType, EImage, EVideo, EAudio, EContact };
     enum TThumbnailSizeType { EUnknownSizeType, EGrid, EList, EFullscreen }; 
     
 public:
@@ -203,7 +203,10 @@
     TBool iVideoFullscreen;
     TBool iAudioGrid;
     TBool iAudioList;
-    TBool iAudioFullscreen;    
+    TBool iAudioFullscreen;
+    TBool iContactGrid;
+    TBool iContactList;
+    TBool iContactFullscreen; 
 };
 
 #endif // THUMBNAILCENREP_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailfetchedchecker.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailfetchedchecker.h	Thu Aug 19 10:13:51 2010 +0300
@@ -18,6 +18,7 @@
 #define THUMBNAILFETCHEDCHECKER_H
 
 #include <e32base.h>
+#include <thumbnailmanager.h>
 
 NONSHARABLE_CLASS( CThumbnailFetchedChecker ): public CBase
     {
@@ -25,8 +26,10 @@
     static CThumbnailFetchedChecker* NewL();
     virtual ~CThumbnailFetchedChecker();
 public:
-    TInt LastFetchResult( const TDesC& aUri );
-    void SetFetchResult( const TDesC& aUri, TInt aError );
+    TInt LastFetchResult( const TDesC& aUri, const TThumbnailSize aThumbnailSize );
+    void SetFetchResult( const TDesC& aUri, const TThumbnailSize aThumbnailSize, TInt aError );
+    void DeleteFetchResult( const TDesC& aUri );
+    void RenameFetchResultL( const TDesC& aNewUri, const TDesC& aOldUri );
     void Reset();
 private:
     CThumbnailFetchedChecker();
@@ -34,13 +37,15 @@
     NONSHARABLE_CLASS( CEntry ) : public CBase
         {
     public:
-        static CEntry* NewL( const TDesC& aUri, TInt aError );
-        static TInt FindCB( const TDesC* aUri, const CEntry& aEntry );
+        static CEntry* NewL( const TDesC& aUri, const TThumbnailSize aThumbnailSize, TInt aError );
+        static TInt FindCB( const CEntry& aEntry1, const CEntry& aEntry );
+        static TInt FindCBUri( const TDesC* aUri, const CEntry& aEntry );
         static TInt InsertCB( const CEntry& aEntry1, const CEntry& aEntry2 );
         CEntry();
         virtual ~CEntry();
     public:
         HBufC* iUri;
+        TInt32 iSize;
         TInt iError;
         };
 
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h	Thu Aug 19 10:13:51 2010 +0300
@@ -33,7 +33,7 @@
  *  @since S60 v5.0
  */
 class CThumbnailGenerateTask: public CThumbnailTask,
-    public MThumbnailProviderObserver
+                              public MThumbnailProviderObserver
     {
 public:
 
@@ -56,7 +56,8 @@
             TDisplayMode aDisplayMode, TInt aPriority,
             RArray < TThumbnailPersistentSize >* aMissingSizes, const TDesC& aTargetUri,
             TThumbnailSize aThumbnailSize, const TInt64 aModified,
-            const CThumbnailManager::TThumbnailQualityPreference aQualityPreference );
+            const CThumbnailManager::TThumbnailQualityPreference aQualityPreference,
+            TBool aImportVirtual );
 
     /**
      * Destructor.
@@ -233,6 +234,9 @@
     TBool iPortrait;
     
     TInt iBitmapHandle;
+    
+    // virtual uri
+    TBool iVirtualUri;
 };
 
 #endif // THUMBNAILGENERATETASK_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailscaletask.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailscaletask.h	Thu Aug 19 10:13:51 2010 +0300
@@ -59,7 +59,7 @@
         TDisplayMode aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
         const TThumbnailSize aThumbnailSize, const TInt64 aModified,
         const TBool aBitmapToPool, const TBool aEXIF, 
-        const TThumbnailServerRequestId aRequestId);
+        const TThumbnailServerRequestId aRequestId, const TBool aImportVirtual);
 
     /**
      * Destructor
@@ -131,7 +131,7 @@
         aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
         const TThumbnailSize aThumbnailSize, const TInt64 aModified,
         const TBool aBitmapToPool, const TBool aEXIF, 
-        const TThumbnailServerRequestId aRequestId);
+        const TThumbnailServerRequestId aRequestId, const TBool aImportVirtual);
 
     /**
      * Symbian 2nd phase constructor can leave.
@@ -278,6 +278,9 @@
      * Is origin EXIF.
      */
     TBool iEXIF;
+    
+    // virtual uri
+    TBool iVirtualUri;
 };
 
 #endif // THUMBNAILSCALETASK_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h	Thu Aug 19 10:13:51 2010 +0300
@@ -63,7 +63,7 @@
 
     while ( item )
         {
-        delete * item;
+        delete *item;
         item = iter.NextValue();
         }
     aHashMap.Close();
@@ -168,9 +168,8 @@
      */
     void StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aBitmap, const TSize&
         aOriginalSize, const TBool aCropped, const TThumbnailSize aThumbnailSize,
-        const TInt64 aModified,
-        const TBool aThumbFromPath = ETrue,
-        const TBool aCheckExist = ETrue);
+        const TInt64 aModified, const TBool aThumbFromPath,
+        const TBool aCheckExist);
 
     /**
      * Fetch thumbnail image.
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h	Thu Aug 19 10:13:51 2010 +0300
@@ -130,10 +130,6 @@
 _LIT8 ( KGetInfoRowID, "SELECT MAX (ThumbnailInfo.rowID) FROM ThumbnailInfo" );
 _LIT8 ( KGetDataRowID, "SELECT MAX (ThumbnailInfoData.rowID) FROM ThumbnailInfoData" );
 
-// counts
-_LIT8 ( KGetInfoCount, "SELECT COUNT(*) FROM ThumbnailInfo" );
-_LIT8 ( KGetInfoDataCount, "SELECT COUNT(*) FROM ThumbnailInfoData" );
-
 // flush 
 _LIT8( KThumbnailMoveFromTempInfoToMainTable, "INSERT INTO ThumbnailInfo SELECT * FROM TempThumbnailInfo;");
 _LIT8( KThumbnailMoveFromTempDataToMainTable, "INSERT INTO ThumbnailInfoData SELECT * FROM TempThumbnailInfoData;");
@@ -214,6 +210,6 @@
 _LIT8( KThumbnailSelectAllPaths, "SELECT ThumbnailInfo.RowID,Path FROM ThumbnailInfo "
         "WHERE NOT EXISTS (SELECT Path FROM ThumbnailDeleted "
         "WHERE ThumbnailInfo.Path = ThumbnailDeleted.Path) "
-        "AND ThumbnailInfo.RowID > :RowID ORDER BY ThumbnailInfo.RowID ASC LIMIT :Limit;" );
+        "AND ThumbFromPath = 1 AND ThumbnailInfo.RowID > :RowID ORDER BY ThumbnailInfo.RowID ASC LIMIT :Limit;" );
 
 #endif // THUMBNAILSQL_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h	Thu Aug 19 10:13:51 2010 +0300
@@ -208,9 +208,10 @@
      * @param aFs File server.
      * @param aDrive Drive the store used for
      * @param aCenter Pointer to cenrep data handler
+	 * @param aReadOnly flag is store write protected
      * @return New CThumbnailStore instance.
      */
-    static CThumbnailStore* NewL( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer );
+    static CThumbnailStore* NewL( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly );
 
     /**
      * Destructor
@@ -232,9 +233,7 @@
      */
     void StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aThumbnail, const
         TSize& aOriginalSize, TBool aCropped, const TThumbnailSize aThumbnailSize, 
-        const TInt64 aModified,
-        const TBool aThumbFromPath = ETrue,
-        TBool aBlackListed = EFalse );
+        const TInt64 aModified, const TBool aThumbFromPath, TBool aBlackListed);
 
     /**
      * Fetches thumbnail image.
@@ -360,6 +359,11 @@
      * @contains indication whether file modified
      */
     TBool CheckModifiedByPathL( const TDesC& aPath, const TInt64 aModified, TBool& modifiedChanged);
+    
+    /**
+     *  @return TBool is store write protected
+     */
+    TBool IsReadOnly();
 
 private:
     /**
@@ -368,9 +372,10 @@
      * @since S60 v5.0
      * @param aFs File server.
      * @param aDrive Drive the store used for
+	 * @param aReadOnly set flag if store is write protected
      * @return New CThumbnailStore instance.
      */
-    CThumbnailStore( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer);
+    CThumbnailStore( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly);
 
     /**
      * Symbian 2nd phase constructor can leave.
@@ -442,7 +447,7 @@
     void StoreThumbnailL( const TDesC& aPath, const TDes8& aData, const TSize&
         aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, 
         const TThumbnailSize& aThumbnailSize, const TInt64 aModified,
-        const TBool aThumbFromPath = ETrue);
+        const TBool aThumbFromPath);
 
     /**
      * Finds possible existing duplicate thumbnail.
@@ -650,6 +655,11 @@
      * How long previous flush took ms
      */
     TInt iPreviousFlushDelay;
+    
+    /**
+     * is store write protected
+     */
+    TBool iReadOnly;
 
 };
 // End of File
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailcenrep.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailcenrep.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -67,6 +67,11 @@
         case EAudioFullScreenThumbnailSize:
             iSourceType = EAudio;
             break;
+        case EContactGridThumbnailSize:
+        case EContactListThumbnailSize:
+        case EContactFullScreenThumbnailSize:
+            iSourceType = EContact;
+            break;
         default:
             iSourceType = EUnknownSourceType;        
         }
@@ -80,7 +85,8 @@
 TThumbnailAutoCreate::TThumbnailAutoCreate()
     : iImageGrid(EFalse), iImageList(EFalse), iImageFullscreen(EFalse),
       iVideoGrid(EFalse), iVideoList(EFalse), iVideoFullscreen(EFalse),
-      iAudioGrid(EFalse), iAudioList(EFalse), iAudioFullscreen(EFalse)
+      iAudioGrid(EFalse), iAudioList(EFalse), iAudioFullscreen(EFalse),
+      iContactGrid(EFalse), iContactList(EFalse), iContactFullscreen(EFalse)
     {
     // No implementation required
     }
@@ -107,7 +113,9 @@
     {
     iPersistentSizes.Close();
     delete iAutoCreate;
+    iAutoCreate = NULL;
     delete iRepository;
+    iRepository = NULL;
     }
 
 // ---------------------------------------------------------------------------
@@ -203,6 +211,57 @@
     
     iPersistentSizes.AppendL( TThumbnailPersistentSize( EAudioFullScreenThumbnailSize, TSize( xSize, ySize ),
                               flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EFullscreen ));     
+
+// Contact TN, set default values if not found
+    if(iRepository->Get( KSizeContactGridWidth, xSize ) != KErrNone)
+        {
+        xSize = 54;
+        }
+    if( iRepository->Get( KSizeContactGridHeight, ySize ) != KErrNone)
+        {
+        ySize = 54;
+        }
+    
+    if( iRepository->Get( KAutoCreateContactGrid, autoCreate ) != KErrNone)
+    {
+        autoCreate = 1;
+    }
+
+    iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactGridThumbnailSize, TSize( xSize, ySize ),
+            KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EGrid ));
+    
+    if(  iRepository->Get( KSizeContactListWidth, xSize ) != KErrNone)
+        {
+        xSize = 64;
+        }
+    if(  iRepository->Get( KSizeContactListHeight, ySize ) != KErrNone)
+        {
+        ySize = 64;
+        }
+    if(  iRepository->Get( KAutoCreateContactList, autoCreate ) != KErrNone)
+        {
+        autoCreate = 1;
+        }
+
+    iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactListThumbnailSize, TSize( xSize, ySize ),
+            KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EList ));
+    
+    if( iRepository->Get( KSizeContactFullscreenWidth, xSize ) != KErrNone)
+        {
+        xSize = 250;
+        }
+    if( iRepository->Get( KSizeContactFullscreenHeight, ySize ) != KErrNone)
+        {
+        ySize = 250;
+        }
+    if( iRepository->Get( KAutoCreateContactFullscreen, autoCreate) != KErrNone)
+        {
+        autoCreate = 1;
+        }
+    
+    iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactFullScreenThumbnailSize, TSize( xSize, ySize ),
+                              flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EFullscreen ));     
+    
     
     iAutoCreate = new (ELeave) TThumbnailAutoCreate();
     
@@ -215,6 +274,19 @@
     User::LeaveIfError( iRepository->Get( KAutoCreateAudioGrid, iAutoCreate->iAudioGrid ));
     User::LeaveIfError( iRepository->Get( KAutoCreateAudioList, iAutoCreate->iAudioList ));
     User::LeaveIfError( iRepository->Get( KAutoCreateAudioFullscreen, iAutoCreate->iAudioFullscreen ));    
+    
+    if( iRepository->Get( KAutoCreateContactGrid, iAutoCreate->iContactGrid ) != KErrNone )
+        {
+        iAutoCreate->iContactGrid = 1;
+        }
+    if( iRepository->Get( KAutoCreateContactList, iAutoCreate->iContactList ) != KErrNone )
+        {
+        iAutoCreate->iContactList = 1;
+        }
+    if( iRepository->Get( KAutoCreateContactFullscreen, iAutoCreate->iContactFullscreen ) != KErrNone )
+        {
+        iAutoCreate->iContactFullscreen = 1;
+        }
     }
 
 // ---------------------------------------------------------------------------
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -16,6 +16,7 @@
 */
 
 #include "thumbnailfetchedchecker.h"
+#include "thumbnaillog.h"
 
 const int KMaxStoredEntries = 100;
 
@@ -49,13 +50,27 @@
 // CThumbnailFetchedChecker::LastFetchResult()
 // -----------------------------------------------------------------------------
 //
-TInt CThumbnailFetchedChecker::LastFetchResult( const TDesC& aUri )
+TInt CThumbnailFetchedChecker::LastFetchResult( const TDesC& aUri, const TThumbnailSize aThumbnailSize )
     {
-    TInt i = iNotFetched.FindInOrder( aUri, CEntry::FindCB );
-    if ( i >= 0 && i < iNotFetched.Count() )
+    TN_DEBUG3( "CThumbnailFetchedChecker::LastFetchResult(aUri=%S aThumbnailSize=%d)", &aUri, aThumbnailSize);
+
+    CEntry* entry = NULL;
+    TRAPD( err, entry = CEntry::NewL( aUri, aThumbnailSize, KErrNone ) );
+    if ( !err && entry )
         {
-        return iNotFetched[ i ]->iError;
+        TInt ret = iNotFetched.FindInOrder( entry, CEntry::FindCB );
+        if ( ret != KErrNotFound )
+            {
+            TN_DEBUG1( "CThumbnailFetchedChecker::LastFetchResult() -> error found");
+            delete entry;
+            entry = NULL;
+            return iNotFetched[ ret ]->iError;
+            }
         }
+
+    delete entry;        
+    entry = NULL;
+        
     return KErrNone;
     }
 
@@ -63,31 +78,44 @@
 // CThumbnailFetchedChecker::SetFetchResult()
 // -----------------------------------------------------------------------------
 //
-void CThumbnailFetchedChecker::SetFetchResult( const TDesC& aUri, TInt aError )
+void CThumbnailFetchedChecker::SetFetchResult( const TDesC& aUri, const TThumbnailSize aThumbnailSize, TInt aError )
     {
+    TN_DEBUG4( "CThumbnailFetchedChecker::SetFetchResult(aUri=%S aThumbnailSize=%d aError=%d)", &aUri, aThumbnailSize, aError);
     if ( aError == KErrNone )
         {
-        // Do not store successful results
-        TInt i = iNotFetched.FindInOrder( aUri, CEntry::FindCB );
-        if ( i >= 0 && i < iNotFetched.Count() )
+        // Remove successful results from store
+        CEntry* entry = NULL;
+        TRAPD( err, entry = CEntry::NewL( aUri, aThumbnailSize, aError ) );
+        if ( !err && entry )
             {
-            delete iNotFetched[ i ];
-            iNotFetched.Remove( i );
+            TInt i = iNotFetched.FindInOrder( entry, CEntry::FindCB );
+            if ( i >= 0 )
+                {
+                TN_DEBUG2( "CThumbnailFetchedChecker::LastFetchResult() -> Remove successful results from store %d",  iNotFetched.Count() );
+                delete iNotFetched[ i ];
+                iNotFetched[ i ] = NULL;
+                iNotFetched.Remove( i );
+                }
             }
+        entry = NULL;
+        delete entry;
         }
     else
         {
+
         // Add or update
         CEntry* entry = NULL;
-        TRAPD( err, entry = CEntry::NewL( aUri, aError ) );
+        TRAPD( err, entry = CEntry::NewL( aUri, aThumbnailSize, aError ) );
         if ( !err && entry )
             {
             err = iNotFetched.Find( entry );
             if ( err != KErrNotFound )
                 {
-                TInt i = iNotFetched.FindInOrder( aUri, CEntry::FindCB );
-                if ( i >= 0 && i < iNotFetched.Count() )
+                // update existing fetch result
+                TInt i = iNotFetched.FindInOrder( entry, CEntry::FindCB );
+                if ( i >= 0 )
                     {
+                    TN_DEBUG1( "CThumbnailFetchedChecker::LastFetchResult() -> Update fetched tn error" );
                     iNotFetched[ i ]->iError = aError;
                     }
                 }
@@ -95,9 +123,11 @@
                 {
                 if( iNotFetched.Count() < KMaxStoredEntries )
                     {
+                    // insert new fetch result
                     TInt err = iNotFetched.InsertInOrder( entry, CEntry::InsertCB );
                     if ( err == KErrNone )
                         {
+                        TN_DEBUG2( "CThumbnailFetchedChecker::LastFetchResult() -> Inserted new fetched tn error %d", iNotFetched.Count());	
                         entry = NULL; // owned by array now
                         }
                     }
@@ -110,25 +140,77 @@
     }
 
 // -----------------------------------------------------------------------------
+// CThumbnailFetchedChecker::DeleteFetchResult()
+// -----------------------------------------------------------------------------
+//
+void CThumbnailFetchedChecker::DeleteFetchResult( const TDesC& aUri )
+    {
+    TN_DEBUG2( "CThumbnailFetchedChecker::DeleteFetchResult(%S)", &aUri);
+    // delete all entries of passed uri
+    TInt ret;
+    do
+        {
+        ret = iNotFetched.FindInOrder( aUri, CEntry::FindCBUri );
+        if ( ret >= 0 )
+            {
+            TN_DEBUG1( "CThumbnailFetchedChecker::DeleteFetchResult() -> Deteled URI from fetched list" );	
+            delete iNotFetched[ ret ];
+            iNotFetched[ ret ] = NULL;
+            iNotFetched.Remove( ret );
+            }
+        }
+    while(ret != KErrNotFound );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CThumbnailFetchedChecker::LastFetchResult()
+// -----------------------------------------------------------------------------
+//
+void CThumbnailFetchedChecker::RenameFetchResultL( const TDesC& aNewUri, const TDesC& aOldUri )
+    {
+    TN_DEBUG3( "CThumbnailFetchedChecker::RenameFetchResult(aNewUri=%S aOldUri=%S)", &aNewUri, &aOldUri);
+    // change every occurence of passed uri
+    TInt ret;
+    do
+        {
+        ret = iNotFetched.FindInOrder( aOldUri, CEntry::FindCBUri );
+        if ( ret >= 0 )
+            {
+            delete iNotFetched[ ret ]->iUri;
+            iNotFetched[ ret ]->iUri = NULL;
+
+            iNotFetched[ ret ]->iUri = aNewUri.AllocL();
+            TN_DEBUG1( "CThumbnailFetchedChecker::RenameeFetchResult() -> Renamed URI in fetched list" );	
+            }
+        }
+    while(ret != KErrNotFound );
+    
+    }
+
+// -----------------------------------------------------------------------------
 // CThumbnailFetchedChecker::Reset()
 // -----------------------------------------------------------------------------
 //
 void CThumbnailFetchedChecker::Reset()
     {
+    TN_DEBUG1( "CThumbnailFetchedChecker::Reset()");
     iNotFetched.ResetAndDestroy();
     }
 
 // -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::CEntry::New()
+// CThumbnailFetchedChecker::CEntry::NewL()
 // -----------------------------------------------------------------------------
 //
 CThumbnailFetchedChecker::CEntry* CThumbnailFetchedChecker::CEntry::NewL(
-        const TDesC& aUri, TInt aError )
+        const TDesC& aUri, const TThumbnailSize aThumbnailSize, TInt aError )
     {
+    TN_DEBUG4( "CThumbnailFetchedChecker::CEntry::NewL(aUri=%S aThumbnailSize=%d aError=%d)", &aUri, aThumbnailSize, aError);
     CEntry* self  = new (ELeave) CEntry();
     if ( self )
         {
-        self->iUri = aUri.Alloc();
+        self->iUri = aUri.AllocL();
+        self->iSize = aThumbnailSize;
         self->iError = aError;
         if ( !self->iUri )
             {
@@ -144,8 +226,28 @@
 // -----------------------------------------------------------------------------
 //
 TInt CThumbnailFetchedChecker::CEntry::FindCB(
-    const TDesC* aUri, const CThumbnailFetchedChecker::CEntry& aEntry )
+        const CThumbnailFetchedChecker::CEntry& aEntry, const CThumbnailFetchedChecker::CEntry& aEntry1 )
     {
+    TN_DEBUG1( "CThumbnailFetchedChecker::CEntry::FindCB");
+    if( aEntry1.iSize == aEntry.iSize)
+        {
+        // return index if size and uri matches
+        return aEntry.iUri->CompareF( *( aEntry1.iUri ) );
+        }
+    else 
+        {
+        return KErrNotFound;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CThumbnailFetchedChecker::CEntry::FindCBUri()
+// -----------------------------------------------------------------------------
+//
+TInt CThumbnailFetchedChecker::CEntry::FindCBUri(
+        const TDesC* aUri, const CThumbnailFetchedChecker::CEntry& aEntry )
+    {
+    TN_DEBUG2( "CThumbnailFetchedChecker::CEntry::FindCBUri(aUri=%S", &aUri);
     return aUri->CompareF( *( aEntry.iUri ) );
     }
 
@@ -157,7 +259,16 @@
         const CThumbnailFetchedChecker::CEntry& aEntry1,
         const CThumbnailFetchedChecker::CEntry& aEntry2 )
     {
-    return aEntry1.iUri->CompareF( *( aEntry2.iUri ) );
+    TN_DEBUG1( "CThumbnailFetchedChecker::CEntry::InsertCB");
+    if( aEntry1.iSize == aEntry2.iSize)
+        {
+        // return index if size and uri matches
+        return aEntry1.iUri->CompareF( *( aEntry2.iUri ) );
+        }
+    else 
+        {
+        return KErrNotFound;
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -175,4 +286,5 @@
 CThumbnailFetchedChecker::CEntry::~CEntry()
     {
     delete iUri;
+    iUri = NULL;
     }
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -43,12 +43,13 @@
     const TSize& aSize, TDisplayMode aDisplayMode, TInt aPriority,
     RArray < TThumbnailPersistentSize >* aMissingSizes, const TDesC& aTargetUri,
     TThumbnailSize aThumbnailSize, const TInt64 aModified, 
-    const CThumbnailManager::TThumbnailQualityPreference aQualityPreference ): 
+    const CThumbnailManager::TThumbnailQualityPreference aQualityPreference,
+    TBool aVirtualUri ): 
     CThumbnailTask( aProcessor, aPriority ), iServer( aServer ), 
     iFlags( aFlags ), iSize( aSize ), iDisplayMode( aDisplayMode ),
     iMissingSizes( aMissingSizes ), iTargetUri( aTargetUri ),
     iThumbnailSize( aThumbnailSize ), iModified(aModified),
-    iQualityPreference( aQualityPreference )
+    iQualityPreference( aQualityPreference ), iVirtualUri( aVirtualUri )
     {
     TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CThumbnailGenerateTask()", this);
     
@@ -94,6 +95,7 @@
         {
         iMissingSizes->Reset();
         delete iMissingSizes;
+        iMissingSizes = NULL;
         }
 		
     if ( iBitmapHandle )
@@ -125,11 +127,11 @@
     aStart.UniversalTime();
 #endif
    
-    TParsePtrC parse(iFilename);
-    TPtrC ext(parse.Ext());
-    TBuf8< KMaxDataTypeLength > mimeType;                
-    if  (ext.CompareF(KNonEmbeddedArtExt)== 0) 
-        {       
+    TBuf8< KMaxDataTypeLength > mimeType;
+
+    if ( (!iVirtualUri && iFilename.Right(KExtLength).CompareF(KNonEmbeddedArtExt) == 0) ||
+         (iVirtualUri && iTargetUri.Right(KExtLength).CompareF(KContactExt) == 0) ) // tparse panics with virtual URI
+        {         
         mimeType.Copy( KImageMime );  		
         }
     else
@@ -138,8 +140,7 @@
         }
     iProvider = iServer.ResolveProviderL(mimeType);
        	
-    TN_DEBUG3( "CThumbnailGenerateTask(0x%08x) -- provider UID 0x%08x", this,
-        iProvider->Uid());
+    TN_DEBUG3( "CThumbnailGenerateTask(0x%08x) -- provider UID 0x%08x", this, iProvider->Uid());
 
     __ASSERT_DEBUG(( iProvider ), ThumbnailPanic( EThumbnailNullPointer ));
 
@@ -197,6 +198,7 @@
 void CThumbnailGenerateTask::DoCancel()
     {
     TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::DoCancel()", this );
+    
     if ( iProvider )
         {
         iProvider->CancelGetThumbnail();
@@ -328,6 +330,25 @@
     // compTask is the scale task which returns the bitmap to the client
     CThumbnailScaleTask* complTask = NULL;
 	
+    TInt err1 = KErrNone;
+    TInt err2 = KErrNone;
+    TBool isPublic = ETrue;
+    TBool isPublic2 = ETrue;
+    
+    if(iFilename != KNullDesC)
+        {
+        TRAP(err1, iServer.StoreForPathL(iFilename));
+        
+        isPublic = iServer.IsPublicPath( iFilename );
+        }           
+    if(iTargetUri != KNullDesC )
+        {
+        TRAP(err2, iServer.StoreForPathL(iTargetUri));
+        
+        isPublic2 = iServer.IsPublicPath( iTargetUri );
+        }
+    
+    // check if need to create more than one scale task
     if ( iMissingSizes )
         {
         const TInt count = iMissingSizes->Count();
@@ -359,41 +380,23 @@
             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);
+                iRequestId, iVirtualUri);
             CleanupStack::PushL( complTask );
             
-            TInt err1 = KErrNone;
-            TInt err2 = KErrNone;
-            
-            if(iFilename != KNullDesC)
-                {
-                TRAP(err1, iServer.StoreForPathL(iFilename));
-                }
-            
-            if(iTargetUri != KNullDesC )
-                {
-                TRAP(err2, iServer.StoreForPathL(iTargetUri));
-                }
             // if trying to access Z drive, don't try to store
             // don't want to store custom sizes
-            if( err1 == KErrAccessDenied || err2 == KErrAccessDenied ||
-                    (*iMissingSizes)[ i ].iType == ECustomThumbnailSize || 
-                    (*iMissingSizes)[ i ].iType == EUnknownThumbnailSize )
+            // don't store if from private directory
+            if( !isPublic || !isPublic2 ||
+                err1 == KErrAccessDenied || err2 == KErrAccessDenied ||
+                (*iMissingSizes)[ i ].iType == ECustomThumbnailSize || 
+                (*iMissingSizes)[ i ].iType == EUnknownThumbnailSize )
                 {
                 complTask->SetDoStore( EFalse );
                 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this );
                 }
             else
                 {
-                if(iFilename != KNullDesC)
-                    {
-                    complTask->SetDoStore(iServer.IsPublicPath( iFilename ));
-                    }
-                
-                if(iTargetUri != KNullDesC)
-                    {
-                    complTask->SetDoStore(iServer.IsPublicPath( iTargetUri ));
-                    }
+                complTask->SetDoStore( ETrue );
                 }
             
             iProcessor.AddTaskL( complTask );
@@ -426,22 +429,14 @@
         complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename,
             aBitmap, iOriginalSize, iSize, iFlags& CThumbnailManager
             ::ECropToAspectRatio, iDisplayMode, KMaxPriority, iTargetUri,
-            iThumbnailSize, iModified, iScaledBitmapToPool, iEXIF, iRequestId );
+            iThumbnailSize, iModified, iScaledBitmapToPool, iEXIF, iRequestId,
+            iVirtualUri);
         CleanupStack::PushL( complTask );
         
-        TInt err1 = KErrNone;
-        TInt err2 = KErrNone;
-        if(iFilename != KNullDesC)
-            {
-            TRAP(err1, iServer.StoreForPathL(iFilename));
-            }
-        if(iTargetUri != KNullDesC)
-            {
-            TRAP(err2, iServer.StoreForPathL(iTargetUri));
-            }
         // if trying to access Z drive, don't try to store
         // don't want to store custom sizes
-        if( err1 == KErrAccessDenied || err2 == KErrAccessDenied ||
+        if( !isPublic || !isPublic2 ||
+            err1 == KErrAccessDenied || err2 == KErrAccessDenied ||
             iThumbnailSize == ECustomThumbnailSize || 
             iThumbnailSize == EUnknownThumbnailSize )
             {
@@ -450,15 +445,7 @@
             }
         else
             {
-            if(iFilename != KNullDesC)
-                {
-                complTask->SetDoStore(iServer.IsPublicPath( iFilename ));
-                }
-             
-             if(iTargetUri != KNullDesC)
-                {
-                complTask->SetDoStore(iServer.IsPublicPath( iTargetUri ));
-                }
+            complTask->SetDoStore( ETrue );
             }
         
         iProcessor.AddTaskL( complTask );
@@ -506,16 +493,16 @@
     if(iFilename != KNullDesC)
         {
         iServer.StoreForPathL( iFilename )->StoreThumbnailL( 
-            iFilename, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, EFalse, ETrue );
+            iFilename, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, !iVirtualUri, ETrue );
 		//remove result from fetched checker
-        iServer.FetchedChecker().SetFetchResult( iFilename, KErrNone );
+        iServer.FetchedChecker().SetFetchResult( iFilename,  iThumbnailSize, KErrNone );
         }
     else if(iTargetUri != KNullDesC)
         {
         iServer.StoreForPathL( iTargetUri )->StoreThumbnailL( 
-            iTargetUri, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, EFalse, ETrue );
+            iTargetUri, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, !iVirtualUri, ETrue );
 		//remove result from fetched checker
-        iServer.FetchedChecker().SetFetchResult( iTargetUri, KErrNone );
+        iServer.FetchedChecker().SetFetchResult( iTargetUri, iThumbnailSize, KErrNone );
         }
 
     CleanupStack::PopAndDestroy( tempBitmap );
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailmdsquerytask.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailmdsquerytask.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -36,7 +36,7 @@
 //
 CThumbnailMDSQueryTask::CThumbnailMDSQueryTask(
         CThumbnailTaskProcessor& aProcessor, TInt aPriority, CMdESession* aMdESession, CThumbnailServer& aServer): 
-        CThumbnailTask( aProcessor, aPriority ), iMdESession( aMdESession ), iServer(aServer), iUpdateToDb(ETrue)
+        CThumbnailTask( aProcessor, aPriority ), iMdESession( aMdESession ), iQuery(NULL), iServer(aServer), iUpdateToDb(ETrue)
     {
     TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::CThumbnailMDSQueryTask()", this );
     }
@@ -55,6 +55,7 @@
         {
         iQuery->Cancel();
         delete iQuery;
+        iQuery = NULL;
         }
     }
 
@@ -182,14 +183,21 @@
     CMdENamespaceDef* defNamespace = &iMdESession->GetDefaultNamespaceDefL();
     CMdEObjectDef& objDef = defNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
     
+    delete iQuery;
+    iQuery = NULL;
+    
     iQuery = iMdESession->NewObjectQueryL( *defNamespace, objDef, this );
-    iQuery->SetResultMode( EQueryResultModeItem );
+	
+	if(iQuery)
+		{
+	    iQuery->SetResultMode( EQueryResultModeItem );
 
-    CMdELogicCondition& rootCondition = iQuery->Conditions();
-    rootCondition.SetOperator( ELogicConditionOperatorOr );
+    	CMdELogicCondition& rootCondition = iQuery->Conditions();
+	    rootCondition.SetOperator( ELogicConditionOperatorOr );
     
-    // add ID condition
-    rootCondition.AddObjectConditionL( aId );
+	    // add ID condition
+    	rootCondition.AddObjectConditionL( aId );
+		}
     }
 
 // ---------------------------------------------------------------------------
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -42,14 +42,15 @@
     aBitmap, const TSize& aOriginalSize, const TSize& aTargetSize, TBool aCrop,
     TDisplayMode aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
     const TThumbnailSize aThumbnailSize, const TInt64 aModified,
-    TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId)
+    TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId,
+    const TBool aImportVirtual)
     {
     // We take ownership of aBitmap
     CleanupStack::PushL( aBitmap );
     CThumbnailScaleTask* self = new( ELeave )CThumbnailScaleTask( aProcessor,
         aServer, aFilename, aBitmap, aOriginalSize, aTargetSize, aCrop,
         aDisplayMode, aPriority, aTargetUri, aThumbnailSize, aModified,
-        aBitmapToPool, aEXIF, aRequestId);
+        aBitmapToPool, aEXIF, aRequestId, aImportVirtual);
     CleanupStack::Pop( aBitmap );
     CleanupStack::PushL( self );
     self->ConstructL();
@@ -68,12 +69,13 @@
     const TSize& aOriginalSize, const TSize& aTargetSize, TBool aCrop,
     TDisplayMode aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
     const TThumbnailSize aThumbnailSize, const TInt64 aModified,
-    TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId):
+    TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId,
+    const TBool aVirtualUri):
     CThumbnailTask( aProcessor, aPriority ), iServer( aServer ), iOwnBitmap( aBitmap ),
     iOriginalSize( aOriginalSize ), iTargetSize(aTargetSize), iTargetSizeTN( aTargetSize ), iCrop( aCrop ),
     iDisplayMode( aDisplayMode ), iFilename( aFilename ), iTargetUri( aTargetUri ),
     iThumbnailSize(aThumbnailSize), iModified(aModified),
-    iBitmapToPool(aBitmapToPool), iEXIF(aEXIF)
+    iBitmapToPool(aBitmapToPool), iEXIF(aEXIF), iVirtualUri( aVirtualUri )
     {
     TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::CThumbnailScaleTask()", this );
     
@@ -119,6 +121,7 @@
 
     // Scaled bitmap is owned by us, delete now
     delete iScaledBitmap;
+    iScaledBitmap = NULL;
     }
 
 
@@ -348,17 +351,20 @@
             if (iFilename != KNullDesC && iFilename.CompareF(iTargetUri) == 0)
                 {
                 // filename and target URI match, so thumb created from associated path
-                iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop, iThumbnailSize, iModified, ETrue );
+                iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop, 
+                                         iThumbnailSize, iModified, !iVirtualUri, !iVirtualUri );
                 }
             else
                 {
                 // thumb not created from associated path
-                iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop, iThumbnailSize, iModified, EFalse, EFalse );
+                iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop, 
+                                         iThumbnailSize, iModified, !iVirtualUri, EFalse );
                 }  
             }
         else if (iFilename != KNullDesC)
             {
-            iServer.StoreThumbnailL( iFilename, iScaledBitmap, iOriginalSize, iCrop, iThumbnailSize, iModified, ETrue );
+            iServer.StoreThumbnailL( iFilename, iScaledBitmap, iOriginalSize, iCrop, 
+                                     iThumbnailSize, iModified, !iVirtualUri, !iVirtualUri );
             }
         }    
     
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -43,6 +43,7 @@
 _LIT8( KThumbnailMimeImage, "image" );
 _LIT8( KThumbnailMimeVideo, "video" );
 _LIT8( KThumbnailMimeAudio, "audio" );
+_LIT8( KThumbnailMimeContact, "contact" );
 
 const TChar KThumbnailMimeSeparatorChar = '/';
 const TChar KThumbnailMimeWildCardChar = '*';
@@ -415,6 +416,7 @@
             "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() out" );
         // Comes here if server gets shut down
         delete server;
+        server = NULL;
         CleanupStack::PopAndDestroy( scheduler );
         }
     }
@@ -442,7 +444,10 @@
         iSessionCount );
     iSessionCount--;
     
-    iProcessor->RemoveTasks(aSession);
+    if(iProcessor)
+        {
+        iProcessor->RemoveTasks(aSession);
+        }
     
     TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession );        
     
@@ -458,7 +463,7 @@
             {
             TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
         
-            delete ref->iBitmap;            
+            delete ref->iBitmap;
             bpiter.RemoveCurrent();
                         
             TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count());
@@ -555,12 +560,12 @@
     if (!aCheckExist)
         {
         StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
-                       aCropped, aThumbnailSize, aModified, aThumbFromPath );
+                       aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse );
         }    
     else if(BaflUtils::FileExists( iFs, aPath))
         {
         StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
-                       aCropped, aThumbnailSize, aModified, aThumbFromPath );
+                       aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse );
         }
     else
         {
@@ -569,7 +574,7 @@
     
     if( iFetchedChecker )    
         {
-        iFetchedChecker->SetFetchResult( aPath, KErrNone );
+        iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, KErrNone );
         }
     }
 
@@ -584,7 +589,7 @@
     TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize );
     if( iFetchedChecker )
         {
-        TInt err( iFetchedChecker->LastFetchResult( aPath ) );
+        TInt err( iFetchedChecker->LastFetchResult( aPath, aThumbnailSize ) );
         if ( err == KErrNone ) // To avoid useless sql gets that fails for sure
             {
             // custom sizes are not stored to db, skip fetching
@@ -596,7 +601,7 @@
             TRAP( err, StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize) );
             if ( err != KErrNone )
                 {
-                iFetchedChecker->SetFetchResult( aPath, err );
+                iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, err );
                 }
             }
         User::LeaveIfError( err );
@@ -665,7 +670,7 @@
     
     if( iFetchedChecker ) 
         {
-        iFetchedChecker->SetFetchResult( aPath, KErrNone );
+        iFetchedChecker->DeleteFetchResult( aPath );
         }
     }
 
@@ -851,7 +856,7 @@
         if ( ref->iSession == aRequestId.iSession && 
              ref->iRequestId == aRequestId.iRequestId )
             {            
-            delete ref->iBitmap;            
+            delete ref->iBitmap;
             bpiter.RemoveCurrent();                        
                         
             TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d", 
@@ -943,7 +948,7 @@
         }
     else
         {
-        if(iFormatting)
+        if( iFormatting )
            {
            TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT");
            User::Leave( KErrNotSupported );
@@ -952,17 +957,31 @@
         TVolumeInfo volumeInfo;
         TInt err = iFs.Volume( volumeInfo, aDrive );
         
-        if ( err || volumeInfo.iDrive.iDriveAtt& KDriveAttRom ||
-            volumeInfo.iDrive.iDriveAtt& KDriveAttRemote ||
-            volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected ||
-            volumeInfo.iDrive.iMediaAtt& KMediaAttLocked )
+        if ( err )
+            {
+            // Locked
+            TN_DEBUG2( "CThumbnailServer::StoreForDriveL() - err %d", err);
+            User::Leave( err);
+            }
+        else if( volumeInfo.iDrive.iMediaAtt& KMediaAttLocked )
             {
-            // We don't support ROM disks or remote mounts. Media
-            // must be read-write and not locked.
-            User::Leave( KErrAccessDenied);
+            TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - locked");
+            User::Leave( KErrAccessDenied );
             }
-        
-        res = CThumbnailStore::NewL( iFs, aDrive, iImei, this );
+		else if ( volumeInfo.iDrive.iDriveAtt& KDriveAttRom ||
+            volumeInfo.iDrive.iDriveAtt& KDriveAttRemote ||
+            volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected )
+            {
+            // We support ROM disks and remote disks in read only mode.
+            TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - rom/remote/write protected");
+            res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, ETrue );
+            }
+        else
+            {
+            TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - normal");
+            res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, EFalse );
+            }
+			
         CleanupStack::PushL( res );
         iStores.InsertL( aDrive, res );
         res->SetPersistentSizes(iPersistentSizes);
@@ -1056,6 +1075,7 @@
     if (store)
         {
         delete *store;
+        *store = NULL;
         iStores.Remove( aDrive );
         }
     }
@@ -1144,7 +1164,7 @@
           // If drive-list entry is zero, drive is not available
             continue;
            }
-            
+
         TInt err = iFs.Volume(volumeInfo, drive);
         TInt err_drive = iFs.Drive(driveInfo, drive);    
         
@@ -1166,8 +1186,15 @@
             // ignore errors
             TRAP_IGNORE( StoreForDriveL( drive ));
             
-            TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() update KItemsleft == %d", KErrNotReady);
-            RProperty::Set(KTAGDPSNotification, KItemsleft, KErrNotReady );
+            TUint driveStatus(0);
+            DriveInfo::GetDriveStatus(iFs, drive, driveStatus);
+            TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() driveStatus = %d", driveStatus);
+            if (!(driveStatus & DriveInfo::EDriveUsbMemory) && 
+			    !(driveStatus & DriveInfo::EDriveRemote))
+                {
+                TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() update KItemsleft = %d", KErrNotReady);
+                RProperty::Set(KTAGDPSNotification, KItemsleft, KErrNotReady );
+                }
 			
             TInt index = iUnmountedDrives.Find( drive );
             
@@ -1252,62 +1279,45 @@
     TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL()");
     
     // 1. check path change
-    // 2. check orientation change
-    // 3. check timestamp change
-
-    TBool orientationChanged = EFalse;
+    // 2. check timestamp change
     TBool modifiedChanged = EFalse;
     
     CThumbnailStore* store = StoreForPathL( aPath );
    
-    // placeholder for orientation check
-    orientationChanged = EFalse;
-    
-    if (orientationChanged)
+    TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exist");
+        
+    TBool exists = store->CheckModifiedByPathL(aPath, aModified, modifiedChanged);
+       
+    if(!exists)
         {
-        TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - orientation updated");
-        
-        // orientation updated, no need to check further
-        return ETrue;
+        TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exists NO");
+        //not found, needs to be generated
+        return EFalse;
+        }
+    
+    TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified ?");
+    
+    if (modifiedChanged)
+        {
+        TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified YES");
+            
+        // delete old thumbs
+        store->DeleteThumbnailsL(aPath, ETrue);
+            
+        if( iFetchedChecker ) 
+            {
+            iFetchedChecker->DeleteFetchResult( aPath );
+            }
+            
+        // need to create new thumbs
         }
     else
         {
-        TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exist");
-        
-        TBool exists = store->CheckModifiedByPathL(aPath, aModified, modifiedChanged);
-       
-        if(!exists)
-            {
-            TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exists NO");
-            //not found, needs to be generated
-            return EFalse;
-            }
-        
-        TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified ?");
+        TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified NO");
         
-        if (modifiedChanged)
-            {
-            TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified YES");
-            
-            // delete old thumbs
-            store->DeleteThumbnailsL(aPath, ETrue);
-            
-            if( iFetchedChecker ) 
-                {
-                iFetchedChecker->SetFetchResult( aPath, KErrNone );
-                }
-            
-            // need to create new thumbs
-            }
-        else
-            {
-            TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified NO");
-            
-            // not modified
-            return ETrue;
-            }
+        // not modified
+        return ETrue;
         }
-  
     
     TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - no thumbs found, create new");
     
@@ -1326,8 +1336,7 @@
     
     if( iFetchedChecker ) 
         {
-        iFetchedChecker->SetFetchResult( aNewPath, iFetchedChecker->LastFetchResult(aCurrentPath) );
-        iFetchedChecker->SetFetchResult( aCurrentPath, KErrNone );
+        iFetchedChecker->RenameFetchResultL( aNewPath, aCurrentPath );
         }
     }
 
@@ -1338,8 +1347,7 @@
 TInt CThumbnailServer::MimeTypeFromFileExt( const TDesC& aFileName, TDataType& aMimeType )
     {
     TBool found = ETrue;
-    TParsePtrC parse( aFileName );
-    TPtrC ext( parse.Ext() );
+    TPtrC ext( aFileName.Right(KExtLength) ); // tparse panics with virtual URI
     
     if ( ext.CompareF( KJpegExt ) == 0 || ext.CompareF( KJpgExt ) == 0)
         {
@@ -1449,6 +1457,14 @@
         {
         aMimeType = TDataType( KMatroskaVideoMime );
         } 
+    else if ( ext.CompareF( KContactExt ) == 0 )
+        {
+        aMimeType = TDataType( KContactMime );
+        } 
+    else if ( ext.CompareF( KAlbumArtExt ) == 0 )
+        {
+        aMimeType = TDataType( KAlbumArtMime );
+        }
     else
         {
         aMimeType = TDataType( KNullDesC8 );
@@ -1486,6 +1502,10 @@
         {
         return TThumbnailPersistentSize::EAudio;
         }
+    else if (mediaType.Compare(KThumbnailMimeContact) == 0)
+        {
+        return TThumbnailPersistentSize::EContact;
+        }
 
     return TThumbnailPersistentSize::EUnknownSourceType;        
     }
@@ -1515,6 +1535,11 @@
         case EAudioFullScreenThumbnailSize:
             sourceType = TThumbnailPersistentSize::EAudio;
             break;
+        case EContactListThumbnailSize:
+        case EContactGridThumbnailSize:
+        case EContactFullScreenThumbnailSize:
+            sourceType = TThumbnailPersistentSize::EContact;
+            break;
         default:
             sourceType = TThumbnailPersistentSize::EUnknownSourceType;  
         }
@@ -1534,24 +1559,30 @@
          mimeType.CompareF( KJpeg2000Mime ) == 0 ||
          mimeType.CompareF( KGifMime ) == 0 ||
          mimeType.CompareF( KPngMime ) == 0 ||
-         mimeType.CompareF( KBmpMime ) == 0 ||
+         mimeType.CompareF( KSvgMime ) == 0 ||
          mimeType.CompareF( KMpgMime1 ) == 0 ||
          mimeType.CompareF( KMpeg4Mime ) == 0 ||
          mimeType.CompareF( KMp4Mime ) == 0 ||
          mimeType.CompareF( KAviMime ) == 0 ||
-         mimeType.CompareF( KVideo3gppMime ) == 0 ||
-         mimeType.CompareF( KVideoWmvMime ) == 0 ||
-         mimeType.CompareF( KRealVideoMime ) == 0 ||
          mimeType.CompareF( KMp3Mime ) == 0 ||
+         mimeType.CompareF( KNonEmbeddArtMime ) == 0 ||
+         mimeType.CompareF( KM4aMime ) == 0  ||
          mimeType.CompareF( KAacMime ) == 0 ||
          mimeType.CompareF( KWmaMime ) == 0 ||
+         mimeType.CompareF( KBmpMime ) == 0 ||         
+         mimeType.CompareF( KAudio3gppMime ) == 0 ||
+         mimeType.CompareF( KVideo3gppMime ) == 0 ||
          mimeType.CompareF( KAudioAmrMime ) == 0 ||
+         mimeType.CompareF( KVideoWmvMime ) == 0 ||
          mimeType.CompareF( KRealAudioMime ) == 0 ||
-         mimeType.CompareF( KM4aMime ) == 0  ||
-         mimeType.CompareF( KFlashVideoMime ) == 0 ||
+         mimeType.CompareF( KPmRealAudioPluginMime ) == 0 ||
          mimeType.CompareF( KPmRealVideoPluginMime ) == 0 ||
          mimeType.CompareF( KPmRealVbVideoPluginMime ) == 0 ||
-         mimeType.CompareF( KPmRealAudioPluginMime ) == 0 )
+         mimeType.CompareF( KRealVideoMime ) == 0 ||
+         mimeType.CompareF( KFlashVideoMime ) == 0 ||
+         mimeType.CompareF( KMatroskaVideoMime ) == 0 ||
+         mimeType.CompareF( KContactMime ) == 0 ||
+         mimeType.CompareF( KAlbumArtMime ) == 0 )
         {
         return ETrue;
         }
@@ -1585,6 +1616,7 @@
             "CThumbnailServer::E32Main() -- thread function out, result=%d",
             result );
         delete cleanup;
+        cleanup = NULL;
         }
     if ( result != KErrNone )
         {
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -462,6 +462,12 @@
         ModifyThumbnailSize(sourceType);
         }
     
+    // delete existing
+    if(params.iImport && params.iOverwrite)
+        {
+        Server()->DeleteThumbnailsL( params.iTargetUri);
+        }
+    
     // CreateThumbnails
     if (params.iControlFlags == EThumbnailGeneratePersistentSizesOnly)
         {
@@ -619,6 +625,19 @@
 	        TN_DEBUG2( 
 	            "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail not found, err = %d", err );
 	        
+	        // don't try to create from virtual URI
+	        if ( params.iVirtualUri )
+	            {
+                User::Leave(err);
+	            }
+	        
+            // disk space check only for stored sizes
+            if ( params.iThumbnailSize != ECustomThumbnailSize && 
+                 Server()->StoreForPathL(params.iFileName)->IsDiskFull() )
+                {
+                User::Leave( KErrDiskFull );
+                }
+	        
 	        if ( (err == KErrNotFound || err == KErrAccessDenied) && 
 	            !(params.iFlags& CThumbnailManager::EDoNotCreate) )
 	            {
@@ -626,17 +645,6 @@
 	            // and retry the request using file handle
 	            err = KThumbnailErrThumbnailNotFound;
 	            }
-	        else
-	            {
-                User::Leave(err);
-                }
-	        
-	        // disk space check only for stored sizes
-	        if ( params.iThumbnailSize != ECustomThumbnailSize && 
-	             Server()->StoreForPathL(params.iFileName)->IsDiskFull() )
-	            {
-	            User::Leave( KErrDiskFull );
-	            }
 
             User::Leave(err);
 	        }   
@@ -807,7 +815,8 @@
                     *Server(), params.iTargetUri, bitmap, bitmapSize,
                     (*missingSizes)[i].iSize, (*missingSizes)[i].iCrop, params.iDisplayMode,
                     KMaxPriority, KNullDesC, (*missingSizes)[i].iType, params.iModified, EFalse, EFalse,
-                    reqId);
+                    reqId, params.iVirtualUri);
+            
             CleanupStack::PushL( scaleTask );
             scaleTask->SetDoStore( ETrue );
             Server()->Processor().AddTaskL( scaleTask );
@@ -855,7 +864,12 @@
         "CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() -- create thumbnail generation task for %S", &params.iFileName );
     
     // disk space check only for stored sizes
-    if ( params.iThumbnailSize != ECustomThumbnailSize && 
+    if ( params.iImport && 
+         Server()->StoreForPathL(params.iTargetUri)->IsDiskFull() )
+        {
+        User::Leave( KErrDiskFull );
+        }
+    else if ( params.iThumbnailSize != ECustomThumbnailSize && 
          Server()->StoreForPathL(params.iFileName)->IsDiskFull() )
         {
         User::Leave( KErrDiskFull );
@@ -873,19 +887,28 @@
 		
 	    TBool gridSizeOnly(EFalse);
             
-	    if ( params.iQualityPreference == CThumbnailManager
-	                    ::EOptimizeForQualityWithPreview )
+	    if ( params.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
 	        {
 	        gridSizeOnly = ETrue;
 	        }
         
-        Server()->GetMissingSizesL( params.iFileName, sourceType, *missingSizes, gridSizeOnly);
+	    // import vs. normal
+	    if(params.iImport)
+	        {
+            Server()->GetMissingSizesL( params.iTargetUri, sourceType, *missingSizes, gridSizeOnly);
+	        }
+	    else
+	        {
+            Server()->GetMissingSizesL( params.iFileName, sourceType, *missingSizes, gridSizeOnly);
+	        }     
         
         if ( missingSizes->Count() == 0)
             {
             // all thumbs already exist
             CleanupStack::PopAndDestroy( missingSizes );
             delete missingSizes;
+            missingSizes = NULL;
+            
             if( aFile )
                {
                aFile->Close();
@@ -930,7 +953,8 @@
     CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
         ->Processor(), * Server(), aFile, NULL, &params.iMimeType, params.iFlags,
         params.iSize, params.iDisplayMode, priority, missingSizes, params.iTargetUri,
-        params.iThumbnailSize, params.iModified, params.iQualityPreference );
+        params.iThumbnailSize, params.iModified, params.iQualityPreference,
+        params.iVirtualUri);
 
     // do not store bitmaps to server pool when generating only
     if( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly )
@@ -1016,6 +1040,8 @@
             // all thumbs already exist
             CleanupStack::PopAndDestroy( missingSizes );
             delete missingSizes;
+            missingSizes = NULL;
+            
             if ( aBuffer)
                {
                delete aBuffer;
@@ -1042,7 +1068,8 @@
     CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
         ->Processor(), * Server(), NULL, aBuffer, &params.iMimeType, params.iFlags,
         params.iSize, params.iDisplayMode, priority, missingSizes, params.iTargetUri,
-        params.iThumbnailSize, params.iModified, params.iQualityPreference );
+        params.iThumbnailSize, params.iModified, params.iQualityPreference,
+        params.iVirtualUri);
 
     // do not store bitmaps to server pool when generating only
     if( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly )
@@ -1336,6 +1363,21 @@
                params.iThumbnailSize = EAudioListThumbnailSize;
                }       
            }
+    else if(aSourceType == TThumbnailPersistentSize::EContact)
+           {
+           if(params.iThumbnailSize == EFullScreenThumbnailSize)
+               {
+               params.iThumbnailSize = EContactFullScreenThumbnailSize;
+               }
+           else if(params.iThumbnailSize == EGridThumbnailSize)
+               {
+               params.iThumbnailSize = EContactGridThumbnailSize;
+               }
+           else if(params.iThumbnailSize == EListThumbnailSize)
+               {
+               params.iThumbnailSize = EContactListThumbnailSize;
+               }       
+           }
     }
 
 //------------------------------------------------------------------------
@@ -1349,34 +1391,42 @@
         
     // mime type
     if ( params.iMimeType.Des8() == KNullDesC8 && !Server()->SupportedMimeType(params.iMimeType) )
-       {
-       // try parsing from file extension
-       res = Server()->MimeTypeFromFileExt( params.iFileName, params.iMimeType );
-       if ( res == KErrNotFound )
-           {
-          if( aFile )
-             {
-             // parsed type not in the list, resolve from file
-             params.iMimeType = Server()->ResolveMimeTypeL(*aFile);
-             }
-          else
-             {
-             Server()->Fs().ShareProtected();
-             RFile64 file;
-             CleanupClosePushL( file );
-             
-             User::LeaveIfError( file.Open( Server()->Fs(), params.iFileName, EFileShareReadersOrWriters )); 
-             TN_DEBUG2( "CThumbnailServerSession::ResolveMimeType - file handle opened for %S", &params.iFileName );
-             
-             params.iMimeType = Server()->ResolveMimeTypeL(file);
-             
-             file.Close();
-             TN_DEBUG1("CThumbnailServerSession::ResolveMimeType - file handle closed");
-             
-             CleanupStack::Pop( &file );    
-             }    
-          }        
-       }      
+        {
+        // try parsing from file extension
+        if (params.iImport)
+            {
+            res = Server()->MimeTypeFromFileExt( params.iTargetUri, params.iMimeType );
+            }
+        else
+            {
+            res = Server()->MimeTypeFromFileExt( params.iFileName, params.iMimeType );
+            }
+        
+        if ( res == KErrNotFound )
+            {
+            if( aFile )
+                {
+                // parsed type not in the list, resolve from file
+                params.iMimeType = Server()->ResolveMimeTypeL(*aFile);
+                }
+            else
+                {
+                Server()->Fs().ShareProtected();
+                RFile64 file;
+                CleanupClosePushL( file );
+              
+                User::LeaveIfError( file.Open( Server()->Fs(), params.iFileName, EFileShareReadersOrWriters )); 
+                TN_DEBUG2( "CThumbnailServerSession::ResolveMimeType - file handle opened for %S", &params.iFileName );
+              
+                params.iMimeType = Server()->ResolveMimeTypeL(file);
+              
+                file.Close();
+                TN_DEBUG1("CThumbnailServerSession::ResolveMimeType - file handle closed");
+              
+                CleanupStack::Pop( &file );    
+                }    
+            }        
+        }       
     }
 
 
@@ -1517,4 +1567,5 @@
         }
     }
 
+
 // End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -47,7 +47,6 @@
 //Symbian^3 v4
 _LIT( KThumbnailDatabaseName, ":[102830AB]thumbnail_v4.db" );
 
-_LIT( KDrv, ":");
 
 // Allow access to database only for the server process
 const TSecurityPolicy KThumbnailDatabaseSecurityPolicy( TSecureId(
@@ -167,9 +166,9 @@
 // Two-phased constructor.
 // ---------------------------------------------------------------------------
 //
-CThumbnailStore* CThumbnailStore::NewL( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer )
+CThumbnailStore* CThumbnailStore::NewL( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly )
     {
-    CThumbnailStore* self = new( ELeave )CThumbnailStore( aFs, aDrive, aImei, aServer );
+    CThumbnailStore* self = new( ELeave )CThumbnailStore( aFs, aDrive, aImei, aServer, aReadOnly );
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop( self );
@@ -223,9 +222,9 @@
 // C++ default constructor can NOT contain any code, that might leave.
 // ---------------------------------------------------------------------------
 //
-CThumbnailStore::CThumbnailStore( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer ): 
-    iFs( aFs ), iDrive( aDrive ), iDriveChar( 0 ), iBatchItemCount(0), iImei(aImei), 
-    iServer(aServer), iDiskFull(EFalse), iUnrecoverable(ETrue), iBatchFlushItemCount(KMInBatchItems)
+CThumbnailStore::CThumbnailStore( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly ): 
+    iFs( aFs ), iDrive( aDrive ), iDriveChar( 0 ), iBatchItemCount(0), iImei(aImei), iServer(aServer), iDiskFullNotifier(NULL), 
+    iDiskFull(EFalse), iActivityManager(NULL), iUnrecoverable(ETrue), iBatchFlushItemCount(KMInBatchItems), iReadOnly(aReadOnly)
     {
     // no implementation required
     }
@@ -242,31 +241,39 @@
 #ifdef _DEBUG
     iThumbCounter = 0;
 #endif
-    
-    HBufC* databasePath = HBufC::NewLC( KMaxFileName );
-    TPtr pathPtr = databasePath->Des();
-    User::LeaveIfError( RFs::DriveToChar( iDrive, iDriveChar ));
-    pathPtr.Append( iDriveChar );
-    pathPtr.Append( KThumbnailDatabaseName );
-    
-	//start disk space monitor
-    iDiskFullNotifier = CThumbnailStoreDiskSpaceNotifierAO::NewL( *this, 
-                                            KDiskFullThreshold,
-                                            pathPtr );
+    if(!iReadOnly)
+        {
+        HBufC* databasePath = HBufC::NewLC( KMaxFileName );
+        TPtr pathPtr = databasePath->Des();
+        User::LeaveIfError( RFs::DriveToChar( iDrive, iDriveChar ));
+        pathPtr.Append( iDriveChar );
+        pathPtr.Append( KThumbnailDatabaseName );
+        
+        //start disk space monitor
+        iDiskFullNotifier = CThumbnailStoreDiskSpaceNotifierAO::NewL( *this, 
+                                                KDiskFullThreshold,
+                                                pathPtr );
 
-    CleanupStack::PopAndDestroy( databasePath );
+        CleanupStack::PopAndDestroy( databasePath );
+    
+        TN_DEBUG2( "CThumbnailStore::ConstructL() drive: %d", iDrive );
     
-    TN_DEBUG2( "CThumbnailStore::ConstructL() drive: %d", iDrive );
+        OpenDatabaseL();
     
-    OpenDatabaseL();
+        // to monitor device activity
+        iActivityManager = CTMActivityManager::NewL( this, KStoreMaintenanceIdle);
+        iActivityManager->Start();
     
-    // to monitor device activity
-    iActivityManager = CTMActivityManager::NewL( this, KStoreMaintenanceIdle);
-    iActivityManager->Start();
-    
-    iDeleteThumbs = ETrue;
-    iCheckFilesExist = ETrue;
-    iLastCheckedRowID = -1;
+        iDeleteThumbs = ETrue;
+        iCheckFilesExist = ETrue;
+        }
+    else
+        {
+	    TN_DEBUG1( "CThumbnailStore::ConstructL() - read only, dymmy mode..." );
+        iDeleteThumbs = EFalse;
+        iCheckFilesExist = EFalse;
+        iLastCheckedRowID = -1;
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -548,9 +555,7 @@
     TInt column = 0;   
     TInt rowStatus = 0;
     TInt64 inforows = -1;
-    TInt64 infocount = -1;
     TInt64 datarows = -1;
-    TInt64 datacount = -1;
     
     TInt ret = stmt.Prepare( iDatabase, KGetInfoRowID );
     if(ret < 0)
@@ -576,32 +581,7 @@
 #endif
         return KErrNotSupported;
         }
-    
-    ret = stmt.Prepare( iDatabase, KGetInfoCount );
-    if(ret < 0)
-        {
-        stmt.Close();
-        TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoCount failed %d");
-        return KErrNotSupported;
-        }
-    rowStatus = stmt.Next();
-                
-    if ( rowStatus == KSqlAtRow)    
-        {        
-        infocount = stmt.ColumnInt64( column );  
-        }
-                
-    stmt.Close();
-    
-    if(rowStatus < 0)
-        {
-#ifdef _DEBUG
-        TPtrC errorMsg2 = iDatabase.LastErrorMessage();
-        TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
-#endif
-        return KErrNotSupported;
-        }
-            
+              
     ret = stmt.Prepare( iDatabase, KGetDataRowID );
     if(ret < 0)
         {
@@ -627,37 +607,10 @@
         return KErrNotSupported;
         }
     
-    ret = stmt.Prepare( iDatabase, KGetInfoDataCount );
-    if(ret < 0)
-        {
-        stmt.Close();
-        TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoDataCount failed %d");
-        return KErrNotSupported;
-        }
-    rowStatus = stmt.Next();
-                
-    if ( rowStatus == KSqlAtRow)    
-        {        
-        datacount = stmt.ColumnInt64( column );  
-        }
-                
-    stmt.Close();
-    
-    if(rowStatus < 0)
-        {
-#ifdef _DEBUG
-        TPtrC errorMsg2 = iDatabase.LastErrorMessage();
-        TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
-#endif
-        return KErrNotSupported;
-        }
-    
     TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - inforows %Ld", inforows );
-    TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - infocount %Ld", infocount );
     TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datarows %Ld", datarows );
-    TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datacount %Ld", datacount );
             
-    if( inforows != datarows || datacount != infocount)
+    if( inforows != datarows )
         {
         TN_DEBUG1( "CThumbnailStore::CheckRowIDsL() - tables out of sync" );
         return KErrNotSupported;
@@ -1122,6 +1075,12 @@
 	const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath )
     {
     TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) in" );
+    
+    if(iReadOnly)
+        {
+        TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() read only, skip..." );
+        return;
+        }
 
 #ifdef _DEBUG
     TTime aStart, aStop;
@@ -1273,6 +1232,12 @@
     {
     TSize thumbSize = aThumbnail->SizeInPixels();
     TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
+    
+    if(iReadOnly)
+        {
+        TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() read only, skip..." );
+        return;
+        }
 
     __ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer ));
     
@@ -1320,17 +1285,20 @@
                 CleanupStack::PushL( data );
                 
                 CImageEncoder* encoder = NULL;
-                TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::EHwImplementation, data, CImageEncoder::EOptionAlwaysThread ) );
+				
+				CImageEncoder::TOptions options = ( CImageEncoder::TOptions )( CImageEncoder::EOptionAlwaysThread );
+				
+                TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::EHwImplementation, data, options ) );
                 if ( decErr != KErrNone )
                     {
                     TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder failed %d", decErr);
                 
-                    TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::ESwImplementation, data, CImageEncoder::EOptionAlwaysThread ) );
+                    TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::ESwImplementation, data, options ) );
                     if ( decErr != KErrNone )
                         {
                         TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder failed %d", decErr);
                     
-                        TRAPD( decErr, encoder = CImageEncoder::DataNewL( data,  KJpegMime(), CImageEncoder::EOptionAlwaysThread ) );
+                        TRAPD( decErr, encoder = CImageEncoder::DataNewL( data,  KJpegMime(), options ) );
                         if ( decErr != KErrNone )
                             {
                             TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder failed %d", decErr);
@@ -1363,7 +1331,7 @@
                 
                 // Set some format specific data
                 imageData->iSampleScheme = TJpegImageData::EColor444;
-                imageData->iQualityFactor = 75;
+                imageData->iQualityFactor = 80;
                 
                 // imageData - ownership passed to frameImageData after AppendImageData
                 User::LeaveIfError(frameImageData->AppendImageData(imageData));
@@ -1412,7 +1380,7 @@
             
                 StoreThumbnailL( *path, buf->Ptr( 0 ), aThumbnail->SizeInPixels(),
                                  aOriginalSize, EThumbnailFormatFbsBitmap, flags, 
-                                 aThumbnailSize, aModified);
+                                 aThumbnailSize, aModified, aThumbFromPath);
   
                 CleanupStack::PopAndDestroy( buf );
                 }
@@ -1433,6 +1401,12 @@
 TBool CThumbnailStore::FindDuplicateL( const TDesC& aPath, const TThumbnailSize& aThumbnailSize )
     {
     TN_DEBUG1( "CThumbnailStore::FindDuplicateL()" );
+	
+	if(iReadOnly)
+		{
+		TN_DEBUG1( "CThumbnailStore::FindDuplicateL() read only, skip..." );
+		return EFalse;
+		}
     
     User::LeaveIfError( CheckDbState() );
     
@@ -1529,6 +1503,12 @@
     {
     TN_DEBUG2( "CThumbnailStore::GetMissingSizesL() aSourceType == %d", aSourceType );
     
+    if(iReadOnly)
+        {
+        TN_DEBUG1( "CThumbnailStore::GetMissingSizesL() read only, skip..." );
+		return;
+        }
+    
     User::LeaveIfError( CheckDbState() );
     
     HBufC* path = aPath.AllocLC();
@@ -1638,6 +1618,12 @@
     {
     TN_DEBUG3( "CThumbnailStore::FetchThumbnailL(%S) aThumbnailSize==%d", &aPath, aThumbnailSize );
     
+    if(iReadOnly)
+        {
+        TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() read only, skip..." );
+        User::Leave( KErrNotFound );
+        }
+    
     User::LeaveIfError( CheckDbState() );
     
     HBufC* path = aPath.AllocLC();
@@ -1762,6 +1748,12 @@
     {
     TN_DEBUG2( "CThumbnailStore::DeleteThumbnailsL(%S)", &aPath );
 
+    if(iReadOnly)
+        {
+        TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsL() read only, skip..." );
+        return;
+        }
+    
 #ifdef _DEBUG
     TTime aStart, aStop;
     aStart.UniversalTime();
@@ -1961,6 +1953,12 @@
     {
     TN_DEBUG2( "CThumbnailStore::RenameThumbnailsL(%S)", &aCurrentPath );
     
+    if(iReadOnly)
+        {
+        TN_DEBUG1( "CThumbnailStore::RenameThumbnailsL() read only, skip..." );
+        return;
+        }
+    
 #ifdef _DEBUG
     TTime aStart, aStop;
     aStart.UniversalTime();
@@ -2050,6 +2048,12 @@
     
     StopAutoFlush();
     
+    if(iReadOnly)
+        {
+        TN_DEBUG1( "CThumbnailStore::FlushCacheTable() read only, skip..." );
+        return;
+        }
+    
     if(iBatchItemCount <= 0 || CheckDbState() != KErrNone)
         {
         // cache empty or db unusable
@@ -2191,6 +2195,12 @@
     {
     TN_DEBUG1( "CThumbnailStore::StartAutoFlush()" );
     
+    if(iReadOnly)
+        {
+        TN_DEBUG1( "CThumbnailStore::StartAutoFlush() read only, skip..." );
+        return;
+        }
+    
     TInt err = KErrNone;
     
     if( iAutoFlushTimer )
@@ -2372,6 +2382,13 @@
     {
     TN_DEBUG2( "CThumbnailStore::CheckModifiedByPathL() %S", &aPath);
     
+    if(iReadOnly)
+    	{
+    	TN_DEBUG1( "CThumbnailStore::CheckModifiedByPathL() read only, skip..." );
+		modifiedChanged = EFalse;
+    	return ETrue;
+    	}
+	
     User::LeaveIfError( CheckDbState() );
     
     HBufC* path = aPath.AllocLC();
@@ -2451,6 +2468,16 @@
     return ret;
 }
 	
+
+// -----------------------------------------------------------------------------
+// IsReadOnly()
+// -----------------------------------------------------------------------------
+//
+TBool CThumbnailStore::IsReadOnly()
+    {
+    return iReadOnly;
+    }
+
 // -----------------------------------------------------------------------------
 // PrepareBlacklistedItemsForRetryL()
 // -----------------------------------------------------------------------------
@@ -2481,6 +2508,12 @@
 TInt CThumbnailStore::DeleteMarkedL()
     {
     TN_DEBUG1( "CThumbnailStore::DeleteMarkedL()" );
+    
+    if(iReadOnly)
+        {
+        TN_DEBUG1( "CThumbnailStore::DeleteMarkedL() read only, skip..." );
+        return KErrAccessDenied;
+        }
    
 #ifdef _DEBUG
     TTime aStart, aStop;
@@ -2572,6 +2605,12 @@
 TInt CThumbnailStore::FileExistenceCheckL()
     {
     TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL()" );
+	
+    if(iReadOnly)
+		{
+		TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL() read only, skip..." );
+		return ETrue;
+		}
     
 #ifdef _DEBUG
     TTime aStart, aStop;
@@ -2670,11 +2709,21 @@
 void CThumbnailStore::StripDriveLetterL( TDes& aPath )
     {
     TInt pos = aPath.Find(KDrv);
+    TInt pos2 = aPath.Find(KBackSlash);
     
     // if URI contains drive letter
     if ( pos == 1 )
         {
-        aPath.Delete(0,pos+1);
+        // normal URI
+        if ( pos2 == 2 )
+            {
+            aPath.Delete(0,pos+1);
+            }
+        // virtual URI
+        else
+            {
+            aPath.Replace(0,2,KBackSlash);
+            }
         }
     }
 
@@ -2684,7 +2733,7 @@
 //
 TInt CThumbnailStore::CheckDbState()
     {
-    if (iUnrecoverable)
+    if (iUnrecoverable && !iReadOnly)
         {
         TN_DEBUG1( "CThumbnailStore::CheckDbState() - database in unrecoverable state" );
         __ASSERT_DEBUG( !iUnrecoverable, ThumbnailPanic( EThumbnailDatabaseUnrecoverable ));
@@ -2714,6 +2763,11 @@
 
 TBool CThumbnailStore::IsDiskFull()
     {
+    if(iReadOnly)
+        {
+        TN_DEBUG1( "CThumbnailStore::IsDiskFull() read only, skip..." );
+        return EFalse;
+        }
     return iDiskFull;
     }
 
@@ -2725,6 +2779,12 @@
     {
     TN_DEBUG2( "CThumbnailStore::ActivityChanged() aActive == %d", aActive);
     
+    if( iReadOnly )
+        {
+        TN_DEBUG1( "CThumbnailStore::ActivityChanged() read only, skip..." );
+        return;
+        }
+    
     if( aActive )
         {
         iIdle = EFalse;
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -105,7 +105,7 @@
        iPeriodicTimer->Cancel();
        }
     delete iPeriodicTimer;
-    
+    iPeriodicTimer = NULL;
     }
 
 
@@ -155,6 +155,7 @@
                 {
                 // Remove task from queue
                 delete task;
+                task = NULL;
                 iTasks.Remove( i );
                 
                 TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - removed request ID: %d", aRequestId.iRequestId);
@@ -164,6 +165,7 @@
                 // Task is already running, canceled first
                 task->Cancel();
                 delete task;
+                task = NULL;
                 iTasks.Remove( i );
                 cancel = ETrue;
                 
@@ -207,6 +209,7 @@
     for ( TInt i = iTasks.Count(); --i >= 0; )
         {
         CThumbnailTask* task = iTasks[i];
+        
         if ( task->RequestId().iSession == aSession)
             {
             if ( task->State() != CThumbnailTask::ERunning )
@@ -215,6 +218,7 @@
                 
                 // Remove task from queue
                 delete task;
+                task = NULL;
                 iTasks.Remove( i );
                 
                 TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - removed request ID: %d", id);
@@ -228,6 +232,7 @@
                 // Task is already running, canceled first
                 task->Cancel();
                 delete task;
+                task = NULL;
                 iTasks.Remove( i );
                 cancel = ETrue;
                 
@@ -266,6 +271,7 @@
             
             // Remove task from queue
             delete task;
+            task = NULL;
             iTasks.Remove( i );
             
             TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - removed request ID: %d", id);
@@ -279,6 +285,7 @@
             // Task is already running, canceled first
             task->Cancel();
             delete task;
+            task = NULL;
             iTasks.Remove( i );
             cancel = ETrue;
             
@@ -342,6 +349,7 @@
             {
             // Delete completed task
             delete task;
+            task = NULL;
             iTasks.Remove( i );
             }
         else
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/tmgetimei.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/tmgetimei.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -45,6 +45,7 @@
     Cancel();
 
     delete iTelephony;
+    iTelephony = NULL;
     }
 
 TBuf<KImeiBufferSize> CTMGetImei::GetIMEI()
--- a/imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp	Thu Jul 15 18:59:26 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp	Thu Aug 19 10:13:51 2010 +0300
@@ -150,6 +150,7 @@
     TRAP(err, MainL());
 
     delete cleanup;
+    cleanup = NULL;
     __UHEAP_MARKEND;
     return err;
     }