Revision: 201015 RCL_3 PDK_3.0.i
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 27 Apr 2010 17:05:23 +0300
branchRCL_3
changeset 22 ab88d4a85041
parent 19 82c0024438c8
child 26 9f21bab39f42
Revision: 201015 Kit: 201017
clfwrapper/ClientSrc/CCLFDefaultOperation.cpp
clfwrapper/ClientSrc/CCLFItemListModelImpl.cpp
harvester/blacklistclient/group/blacklistclient.mmp
harvester/blacklistclient/inc/blacklistclient.h
harvester/blacklistclient/src/blacklistclient.cpp
harvester/common/src/harvesterplugin.cpp
harvester/common/src/harvesterpluginfactory.cpp
harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp
harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp
harvester/server/inc/harvesterqueue.h
harvester/server/src/harvesterao.cpp
harvester/server/src/harvesterqueue.cpp
mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg
mds_plat/metadata_engine_api/tsrc/conf/MdETestScripter.cfg
mds_pub/content_listing_framework_api/tsrc/conf/ContentListingFrameworkTest.cfg
mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTestBlocks.cpp
metadataengine/client/src/mdesessionimpl.cpp
metadataengine/server/src/mdsfindsqlclause.cpp
sis/mds/mds_stub.sis
sis/mds/package.pkg
sis/mds/package_separate.pkg
sis/mds/stub.pkg
--- a/clfwrapper/ClientSrc/CCLFDefaultOperation.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/clfwrapper/ClientSrc/CCLFDefaultOperation.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -26,6 +26,9 @@
 #include    <badesca.h>
 #include    "MGDebugPrint.h"
 
+// for CleanupResetAndDestroyPushL
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
 // CONSTANTS
 const TInt KCLFGroupedItemArrayGranularity( 4 );
 const TInt KCLFSortingStyleArrayGranularity( 3 );
@@ -475,6 +478,8 @@
                                     const TArray<MCLFItem*>& aSourceList,
                                     RPointerArray<MCLFItem>& aGroupedList )
     {
+    CleanupResetAndDestroyPushL( aGroupedList );
+    
     CDesCArray* tempAlbumNameArray =
                 new (ELeave) CDesCArraySeg( KCLFGroupedItemArrayGranularity );
     CleanupStack::PushL( tempAlbumNameArray );
@@ -511,6 +516,8 @@
             }
         }
     CleanupStack::PopAndDestroy( tempAlbumNameArray );
+    
+    CleanupStack::Pop( &aGroupedList );
     }
 
 //  End of File
--- a/clfwrapper/ClientSrc/CCLFItemListModelImpl.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/clfwrapper/ClientSrc/CCLFItemListModelImpl.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -29,6 +29,9 @@
 #include    <collate.h>
 #include    "MGDebugPrint.h"
 
+// for CleanupResetAndDestroyPushL
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
 // CONSTANTS
 const TInt KCLFResourceVersionNumber( 1 );
 const TInt KCLFEmptyArrayGranularity( 1 );
@@ -443,10 +446,12 @@
 void CCLFItemListModelImpl::CopyArrayL( const TArray<MCLFItem*>& aSource,
                                         RPointerArray<MCLFItem>& aDest )
     {
+    CleanupResetAndDestroyPushL( aDest );
     for( TInt i = aSource.Count() - 1; i >=0; i--)
         {
         aDest.AppendL( aSource[i] );
         }
+    CleanupStack::Pop( &aDest );
     }
 
 // -----------------------------------------------------------------------------
--- a/harvester/blacklistclient/group/blacklistclient.mmp	Wed Apr 14 16:24:03 2010 +0300
+++ b/harvester/blacklistclient/group/blacklistclient.mmp	Tue Apr 27 17:05:23 2010 +0300
@@ -37,6 +37,7 @@
 
 LIBRARY        	  euser.lib
 LIBRARY           mdccommon.lib
+LIBRARY           efsrv.lib
 
 #if defined(WINSCW)
 deffile ../bwincw/blacklistclientwinscw.def
--- a/harvester/blacklistclient/inc/blacklistclient.h	Wed Apr 14 16:24:03 2010 +0300
+++ b/harvester/blacklistclient/inc/blacklistclient.h	Tue Apr 27 17:05:23 2010 +0300
@@ -147,6 +147,11 @@
   
     private: // private data
        
+        /** 
+         * Handle to File server session.
+         */
+        RFs iFs;
+        
         /*! @var iSessionOk flag to indicate if session is ok or not.*/
         TBool iSessionOk;
        
--- a/harvester/blacklistclient/src/blacklistclient.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/harvester/blacklistclient/src/blacklistclient.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -43,6 +43,7 @@
     iBlacklistMemoryTable.ResetAndDestroy();
     iBlacklistMemoryTable.Close();
 	iBlacklistChunk.Close();
+	iFs.Close();
 
     WRITELOG( "RBlacklistClient::~RBlacklistClient - end" );
     }
@@ -56,8 +57,15 @@
     WRITELOG( "RBlacklistClient::Connect - begin" );
 
     iSessionOk = EFalse;
+    
+    TInt error = iFs.Connect();
+    
+    if( error != KErrNone )
+        {
+        return error;
+        }
       
-    TInt error = StartServer();
+    error = StartServer();
 
     if ( error == KErrNone || error == KErrAlreadyExists )
         {
@@ -69,6 +77,10 @@
         {
         iSessionOk = ETrue;
         }
+    else
+        {
+        iFs.Close();
+        }
     
     WRITELOG( "RBlacklistClient::Connect - end" );
 
@@ -273,19 +285,35 @@
 // RBlacklistClient::IsBlacklistedL()
 // ---------------------------------------------------------------------------
 //
-EXPORT_C TBool RBlacklistClient::IsBlacklistedL( const TDesC& aUri, TUint32 aMediaId, TTime aLastModifiedTime )
+EXPORT_C TBool RBlacklistClient::IsBlacklistedL( const TDesC& aUri, TUint32 aMediaId, TTime /*aLastModifiedTime*/ )
     {
     WRITELOG( "RBlacklistClient::IsBlacklistedL - begin" );
 
+    if ( !iSessionOk )
+        {
+        return EFalse;
+        }
+    
     const TInt index = GetListIndex( aUri, aMediaId );
     if ( index >= 0 )
         {
+        TEntry entry;
+        const TInt errorcode = iFs.Entry( aUri, entry );
+        
+        if ( errorcode != KErrNone )
+            {
+            return EFalse;
+            }
+        
+        TTime fileLastModified( 0 );
+        fileLastModified = entry.iModified;
+    
         TInt64 modified( 0 );
         modified = iBlacklistMemoryTable[index]->Modified();
         
         if( modified > 0 )
             {
-            if ( modified == aLastModifiedTime.Int64() )
+            if ( modified == fileLastModified.Int64() )
                 {
                 WRITELOG( "RBlacklistClient::IsBlacklistedL - file is blacklisted, modification time is the same" );
                 return ETrue;
--- a/harvester/common/src/harvesterplugin.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/harvester/common/src/harvesterplugin.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -220,6 +220,7 @@
 //
 EXPORT_C void CHarvesterPlugin::DoCancel()
     {
+    iState = EHarvesterIdle;
     }
 
 // ---------------------------------------------------------------------------
--- a/harvester/common/src/harvesterpluginfactory.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/harvester/common/src/harvesterpluginfactory.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -28,6 +28,9 @@
 #include "mdsutils.h"
 #include "harvesterlog.h"
 
+// for CleanupResetAndDestroyPushL
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
 const TInt KCacheItemCountForEventCaching = 1;
 
 // ---------------------------------------------------------------------------
@@ -36,7 +39,7 @@
 //
 CHarvesterPluginFactory::CHarvesterPluginFactory() :
     iBlacklist( NULL ),
-    iHarvesting( NULL ),
+    iHarvesting( EFalse ),
     iHarvesterEventManager( NULL )
 	{
 	WRITELOG( "CHarvesterPluginFactory::CHarvesterPluginFactory()" );
@@ -338,6 +341,8 @@
 void CHarvesterPluginFactory::GetSupportedPluginsL(
 		RPointerArray<CHarvesterPluginInfo>& aSupportedPlugins, const TDesC& aExt )
 	{
+    CleanupResetAndDestroyPushL( aSupportedPlugins );
+    
 	const TInt pluginInfoCount = iHarvesterPluginInfoArray.Count();
 	TInt extCount = 0;
 	for ( TInt i = pluginInfoCount; --i >= 0; )
@@ -358,6 +363,8 @@
                 }
             }
         }	
+	
+	CleanupStack::Pop( &aSupportedPlugins );
 	}
 
 EXPORT_C TBool CHarvesterPluginFactory::IsSupportedFileExtension( const TDesC& aFileName )
--- a/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -178,44 +178,44 @@
 	// MPEG4
 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
     		KExtensionMp4(), KNullDesC(), 
-    		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
+    		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
     		cmp ) );
 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
     		KExtensionMpg4(), KNullDesC(), 
-    		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
+    		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
     		cmp ) );
 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
     		KExtensionMpeg4(), KNullDesC(), 
-    		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
+    		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
     		cmp ) );
 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
     		KExtensionM4v(), KMimeTypeVideoMp4(), 
-    		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KVideo(),
+    		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KVideo(),
     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
     		cmp ) );
 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
     		KExtensionM4a(), KMimeTypeAudioMp4(), 
-    		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KAudio(),
+    		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KAudio(),
     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
     		cmp ) );
 
 	// 3GP
 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
     		KExtension3gp(), KNullDesC(), 
-    		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
+    		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
     				KMimeTypeVideo3gpp(), KMimeTypeAudio3gpp() ) ), 
     		cmp ) );
 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
     		KExtension3gpp(), KNullDesC(), 
-    		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
+    		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
     				KMimeTypeVideo3gpp(), KMimeTypeAudio3gpp() ) ), 
     		cmp ) );
 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
     		KExtension3g2(), KNullDesC(), 
-    		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
+    		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
     				KMimeTypeVideo3gpp(), KMimeTypeAudio3gpp() ) ), 
     		cmp ) );
 
@@ -837,6 +837,7 @@
         }
     else if( mapping->iHandler.iLibrary == TVideoMetadataHandling::EMp4LibHandling )
         {
+#ifdef MDS_MP4LIB_USAGE
         MP4Handle handle( 0 );
         MP4Err mp4err = MP4_OK;
         
@@ -926,6 +927,7 @@
             {
             WRITELOG( "CHarvesterVideoPlugin - Error closing file handle" );
             }
+#endif
         }
     WRITELOG( "CHarvesterVideoPlugin - Closing file" );        
     CleanupStack::PopAndDestroy( &file );        
@@ -1049,7 +1051,7 @@
     	        }
     		}
     	}
-    
+
     // Copyright
     if( aVHD.iCopyright && aVHD.iCopyright->Length() < iMaxTextLength )
     	{
@@ -1099,8 +1101,9 @@
         }
     }
 
+#ifdef MDS_MP4LIB_USAGE 
 void CHarvesterVideoPlugin::GetMp4Type( RFile64& aFile, TDes& aType )
-	{
+    {
     WRITELOG( "CHarvesterVideoPlugin::GetMp4Mime - MP4ParseOpenFileHandle - start" );
     MP4Handle handle;
 
@@ -1139,6 +1142,11 @@
 
     MP4ParseClose( handle );
 	}
+#else
+void CHarvesterVideoPlugin::GetMp4Type( RFile64& /*aFile*/, TDes& /*aType*/ )
+    {
+    }
+#endif
 
 void CHarvesterVideoPlugin::GetRmTypeL( RFile64& aFile, TDes& aType )
 	{
--- a/harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -31,6 +31,9 @@
 #include <harvesterdata.h>
 #include "harvesterpluginfactory.h"
 
+// for CleanupResetAndDestroyPushL
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
 _LIT( KBackslash, "\\");
 
 const TInt KEntryBufferSize = 100;
@@ -87,6 +90,9 @@
 		RPointerArray<CPlaceholderData>& aEntryArray )
 	{
 	WRITELOG( "CMmcFileList::BuildFileListL - start" );
+	
+	CleanupResetAndDestroyPushL( aEntryArray );
+	
 	CDesCArrayFlat* path = new(ELeave) CDesCArrayFlat( 10 );
 	CleanupStack::PushL( path );
 	TFileName firstPath;
@@ -180,6 +186,8 @@
 	
 	CleanupStack::PopAndDestroy( path );
 	
+	CleanupStack::Pop( &aEntryArray );
+	
 	WRITELOG( "CMmcFileList::BuildFileListL - end" );
 	}
 
--- a/harvester/server/inc/harvesterqueue.h	Wed Apr 14 16:24:03 2010 +0300
+++ b/harvester/server/inc/harvesterqueue.h	Tue Apr 27 17:05:23 2010 +0300
@@ -19,6 +19,7 @@
 
 #include <monitorplugin.h>
 #include "harvestermediaidutil.h"
+#include "harvestereventmanager.h"
 
 // FORWARD DECLARATION
 class CHarvesterAO;
@@ -118,6 +119,8 @@
         
         // not own
         CHarvesterMediaIdUtil* iMediaIdUtil;
+        
+        CHarvesterEventManager* iHEM;
     };
 
 #endif
--- a/harvester/server/src/harvesterao.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/harvester/server/src/harvesterao.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -262,6 +262,9 @@
     iHarvesterPluginFactory = CHarvesterPluginFactory::NewL();
     iHarvesterPluginFactory->SetBlacklist( *iBlacklist );
     
+    // Reset harvesting status for clients in case blacklisted file was handled
+    iHarvesterPluginFactory->SendHarvestingStatusEventL( EFalse );
+    
     iCameraExtensionArray = new ( ELeave ) CDesCArraySeg( 6 );
     iCameraExtensionArray->InsertIsqL( KExtensionMp4 );
     iCameraExtensionArray->InsertIsqL( KExtensionMpg4 );
@@ -523,8 +526,6 @@
         TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, removed ) );
 	    }
 	
-	iMediaIdUtil->RemoveMediaId( aMediaId );
-	
 	removed = 0;
 	
 	RPointerArray<CHarvesterPluginInfo>& hpiArray = iHarvesterPluginFactory->GetPluginInfos();
@@ -570,6 +571,8 @@
 		    }
 		}
 	
+    iMediaIdUtil->RemoveMediaId( aMediaId );
+	
 	// resume harvesting from last state
     if( !iRamFull && !iDiskFull )
         {
@@ -818,6 +821,7 @@
 		CMdEObjectDef& mdeObjectDef = defNS.GetObjectDefL( objDefStr );
 
 		CMdEObject* mdeObject = iMdESession->NewObjectL( mdeObjectDef, hd->Uri() );
+		CleanupStack::PushL( mdeObject );
 		
 		CPlaceholderData* phData = NULL;
 
@@ -953,9 +957,12 @@
 		
 		hd->SetMdeObject( mdeObject );
 		
-		mdeObjectArray.Append( mdeObject );
+		// Ownership of mdeObject transferred to the array
+		mdeObjectArray.AppendL( mdeObject );
 		
 	    CleanupStack::PopAndDestroy( phData );
+	    
+	    CleanupStack::Pop( mdeObject );
 		
 		iReadyPHArray.Append( hd );
 		iPHArray.Remove( i );
--- a/harvester/server/src/harvesterqueue.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/harvester/server/src/harvesterqueue.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -75,6 +75,11 @@
     iItemQueue.Close();
     iFs.Close();
     RMediaIdUtil::ReleaseInstance();
+    
+    if (iHEM)
+        {
+        iHEM->ReleaseInstance();
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -86,6 +91,7 @@
     WRITELOG( "CHarvesterQueue::ConstructL()" );
     User::LeaveIfError( iFs.Connect() );
 	iMediaIdUtil = &RMediaIdUtil::GetInstanceL();
+    iHEM = CHarvesterEventManager::GetInstanceL();
     }
 
 // ---------------------------------------------------------------------------
@@ -148,6 +154,8 @@
         		aItem->Uri(), mediaId, time ) )
             {
             WRITELOG( "CHarvesterQueue::Append() - found a blacklisted file" );
+            TRAP_IGNORE( iHEM->DecreaseItemCountL( EHEObserverTypePlaceholder ) );
+            TRAP_IGNORE( iHEM->DecreaseItemCountL( EHEObserverTypeMMC ) );
             if( aItem->EventType() == EHarvesterEdit )
                 {
                 // Remove possible placeholder items from DB if file was blacklisted during harvesting
--- a/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg	Wed Apr 14 16:24:03 2010 +0300
+++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg	Tue Apr 27 17:05:23 2010 +0300
@@ -93,7 +93,7 @@
 
 [Test]
 title HarvestFile 1
-timeout 180000
+timeout 500000
 create HarvesterClientTestScripter test
 request Session
 test SetUp
@@ -151,7 +151,7 @@
 
 [Test]
 title HarvestFile 3
-timeout 180000
+timeout 500000
 create HarvesterClientTestScripter test
 request Session
 test SetUp
@@ -180,7 +180,7 @@
 
 [Test]
 title HarvestFile 4
-timeout 200000
+timeout 500000
 create HarvesterClientTestScripter test
 request Session
 test SetUp
@@ -210,7 +210,7 @@
 
 [Test]
 title HarvestFile 5
-timeout 180000
+timeout 500000
 create HarvesterClientTestScripter test
 request Session
 test SetUp
@@ -239,7 +239,7 @@
 
 [Test]
 title HarvestFile 6
-timeout 180000
+timeout 500000
 create HarvesterClientTestScripter test
 request Session
 test SetUp
@@ -268,7 +268,7 @@
 
 [Test]
 title HarvestFileWithUID 1
-timeout 180000
+timeout 500000
 create HarvesterClientTestScripter test
 request Session
 test SetUp
@@ -298,7 +298,7 @@
 
 [Test]
 title HarvestFileWithUID 2
-timeout 180000
+timeout 500000
 create HarvesterClientTestScripter test
 request Session
 test SetUp
--- a/mds_plat/metadata_engine_api/tsrc/conf/MdETestScripter.cfg	Wed Apr 14 16:24:03 2010 +0300
+++ b/mds_plat/metadata_engine_api/tsrc/conf/MdETestScripter.cfg	Tue Apr 27 17:05:23 2010 +0300
@@ -1917,10 +1917,10 @@
 test SetGuidL EObject obj3 000007 000004
 
 // Test objects' SetUri & Uri
-test SetUriL obj0 e:\testing\data\TestVideo1.3gp
-test UriL obj0 e:\testing\data\testvideo1.3gp
-test SetUriL obj1 e:\testing\data\TestVideo2.mp4
-test UriL obj1 e:\testing\data\testvideo2.mp4
+//test SetUriL obj0 e:\testing\data\TestVideo1.3gp
+//test UriL obj0 e:\testing\data\testvideo1.3gp
+//test SetUriL obj1 e:\testing\data\TestVideo2.mp4
+//test UriL obj1 e:\testing\data\testvideo2.mp4
 
 // Add the objects to the database, observe the additions and verify the observed results.
 test AddObjectObserverWithUriL
--- a/mds_pub/content_listing_framework_api/tsrc/conf/ContentListingFrameworkTest.cfg	Wed Apr 14 16:24:03 2010 +0300
+++ b/mds_pub/content_listing_framework_api/tsrc/conf/ContentListingFrameworkTest.cfg	Tue Apr 27 17:05:23 2010 +0300
@@ -82,14 +82,14 @@
 delete test
 [Endtest]
 
-[Test]
-title Engine update test
-create ContentListingFrameworkTest test
-test EngineTestSetup
-test UpdateItemsTest
-test Teardown
-delete test
-[Endtest]
+#[Test]
+#title Engine update test
+#create ContentListingFrameworkTest test
+#test EngineTestSetup
+#test UpdateItemsTest
+#test Teardown
+#delete test
+#[Endtest]
 
 #[Test]
 #title Engine update test
--- a/mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTestBlocks.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTestBlocks.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -1497,7 +1497,7 @@
     CreateNewFileL( 5, iFileName );
 
 // update server
-// to aTInt incorrect test result
+// to avoid incorrect test result
     CreateNewFileL( 0, iFileName );
     iEngine->UpdateItemsL();
 
--- a/metadataengine/client/src/mdesessionimpl.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/metadataengine/client/src/mdesessionimpl.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -42,6 +42,9 @@
 #include "mdeobjectcondition.h"
 #include "mdscommoninternal.h"
 
+// for CleanupResetAndDestroyPushL
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
 RMdESessionAsyncRequest::RMdESessionAsyncRequest( TRequestType aRequestType, 
 	CMdCSerializationBuffer* aBuffer, CMdCSerializationBuffer& aResultBuffer,
 	TRequestStatus& aRequestStatus) : 
@@ -1840,6 +1843,8 @@
 		CMdCSerializationBuffer& aBuffer, 
 		RPointerArray<CMdEInstanceItem>& aItems )
 	{
+    CleanupResetAndDestroyPushL( aItems );
+    
 	const TMdCItems& items = TMdCItems::GetFromBufferL( aBuffer );
 
     CMdENamespaceDef& namespaceDef = GetNamespaceDefL( items.iNamespaceDefId );
@@ -1881,6 +1886,8 @@
 			CleanupStack::Pop( relation );
 			}
 		}
+	
+	CleanupStack::Pop( &aItems );
 	}
 
 TItemId CMdESessionImpl::AddObjectL( CMdEObject& aObject )
@@ -2527,7 +2534,6 @@
     		&aObserver, *namespaceDef );
     if ( index != KErrNotFound )
         {
-    	iNotifiers[index]->Cancel();
     	delete iNotifiers[index];
     	iNotifiers[index] = NULL;
     	iNotifiers.Remove( index );
@@ -2549,7 +2555,6 @@
     		&aObserver, namespaceDef );
     if ( index != KErrNotFound )
         {
-    	iNotifiers[index]->Cancel();
     	delete iNotifiers[index];
     	iNotifiers[index] = NULL;
     	iNotifiers.Remove( index );
@@ -2580,7 +2585,6 @@
     		&aObserver, *namespaceDef );
     if ( index != KErrNotFound )
         {
-    	iNotifiers[index]->Cancel();
     	delete iNotifiers[index];
     	iNotifiers[index] = NULL;
     	iNotifiers.Remove( index );
@@ -2612,7 +2616,6 @@
     		&aObserver, *namespaceDef );
     if ( index != KErrNotFound )
         {
-    	iNotifiers[index]->Cancel();
     	delete iNotifiers[index];
     	iNotifiers[index] = NULL;
     	iNotifiers.Remove( index );
@@ -2634,7 +2637,6 @@
     		&aObserver, namespaceDef );
     if ( index != KErrNotFound )
         {
-    	iNotifiers[index]->Cancel();
     	delete iNotifiers[index];
     	iNotifiers[index] = NULL;
     	iNotifiers.Remove( index );
@@ -2664,7 +2666,6 @@
     		&aObserver, *namespaceDef );
     if ( index != KErrNotFound )
         {
-	    iNotifiers[index]->Cancel();
 	    delete iNotifiers[index];
 	    iNotifiers[index] = NULL;
 	    iNotifiers.Remove( index );
@@ -2891,6 +2892,8 @@
 void CMdESessionImpl::GetItemIdL( CMdCSerializationBuffer* aBuffer, 
 		RArray<TItemId>& aIdArray )
 	{
+    CleanupClosePushL( aIdArray );
+    
 	const TMdCItemIds& itemIds = TMdCItemIds::GetFromBufferL( *aBuffer );
 
 	if( itemIds.iObjectIds.iPtr.iCount > 0 ) 
@@ -2917,6 +2920,8 @@
 	    aBuffer->ReceiveL( id );
 	    aIdArray.AppendL( id );
 	    }
+	
+	CleanupStack::Pop( &aIdArray );
 	}
 
 void CMdESessionImpl::GetDistinctValuesL( CMdCSerializationBuffer& aBuffer, 
@@ -3021,7 +3026,6 @@
             &aObserver, *namespaceDef );
     if ( index != KErrNotFound )
         {
-        iNotifiers[index]->Cancel();
         delete iNotifiers[index];
         iNotifiers[index] = NULL;
         iNotifiers.Remove( index );
--- a/metadataengine/server/src/mdsfindsqlclause.cpp	Wed Apr 14 16:24:03 2010 +0300
+++ b/metadataengine/server/src/mdsfindsqlclause.cpp	Tue Apr 27 17:05:23 2010 +0300
@@ -15,6 +15,7 @@
 */
 
 // INCLUDE FILES
+#include <mdequery.h>
 #include "mdsfindsqlclause.h"
 #include "mdsfindsqlclausedef.h"
 #include "mdsclausebuffer.h"
@@ -2642,10 +2643,13 @@
 			{
 			case EQueryResultModeItem:
 			case EQueryResultModeId:
+                {
+                // "GROUP BY BO.ObjectId "
+                iQueryBuf->AppendL( KGroupByObjectId );
+                }
+                break;
 			case EQueryResultModeCount:
 				{
-				// "GROUP BY BO.ObjectId "
-				iQueryBuf->AppendL( KGroupByObjectId );
 				}
 				break;
 
@@ -2664,6 +2668,12 @@
 //
 void CMdSFindSqlClause::AppendOrderByL()
     {
+    if( iSearchCriteria->iQueryResultType == EQueryResultModeCount )
+        {
+        // No need to sort or group if only one count is returned
+        return;
+        }
+    
 	if( iSearchCriteria->iOrderRules.iPtr.iCount > 0 )
 		{
 		iQueryBuf->AppendL( KOrderBy );
@@ -2828,7 +2838,7 @@
     	iQueryBuf->AppendL( KComma );
     	iQueryBuf->BufferL().AppendNum( iSearchCriteria->iOffset );
     	}
-    else if ( iSearchCriteria->iLimit != KMaxTUint32 )
+    else if ( iSearchCriteria->iLimit != KMdEQueryDefaultMaxCount )
     	{
     	// 10 is maximum length of text format TUint32
     	iQueryBuf->ReserveSpaceL( iQueryBuf->ConstBufferL().Length() + 
Binary file sis/mds/mds_stub.sis has changed
--- a/sis/mds/package.pkg	Wed Apr 14 16:24:03 2010 +0300
+++ b/sis/mds/package.pkg	Tue Apr 27 17:05:23 2010 +0300
@@ -17,7 +17,7 @@
 &EN
 
 ;packet-header (name, uid, major, minor, build, type)
-#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 11, TYPE=SA, RU
+#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 13, TYPE=SA, RU
 
 ; Localised vendor name
 %{"Nokia"}
@@ -31,7 +31,7 @@
 ; CenRep
 "..\..\clfwrapper\conf\102828AC.txt"-"c:\private\10202be9\102828AC.txt"
 "..\..\harvester\common\data\200009FE.txt"-"c:\private\10202be9\200009FE.txt"
-"..\..\locationmanager\conf\200071BE.txt"-"c:\private\10202be9\200071BE.txt"
+"..\..\locationmanager\data\200071BE.txt"-"c:\private\10202be9\200071BE.txt"
 
 ; contextengine
 "\EPOC32\RELEASE\ARMV5\UREL\contextengine.dll" -"c:\sys\bin\contextengine.dll"
--- a/sis/mds/package_separate.pkg	Wed Apr 14 16:24:03 2010 +0300
+++ b/sis/mds/package_separate.pkg	Tue Apr 27 17:05:23 2010 +0300
@@ -17,7 +17,7 @@
 &EN
 
 ;packet-header (name, uid, major, minor, build, type)
-#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 11, TYPE=SA, RU
+#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 13, TYPE=SA, RU
 
 ; Localised vendor name
 %{"Nokia"}
--- a/sis/mds/stub.pkg	Wed Apr 14 16:24:03 2010 +0300
+++ b/sis/mds/stub.pkg	Tue Apr 27 17:05:23 2010 +0300
@@ -17,7 +17,7 @@
 &EN
 
 ; Header
-#{"Metadata System"}, (0x200009F5), 9, 20, 11, TYPE=SA
+#{"Metadata System"}, (0x200009F5), 9, 20, 13, TYPE=SA
 
 ; Localised Vendor name
 %{"Nokia"}