Revision: 201019 RCL_3 PDK_3.0.0
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 25 May 2010 13:10:05 +0300
branchRCL_3
changeset 27 4a4892eec172
parent 26 9f21bab39f42
child 30 3e156c80c15d
Revision: 201019 Kit: 2010121
harvester/common/data/200009FE.txt
harvester/common/inc/harvestercommon.h
harvester/conf/harvester.confml
harvester/conf/harvester_200009FE.crml
harvester/harvesterplugins/AudioPlugin/group/harvesteraudioplugin.mmp
harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h
harvester/harvesterplugins/AudioPlugin/inc/harvesteraudiopluginutils.h
harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp
harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp
harvester/harvesterplugins/ImagePlugin/group/harvesterimageplugin.mmp
harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h
harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp
harvester/harvesterplugins/OMADRMPlugin/group/harvesteromadrmplugin.mmp
harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h
harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp
harvester/harvesterplugins/RTPPlugin/inc/harvesterrtpplugin.h
harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp
harvester/harvesterplugins/VideoPlugin/group/harvestervideoplugin.mmp
harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h
harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp
harvester/harvesterplugins/WMVPlugin/group/harvesterwmvplugin.mmp
harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h
harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp
harvester/monitorplugins/mdsfileserverplugin/inc/mdsfileserverplugin.h
harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp
harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp
harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp
harvester/server/inc/harvesterao.h
harvester/server/src/harvesterao.cpp
iadstoprestart/group/iadstop.mmp
inc/mdscommoninternal.h
inc/mdssqliteconnection.h
mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/HarvesterClientTestScripter.pkg
mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/bld.inf
mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/src/HarvesterClientTestScripterBlocks.cpp
mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/conf/MonitorPluginTest.cfg
mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/corrupt.jpg
mds_plat/location_manager_api/tsrc/conf/LocationManagerTestScripter.cfg
mds_plat/metadata_engine_api/inc/mdeconstants.h
metadataengine/client/src/mdeobject.cpp
metadataengine/client/src/mdesessionimpl.cpp
metadataengine/server/inc/mdslogger.h
metadataengine/server/inc/mdsmanipulationengine.h
metadataengine/server/inc/mdsserversession.h
metadataengine/server/inc/mdssqlobjectmanipulate.h
metadataengine/server/src/mdsgarbagecollector.cpp
metadataengine/server/src/mdsmanipulationengine.cpp
metadataengine/server/src/mdsschema.cpp
metadataengine/server/src/mdsserver.cpp
metadataengine/server/src/mdsserversession.cpp
metadataengine/server/src/mdssqliteconnection.cpp
metadataengine/server/src/mdssqlobjectmanipulate.cpp
Binary file harvester/common/data/200009FE.txt has changed
--- a/harvester/common/inc/harvestercommon.h	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/common/inc/harvestercommon.h	Tue May 25 13:10:05 2010 +0300
@@ -93,6 +93,9 @@
 const TInt KHarvesterGetRootDirFlags = EDirsFirst;
 const TInt KHarvesterGetDirFlags = ESortByDate | EAscending | EDirsFirst;
 
+_LIT( KExludedThumbPath, "_PAlbTN");
+_LIT( KExludedMediaArtPath, ".mediaartlocal");
+
 const TInt KOriginIgnored = 255;
 const TInt KOriginFastHarvest = 254;
 
Binary file harvester/conf/harvester.confml has changed
Binary file harvester/conf/harvester_200009FE.crml has changed
--- a/harvester/harvesterplugins/AudioPlugin/group/harvesteraudioplugin.mmp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/AudioPlugin/group/harvesteraudioplugin.mmp	Tue May 25 13:10:05 2010 +0300
@@ -60,6 +60,7 @@
 LIBRARY     centralrepository.lib
 LIBRARY     caf.lib
 LIBRARY     cafutils.lib
+LIBRARY     platformenv.lib 
 
 PAGED
 BYTEPAIRCOMPRESSTARGET
--- a/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h	Tue May 25 13:10:05 2010 +0300
@@ -55,6 +55,7 @@
 		CMdEPropertyDef* iThumbnailPropertyDef;
 		CMdEPropertyDef* iDatePropertyDef;
 		CMdEPropertyDef* iDrmPropertyDef;
+		CMdEPropertyDef* iDefaultFolderPropertyDef;
 
 		// Audio property definitions
 		CMdEPropertyDef* iAlbumPropertyDef;
@@ -145,7 +146,7 @@
 		 * Get song name, artist, album, genre and composer from normal music
          * file (eg. mp3).
 		 */
-        void GetMusicPropertiesL( CHarvesterData* aHD, TBool aIsAdd );
+        void GetMusicPropertiesL( CHarvesterData* aHD, TBool aIsAdd, TPtrC aMimeType );
 
 	private:
 		CAudioMDParser* iAudioParser;
@@ -156,6 +157,9 @@
 		TBool iHarvestAlbumArt;
 		
 		TInt iMaxTextLength;
+		
+		HBufC* iPhoneSoundsPath;
+		HBufC* iMmcSoundsPath;
 	};
 
 
--- a/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudiopluginutils.h	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudiopluginutils.h	Tue May 25 13:10:05 2010 +0300
@@ -24,6 +24,10 @@
 
 #include "mimetypemapping.h"
 
+// Wma extension and mime type are shared with actual audio plugin
+_LIT( KExtensionWma,    "wma" );
+_LIT( KMimeTypeWma,    "audio/x-ms-wma");
+
 enum TAudioMetadataHandling
 	{
 	EMetaDataUtilityHandling,
--- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp	Tue May 25 13:10:05 2010 +0300
@@ -23,6 +23,7 @@
 #include <mdeobject.h>
 #include <centralrepository.h>
 #include <caf/caf.h>
+#include <pathinfo.h>
 
 #include "harvestercommon.h"
 #include "harvesteraudioplugin.h"
@@ -36,8 +37,6 @@
 const TUid KHarvesterRepoUid = { 0x200009FE };
 const TUint32 KEnableAlbumArtHarvest = 0x00090001;
 
-_LIT( KExtensionWma,    "wma" );
-
 CHarvesterAudioPluginPropertyDefs::CHarvesterAudioPluginPropertyDefs() : CBase()
 	{
 	}
@@ -54,6 +53,7 @@
 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
 	iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
     iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTimeOffsetProperty );
+    iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder );
 
 	// Media property definitions
 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
@@ -121,6 +121,9 @@
 	delete iAudioParser;
 	delete iPropDefs;
 	delete iTNM;
+	
+	delete iPhoneSoundsPath;
+	delete iMmcSoundsPath;
 	}
 
 // ---------------------------------------------------------------------------
@@ -144,6 +147,16 @@
         }
     
     SetPriority( KHarvesterPriorityHarvestingPlugin - 2 );
+	
+    TFileName sounds = PathInfo::SoundsPath();
+    
+    TFileName phonePath = PathInfo::PhoneMemoryRootPath();
+    phonePath.Append( sounds );
+    iPhoneSoundsPath = phonePath.AllocL();
+
+    TFileName mmcPath = PathInfo::MemoryCardRootPath();
+    mmcPath.Append( sounds );
+    iMmcSoundsPath = mmcPath.Right( mmcPath.Length() - 1 ).AllocL();
 	}
 
 // ---------------------------------------------------------------------------
@@ -248,7 +261,7 @@
 		// get properties for file types supported by CMetaDataUtility.
     	if( mapping->iHandler == EMetaDataUtilityHandling )
     		{
-    		GetMusicPropertiesL( aHD, aIsAdd );
+    		GetMusicPropertiesL( aHD, aIsAdd, mapping->iMimeType );
     		}
     	}
     }
@@ -331,7 +344,7 @@
 // ---------------------------------------------------------------------------
 //    
 void CHarvesterAudioPlugin::GetMusicPropertiesL( CHarvesterData* aHD,
-                                      TBool aIsAdd )
+                                      TBool aIsAdd, TPtrC aMimeType )
     {
 #ifdef _DEBUG
     TTime dStart, dStop;
@@ -350,12 +363,17 @@
         // Prefetch max text lengt for validity checking
         iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
         }
-    
-    TPtrC ext;
-    MdsUtils::GetExt( uri, ext );
-    
-    // Check for possibly protected content
-    if( ext.CompareF( KExtensionWma ) == 0 )
+
+    TBool possiblyProtectedContent( EFalse );
+    if( aMimeType.Length() > 0 )
+        {
+        if( aMimeType == KMimeTypeWma )
+            {
+            possiblyProtectedContent = ETrue;
+            }
+        }
+
+    if( possiblyProtectedContent )
         {
         ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
         ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
@@ -369,7 +387,7 @@
             }
         CleanupStack::PopAndDestroy( 2 ); // content, data
         }
-    
+
     TBool parsed( EFalse );
     TRAPD( parseError, parsed = iAudioParser->ParseL( uri ) );
 
@@ -398,7 +416,22 @@
     TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
     TInt16 timeOffsetMinutes = timeOffsetSeconds.Int() / 60;
     CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTimeOffsetPropertyDef, &timeOffsetMinutes, aIsAdd );
-	
+    
+    if( !mdeObject.Placeholder() )
+        {
+        if( uri.FindF( iMmcSoundsPath->Des()) != KErrNotFound ||
+            uri.FindF( iPhoneSoundsPath->Des()) != KErrNotFound )
+            {
+            TBool inDefaultFolder( ETrue );
+            CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
+            }
+        else
+            {
+            TBool inDefaultFolder( EFalse );
+            CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );    
+            }
+        }
+    
     if ( song.Length() > 0
         && song.Length() < KMaxTitleFieldLength )
         {    
--- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp	Tue May 25 13:10:05 2010 +0300
@@ -34,7 +34,6 @@
 _LIT( KMimeTypeMxmf,   "audio/vnd.nokia.mobile-xmf" );
 _LIT( KMimeTypeWav,    "audio/wav" );
 _LIT( KMimeTypeAu,     "audio/au" );
-_LIT( KMimeTypeWma,    "audio/x-ms-wma");
 _LIT( KMimeTypeAudioMatroska, "audio/x-matroska");
 
 _LIT( KExtensionMp3,    "mp3" );
@@ -48,7 +47,6 @@
 _LIT( KExtensionMxmf,   "mxmf" );
 _LIT( KExtensionWav,    "wav" );
 _LIT( KExtensionAu,     "au" );
-_LIT( KExtensionWma,    "wma" );
 _LIT( KExtensionNrt,    "nrt" );
 _LIT( KExtensionMka,    "mka" );
 
--- a/harvester/harvesterplugins/ImagePlugin/group/harvesterimageplugin.mmp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/ImagePlugin/group/harvesterimageplugin.mmp	Tue May 25 13:10:05 2010 +0300
@@ -48,12 +48,13 @@
 LIBRARY       efsrv.lib
 LIBRARY       imageconversion.lib
 LIBRARY       fbscli.lib 
-LIBRARY	  lbs.lib
-LIBRARY	  etel3rdparty.lib
+LIBRARY	      lbs.lib
+LIBRARY	      etel3rdparty.lib
 LIBRARY       harvesterplugininterface.lib
 LIBRARY       mdeclient.lib
-LIBRARY	  harvesterdata.lib
-LIBRARY	  harvestercommon.lib
+LIBRARY	      harvesterdata.lib
+LIBRARY	      harvestercommon.lib
+LIBRARY       platformenv.lib 
 
 PAGED
 BYTEPAIRCOMPRESSTARGET
--- a/harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h	Tue May 25 13:10:05 2010 +0300
@@ -56,6 +56,7 @@
 		CMdEPropertyDef* iCaptureDatePropertyDef;
 		CMdEPropertyDef* iResolutionUnitPropertyDef;
 		CMdEPropertyDef* iArtistPropertyDef;
+		CMdEPropertyDef* iDefaultFolderPropertyDef;
 		
 		// Image property definitions
 		CMdEPropertyDef* iPixelYDimensionPropertyDef;
@@ -199,6 +200,9 @@
         CHarvesterImagePluginPropertyDefs* iPropDefs;
         
         TInt iMaxTextLength;
+        
+        HBufC* iPhoneImagesPath;
+        HBufC* iMmcImagesPath;
 	};
 
 #endif
--- a/harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp	Tue May 25 13:10:05 2010 +0300
@@ -20,12 +20,14 @@
 #include <e32math.h>
 #include <locationdatatype.h>
 #include <harvesterdata.h>
+#include <pathinfo.h>
 
 #include "harvesterlog.h"
 #include "mdsutils.h"
 #include "harvesterexifutil.h"
 #include "harvesterimageplugin.h"
 #include "mdeobjectwrapper.h"
+#include "mdscommoninternal.h"
 
 using namespace MdeConstants;
 
@@ -82,6 +84,7 @@
 	iSizePropertyDef = &objectDef.GetPropertyDefL( Object::KSizeProperty );
 	iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty );
 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty );
+	iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( Object::KInDefaultFolder );
 
 	// Media property definitions
 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject );
@@ -191,6 +194,9 @@
    	
     delete iPropDefs;
     
+    delete iPhoneImagesPath;
+    delete iMmcImagesPath;
+    
     iMimeTypeMappings.Close();
     iFbs.Disconnect();
 	}
@@ -255,7 +261,16 @@
     
     User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>(
             KExtOtb(), KOtbMime(), EOtherHandling ), cmp ) );
+
+    TFileName images = PathInfo::ImagesPath();
     
+    TFileName phonePath = PathInfo::PhoneMemoryRootPath();
+    phonePath.Append( images );
+    iPhoneImagesPath = phonePath.AllocL();
+
+    TFileName mmcPath = PathInfo::MemoryCardRootPath();
+    mmcPath.Append( images );
+    iMmcImagesPath = mmcPath.Right( mmcPath.Length() - 1 ).AllocL();
 	}
 
 void CHarvesterImagePlugin::HarvestL( CHarvesterData* aHD )
@@ -711,8 +726,22 @@
 	    
 	    // Item Type
 	    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iItemTypePropertyDef, &aFileData.iMime16, aIsAdd );
+
+	    const TDesC& uri = mdeObject.Uri();
+	    if( uri.FindF( iMmcImagesPath->Des()) != KErrNotFound ||
+	        uri.FindF( iPhoneImagesPath->Des()) != KErrNotFound ||
+	        uri.FindF( KDCIMFolder ) != KErrNotFound )
+	        {
+	        TBool inDefaultFolder( ETrue );
+	        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
+	        }
+	    else
+	        {
+	        TBool inDefaultFolder( EFalse );
+	        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );    
+	        }    	
     	}
-
+    
     if( aFileData.iJpeg )
     	{
     	// Time offset
--- a/harvester/harvesterplugins/OMADRMPlugin/group/harvesteromadrmplugin.mmp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/OMADRMPlugin/group/harvesteromadrmplugin.mmp	Tue May 25 13:10:05 2010 +0300
@@ -53,6 +53,7 @@
 LIBRARY       mdeclient.lib
 LIBRARY	      harvesterdata.lib
 LIBRARY	      harvestercommon.lib
+LIBRARY       platformenv.lib 
 
 PAGED
 BYTEPAIRCOMPRESSTARGET
--- a/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h	Tue May 25 13:10:05 2010 +0300
@@ -83,6 +83,7 @@
 		CMdEPropertyDef* iDescriptionPropertyDef;
 		CMdEPropertyDef* iAuthorPropertyDef;
 		CMdEPropertyDef* iGenrePropertyDef;
+		CMdEPropertyDef* iDefaultFolderPropertyDef;
 	
 	private:
 		CHarvesterOmaDrmPluginPropertyDefs();
@@ -157,6 +158,15 @@
 		CHarvesterOmaDrmPluginPropertyDefs* iPropDefs;
 		
 		TInt iMaxTextLength;
+		
+        HBufC* iPhoneImagesPath;
+        HBufC* iMmcImagesPath;
+        
+        HBufC* iPhoneVideosPath;
+        HBufC* iMmcVideosPath;
+        
+        HBufC* iPhoneSoundsPath;
+        HBufC* iMmcSoundsPath;
 	};
 
 #endif // __CHarvesterOMADRMPlugin_H__
--- a/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Tue May 25 13:10:05 2010 +0300
@@ -17,6 +17,7 @@
 
 #include <e32base.h>
 #include <caf/caf.h>
+#include <pathinfo.h>
 
 #include "mdsutils.h"
 #include "harvesteromadrmplugin.h"
@@ -39,6 +40,7 @@
 _LIT(KRmMimetype, "realmedia");
 
 _LIT( KSvgMime, "image/svg+xml" );
+_LIT( KRingingToneMime, "application/vnd.nokia.ringing-tone" );
 
 _LIT(KInUse, "InUse");
 
@@ -57,6 +59,7 @@
 	iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
 	iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
+	iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder );
 
 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
 	iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
@@ -105,6 +108,15 @@
 	{
 	WRITELOG("CHarvesterOMADRMPlugin::~CHarvesterOMADRMPlugin()");
 	
+    delete iPhoneImagesPath;
+    delete iMmcImagesPath;
+    
+    delete iPhoneVideosPath;
+    delete iMmcVideosPath;
+    
+    delete iPhoneSoundsPath;
+    delete iMmcSoundsPath;
+	
 	delete iPropDefs;
 	}
 
@@ -114,7 +126,40 @@
 void CHarvesterOMADRMPlugin::ConstructL()
 	{
 	WRITELOG( "CHarvesterOMADRMPlugin::ConstructL()" );
-    SetPriority( KHarvesterPriorityHarvestingPlugin - 1 );
+    SetPriority( KHarvesterPriorityHarvestingPlugin - 1 );	
+	
+	TFileName phoneRoot = PathInfo::PhoneMemoryRootPath();
+	TFileName mmcRoot = PathInfo::MemoryCardRootPath();
+	
+	TFileName images = PathInfo::ImagesPath();
+	
+    TFileName phoneImagePath( phoneRoot );
+    phoneImagePath.Append( images );
+    iPhoneImagesPath = phoneImagePath.AllocL();
+
+    TFileName mmcImagePath( mmcRoot );
+    mmcImagePath.Append( images );
+    iMmcImagesPath = mmcImagePath.Right( mmcImagePath.Length() - 1 ).AllocL();
+    
+    TFileName videos = PathInfo::VideosPath();
+    
+    TFileName phoneVideoPath( phoneRoot );
+    phoneVideoPath.Append( videos );
+    iPhoneVideosPath = phoneVideoPath.AllocL();
+
+    TFileName mmcVideoPath( mmcRoot );
+    mmcVideoPath.Append( videos );
+    iMmcVideosPath = mmcVideoPath.Right( mmcVideoPath.Length() - 1 ).AllocL();
+    
+    TFileName sounds = PathInfo::SoundsPath();
+    
+    TFileName phoneSoundPath( phoneRoot );
+    phoneSoundPath.Append( sounds );
+    iPhoneSoundsPath = phoneSoundPath.AllocL();
+
+    TFileName mmcSoundPath( mmcRoot );
+    mmcSoundPath.Append( sounds );
+    iMmcSoundsPath = mmcSoundPath.Right( mmcSoundPath.Length() - 1 ).AllocL();
 	}
 
 void CHarvesterOMADRMPlugin::HarvestL( CHarvesterData* aHD )
@@ -252,7 +297,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// HandleNewObjectL
+// HandleObjectPropertiesL
 // ---------------------------------------------------------------------------
 //
 void CHarvesterOMADRMPlugin::HandleObjectPropertiesL(
@@ -285,8 +330,57 @@
     	// File size
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
     			*iPropDefs->iSizePropertyDef, &aVHD.iFileSize, aIsAdd );
+
+    	TPtrC objectDefName( mdeObject.Def().Name() );
+        if( objectDefName == MdeConstants::Image::KImageObject )
+            {
+            const TDesC& uri = mdeObject.Uri();
+            if( uri.FindF( iMmcImagesPath->Des()) != KErrNotFound ||
+                uri.FindF( iPhoneImagesPath->Des()) != KErrNotFound ||
+                uri.FindF( KDCIMFolder ) != KErrNotFound )
+                {
+                TBool inDefaultFolder( ETrue );
+                CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
+                }
+            else
+                {
+                TBool inDefaultFolder( EFalse );
+                CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );    
+                }    
+            }
+        else if( objectDefName == MdeConstants::Video::KVideoObject )
+            {
+            const TDesC& uri = mdeObject.Uri();
+            if( uri.FindF( iMmcVideosPath->Des()) != KErrNotFound ||
+                uri.FindF( iPhoneVideosPath->Des()) != KErrNotFound ||
+                uri.FindF( KDCIMFolder ) != KErrNotFound )
+                {
+                TBool inDefaultFolder( ETrue );
+                CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
+                }
+            else
+                {
+                TBool inDefaultFolder( EFalse );
+                CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );    
+                }    
+            }
+        else if( objectDefName == MdeConstants::Audio::KAudioObject )
+            {
+            const TDesC& uri = mdeObject.Uri();
+            if( uri.FindF( iMmcSoundsPath->Des()) != KErrNotFound ||
+                uri.FindF( iPhoneSoundsPath->Des()) != KErrNotFound )
+                {
+                TBool inDefaultFolder( ETrue );
+                CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
+                }
+            else
+                {
+                TBool inDefaultFolder( EFalse );
+                CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );    
+                }     
+            }
     	}
-    
+        
     // Item Type
     if(aVHD.iMimetype.Length() > 0)
         {
@@ -346,6 +440,50 @@
 		err = content->GetStringAttribute( ContentAccess::EMimeType, mime );
 		delete content;
 		}
+
+#ifdef _DEBUG
+    if( err == KErrInUse || err == KErrLocked )
+        {
+        TPtrC fileName( aUri.Mid(2) );
+        WRITELOG1( "CHarvesterOMADRMPlugin :: Checking open file handles to %S", &fileName );
+
+        CFileList* fileList = 0;
+        TOpenFileScan fileScan( iFs );
+
+        TRAP_IGNORE( fileScan.NextL( fileList ) );   
+          
+        while ( fileList )   
+            {
+            const TInt count( fileList->Count() ); 
+            for (TInt i = 0; i < count; i++ )   
+                {   
+                if ( (*fileList)[i].iName == aUri.Mid(2) )
+                    {
+                    TFullName processName;
+                    TFindThread find(_L("*"));
+                    while( find.Next( processName ) == KErrNone )
+                        {
+                        RThread thread;
+                        TInt error = thread.Open( processName );
+             
+                        if ( error == KErrNone )
+                            {
+                            if ( thread.Id().Id() ==  fileScan.ThreadId() )
+                                {
+                                processName = thread.Name();
+                                thread.Close();
+                                WRITELOG1( "CHarvesterOMADRMPlugin :: %S has a file handle open", &processName );
+                                break;
+                                }
+                            thread.Close();
+                            }
+                        }
+                    }
+                }
+            TRAP_IGNORE( fileScan.NextL( fileList ) );   
+            } 
+        }
+#endif
 	
 	if( err == KErrInUse || err == KErrLocked )
 	    {
@@ -393,6 +531,13 @@
 			aObjectType.Copy( KVideo );
 			return;
 			}
+		
+	    if( mime == KRingingToneMime )
+	        {
+	        WRITELOG1( "CHarvesterOMADRMPlugin::GetObjectType - mimetype %S. Object type changed to Audio", &mime );
+	        aObjectType.Copy( KAudio );
+	        return;
+	        }
     	}
     
 	WRITELOG1( "CHarvesterOMADRMPlugin::GetObjectType - ERROR: mimetype %S. No object type found", &mime );
--- a/harvester/harvesterplugins/RTPPlugin/inc/harvesterrtpplugin.h	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/RTPPlugin/inc/harvesterrtpplugin.h	Tue May 25 13:10:05 2010 +0300
@@ -43,6 +43,7 @@
 		CMdEPropertyDef* iSizePropertyDef;
 		CMdEPropertyDef* iItemTypePropertyDef;
 		CMdEPropertyDef* iTitlePropertyDef;
+		CMdEPropertyDef* iDefaultFolderPropertyDef;
 	
 		// Media property definitions
 		CMdEPropertyDef* iCaptureDatePropertyDef;
--- a/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp	Tue May 25 13:10:05 2010 +0300
@@ -50,6 +50,7 @@
 	iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
 	iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
+	iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder );
 
 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
 	iCaptureDatePropertyDef =& mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KCaptureDateProperty );
@@ -285,6 +286,10 @@
         // Mime Type
         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
                 *iPropDefs->iItemTypePropertyDef, &aClipDetails.iMimeType, aIsAdd );
+        // Default folder
+        TBool inDefaultFolder( ETrue );
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
     	}
 
     // Title (is set from URI by default)
--- a/harvester/harvesterplugins/VideoPlugin/group/harvestervideoplugin.mmp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/VideoPlugin/group/harvestervideoplugin.mmp	Tue May 25 13:10:05 2010 +0300
@@ -54,6 +54,7 @@
 LIBRARY	      harvestercommon.lib
 LIBRARY       caf.lib
 LIBRARY       cafutils.lib
+LIBRARY       platformenv.lib 
 
 STATICLIBRARY       hxmetadatautil.lib
 
--- a/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h	Tue May 25 13:10:05 2010 +0300
@@ -139,6 +139,7 @@
 		CMdEPropertyDef* iArtistPropertyDef;
 		CMdEPropertyDef* iDescriptionPropertyDef;
 		CMdEPropertyDef* iDrmPropertyDef;
+		CMdEPropertyDef* iDefaultFolderPropertyDef;
 		
 		CMdEPropertyDef* iAudioFourCCDef;
 	
@@ -234,6 +235,9 @@
 		
 		// not own
 		CHarvesterMediaIdUtil* iMediaIdUtil;
+		
+	    HBufC* iPhoneVideosPath;
+	    HBufC* iMmcVideosPath;
 	};
 
 #endif // __CHARVESTERVIDEOPLUGIN_H__
--- a/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp	Tue May 25 13:10:05 2010 +0300
@@ -21,6 +21,7 @@
 #include <hxmetadatautil.h>
 #include <hxmetadatakeys.h>
 #include <caf/caf.h>
+#include <pathinfo.h>
 
 #include "mdsutils.h"
 #include "harvestervideoplugin.h"
@@ -98,6 +99,7 @@
 	iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty );
 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty );
 	iTitlePropertyDef = &objectDef.GetPropertyDefL( Object::KTitleProperty );
+	iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( Object::KInDefaultFolder );
 
 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject );
 	iReleaseDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KReleaseDateProperty );
@@ -164,6 +166,9 @@
 	iMimeTypeMappings.Close();
     RMediaIdUtil::ReleaseInstance();
 
+    delete iPhoneVideosPath;
+    delete iMmcVideosPath;
+    
 	WRITELOG("CHarvesterVideoPlugin::CHarvesterVideoPlugin()");
 	}
 
@@ -269,6 +274,16 @@
             TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KVideo(),
                     KMimeTypeWmv(), KMimeTypeWmv() ) ), 
             cmp ) );
+
+    TFileName videos = PathInfo::VideosPath();
+    
+    TFileName phonePath = PathInfo::PhoneMemoryRootPath();
+    phonePath.Append( videos );
+    iPhoneVideosPath = phonePath.AllocL();
+
+    TFileName mmcPath = PathInfo::MemoryCardRootPath();
+    mmcPath.Append( videos );
+    iMmcVideosPath = mmcPath.Right( mmcPath.Length() - 1 ).AllocL();
     
     iMediaIdUtil = &RMediaIdUtil::GetInstanceL();
     }
@@ -399,7 +414,7 @@
     	}
     else
         {
-        WRITELOG1( "CHarvesterVideoPlugin::HarvestSingleFileL() - TRAP error: %d", error );
+        WRITELOG1( "CHarvesterVideoPlugin::HarvestL() - TRAP error: %d", error );
         TInt convertedError = KErrNone;
         MdsUtils::ConvertTrapError( error, convertedError );
         aHD->SetErrorCode( convertedError );
@@ -434,6 +449,12 @@
 void CHarvesterVideoPlugin::GatherDataL( CMdEObject& aMetadataObject,
 		CVideoHarvestData& aVHD )
     {
+#ifdef _DEBUG
+    TTime dStart, dStop;
+    dStart.UniversalTime();
+    dStop.UniversalTime();
+    WRITELOG1( "CHarvesterVideoPlugin::GatherDataL start %d us", (TInt)dStop.MicroSecondsFrom(dStart).Int64() );
+#endif
     const TDesC& uri = aMetadataObject.Uri();
     
     WRITELOG1( "CHarvesterVideoPlugin - Gather data from file %S", &uri );
@@ -932,6 +953,11 @@
     WRITELOG( "CHarvesterVideoPlugin - Closing file" );        
     CleanupStack::PopAndDestroy( &file );        
 
+#ifdef _DEBUG
+    dStop.UniversalTime();
+    WRITELOG1( "CHarvesterVideoPlugin::GatherDataL start %d us", (TInt)dStop.MicroSecondsFrom(dStart).Int64() );
+#endif  
+    
     WRITELOG( "CHarvesterVideoPlugin - Start adding data to object" );
     }
 
@@ -969,6 +995,21 @@
     
     	// File size
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iSizePropertyDef, &aVHD.iFileSize, aIsAdd );
+    	
+    	// Default folder
+        const TDesC& uri = mdeObject.Uri();
+        if( uri.FindF( iMmcVideosPath->Des()) != KErrNotFound ||
+            uri.FindF( iPhoneVideosPath->Des()) != KErrNotFound ||
+            uri.FindF( KDCIMFolder ) != KErrNotFound ) 
+            {
+            TBool inDefaultFolder( ETrue );
+            CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
+            }
+        else
+            {
+            TBool inDefaultFolder( EFalse );
+            CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );    
+            }
     	}
 
     // Item Type
--- a/harvester/harvesterplugins/WMVPlugin/group/harvesterwmvplugin.mmp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/WMVPlugin/group/harvesterwmvplugin.mmp	Tue May 25 13:10:05 2010 +0300
@@ -52,6 +52,7 @@
 LIBRARY       harvesterplugininterface.lib
 LIBRARY       mdeclient.lib
 LIBRARY	      harvesterdata.lib
+LIBRARY       platformenv.lib 
 
 PAGED
 BYTEPAIRCOMPRESSTARGET
--- a/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h	Tue May 25 13:10:05 2010 +0300
@@ -47,6 +47,7 @@
         CMdEPropertyDef* iDescriptionPropertyDef;
         CMdEPropertyDef* iAuthorPropertyDef;
         CMdEPropertyDef* iGenrePropertyDef;
+        CMdEPropertyDef* iDefaultFolderPropertyDef;
 		
 	private:
 		CHarvesterWmvPluginPropertyDefs();
@@ -184,6 +185,9 @@
 	CHarvesterWmvPluginPropertyDefs* iPropDefs;
 	
 	TInt iMaxTextLength;
+	
+    HBufC* iPhoneVideosPath;
+    HBufC* iMmcVideosPath;
     };
 
 #endif // C_HARVESTERWMVPLUGIN_H
--- a/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Tue May 25 13:10:05 2010 +0300
@@ -17,6 +17,7 @@
 
 #include <e32std.h>
 #include <caf/caf.h>
+#include <pathinfo.h>
 
 #include "mdsutils.h"
 #include "harvesterdata.h"
@@ -45,6 +46,7 @@
 	iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
     iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
+    iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder );
 	
     CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
     iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
@@ -87,6 +89,9 @@
     {
     WRITELOG( "CHarvesterWMVPlugin::~CHarvesterWMVPlugin()" );
     delete iPropDefs;
+    
+    delete iPhoneVideosPath;
+    delete iMmcVideosPath;
     }
 
 // ---------------------------------------------------------------------------
@@ -164,6 +169,17 @@
 void CHarvesterWMVPlugin::ConstructL()
     {
     WRITELOG( "CHarvesterWMVPlugin::ConstructL()" );
+    
+    TFileName videos = PathInfo::VideosPath();
+    
+    TFileName phonePath = PathInfo::PhoneMemoryRootPath();
+    phonePath.Append( videos );
+    iPhoneVideosPath = phonePath.AllocL();
+
+    TFileName mmcPath = PathInfo::MemoryCardRootPath();
+    mmcPath.Append( videos );
+    iMmcVideosPath = mmcPath.Right( mmcPath.Length() - 1 ).AllocL();
+   
     SetPriority( KHarvesterPriorityHarvestingPlugin - 1 );
     }
 
@@ -302,6 +318,20 @@
         // Mime Type
         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
                 *iPropDefs->iItemTypePropertyDef, &aClipDetails.iMimeType, aIsAdd );
+
+        const TDesC& uri = mdeObject.Uri();
+        if( uri.FindF( iMmcVideosPath->Des()) != KErrNotFound ||
+            uri.FindF( iPhoneVideosPath->Des()) != KErrNotFound ||
+            uri.FindF( KDCIMFolder ) != KErrNotFound )
+            {
+            TBool inDefaultFolder( ETrue );
+            CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
+            }
+        else
+            {
+            TBool inDefaultFolder( EFalse );
+            CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );    
+            }
     	}
     
     // DRM protection
--- a/harvester/monitorplugins/mdsfileserverplugin/inc/mdsfileserverplugin.h	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/monitorplugins/mdsfileserverplugin/inc/mdsfileserverplugin.h	Tue May 25 13:10:05 2010 +0300
@@ -111,10 +111,15 @@
          * 
          * @param aFilename  Filename to check.
          * @param aIsDirectory ETrue if filename points to directory.
+         * @param aFsPlugin Reference to Fileserver Plugin.
+         * @param aDelete Indicates if file deletion is in question.
          * 
          * @return EFalse, if path or file has a hidden or system attribute set.
          */
-        TBool CheckAttribs( const TDesC& aFilename, TBool& aIsDirectory ) const;
+        TBool CheckAttribs( const TDesC& aFilename, 
+                                        TBool& aIsDirectory, 
+                                        RFsPlugin& aFsPlugin,
+                                        TBool aDelete) const;
 
         /**
          * Check if directory is named correctly and ends with backslash.
@@ -127,6 +132,19 @@
          * Check if harvester (main observer) is alive
          */
         TBool CheckHarvesterStatus();
+
+        /**
+         * Checks file entry path and attributes for validity
+         * 
+         * @param aFilename  Filename to check.
+         * @param aIsDirectory ETrue if filename points to directory.
+         * @param aRequest Reference to request from file server.
+         * @param aDelete Indicates if file deletion is in question.
+         * 
+         * @return EFalse if file is not to be handled
+         */
+        TBool CheckIfValidFile( const TDesC& aFilename, 
+                TBool& aIsDirectory, TFsPluginRequest& aRequest, TBool aDelete );
         
 #ifdef _DEBUG_EVENTS
         void RegisterDebugEventsL();
@@ -151,12 +169,7 @@
         RPointerArray<CMdsFSPQueueItem> iQueue;
 
         RPointerArray<TDesC> iIgnorePaths;
-
-        /**
-         * File system client session.
-         */
-        RFs iFsSession;
-
+        
         RPointerArray<TDesC> iCreatedFiles;
         RPointerArray<TDesC> iModifiedFiles;
         
--- a/harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp	Tue May 25 13:10:05 2010 +0300
@@ -21,6 +21,8 @@
 #include "mdsutils.h"
 
 _LIT( KMdsFileServerPlugin, "MdsFileServerPlugin" );
+_LIT( KExludedThumbPath, "\\_PAlbTN\\");
+_LIT( KExludedMediaArtPath, "\\.mediaartlocal\\");
 
 /* Server name */
 _LIT( KHarvesterServerName, "HarvesterServer" );
@@ -45,8 +47,13 @@
     {
     WRITELOG( "CMdsFileServerPlugin::~CMdsFileServerPlugin()" );
     
-    TRAP_IGNORE( DisableL() );
-    iFsSession.Close();
+#ifdef _DEBUG
+    TRAPD( error, DisableL() );
+    _LIT( KPanicCategory,"CMdsFileServerPlugin" );
+    __ASSERT_DEBUG( error == KErrNone, User::Panic( KPanicCategory,  error ) );
+#else
+    TRAP_IGNORE( DisableL() );    
+#endif
     
     iCreatedFiles.ResetAndDestroy();
     iCreatedFiles.Close();
@@ -81,7 +88,6 @@
 void CMdsFileServerPlugin::InitialiseL()
     {
     WRITELOG( "CMdsFileServerPlugin::InitializeL()" );
-    User::LeaveIfError( iFsSession.Connect() );
     }
     
 //-----------------------------------------------------------------------------
@@ -174,7 +180,7 @@
 //
 TInt CMdsFileServerPlugin::DoRequestL( TFsPluginRequest& aRequest )
 	{
-	// ignore event if there is no any client listening
+	// ignore event if there are not any clients listening
 	if( iConnectionCount <= 0 )
 		{
 		WRITELOG( "CMdsFileServerPlugin::DoRequestL() - no clients -> ignore event" );
@@ -183,9 +189,6 @@
 	
 	TInt function = aRequest.Function();
 	
-	iFileName.Zero();
-    iNewFileName.Zero();
-	
 #ifdef _DEBUG_EVENTS
     PrintDebugEvents( function );
 #endif
@@ -201,7 +204,7 @@
         return KErrNone;
         }
     
-    const TBool formatFunction = function == EFsFormatOpen || function == EFsFormatSubClose;
+    const TBool formatFunction( function == EFsFormatOpen || function == EFsFormatSubClose );
         
     WRITELOG1( "----- CMdsFileServerPlugin::DoRequestL() - plugin function: %d -----", function );
 
@@ -218,9 +221,7 @@
 		}
 
     // get process id
-	TUid processId = { 0 };
-
-	processId = aRequest.Message().SecureId();
+	TUid processId = aRequest.Message().SecureId();
 
 	TBool isDirectory = EFalse;
 	
@@ -235,6 +236,7 @@
         	return KErrNone;
         	}
         WRITELOG2( "CMdsFileServerPlugin::DoRequestL() - newFileName: '%S' %d", &iNewFileName, newNameErr );
+        TBool setToBeDeleted( EFalse );
         if ( newNameErr == KErrNone )
             {
             if ( !CheckPath(iNewFileName) )
@@ -248,47 +250,43 @@
                     }
                 // file moved to ignored path, delete from db
                 function = EFsDelete;
+                setToBeDeleted = ETrue;
                 }
             
-            if ( !CheckAttribs( iNewFileName, isDirectory ) )
+            if( !setToBeDeleted )
                 {
-                WRITELOG( "CMdsFileServerPlugin::DoRequestL() - new path attribute check failed" );
-                if( !CheckAttribs(iFileName, isDirectory) )
+                RFsPlugin fsPlugin( aRequest ); 
+                const TInt rfsPluginErr = fsPlugin.Connect();
+            
+                if ( ( rfsPluginErr == KErrNone ) && !CheckAttribs( iNewFileName, isDirectory, fsPlugin, EFalse ) )
                     {
-                    WRITELOG( "CMdsFileServerPlugin::DoRequestL() - old path attribute check failed" );
-                    WRITELOG( "CMdsFileServerPlugin::DoRequestL() - ignore file" );
-                    return KErrNone;
+                    WRITELOG( "CMdsFileServerPlugin::DoRequestL() - new path attribute check failed" );
+                    if( !CheckAttribs(iFileName, isDirectory, fsPlugin, EFalse) )
+                        {
+                        WRITELOG( "CMdsFileServerPlugin::DoRequestL() - old path attribute check failed" );
+                        WRITELOG( "CMdsFileServerPlugin::DoRequestL() - ignore file" );
+                        fsPlugin.Close();
+                        return KErrNone;
+                        }
+                    // file set to hidden, delete from db
+                    function = EFsDelete;
                     }
-                // file set to hidden, delete from db
-                function = EFsDelete;
+                fsPlugin.Close();
                 }
             }
         else
         	{
-            if ( !CheckPath(iFileName) )
+            if( !CheckIfValidFile(iFileName, isDirectory, aRequest, EFalse)  )
                 {
-                WRITELOG( "CMdsFileServerPlugin::DoRequestL() - path not supported" );
-                return KErrNone;
-                }
-
-            if ( !CheckAttribs(iFileName, isDirectory) )
-                {
-                WRITELOG( "CMdsFileServerPlugin::DoRequestL() - attribute check failed" );
                 return KErrNone;
                 }
         	}
         }
     else if ( !formatFunction )
         {
-        if ( !CheckPath(iFileName) )
+        const TBool deleteFunction( function == EFsDelete );
+        if( !CheckIfValidFile(iFileName, isDirectory, aRequest, deleteFunction)  )
             {
-            WRITELOG( "CMdsFileServerPlugin::DoRequestL() - path not supported" );
-            return KErrNone;
-            }
-
-        if ( !CheckAttribs( iFileName, isDirectory ) )
-            {
-            WRITELOG( "CMdsFileServerPlugin::DoRequestL() - attribute check failed" );
             return KErrNone;
             }
         }
@@ -306,14 +304,23 @@
         case EFsFileCreate:
             {
 #ifdef _DEBUG            
-            if (function == EFsFileCreate)            
+            if (function == EFsFileCreate)
+                {
             	WRITELOG( "CMdsFileServerPlugin::DoRequestL() - EFsFileCreate" );
-            if (function == EFsFileReplace)
-            	WRITELOG( "CMdsFileServerPlugin::DoRequestL() - EFsFileReplace" );
+                }
 #endif            
             
-            iCreatedFiles.Append( iFileName.AllocL() );
-            User::LeaveIfError( UnregisterIntercept(EFsFileSetModified, EPostIntercept) );
+            HBufC* createdFileName = iFileName.Alloc();
+            if( createdFileName )
+                {
+                // Ownership transferred if succeeded
+                const TInt appendError( iCreatedFiles.Append( createdFileName ) );
+                if( appendError != KErrNone )
+                    {
+                    delete createdFileName;
+                    createdFileName = NULL;
+                    }
+                }
             return KErrNone;
             }
 
@@ -331,13 +338,18 @@
             			delete iCreatedFiles[i];
             			iCreatedFiles.Remove( i );
             			
-						//Have to check whether file has been hidden
-						if ( CheckAttribs( iFileName, isDirectory ) )
-							{
-							found = ETrue;
-							}
-    						
-            			User::LeaveIfError( RegisterIntercept(EFsFileSetModified, EPostIntercept) );
+						//Have to check whether file has been hidden          			
+            	        RFsPlugin fsPlugin( aRequest ); 
+            	        const TInt rfsPluginError( fsPlugin.Connect() );
+            	        if( (rfsPluginError == KErrNone) && CheckAttribs( iFileName, isDirectory, fsPlugin, EFalse ) )
+            	            {
+            	            found = ETrue;
+            	            }
+            	        else if( rfsPluginError != KErrNone )
+            	            {
+            	            found = ETrue;
+            	            }
+            	        fsPlugin.Close();
             			}
             		}
            	
@@ -377,10 +389,34 @@
             break;
 
         case EFsFileSetModified:
-        
+            {
             WRITELOG( "CMdsFileServerPlugin::DoRequestL() - EFsFileSetModified" );
-            iModifiedFiles.Append( iFileName.AllocL() );
+            
+            for ( TInt i = iCreatedFiles.Count(); --i >= 0; )
+                {
+                // If file has been created but not closed, do not handle modified events
+                // for that file before the application that has created the file is done with writing 
+                // it to the disk.
+                if ( MdsUtils::Compare( iFileName, *(iCreatedFiles[i]) ) == 0 )
+                    {
+                    return KErrNone;
+                    }
+                } 
+
+            HBufC* modifiedFileName = iFileName.Alloc();
+            if( modifiedFileName )
+                {
+                // Ownership transferred if succeeded
+                const TInt appendError( iModifiedFiles.Append( modifiedFileName ) );
+                if( appendError != KErrNone )
+                    {
+                    delete modifiedFileName;
+                    modifiedFileName = NULL;
+                    }
+                }
+            
             fileEventType = EMdsFileModified;
+            }
             break;
 
         case EFsSetEntry:
@@ -428,17 +464,13 @@
 		    {
 			WRITELOG( "CMdsFileServerPlugin::DoRequestL() - EFsFormatOpen" );
 			// get the drive letter
-		    RFsPlugin fsplugin( aRequest ); 
-	        const TInt rfsPluginError( fsplugin.Connect() );
-	        if( rfsPluginError == KErrNone )
+		    RFsPlugin fsPlugin( aRequest ); 
+		    err = fsPlugin.Connect();
+	        if( err == KErrNone )
 	            {
-	            err = fsplugin.Volume( volInfo, drvNumber );
+	            err = fsPlugin.Volume( volInfo, drvNumber );
 	            }
-	        else
-	            {
-	            err = iFsSession.Volume( volInfo, drvNumber );
-	            }
-	        fsplugin.Close();
+	        fsPlugin.Close();
 	        
 			if( KErrNone == err )
 				{
@@ -525,6 +557,9 @@
             }
         }
     
+    iFileName.Zero();
+    iNewFileName.Zero();
+    
     WRITELOG( "CMdsFileServerPlugin::DoRequestL() - return" );
     return err;
     }
@@ -780,7 +815,12 @@
         HBufC* fn = status.iFileName.Alloc();
         if ( fn )
             {
-            iPaths.InsertInOrder(fn, TLinearOrder<TDesC>(CMdsFileServerPlugin::Compare)); 
+            const TInt insertError( iPaths.InsertInOrder(fn, TLinearOrder<TDesC>(CMdsFileServerPlugin::Compare)));
+            if( insertError != KErrNone )
+                {
+                delete fn;
+                fn = NULL;
+                }
             }
         else
             {
@@ -870,7 +910,12 @@
         HBufC* fn = status.iFileName.Alloc();
         if ( fn )
             {
-            iIgnorePaths.InsertInOrder(fn, TLinearOrder<TDesC>(CMdsFileServerPlugin::Compare)); 
+            const TInt insertError( iIgnorePaths.InsertInOrder(fn, TLinearOrder<TDesC>(CMdsFileServerPlugin::Compare))); 
+            if( insertError != KErrNone )
+                {
+                delete fn;
+                fn = NULL;
+                }
             }
         else
             {
@@ -947,6 +992,14 @@
             {
             return EFalse;
             }
+        else if( MdsUtils::Find( aFilename, KExludedThumbPath ) != KErrNotFound )
+            {
+            return EFalse;
+            }
+        else if( MdsUtils::Find( aFilename, KExludedMediaArtPath ) != KErrNotFound )
+            {
+            return EFalse;
+            }
         }
 
     // check if notification path
@@ -981,7 +1034,7 @@
 //-----------------------------------------------------------------------------
 //
 TBool CMdsFileServerPlugin::CheckAttribs( const TDesC& aFilename, 
-		TBool& aIsDirectory ) const
+		TBool& aIsDirectory, RFsPlugin& aFsPlugin, TBool aDelete ) const
 	{
 	// find last backslash from filename and 
     // take drive and path from filename including last backslash
@@ -993,29 +1046,31 @@
     	}
     TPtrC path( aFilename.Left( pos + 1 ) );
 
-    TUint att = 0;
+    TEntry entry;
 
-    // check if path is hidden or system path
-    TInt err = iFsSession.Att( path, att );
+    // check if path is hidden 
+    TInt err = aFsPlugin.Entry( path, entry );
     if ( err == KErrNone )
-        {
-        if ( att & KEntryAttHidden || att & KEntryAttSystem )
+        {      
+        if ( entry.iAtt & KEntryAttHidden )
             {
             return EFalse;
             }
         }
 
-    // or is the file hidden or system file
-    att = 0;
-    err = iFsSession.Att( aFilename, att );
-    if ( err == KErrNone )
+    if( !aDelete )
         {
-        if ( att & KEntryAttHidden || att & KEntryAttSystem )
+        // check if the file hidden or system file
+        err = aFsPlugin.Entry( aFilename, entry );
+        if ( err == KErrNone )
             {
-            return EFalse;
-            }
+            if ( entry.iAtt & KEntryAttHidden || entry.iAtt & KEntryAttSystem )
+                {
+                return EFalse;
+                }
         
-        aIsDirectory = att & KEntryAttDir ? ETrue : EFalse;
+            aIsDirectory = entry.iAtt & KEntryAttDir ? ETrue : EFalse;
+            }    
         }
 
     return ETrue;
@@ -1074,6 +1129,35 @@
     }
 
 //-----------------------------------------------------------------------------
+// CheckIfValidFile
+//-----------------------------------------------------------------------------
+//
+TBool CMdsFileServerPlugin::CheckIfValidFile( const TDesC& aFilename, 
+        TBool& aIsDirectory, TFsPluginRequest& aRequest, TBool aDelete )
+    {
+    if ( !CheckPath(aFilename) )
+        {
+        WRITELOG( "CMdsFileServerPlugin::CheckIfValidFile() - path not supported" );
+        return EFalse;
+        }
+
+    RFsPlugin fsPlugin( aRequest ); 
+    const TInt rfsPluginErr = fsPlugin.Connect();
+    
+    if( rfsPluginErr == KErrNone )
+        {
+        if ( !CheckAttribs(aFilename, aIsDirectory, fsPlugin, aDelete) )
+            {
+            WRITELOG( "CMdsFileServerPlugin::CheckIfValidFile() - attribute check failed" );
+            return EFalse;
+            }
+        }
+    fsPlugin.Close(); 
+    
+    return ETrue;
+    }
+
+//-----------------------------------------------------------------------------
 // CMdsFileServerPluginFactory implementation
 //-----------------------------------------------------------------------------
 //
--- a/harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp	Tue May 25 13:10:05 2010 +0300
@@ -27,6 +27,7 @@
 #include "fsutil.h"
 #include "harvestercenreputil.h"
 #include "harvestereventmanager.h"
+#include "harvestercommon.h"
 #include <placeholderdata.h>
 #include <harvesterdata.h>
 #include "harvesterpluginfactory.h"
@@ -135,7 +136,16 @@
 				    }
 				else
 				    {
-				    name.Append( entry.iName );     
+                    // If thumbnail folder is detected, skip it
+				    if( entry.iName.Compare( KExludedThumbPath ) != 0 &&
+				        entry.iName.Compare( KExludedMediaArtPath ) != 0 )
+				        {
+				        name.Append( entry.iName );
+				        }
+				    else
+				        {
+				        continue;
+				        }
 				    }
 			
 				if ( entry.IsDir() )
@@ -157,33 +167,11 @@
 						{
 						continue;
 						}
-					
-                    // check if folder is hidden or system folder
-                    TUint att = 0;
-                    TInt attErr = aFs.Att( name, att );
-                    if ( attErr == KErrNone )
-                        {
-                        if ( att & KEntryAttHidden || att & KEntryAttSystem )
-                            {
-                            continue;
-                            }
-                        }
 
 					path->AppendL( name );
 					}
 				else
-					{
-			        // check if file is hidden or system file
-				    TUint att = 0;
-			        TInt attErr = aFs.Att( name, att );
-			        if ( attErr == KErrNone )
-			            {
-			            if ( att & KEntryAttHidden || att & KEntryAttSystem )
-			                {
-			                continue;
-			                }
-			            }
-				
+					{			
 					CPlaceholderData* phData = CPlaceholderData::NewL();
 					CleanupStack::PushL( phData );
 					phData->SetUri( name );
--- a/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp	Tue May 25 13:10:05 2010 +0300
@@ -113,8 +113,7 @@
 	TUint32 hdMediaId( 0 );
     hdMediaId = iMountTask->GetInternalDriveMediaId();
     
-    const TInt count( medias.Count() );
-    for ( TInt i = 0; i < count; i++ )
+    for( TInt i = medias.Count() - 1; i >=0; i-- )
     	{
     	TRAP_IGNORE( iMdEClient->GetMediaL( medias[i].iMediaId, driveLetter, presentState ) );
     	
@@ -349,9 +348,11 @@
                 }
             
             iFs.Drive( driveInfo, i );
-            if ( ((driveInfo.iDriveAtt & KDriveAttRemovable) || (driveInfo.iDriveAtt & KDriveAttLogicallyRemovable) ||
-                   (driveInfo.iType == EMediaHardDisk && driveStatus & DriveInfo::EDriveInternal) ) &&
-                   (driveInfo.iType != EMediaNotPresent) )
+            if( ( (driveStatus & DriveInfo::EDriveRemovable) ||
+                   (driveInfo.iType == EMediaHardDisk && driveStatus & DriveInfo::EDriveInternal) ||
+                   (driveInfo.iDriveAtt & KDriveAttLogicallyRemovable) ||
+                   (driveInfo.iDriveAtt & KDriveAttRemovable) ) &&
+                (driveInfo.iType != EMediaNotPresent) )
                 {
                 count++; // DEBUG INFO
                 
--- a/harvester/server/inc/harvesterao.h	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/server/inc/harvesterao.h	Tue May 25 13:10:05 2010 +0300
@@ -63,6 +63,7 @@
 		CMdEPropertyDef* iOriginPropertyDef;
 		CMdEPropertyDef* iItemTypePropertyDef;
 		CMdEPropertyDef* iTitlePropertyDef;
+		CMdEPropertyDef* iDefaultFolderPropertyDef;
 		
 		// Media property definitions
 		CMdEPropertyDef* iPreinstalledPropertyDef;
@@ -306,6 +307,8 @@
         
         TBool CheckForCameraItem( CHarvesterData* aHd, TDes& aObjectDef );
         
+        void AddDefaultFolderDataL( CMdEObject* aObject );
+        
 	private:
 		
 	struct THarvestFileRequest
@@ -568,6 +571,15 @@
         TBool iFastHarvestNeeded;
         
         TBool iHarvestingPlaceholders;
+        
+        HBufC* iPhoneImagesPath;
+        HBufC* iMmcImagesPath;
+        
+        HBufC* iPhoneVideosPath;
+        HBufC* iMmcVideosPath;
+        
+        HBufC* iPhoneSoundsPath;
+        HBufC* iMmcSoundsPath;
 	};
 	
 #endif //__CHARVESTERAO_H__
--- a/harvester/server/src/harvesterao.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/harvester/server/src/harvesterao.cpp	Tue May 25 13:10:05 2010 +0300
@@ -22,6 +22,7 @@
 #include <rlocationobjectmanipulator.h>
 #include <placeholderdata.h>
 #include <harvesterclientdata.h>
+#include <pathinfo.h>
 
 using namespace ContentAccess;
 
@@ -34,6 +35,7 @@
 #include "harvesterdata.h"
 #include "ondemandao.h"
 #include "harvestercommon.h"
+#include "mdscommoninternal.h"
 #include "processoriginmapperinterface.h"
 #include "mdeobjecthandler.h"
 #include "harvestereventmanager.h"
@@ -79,6 +81,7 @@
 	iOriginPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
 	iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
+	iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder );
 	
 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
 	iPreinstalledPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KPreinstalledProperty );
@@ -216,6 +219,15 @@
 	delete iPropDefs;
 	delete iCameraExtensionArray;
 	
+    delete iPhoneImagesPath;
+    delete iMmcImagesPath;
+    
+    delete iPhoneVideosPath;
+    delete iMmcVideosPath;
+    
+    delete iPhoneSoundsPath;
+    delete iMmcSoundsPath;
+	
 	RMediaIdUtil::ReleaseInstance();
     
     REComSession::FinalClose();
@@ -272,7 +284,40 @@
     iCameraExtensionArray->InsertIsqL( KExtension3gp );
     iCameraExtensionArray->InsertIsqL( KExtension3gpp );
     iCameraExtensionArray->InsertIsqL( KExtension3g2 );
-	
+
+    TFileName phoneRoot = PathInfo::PhoneMemoryRootPath();
+    TFileName mmcRoot = PathInfo::MemoryCardRootPath();
+    
+    TFileName images = PathInfo::ImagesPath();
+    
+    TFileName phoneImagePath( phoneRoot );
+    phoneImagePath.Append( images );
+    iPhoneImagesPath = phoneImagePath.AllocL();
+
+    TFileName mmcImagePath( mmcRoot );
+    mmcImagePath.Append( images );
+    iMmcImagesPath = mmcImagePath.Right( mmcImagePath.Length() - 1 ).AllocL();
+    
+    TFileName videos = PathInfo::VideosPath();
+    
+    TFileName phoneVideoPath( phoneRoot );
+    phoneVideoPath.Append( videos );
+    iPhoneVideosPath = phoneVideoPath.AllocL();
+
+    TFileName mmcVideoPath( mmcRoot );
+    mmcVideoPath.Append( videos );
+    iMmcVideosPath = mmcVideoPath.Right( mmcVideoPath.Length() - 1 ).AllocL();
+    
+    TFileName sounds = PathInfo::SoundsPath();
+    
+    TFileName phoneSoundPath( phoneRoot );
+    phoneSoundPath.Append( sounds );
+    iPhoneSoundsPath = phoneSoundPath.AllocL();
+
+    TFileName mmcSoundPath( mmcRoot );
+    mmcSoundPath.Append( sounds );
+    iMmcSoundsPath = mmcSoundPath.Right( mmcSoundPath.Length() - 1 ).AllocL();
+    
     WRITELOG( "CHarvesterAO::ConstructL() - end" );
     }
 
@@ -912,6 +957,16 @@
             mdeObject->AddTextPropertyL( *iPropDefs->iItemTypePropertyDef, KUndefinedMime );
             }
 		
+        if( hd->Origin() == MdeConstants::Object::ECamera )
+            {
+            TBool inDefaultFolder( ETrue );
+            mdeObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
+            }
+        else
+            {
+            AddDefaultFolderDataL( mdeObject );
+            }       
+        
 	    TPtrC name;
 	    TBool nameFound = MdsUtils::GetName( hd->Uri(), name );
 
@@ -2414,6 +2469,10 @@
                 	WRITELOG("CHarvesterAO::HarvestingCompleted() NOT COMPLETING AS msg->iMessage->IsNull returns ETrue");
                 	} 
                 iHarvestFileMessages.Remove( i );
+                if( iHarvestFileMessages.Count() == 0 )
+                    {
+                    iHarvestFileMessages.Compress();
+                    }
                 }
             }
         }
@@ -2832,3 +2891,60 @@
         }
     }
 
+void CHarvesterAO::AddDefaultFolderDataL( CMdEObject* aObject )
+    {
+    TPtrC objectDefName( aObject->Def().Name() );
+    if( objectDefName == MdeConstants::Image::KImageObject )
+        {
+        const TDesC& uri = aObject->Uri();
+        if( uri.FindF( iMmcImagesPath->Des()) != KErrNotFound ||
+            uri.FindF( iPhoneImagesPath->Des()) != KErrNotFound ||
+            uri.FindF( KDCIMFolder ) != KErrNotFound )
+            {
+            TBool inDefaultFolder( ETrue );
+            aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
+            }
+        else
+            {
+            TBool inDefaultFolder( EFalse );
+            aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );  
+            }    
+        }
+    else if( objectDefName == MdeConstants::Video::KVideoObject )
+        {
+        const TDesC& uri = aObject->Uri();
+        if( uri.FindF( iMmcVideosPath->Des()) != KErrNotFound ||
+            uri.FindF( iPhoneVideosPath->Des()) != KErrNotFound ||
+            uri.FindF( KDCIMFolder ) != KErrNotFound )
+            {
+            TBool inDefaultFolder( ETrue );
+            aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
+            }
+        else
+            {
+            TBool inDefaultFolder( EFalse );
+            aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );   
+            }    
+        }
+    else if( objectDefName == MdeConstants::Audio::KAudioObject )
+        {
+        const TDesC& uri = aObject->Uri();
+        if( uri.FindF( iMmcSoundsPath->Des()) != KErrNotFound ||
+            uri.FindF( iPhoneSoundsPath->Des()) != KErrNotFound )
+            {
+            TBool inDefaultFolder( ETrue );
+            aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
+            }
+        else
+            {
+            TBool inDefaultFolder( EFalse );
+            aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );    
+            }     
+        }
+    else
+        {
+        // Other objects are set to be in default location by default
+        TBool inDefaultFolder( ETrue );
+        aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
+        }
+    }
--- a/iadstoprestart/group/iadstop.mmp	Tue May 11 16:36:55 2010 +0300
+++ b/iadstoprestart/group/iadstop.mmp	Tue May 25 13:10:05 2010 +0300
@@ -24,8 +24,7 @@
 UID                     0x100039ce 0x20022E94
 
 VENDORID                VID_DEFAULT
-//CAPABILITY              ALL -TCB
-CAPABILITY              CAP_GENERAL_DLL
+CAPABILITY              ALL -TCB
 
 SOURCEPATH              ../src
 SOURCE                  iadstop.cpp
--- a/inc/mdscommoninternal.h	Tue May 11 16:36:55 2010 +0300
+++ b/inc/mdscommoninternal.h	Tue May 25 13:10:05 2010 +0300
@@ -31,6 +31,9 @@
 _LIT( KMdsDefaultImportFile, "C:\\private\\200009f3\\defaultimportfile.mde" );
 _LIT( KMdsDefaultRomImportFile, "Z:\\private\\200009f3\\defaultimportfile.mde" );
 
+// Universal image folder
+_LIT( KDCIMFolder, ":\\DCIM");
+
 // schema file version
 const TInt KSchemaFileMajorVersion = 2;
 const TInt KSchemaFileMinorVersion = 0;
@@ -48,6 +51,8 @@
 
 const TInt KMaxTitleFieldLength = 255;
 
+const TInt KTriggerDbMaintenanceTreasholdValue( 2500 );
+
 _LIT( KMdSServerName,"!MdSServer" ); // Server name
 _LIT( KMdSServerProcessString,"!MdSServer*" ); 
 _LIT( KSchemaChunkName, "MdSSchema" );
--- a/inc/mdssqliteconnection.h	Tue May 11 16:36:55 2010 +0300
+++ b/inc/mdssqliteconnection.h	Tue May 25 13:10:05 2010 +0300
@@ -175,6 +175,8 @@
         
         void EnableTransaction( TBool aEnable, RMdsStatement& aQuery );
 
+        void DoAnalyzeL();
+        
     protected: // Personal methods     
 
         /**
--- a/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/HarvesterClientTestScripter.pkg	Tue May 11 16:36:55 2010 +0300
+++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/HarvesterClientTestScripter.pkg	Tue May 25 13:10:05 2010 +0300
@@ -53,5 +53,5 @@
 "..\..\data\mmc\HarvesterTest\MPEG4.3gp"      -"E:\testing\data\MPEG4.3gp"
 "..\..\data\mmc\HarvesterTest\MPEG4.mp4"      -"E:\testing\data\MPEG4.mp4"
 "..\..\data\mmc\HarvesterTest\00001.mp3"      -"E:\testing\data\00001.mp3"
-;"..\..\data\mmc\HarvesterTest\corrupt.jpg"      -"E:\testing\data\corrupt.jpg"
+"..\..\data\mmc\HarvesterTest\corrupt.jpg"      -"E:\testing\data\corrupt.jpg"
 
--- a/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/bld.inf	Tue May 11 16:36:55 2010 +0300
+++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/bld.inf	Tue May 25 13:10:05 2010 +0300
@@ -51,4 +51,4 @@
 ../../data/mmc/HarvesterTest/Temp2.jpg /epoc32/WINSCW/C/Data/Temp2.jpg
 ../../data/mmc/HarvesterTest/Temp3.jpg /epoc32/WINSCW/C/Data/Temp3.jpg
 ../../data/mmc/HarvesterTest/00001.mp3 /epoc32/WINSCW/C/Data/00001.mp3
-//../../data/mmc/HarvesterTest/corrupt.jpg /epoc32/WINSCW/C/Data/corrupt.jpg
+../../data/mmc/HarvesterTest/corrupt.jpg /epoc32/WINSCW/C/Data/corrupt.jpg
--- a/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/src/HarvesterClientTestScripterBlocks.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/src/HarvesterClientTestScripterBlocks.cpp	Tue May 25 13:10:05 2010 +0300
@@ -552,21 +552,8 @@
     User::LeaveIfError( aItem.GetNextString( inputFile ));
 
     TUint32 mediaId( 0 );
-//    TInt blackListError( KErrNone );
     TTime modified ( 0 );
-/*    
-    blackListError = iMediaIdUtil->GetMediaId( inputFile, mediaId );
-    if( blackListError != KErrNone )
-        {
-        return blackListError;
-        }
-    
-    blackListError = iFs.Modified( inputFile, modified );
-    if( blackListError != KErrNone )
-        {
-        return blackListError;
-        }
-*/    
+
     TRAPD( err, iBlacklistClient.AddL( inputFile, mediaId, modified ) );
     if( err != KErrNone )
         {
@@ -590,27 +577,12 @@
     iLog->Log( KMsg1 );
     RDebug::Print( KMsg1 );
 
-//    iBlacklistClient.LoadBlacklistL();
-    
     TPtrC inputFile;
     User::LeaveIfError( aItem.GetNextString( inputFile ));
     
     TUint32 mediaId( 0 );
-//    TInt blackListError( KErrNone );
     TTime modified ( 0 );
-/*    
-    blackListError = iMediaIdUtil->GetMediaId( inputFile, mediaId );
-    if( blackListError != KErrNone )
-        {
-        return blackListError;
-        }
-  
-    blackListError = iFs.Modified( inputFile, modified );
-    if( blackListError != KErrNone )
-        {
-        return blackListError;
-        }
-*/    
+
     TBool isBlacklisted( EFalse );
     TRAP_IGNORE( isBlacklisted = iBlacklistClient.IsBlacklistedL( inputFile, mediaId, modified ) );
     if( !isBlacklisted )
@@ -639,15 +611,8 @@
     User::LeaveIfError( aItem.GetNextString( inputFile ));
     
     TUint32 mediaId( 0 );
-//    TInt blackListError( KErrNone );
     TTime modified ( 0 );
-/*    
-    blackListError = iMediaIdUtil->GetMediaId( inputFile, mediaId );
-    if( blackListError != KErrNone )
-        {
-        return blackListError;
-        }
-*/    
+
     TRAPD( err, iBlacklistClient.RemoveL( inputFile, mediaId ) );
     if( err != KErrNone )
         {
--- a/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/conf/MonitorPluginTest.cfg	Tue May 11 16:36:55 2010 +0300
+++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/conf/MonitorPluginTest.cfg	Tue May 25 13:10:05 2010 +0300
@@ -53,6 +53,8 @@
 test StartMonitoring
 request Monitor
 test CreateEvents
+wait Monitor
+request Monitor
 test CreateEventsDelete
 wait Monitor
 test StopMonitoring
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/corrupt.jpg	Tue May 25 13:10:05 2010 +0300
@@ -0,0 +1,94 @@
+ZZZZ$Z$$$ZZ$$$$$77$777777777777777777777I77II7I?III?IIII???????+++????????++++++=++++++++++++++++++=++======+======+++++
+ZZZZZZZZ$$ZZ$77777777777III777777I7777IIIIIIIII??IIIIII???????++++???????++++++++++++?????++++++++++========+===~+=+++++
+ZZZZZZ$$$$$$77777$$77I77777777III77IIIIII7IIIII????II????I7$ZZZ$$7I???????++?+++++++++++++++++++++++==+=============++++
+$ZZ77$7$$$$$777777777777I7777IIII77I777III?III??????IDNNMNNNNNDDDNNNDDO7????+++++=++=++++++++=++++====+========~~===++++
+ZZ$$$7777$$$$$777777777777IIIIIIII7IIIIIIIIII?I??+IZNND8NNNMMMMNNNDDDNND8?+??+?++++++++++++++==+=+===++=======~~~====+++
+$$$$$$$$Z$$$$7777777777I7I?II??IIIIII?III???????$DMNN8O8NNNNNNNNMMMMND8DNMD$+++?++==++++++++=======~===========~~======+
+$$$$Z$$$$$$$7777I777IIIIII?IIIIIIIII?????+????ZNND8DDZZDDDDDDDNNNNNNMMMMNNNNNZ?++=====+++++++=====~~==~===~==~=~=~======
+$$$7$$$7$777III777IIIIIIIIIII??III??III???++?$MNNDDD8$O88DDDNMNNNNNNMMMMMMDNMMN7+=====+++++==========~~~~~~~~~~=~======+
+77777777777777IIIII7IIIII????????II?????++++$DN8Z7?+++=++???I$ODNNNMMMMMNNNNNMMM+=+===~==========~==~~~~~~~~~~~~=~======
+$$77777777777I77IIIIIIII????II?III?????++++I8N$I?+======++???I$O8DDNNNMMNNNMNMNMZ+=+==~===~~====~==~~~~~~~~~~~~~~~======
+$$77777777III77IIIIIIII??????I?I????+++++?I8NOI?=~~~~~~~~~==+?I7$ZDNNNNMMMMNNNMNMO+===~~===~~~~~~~~~~~~~~~~~~::~~=======
+$$$$$$77II77IIIIIIIIIII?????????????+++++7NM87+=~:~~:~~~~~~==++I7$8DNNNMNMMMMMNMNMO=~=======~~~~~~~:~~~~~~:::::::~~=====
+77777$$7IIII?II??II??????????++++??++===$NMNZI+=~~~~~~~~~~~==+?I7$OO8DNMNNNMNNMMNMM$==+++===~===~~~~~~~~:::::::::~~~====
+7II?I7I77III???+????++???????++????+==~+$DMD$I+=======~=====+???I7$ZO8DDNNMMNNMMMMMD???+++++++==~=~~~~=~~~~~:::::~~~==+=
+777I777$7II???????++++??????+++???++==+IONM8$I+============+++??II7$ZZODNNNMMMMMMMMM7?I??????+=====~~~~~~~~~~::::~~~===+
+$7777$$ZZ7I7I??++?I?++?++???+++++++===7$DNNO7I++===~~=======++++++?I7$Z8NNNNNMNMNMMM8I7IIII7I+=====~+=~~::::~~~::~~~===+
+ZZZOOZ8OO$7III?II77I?+++++++++=====+=?78DMMZI?=+===~=~=~==++=+++???II7Z8NMMMMMMMNMNMD7$$$I77I????+++?=~~~~~~~::::::~==++
+O8888ZZZ88Z$$$$7777$7?I7?++=+=++====+7$8NMMOI?????+=+===?7$7IIIII77$ZZODNNMMMMMMNNMNN$OZ$7IIII?I??++?+?+=~~:~~:::::===++
+O8DD8OOOOOOOZ$$$$$Z$$$Z$7I++++++====?$Z8MMM87?I77$I++++?$ZOZZZZOZ$OOOOO8NNMMMMMMNNNMMOZ$ZZ$$777I??+??+?+=~~:~~~::::~====
+DDDD88OOOZZZZOOOZZOOOOZ$ZZ7+?+=++=++IOO8DNMDDDI777$ZI+?ZDDZ7$OOO8DMNO$ZODMMMNNNNMMMNMDOZZZZZ$III?I7$7I??=~~~~~~~:~==++++
+888888888OOOO8OZO8OOOZO$7$Z+?+=+++??IZDNNMMOZDIZNDO7I=I8O$I?IOZZZZ???I7O8MMNNMMMMMMMMNOOZZZZZ7$$$77$77I++~:::::~:~====+?
+DD8D8O8OOO888OOOZ8D8O88ZZ8+???IZO$???ONNMMMZIIII$Z7?+=7ZZ7??I77$7I++?I7ODMMMMMMMMNNNMMO8OOOZ$7$$$77$777I?=~~~~~~~===+++?
+8D88OO88OOO8888OODD888OOO8OZ7$OO$8Z7ZO8NMMN7?+=====+?+I77I?=~~~~~=??I7Z8DMMMMNMMMMMNNMZZZZZ$$777$$$Z$$$7I+==~==~=====++?
+8DDDO88888888DDD8DD88DD8O888OZOZ$DO$OO8NMMM$?+====++++?II?+==~~~==?I7$Z8NMMMMNMMMMNNNMZZZZZZ$$Z$$$$ZZZ$7I?==========++??
+DD888D8OO8DDD8ODNDD88DDD8D8D8O8OODOO88DNNMM8I+=~==+++=?II?++====++I7$ZODNMMMNMMNMMNNNM77777I??I???????????++++++???????I
+NMMNNNNNDDDND8D88DD8DDDDDD8DD8D8D8DNNNNNNMMD7+++==++++II7I?++==++?7$ZO8NNMMMNNNMMMMMNN88OOOOO$$$$$$$7I??I???++??III7$$7I
+NMMNDDNNNDDDD88O88888D8DN8DDDDDDNNNMMNNNMMMMZ7++??I?=?777ZI++=+??I$ZOODNNMMMMMMMMMMMMNDD8O8OOOZZZZZZZ$ZZ$7I7777I7I7$$ZZZ
+NNNNNDDNNDDDNDNDD888DD88DDDDDDDDDNNNNNMMMMMMD$II?++?$8NMND7++??II7ZO88DNMMMMMMMMMMMMMMNDDD888OOOOOO8OZ$Z$$$ZZZ$$$$$$$$ZZ
+MMNMNDDNNNDDNDDDNDD8DD888D88DDDDNNNMNNNMMMMMNZ7II?==?NNN8ZI??III7$$ZO8DNMMMMMMMMMMMMMMN8OOOOOOOOZOOOZOZZZZOZZZZ$$$$$$ZZ$
+NNNMMNNDDNDDNDDDNND8DDDDDD88DDDDDNDNMMMMNMMMMO7I77?++I7$$77Z7IIII7ZZO8DNNMMMMMMMMMMMMNND888ZOOOZZZOOOOZZZZ$$77777$$ZZOO8
+MNNMNDDDNNNNNDDDDDD8DDNDDDDDDNNDNDDDNMMMNNMMMN7II7I?77$ZOOZ7I??II7ZO8DNNNMMMNNMMMMMMMNNN8OOZOZZZZZZZZZZZZ$$$$$$$$$$ZOOOO
+NMMNDNNNNNDDDDDDDNNNNNMNDDDNDNNDD88DNNNNMMMMMMO7I?++IZZZZZ$77II7$$O8DDNNMMMMMMMMMMMMMNND8OOOOZZZOOZZZZZZZZZZZZZOOOZZZZZO
+NMMNDNNNNNNDNDDDDNDNNNNNNNNDDDDDD88DNNMMMMMMMMNO$II??$$Z$77$777$ZZ8DDDNNMMMMMMMMMMMMMMDD8ZOO8OZZZ$ZZOOOOZZZZOOOOOOZOOZ$Z
+NMMNNNNNNNNNNNNNDNNDDDDDD8D88D8D88O8NDDNMMMMMMMMNO7?+===?I777$ZO88DDDNMMMMMMMMMMMMMMMMND8O$ZZZ$$$$$ZOZOOZZZ$$$Z$$ZZ$ZOZZ
+MNNMNNMNNNNNNNNNNNNNNNDDD888888888O8NNNMNNNMMNMMMMNOI++?I77$O88DDDDNNMMMMMMMMMMMMMMMMNNNDOZZZZ$$$$$$ZZZZOZ$$ZZOOO$$ZOZZO
+NNMMMNMMMDDNNNNNNNNNDNNDDDDD88O8OOZ$8NNNMMMMMMMMMMMMNZZOO88DDDDDDNMMMNNNMMMNMMMMMMMMNMNNDZOZO8ZOOZZZOOZO8O8OOOOO8OZZZZ$$
+MMMNNNMMNNNDNDNNNNNNNDNNDDDDDD88OZZ$OMNMMMMMMMMMMMMMMMMMMMNNNMMMMMNNNNNNNNNMMMMMMMMMMNNNND88O8OOOOOZOOOO8OZO888888OZZZO8
+NMNNNMNMMMNDNNNNNNNND88DOO8OOZOOZZZ$ZDNMMMMMMMMMMMMMMMMNNMMMMMMNNNNNNDNDDNNMMMNMMMMMMNMMND88OOZZZZZ$OOO88OO8888O8O888OOO
+MMMMMMMNMNNNNDDDDDDD8888D8OZZZZZZOZZO8NMMMMMMMMMMMMMMMN$ZO88DNNNDDD88OOO8DNNMMNMMMMNNNNNN8O8O8OOOO8OOOO8OZZZO88OOZOZZZO8
+MMMMMMMMMMNDNNNDD888OOO8OZ8OOOZOZZZZOOONMMNNMMMMMMMMMMMZI7$$OOO888OOZZZZZ8DNMNNNMMMMNNNMMDD8Z$77II7$77$$$$$$$77$7I??7$ZZ
+NNMMMMMMMNDDND88D888O8OO8O88OOOOOOOO888NMMMNMMMMMMMMMMMD7II77$ZZZZZZ$$77$Z8NNDNMNNMNDNNMMMN8DD8O8O8OZZ7I77Z$77777$$ZOZ7$
+NNNNNNNNNNNND88DNNDDNNNNNOOOOOOOZOZONDDMMMMMMMMMMMMMMMN8$7III777$$777I7I7$Z8NNNNNNNN88MMMMMNMND888DNZOO8DNZ77II777ZZ$7$O
+NNNNNNDNDDD88888D8DNNNNNMDD8O8DD8DNDNNMMMMMMMMMMMMMMMDOZ$7II?I7777IIIII?7$$ODNDDDDDN88MNNMMNNND8OO8NODD8DN8O7II77$Z$$7$O
+NNNNNNNNDDDDD888D8NDDDO8NMNMNNNMNNMMNNNMMMMMMMMMMMNDO7I?I????????I?++????I7Z8DDNN88N8DMNMNNMNDDNNNND88ZZOOZZ7II?IZ$ZZ7$$
+NNNNNNNNNDDDD8DDNNDDDND8NMMMMMMNMNNMMMMMMMMNMMMNNZ$$7???++?+????+++++++++?I$O8NDDZ8D8DNNNNMMNDD8OZZZ7III???III7ZZ$ZOZZZ8
+MMNDDNMMNNND8DNDNNNDD8DDNMNDNMMMMNMMMMMMMMMMMM8$7I???=++=++++++++==+==+++I7ZDDDDOZ8D8NNNNNNNNMND8888O7+?I?7$$77$$$$ZOOOO
+NMMNNNNMNNNDDDNDDDD8888NMMNDNMMMMMMMMMMMMMMMMMZIII++++++==+=+++++==+++????7Z888DOZ8DDNNNNNNNNMNND88D8$?IIII777$$Z$$$Z$$$
+NNNNNNMNNDDDNDDD8O8O8DDNMNNNNMMMMNNNMMMMMMMNNN7I?+++========++========++??I$8OO88O8DNMNNNNMDDNNMNDDDOO$I$7I??II??I777777
+NNNMNNNND8DDD8DDO8D8DNDNDDNNDDNMNNNMMMMMMMNNNOI+++++=~~=====+====~=====+?I$$8DO88O8NNMNNNDD88DDDNNNN8OO8Z$77Z7?7O777$O$$
+NDNNNDNNND8888O8OO8O8DDDNNDDDNNDNNMMMMMMNDDDO$?+==============~====+++++?I$8O888888MMMNN8ZZZ88DDNMMNND8Z$$IIIIII?IIII???
+NNNMNDMMNM8Z8$ZOOO8OODDDDD888DNNMMMMMMMM8OZZO7++======~~~=======~~==++?+?I$ZOO8D88DND888OZOZ7ZZZO8DNMMMND88888Z77777I?I?
+NNNNNDMMNMDDN$ZOZZOOZO88DN888DMMMMMMMMMMOZZ$$?=+===========~=====~===+++?I$ZOO8DDD8OOZ$$$7$$$8DDDDNMNNMMMD8O88OZ$$$OO77$
+NNNNNNMMNNNDNMN8OZZO88O8D88DNMMMMMMMMMMNZ7II?+==========~======~=~===++??7ZOO888O$7$$$$I?IIII$O8DNMMMMMMMMNDD8ODD88888DO
+DDNNDDNDDNNNNNNDNDOOOOOOO88MMMMMMMMMMMN8$III+===~=========~~=~~~==~==++?I$$ZZZZOOOZ7I?7$O888DNNNNNNMMMMMMMMNNDD88DNNDO$I
+NNNNDDDNNNDNNNNNN88DDD8OZ$MMMMMMMMMMMMND7?++=======+===~~~~~~~~=~~~~~=+??7$$ZOO$7$ZO8DDNNNMMMMMMMMMMMMMMMMMMMD88DDD8888D
+DNNNNNNNDDDDDNDDDDD888OZ$8MMMMMMMMMMMNDD87?++=~~=++++=~~~~~~~:~~~~~~===+?7ZZ$ZZODNNMNNDDNNNNMMMMMMMMMMMMMMMMMNMD8888DND8
+DNNNNNNNNND88D8888OZ$ZZZ8NMMMMMMMMMMNNDDDO$I?+===+?++==~~~~~~~~~~~~====?7$ZOO8DDNNNNDDMMMMMMMMMMMMMMMMMMMMMNNNMN888888D8
+NNDDND888OOO888OOOOO88DMMMMMMMMMMMMMNDD8DOOOD87I?I?+=~~~~~~=~~~~~===+I$ZOO8DNNMNNNNMMMMMMMMNMMMMMMMMMMMMMMMNMNMNDOOZOZO8
+NDND888O8888DO888DDDDMMMMMMMMMMMMMMNND88D8DD8888DDD8O7III?++=+==++I$$Z88ODMMNNNMMMMNNMNDNNNNMMMMMMMMMNMMMMMMMNNMMOOOZZ88
+NDDD8D8O8DDDD88888D8MMMMMMMMMMMMMMNDDDDDNNNDD8D8888OOOOOOOOO8OO8OZO8OODMD8NMMMMMMMMNNN8NNNNNMMMMMMMMMMMMMMMMMMMNMDDNDNDD
+NNDDDDDD8888OOZOOZZZMMMMMMMMMMMMMNDNDNNDMMD8DD8O8OO8D888888D888888ODMMNDNMNMMMMMMNNNN8NMNNNNMMMMMMMMMMMMMMMMMMMMNNDDDDD8
+MMNDDD888888O8OOOZ$$MMMMMMMMMMMMMNDDNNNDMMDDDNDD8OOO88888D8DDD8DD8DNNNNMMMMMMMMMNNNMD8NMDNNNMMNNDNNNMMMMMMMMMMMMNM8O88D8
+MMMNNNDDD8888888DDDDMMMMMMMMMMMMMNNNMNDNMNNMNMD8D88DDD88DND8NNNDDNDNMMMMMMMMMMMMNNNNDNNDDNN8OODNDDNDNNMMNMMMMNNNMMNOOO88
+MMMNNNNNNDNDDDDDD8DDMMMMMMMMMMMMMNNMMNMMMNMMMNDDDD8DD88NNMNMD8NNDNMMMMMMMMMMMMNNNMNNNMNND88O888NNNNNDNNMMMMMMMNMNNMDOZZZ
+MMMMMNNNNNNNNDDDDDDDMMMMMMMMMMMMMMMMMMMMNMMMMMNNNNNMNNNNMMMNNMNNMMMMMMMMMMMMMMMMMMMMMMDNND8O8D8N88DNNMMMMMMMNNNMMMMMNNND
+MMMMNNNDDNDNNDDDNNNMMMMMMMMMMMMMMMMMMMMMNMMMMNNNMNNMNNNNMNNNNNMNNMMMMMMMMMMMMMMMMMMMMNNNDDO888O888DNMMMMMMMMNNNNNMNMMMNN
+MMMNDD8D8888OOOO8DNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMNMMMMMNNNMNNNMMMMNMMMMMMMMMMMMMMMMNDND888888DNDNMMMNMMMMMMMNNNNNNMMD88
+MMD8888OOOO88OO88DNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNMMMMMMMMMMMMMMMMMMMMMMNDDDDD8ODDDNMMMMMMMMMMMMMNNNDNMMMMN88
+MD8D888888OOOOOO8NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNMMMMMMMMMMMMMMMMMMMMMMNNNDNND888DMMMNMMMMMMMMMMMMNNNNNNNNMDO
+88DDD88888OOO888MMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMNNMMMMMMMMMMMMMMMMMMMMNMNNNNDDNNDNNNMMNMMMMMMMMMMMMMMNNNNNMNNMN8
+DDDDDDDDDD888DDNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMNNNNDNNNNNMMMMMMMMMMMMMMMMMMMNNNNNNNMMNN
+NMMMMMMNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMNMMMMMMMMMMMMNNNNMMMNNNN
+MMMNNMNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNMMNMMMMMMMMMMMMMMMMMMMMMMMNNNMMMMMMN
+NMMMMMNNNNMMMMMMMMMMMMMMMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMNNMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNMMMN
+NMMMNNMMMMMMMMMMMMMMMMMMMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMNNNMNNNMMMNNNM
+NNMMMMMMMMMMMMMMMMMMMMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMNMMMMMMMMMMMMMMMNNMMNNMMMNNNN
+NMMMMMMMMMMMMMMMMMMMMMMMNNNMMMMMMMMMMMMMMMMMMMMMMMMMMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMNMMMMMMNNN
+NMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMNMMNMMMMNN
+NMMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNMMMMMMMMMMMMMMMNNMNN
+NMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMMMMMMMMMMMMMMMMMMMNN
+NMMMMMMMMMMMMMMNNMMMNDDDNMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMMNMNNMNM
+MMMMMMMMMMMMMNNND88NMMMMNDDMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNMMMMNN
+NMMMMMMMMMMNNNNNDDMMDDDNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMMMMMMMMMNMMNNNMNNNNNNNNN
+MMMMMMMMMMMMMMNNNMNODNND88NODD8DMNMND8OODDNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNMNNN
+NMMMMMMMMMMMMMDDNDOOMMND8N8DDODMN8O$III77$Z8DMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNMNNNNNNMM
+NMMMMMMMMMMMMN8NDNNNNDONMNNO8MDZ8IIIIIII77$$$7ZODNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMNNMNNN
+MMMMMMMMMMMMMNMDDMNMODMM8DNMMNOD$777IIII777777$$$$77$DMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNMMNNMNN
+NMMMMMMMMMMMMNDNMNN8MMMNMNMNMD88$$777777777777777$$77$$8NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNMMMNNNNN
+NMMMMMMMMMMMMMMMMMDNNMMNMDMNMNNDZ$$$$$$$$7777777777$$$$$ZZZZNMMMMMMNNMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMNNNMNNNNNNN
+NMMMMMMMMMMMMMMMMNNNMMNNNDMMNNM8ZZZZZ$$Z$$777777$$77$$$$77$$Z8NMMMMMNMMMMMMMMMMMMMMMMMMMMMMNMMNMMMMMMMMNMMMMNNNNNNNNMMNN
+NNNMMMMMMMMMMMMMMMMMMMNMMMMMNNMND8888OOZZ$$$$$$7777777777777$$ZO88MNMNMMMMMMMMNNNDD8O8NNMMNNNMMMNMMMMMMNNMNNMNNNNNNNNNNN
+NMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMDDNDD88ZZZ$$$$$7$$$$77$ZZ$7III$8NDNNMN8ZO8O88NMND888NNND8O88NNMMMMMMMMNMMNNNNNNNNNNNNNN
+NNNNMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMNN8ZZZZZ$$$$Z$$$$$ZODD8777$7$D88D8OZZO8DD8O88DND88DNNNNNNNMMMMMMMMMMMNMMNMNNNMMMNNN
+NMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMD888OOZZZZZ$$ZZZZ$$ZZ8NNOZ$$$$DDDDDNDOODDDDDDDDDDD8DNNDNNNNNMMMMMMMMMMMMMNNNNNNNMMNN
\ No newline at end of file
--- a/mds_plat/location_manager_api/tsrc/conf/LocationManagerTestScripter.cfg	Tue May 11 16:36:55 2010 +0300
+++ b/mds_plat/location_manager_api/tsrc/conf/LocationManagerTestScripter.cfg	Tue May 25 13:10:05 2010 +0300
@@ -190,22 +190,8 @@
 [Endtest] 
 
 [Test]
-title Tracklog Observer test
-timeout 60000
-create LocationManagerTestScripter test
-test SetupTrackLog
-test AddObserver
-test AddObserver
-test AddObserver
-test RemoveObserver
-test RemoveObserver
-test TearDownTrackLog
-delete test
-[Endtest]
-
-[Test]
 title Start Stop Tracklog Recording
-timeout 60000
+timeout 80000
 create LocationManagerTestScripter test
 test SetupTrackLog
 test AddObserver
@@ -223,8 +209,22 @@
 [Endtest] 
 
 [Test]
+title Tracklog Observer test
+timeout 60000
+create LocationManagerTestScripter test
+test SetupTrackLog
+test AddObserver
+test AddObserver
+test AddObserver
+test RemoveObserver
+test RemoveObserver
+test TearDownTrackLog
+delete test
+[Endtest]
+
+[Test]
 title Start Stop Tracklog Recording 2
-timeout 60000
+timeout 240000
 create LocationManagerTestScripter test
 test SetupTrackLog
 test AddObserver
--- a/mds_plat/metadata_engine_api/inc/mdeconstants.h	Tue May 11 16:36:55 2010 +0300
+++ b/mds_plat/metadata_engine_api/inc/mdeconstants.h	Tue May 25 13:10:05 2010 +0300
@@ -35,6 +35,7 @@
         _LIT( KItemTypeProperty, "ItemType" );
         _LIT( KTitleProperty, "Title" );
         _LIT( KTimeOffsetProperty, "TimeOffset" );
+        _LIT( KInDefaultFolder, "InDefaultFolder" );
 
         enum TOrigin
             {
--- a/metadataengine/client/src/mdeobject.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/client/src/mdeobject.cpp	Tue May 25 13:10:05 2010 +0300
@@ -276,6 +276,7 @@
 		}
 
 	iUri = HBufC::NewL( aUri.Length() );
+	// Note: CopyLC doesn't push anything to cleanup stack
 	iUri->Des().CopyLC( aUri );
 	iFlags |= EMdEObjectFlagModObject;
 	}
--- a/metadataengine/client/src/mdesessionimpl.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/client/src/mdesessionimpl.cpp	Tue May 25 13:10:05 2010 +0300
@@ -1338,6 +1338,7 @@
 			{
 			const TDesC& uri = *((*aObjects)[i]);
 			HBufC* lcUri = HBufC::NewLC( uri.Length() );
+			// Note: CopyLC doesn't push anything to cleanup stack
 			lcUri->Des().CopyLC( uri );
 			buffer->InsertL( *lcUri );
 			CleanupStack::PopAndDestroy( lcUri );
--- a/metadataengine/server/inc/mdslogger.h	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/server/inc/mdslogger.h	Tue May 25 13:10:05 2010 +0300
@@ -57,6 +57,10 @@
 _LIT(KFilename, "server.txt");
 _LIT(KAltFilename, "server2.txt");
 
+#ifdef LOG_QUERY
+#define MDE_FILE_LOGGING
+#endif
+
 // CLASS DECLARATION
 /**
 * CMdSLogger.
--- a/metadataengine/server/inc/mdsmanipulationengine.h	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/server/inc/mdsmanipulationengine.h	Tue May 25 13:10:05 2010 +0300
@@ -32,7 +32,7 @@
 class CMdSSqlObjectManipulate;
 
 // CONSTANT DECLARATION
-const TInt KGarbageCollectionDelay = 60; // 1 minute
+const TInt KGarbageCollectionDelay = 90; // 1,5 minutes
 
 // CLASS DECLARATION
 
@@ -342,6 +342,10 @@
 		CMdSGarbageCollector* iGarbageCollector;
 		
 		CMdSObjectLockList& iLockList;
+		
+		//For DB maintenance
+		TInt iAddedObjectsCount;
+		TInt iModifiedObjectsCount;
 	};
 
 #endif //__MDSMANIPULATIONENGINE_H__
--- a/metadataengine/server/inc/mdsserversession.h	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/server/inc/mdsserversession.h	Tue May 25 13:10:05 2010 +0300
@@ -394,6 +394,9 @@
         
         CMdCSerializationBuffer* CombineBuffersL(
         		CMdCSerializationBuffer& aLeftBuffer, CMdCSerializationBuffer& aRightBuffer );
+        
+        CMdCSerializationBuffer* CombineUriNotificationsBuffersL(
+                CMdCSerializationBuffer& aLeftBuffer, CMdCSerializationBuffer& aRightBuffer );
 
         CMdCSerializationBuffer* CombineItemBuffersL(
         		CMdCSerializationBuffer& aLeftBuffer, CMdCSerializationBuffer& aRightBuffer );
--- a/metadataengine/server/inc/mdssqlobjectmanipulate.h	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/server/inc/mdssqlobjectmanipulate.h	Tue May 25 13:10:05 2010 +0300
@@ -483,6 +483,11 @@
 				RArray<TItemId>& aObjectIds);
 
 		void CheckMassStorageMediaIdL( const TUint32 aMediaId );
+
+        /**
+        * Analyze the  database after enough items have been added or modified
+        */    
+        void AnalyzeL();
 		
     protected: // personal methods
 
@@ -570,6 +575,8 @@
 	
 	    TBuf<256> iLastAddedObjName;
 	    
+	    TBool iDictionaryToBeCleaned;
+	    
 	private:
 		class RClauseBuffer
 			{
--- a/metadataengine/server/src/mdsgarbagecollector.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/server/src/mdsgarbagecollector.cpp	Tue May 25 13:10:05 2010 +0300
@@ -99,14 +99,12 @@
 
 		if ( startAgain )
 			{
-			iTimer.After( iStatus, iDelay ); // start timer
-			SetActive();
-			}
-		else if ( iNewDelay.Int() > 0 )
-			{
-			iDelay = iNewDelay;
-			iNewDelay = 0;
-			iTimer.After( iStatus, iDelay ); // start timer
+		    if( iNewDelay.Int() > 0 )
+		        {
+                iDelay = iNewDelay;
+                iNewDelay = 0;
+		        }
+            iTimer.After( iStatus, iDelay ); // start timer
 			SetActive();
 			}
 		}
--- a/metadataengine/server/src/mdsmanipulationengine.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/server/src/mdsmanipulationengine.cpp	Tue May 25 13:10:05 2010 +0300
@@ -31,6 +31,7 @@
 #include "mdcserializationbuffer.h"
 #include "mdeinternalerror.h"
 #include "mdeerror.h"
+#include "mdscommoninternal.h"
 
 // for CleanupResetAndDestroyPushL
 #include <mmf/common/mmfcontrollerpluginresolver.h>
@@ -168,6 +169,7 @@
             if (err == KErrNone)
                 {
                 aResultBuffer.InsertL( id );
+                iAddedObjectsCount++;
                 }
             else
                 {
@@ -295,6 +297,28 @@
 
 	iManipulate->SetNamespace( NULL );
 	iNotifier.NotifyAddedL( aBuffer, aResultBuffer );
+	
+    if( iAddedObjectsCount > KTriggerDbMaintenanceTreasholdValue )
+	   {
+	   RMdSTransaction transaction( connection );
+	   CleanupClosePushL(transaction);
+	   const TInt beginError( transaction.Error() );
+	       
+	   if( beginError != KErrNone )
+	       {
+	       CleanupStack::PopAndDestroy( &transaction );
+	       }
+	       
+	   iManipulate->AnalyzeL();
+	    
+	   if( beginError == KErrNone )
+	       {
+	       transaction.CommitL();
+	       CleanupStack::PopAndDestroy( &transaction );
+	       }
+	       
+	   iAddedObjectsCount = 0;
+	   }
 	}
 
 // ---------------------------------------------------------------------------
@@ -605,6 +629,7 @@
 			if (err == KErrNone)
 				{
 				aResultBuffer.InsertL( id );
+				iModifiedObjectsCount++;
 				}
 			else
 				{
@@ -689,6 +714,28 @@
 	resultIds.SerializeL( aResultBuffer );
 
 	iNotifier.NotifyModifiedL( aBuffer, aResultBuffer );
+	
+    if( iModifiedObjectsCount > KTriggerDbMaintenanceTreasholdValue )
+       {
+       RMdSTransaction transaction( connection );
+       CleanupClosePushL(transaction);
+       const TInt beginError( transaction.Error() );
+           
+       if( beginError != KErrNone )
+           {
+           CleanupStack::PopAndDestroy( &transaction );
+           }
+           
+       iManipulate->AnalyzeL();
+        
+       if( beginError == KErrNone )
+           {
+           transaction.CommitL();
+           CleanupStack::PopAndDestroy( &transaction );
+           }
+           
+       iModifiedObjectsCount = 0;
+       }
     }
 
 CMdCSerializationBuffer* CMdSManipulationEngine::CheckObjectL( 
--- a/metadataengine/server/src/mdsschema.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/server/src/mdsschema.cpp	Tue May 25 13:10:05 2010 +0300
@@ -100,6 +100,7 @@
 	iBaseObject->AddPropertyL( MdeConstants::Object::KLastModifiedDateProperty, EPropertyTime, KMinTInt64, KMaxTInt64, EFalse, ETrue, EFalse );
 	iBaseObject->AddPropertyL( MdeConstants::Object::KItemTypeProperty, EPropertyText, TInt32(0), TInt32(255), EFalse, EFalse, EFalse );
 	iBaseObject->AddPropertyL( MdeConstants::Object::KTitleProperty, EPropertyText, TInt32(0), TInt32(255), EFalse, EFalse, EFalse );
+	iBaseObject->AddPropertyL( MdeConstants::Object::KInDefaultFolder, EPropertyBool, TInt32(0), TInt32(1), EFalse, EFalse, EFalse );
 	
 	TInt propcount = iBaseObject->GetPropertiesCount();
 	iBaseObject->iCol2Prop.Reset();
@@ -203,7 +204,7 @@
 
 void CMdsSchema::CreateObjectTablesL()
 	{
-	_LIT( KBaseObjectDefinition,  "CREATE TABLE IF NOT EXISTS %S%u(ObjectId INTEGER PRIMARY KEY AUTOINCREMENT,ObjectDefId INTEGER NOT NULL,Flags INTEGER,MediaId LARGEINT,UsageCount LARGEINT DEFAULT 0,GuidHigh LARGEINT,GuidLow LARGEINT,URI TEXT NOT NULL COLLATE NOCASE,Origin INTEGER,Size LARGEINT,TimeOffset INTEGER,CreationDate LARGEINT,LastModifiedDate LARGEINT,ItemType TEXT,Title TEXT,UNIQUE(GuidHigh,GuidLow),UNIQUE(URI,MediaId));" );	
+	_LIT( KBaseObjectDefinition,  "CREATE TABLE IF NOT EXISTS %S%u(ObjectId INTEGER PRIMARY KEY AUTOINCREMENT,ObjectDefId INTEGER NOT NULL,Flags INTEGER,MediaId LARGEINT,UsageCount LARGEINT DEFAULT 0,GuidHigh LARGEINT,GuidLow LARGEINT,URI TEXT NOT NULL COLLATE NOCASE,Origin INTEGER,Size LARGEINT,TimeOffset INTEGER,CreationDate LARGEINT,LastModifiedDate LARGEINT,ItemType TEXT,Title TEXT,InDefaultFolder INTEGER,UNIQUE(GuidHigh,GuidLow),UNIQUE(URI,MediaId));" );	
 	_LIT( KCreateRelationsTable,  "CREATE TABLE IF NOT EXISTS Relations%u(RelationId INTEGER PRIMARY KEY AUTOINCREMENT,Flags INTEGER,RelationDefId INTEGER NOT NULL,LeftObjectId INTEGER NOT NULL,RightObjectId INTEGER NOT NULL,Parameter INTEGER,GuidHigh LARGEINT,GuidLow LARGEINT,LastModifiedDate LARGEINT);" );
 	_LIT( KCreateEventsTable,     "CREATE TABLE IF NOT EXISTS Event%u(EventId INTEGER PRIMARY KEY AUTOINCREMENT,ObjectId INTEGER NOT NULL, EventDefId INTEGER NOT NULL, Timestamp INTEGER NOT NULL, Source TEXT, Participant TEXT);" );
 	_LIT( KCreateTxtSrchTable,    "CREATE TABLE IF NOT EXISTS TextSearch%u(WordId INTEGER NOT NULL,ObjectId INTEGER NOT NULL,Position INTEGER);" );
--- a/metadataengine/server/src/mdsserver.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/server/src/mdsserver.cpp	Tue May 25 13:10:05 2010 +0300
@@ -365,10 +365,10 @@
     CMdSSqLiteConnection* conn = CMdSSqLiteConnection::NewLC();
     iDefaultDBConnection = conn;
     MMdSDbConnectionPool::SetDefaultDB( conn );
-
-    CMdSMaintenanceEngine::InitConnectionL();
     CleanupStack::Pop( conn );
 
+    CMdSMaintenanceEngine::InitConnectionL();    
+    
     iNotifier = CMdSNotifier::NewL();
 
     InitializeL();
--- a/metadataengine/server/src/mdsserversession.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/server/src/mdsserversession.cpp	Tue May 25 13:10:05 2010 +0300
@@ -866,6 +866,7 @@
                 delete findEngine;
                 
                 iFindEngines.Remove( findEngineIndex );
+                iFindEngines.Compress();
                 }
             }
             break;
@@ -984,6 +985,7 @@
             // The cache holds a new notification for this notifier, trigger it
             CNotificationCacheItem* item = iNotificationCache[mid];
             iNotificationCache.Remove(mid);
+            iNotificationCache.Compress();
 
             CleanupStack::PushL( item );
 
@@ -1023,6 +1025,7 @@
 			delete iNotificationCache[i]->iData;
 			iNotificationCache[i]->iData = NULL;
 			iNotificationCache.Remove(i);
+			iNotificationCache.Compress();
 			}
 		}
     }
@@ -1089,6 +1092,95 @@
 	return buffer;
 	}
 
+// ---------------------------------------------------------------------------
+// CacheNotificationL caches a notifier event
+// ---------------------------------------------------------------------------
+//
+
+CMdCSerializationBuffer* CMdSServerSession::CombineUriNotificationsBuffersL(CMdCSerializationBuffer& aLeftBuffer,
+        CMdCSerializationBuffer& aRightBuffer )
+    {
+    // IDs are always stored in object IDs, 
+    // even if those are actually relation or event IDs 
+    
+    aLeftBuffer.PositionL( KNoOffset );
+    aRightBuffer.PositionL( KNoOffset );
+
+    const TMdCItemIds& leftItemIds = TMdCItemIds::GetFromBufferL( aLeftBuffer );
+    const TMdCItemIds& rightItemIds = TMdCItemIds::GetFromBufferL( aRightBuffer );
+
+    // check that namespaces match
+    if ( leftItemIds.iNamespaceDefId != rightItemIds.iNamespaceDefId )
+        {
+        return NULL;
+        }
+
+    // create new buffer, which will contain combined results
+    const TInt leftBufferSize = aLeftBuffer.Size();
+    const TInt rightBufferSize = aRightBuffer.Size();
+    CMdCSerializationBuffer* buffer = CMdCSerializationBuffer::NewLC( 
+            leftBufferSize + rightBufferSize );
+
+    TMdCItemIds combinedItemIds;
+    
+    // use left buffer's data as base line
+    Mem::Copy( &combinedItemIds, &leftItemIds, sizeof( TMdCItemIds ) );
+    
+    // and add right buffer's count
+    combinedItemIds.iObjectIds.iPtr.iCount += rightItemIds.iObjectIds.iPtr.iCount;
+
+    combinedItemIds.SerializeL( *buffer );
+
+    // move left and right buffer to begin of items
+    aLeftBuffer.PositionL( leftItemIds.iObjectIds.iPtr.iOffset );
+    aRightBuffer.PositionL( rightItemIds.iObjectIds.iPtr.iOffset );
+
+    // copy IDs from left and right buffers to combined buffer
+    for (TInt i = 0; i < leftItemIds.iObjectIds.iPtr.iCount; ++i)
+        {
+        TItemId id;
+        aLeftBuffer.ReceiveL( id );
+        buffer->InsertL( id );      
+        }
+
+    for (TInt i = 0; i < rightItemIds.iObjectIds.iPtr.iCount; ++i)
+        {
+        TItemId id;
+        aRightBuffer.ReceiveL( id );
+        buffer->InsertL( id );      
+        }
+    
+    //Add combined URI count
+    TUint32 leftUriCount ( 0 );
+    aLeftBuffer.ReceiveL( leftUriCount );
+    TUint32 rightUriCount ( 0 );
+    aRightBuffer.ReceiveL( rightUriCount );
+    buffer->InsertL( TUint32( leftUriCount + rightUriCount) );    
+   
+    //Add uris
+    HBufC* uri = NULL;
+    for( TInt i( 0 ); i < leftUriCount; i++ )
+        {        
+        //Get uri
+        uri = aLeftBuffer.ReceiveDes16L();
+        CleanupStack::PushL( uri );
+        buffer->InsertL( *uri );
+        CleanupStack::Pop( uri );
+        }
+    
+    for( TInt i( 0 ); i < rightUriCount; i++ )
+        {        
+        //Get uri
+        uri = aRightBuffer.ReceiveDes16L();
+        CleanupStack::PushL( uri );
+        buffer->InsertL( *uri );
+        CleanupStack::Pop( uri );
+        }
+    
+    CleanupStack::Pop( buffer );
+    return buffer;
+    }
+
 CMdCSerializationBuffer* CMdSServerSession::CombineItemBuffersL( CMdCSerializationBuffer& aLeftBuffer,
 		CMdCSerializationBuffer& aRightBuffer )
 	{
@@ -1176,7 +1268,13 @@
 				{
 				CMdCSerializationBuffer* data = NULL;
 				// combine buffers
-				if ( notificationItem.iCode != ERelationItemNotifyRemove )
+				if( notificationItem.iCode == EObjectNotifyAddWithUri ||
+				    notificationItem.iCode == EObjectNotifyModifyWithUri || 
+				    notificationItem.iCode == EObjectNotifyRemoveWithUri )
+				    {
+				    data = CombineUriNotificationsBuffersL( *notificationItem.iData, *aData );
+				    }
+				else if ( notificationItem.iCode != ERelationItemNotifyRemove )
 					{
 					data = CombineBuffersL( *notificationItem.iData, *aData );
 					}
--- a/metadataengine/server/src/mdssqliteconnection.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/server/src/mdssqliteconnection.cpp	Tue May 25 13:10:05 2010 +0300
@@ -75,8 +75,8 @@
 
 void CMdSSqLiteConnection::OpenDbL( const TDesC& aDbFileName )
     {
-    _LIT8( KMdsSqlDbaConfig, "cache_size=8000; page_size=2048; encoding=\"UTF-16\";");
-    _LIT8( KBlacklistSqlDbaConfig, "cache_size=4000; page_size=1024; encoding=\"UTF-16\";");
+    _LIT8( KMdsSqlDbaConfig, "cache_size=2000; page_size=2048; encoding=\"UTF-16\";");
+    _LIT8( KBlacklistSqlDbaConfig, "cache_size=1500; page_size=1024; encoding=\"UTF-16\";");
 
     delete iDbFileName;
     iDbFileName = NULL; // in case AllocL leaves
@@ -639,6 +639,15 @@
         }
     }
 
+void CMdSSqLiteConnection::DoAnalyzeL() 
+    {
+    _LIT( KAnalyze, "ANALYZE;");
+    
+    RRowData emptyRow;
+    CleanupClosePushL( emptyRow );
+    ExecuteL(KAnalyze, emptyRow);
+    CleanupStack::PopAndDestroy( &emptyRow ); 
+    }
 
 TInt CMdSSqLiteConnection::DeleteAndReCreateDB( const HBufC* aDbFileName,
                                                 const RSqlSecurityPolicy& asqlSecurityPolicy,
--- a/metadataengine/server/src/mdssqlobjectmanipulate.cpp	Tue May 11 16:36:55 2010 +0300
+++ b/metadataengine/server/src/mdssqlobjectmanipulate.cpp	Tue May 25 13:10:05 2010 +0300
@@ -3309,14 +3309,13 @@
 
 TBool CMdSSqlObjectManipulate::DoGarbageCollectionL()
 	{
-	_LIT( KDeleteObject,                 "DELETE FROM Object%u WHERE Flags&?;" );
+    _LIT( KDeleteObject,                 "DELETE FROM Object%u WHERE ObjectId IN (SELECT ObjectId FROM Object%u WHERE Flags&? LIMIT 100);" );
 	_LIT( KUpdateDeleteObject,           "UPDATE Object%u SET Flags=Flags|? WHERE Flags&?;" );
 	_LIT( KDeleteRelations,              "DELETE FROM Relations%u WHERE Flags&?;" );
 	_LIT( KUpdateDeleteRelations,        "UPDATE Relations%u SET Flags=Flags|? WHERE Flags&?;" );
 	_LIT( KUpdateDeleteContextObjects,   "UPDATE Object%u SET Flags=Flags|? WHERE ObjectId IN ( SELECT ObjectId FROM Object%u AS O WHERE Flags&? AND UsageCount=0 AND ( SELECT count(*) FROM Relations%u WHERE NOT Flags&? AND ( LeftObjectId = O.ObjectId OR RightObjectId = O.ObjectId ) )= 0 );" );
     _LIT( KDeleteWordFromTextSearchDict, "DELETE FROM TextSearchDictionary%u WHERE NOT EXISTS(SELECT WordId FROM TextSearch%u WHERE WordId = TextSearchDictionary%u.WordId);");
 
-
 	RClauseBuffer commonClauseOne(*this, KUpdateDeleteContextObjects().Length() + 3 * KMaxUintValueLength);
 	CleanupClosePushL( commonClauseOne );
 	CMdsClauseBuffer& buffer = commonClauseOne.BufferL();
@@ -3325,34 +3324,11 @@
     CleanupClosePushL( rowDataDel );
     rowDataDel.AppendL( TColumn( EMdEObjectFlagGarbage ) );
 
-    RRowData rowDataUpd;
-    CleanupClosePushL( rowDataUpd );
-    rowDataUpd.AppendL( TColumn( EMdEObjectFlagGarbage ) );
-    rowDataUpd.AppendL( TColumn( EMdEObjectFlagRemoved ) );
-
-    RRowData rowDataDelRel;
-    CleanupClosePushL( rowDataDelRel );
-    rowDataDelRel.AppendL( TColumn( EMdERelationFlagGarbageDeleted ) );
-
-    RRowData rowDataUpdRel;
-    CleanupClosePushL( rowDataUpdRel );
-    rowDataUpdRel.AppendL( TColumn( EMdERelationFlagGarbageDeleted ) );
-    rowDataUpdRel.AppendL( TColumn( EMdERelationFlagDeleted ) );
-
-    RRowData rowDataDelContext;
-    CleanupClosePushL( rowDataDelContext );
-    rowDataDelContext.AppendL( TColumn( EMdEObjectFlagRemoved ) );
-    rowDataDelContext.AppendL( TColumn( EMdEObjectFlagContext ) );
-    rowDataDelContext.AppendL( TColumn( EMdERelationFlagDeleted ) );
-
-	RRowData emptyRow;
-	CleanupClosePushL( emptyRow );
-
    	const RPointerArray<CMdsNamespaceDef>& namespaceDefs = 
    		iSchema.NamespaceDefs();
 
 	CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
-	TInt deleteObjectResult;
+	TInt deleteObjectResult = 0;
 	TInt updateResult = 0;
 	
 	const TInt count = namespaceDefs.Count();
@@ -3362,14 +3338,43 @@
    	    const TDefId nmspId = namespaceDefs[i]->GetId();
 
 		// deleting objects
-		buffer.BufferL().Format( KDeleteObject, nmspId );
+		buffer.BufferL().Format( KDeleteObject, nmspId, nmspId );
    	    User::LeaveIfError( deleteObjectResult = connection.ExecuteL( 
    	    		buffer.ConstBufferL(), rowDataDel ) );
-
+   	    
+   	    if( deleteObjectResult > 0 )
+   	        {
+   	        // If objects were deleted, continue garbage collection 
+   	        iDictionaryToBeCleaned = ETrue;
+   	        CleanupStack::PopAndDestroy( 2, &commonClauseOne );
+   	        return ETrue;
+   	        }
+
+   	    RRowData rowDataUpd;
+   	    CleanupClosePushL( rowDataUpd );
+   	    rowDataUpd.AppendL( TColumn( EMdEObjectFlagGarbage ) );
+   	    rowDataUpd.AppendL( TColumn( EMdEObjectFlagRemoved ) );
+   	    
         buffer.BufferL().Format( KUpdateDeleteObject, nmspId );
    	    User::LeaveIfError( updateResult += connection.ExecuteL(
    	    		buffer.ConstBufferL(), rowDataUpd ) );
 
+        if( updateResult > 0 )
+            {
+            // If objects were modified, continue garbage collection 
+            CleanupStack::PopAndDestroy( 3, &commonClauseOne );
+            return ETrue;
+            }
+
+        RRowData rowDataDelRel;
+        CleanupClosePushL( rowDataDelRel );
+        rowDataDelRel.AppendL( TColumn( EMdERelationFlagGarbageDeleted ) );
+        
+        RRowData rowDataUpdRel;
+        CleanupClosePushL( rowDataUpdRel );
+        rowDataUpdRel.AppendL( TColumn( EMdERelationFlagGarbageDeleted ) );
+        rowDataUpdRel.AppendL( TColumn( EMdERelationFlagDeleted ) );
+        
 		// deleting relations
 		buffer.BufferL().Format( KDeleteRelations, nmspId );
    	    User::LeaveIfError( connection.ExecuteL( 
@@ -3378,19 +3383,43 @@
 		buffer.BufferL().Format( KUpdateDeleteRelations, nmspId );
    	    User::LeaveIfError( updateResult += connection.ExecuteL( 
    	    		buffer.ConstBufferL(), rowDataUpdRel ) );
-
+   	    
+        if( updateResult > 0 )
+            {
+            // If objects were modified, continue garbage collection 
+            CleanupStack::PopAndDestroy( 5, &commonClauseOne );
+            return ETrue;
+            }
+
+        RRowData rowDataDelContext;
+        CleanupClosePushL( rowDataDelContext );
+        rowDataDelContext.AppendL( TColumn( EMdEObjectFlagRemoved ) );
+        rowDataDelContext.AppendL( TColumn( EMdEObjectFlagContext ) );
+        rowDataDelContext.AppendL( TColumn( EMdERelationFlagDeleted ) );
+        
 		// deleting context objects
 		buffer.BufferL().Format( KUpdateDeleteContextObjects, nmspId, nmspId, nmspId );
    	    User::LeaveIfError( updateResult += connection.ExecuteL( 
    	    		buffer.ConstBufferL(), rowDataDelContext ) );
-
+   	    
+        if( updateResult > 0 )
+            {
+            // If objects were modified, continue garbage collection 
+            CleanupStack::PopAndDestroy( 6, &commonClauseOne );
+            return ETrue;
+            }
+
+        RRowData emptyRow;
+        CleanupClosePushL( emptyRow );
+        
 		// deleting words from text search dictionary
-		if ( deleteObjectResult > 0 )
+		if ( iDictionaryToBeCleaned )
 			{
 			buffer.BufferL().Format( KDeleteWordFromTextSearchDict, nmspId, nmspId, 
 					nmspId );
 	   	    User::LeaveIfError( connection.ExecuteL( 
 	   	    		buffer.ConstBufferL(), emptyRow ) );
+	   	    iDictionaryToBeCleaned = EFalse;
 			}
    	    }
 
@@ -3398,9 +3427,16 @@
    	// rowDataDel, commonClauseOne
 	CleanupStack::PopAndDestroy( 7, &commonClauseOne );
 
-	return updateResult != 0;
+	// When this is reached, all garbage collection steps have been fully executed
+	return EFalse;
 	}
 
+void CMdSSqlObjectManipulate::AnalyzeL()
+    {
+    CMdSSqLiteConnection& db = MMdSDbConnectionPool::GetDefaultDBL();
+    db.DoAnalyzeL();
+    }
+
 CMdSSqlObjectManipulate::RClauseBuffer::RClauseBuffer( CMdSSqlObjectManipulate& aSOM, TInt aSize )
 	: iBuffers( aSOM.iBuffers ), iBuffer( NULL ), iNr( -1 ), iSize( aSize )
 	{