Revision: 201011 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 31 Mar 2010 22:19:07 +0300
branchRCL_3
changeset 17 50de4d668bb6
parent 15 3cebc1a84278
child 19 82c0024438c8
Revision: 201011 Kit: 201013
contextengine/plugins/locationplugin/src/locationcontextplugin.cpp
harvester/blacklistclient/src/blacklistclient.cpp
harvester/client/src/harvesterclient.cpp
harvester/data/default_origin_mappings.db
harvester/harvesterplugins/AudioPlugin/group/harvesteraudioplugin.mmp
harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h
harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp
harvester/harvesterplugins/OMADRMPlugin/group/harvesteromadrmplugin.mmp
harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h
harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.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/server/src/harvesterao.cpp
harvester/server/src/pauseobserverao.cpp
inc/harvesterlog.h
inc/mdeharvestersession.h
inc/mdscommoninternal.h
layers.sysdef.xml
locationmanager/client/src/rlocationmanager.cpp
locationmanager/conf/200071BE.txt
locationmanager/conf/locationmanager.confml
locationmanager/data/200071BE.txt
locationmanager/locationtrail/group/locationtrail.mmp
locationmanager/locationtrail/inc/clocationrecord.h
locationmanager/locationtrail/inc/clocationwrite.h
locationmanager/locationtrail/inc/cnetworkinfo.h
locationmanager/locationtrail/inc/cpositioninfo.h
locationmanager/locationtrail/inc/ctracklog.h
locationmanager/locationtrail/inc/locationtraildefs.h
locationmanager/locationtrail/src/cgpxconverterao.cpp
locationmanager/locationtrail/src/clocationrecord.cpp
locationmanager/locationtrail/src/ctracklog.cpp
locationmanager/locationtrail/src/locationremappingao.cpp
locationmanager/server/group/locationmanagerserver.mmp
locationmanager/server/inc/clocationmanagerserver.h
locationmanager/server/src/clocationmanagerserver.cpp
locationmanager/server/src/clocationmanagersession.cpp
mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg
mds_plat/location_manager_api/inc/rlocationmanager.h
mds_plat/metadata_engine_api/inc/mdccommon.h
mds_pub/content_listing_framework_api/tsrc/bwins/ContentListingFrameworkTestu.def
mds_pub/content_listing_framework_api/tsrc/bwins/T_CLFApiMdlTestu.def
mds_pub/content_listing_framework_api/tsrc/conf/ContentListingFrameworkTest.cfg
mds_pub/content_listing_framework_api/tsrc/custom/preset_custom.xml
mds_pub/content_listing_framework_api/tsrc/eabi/ContentListingFrameworkTestu.def
mds_pub/content_listing_framework_api/tsrc/eabi/T_CLFApiMdlTestu.def
mds_pub/content_listing_framework_api/tsrc/group/ContentListingFramework.mmp
mds_pub/content_listing_framework_api/tsrc/group/ContentListingFramework.pkg
mds_pub/content_listing_framework_api/tsrc/group/T_ContentListingFramework.mmp
mds_pub/content_listing_framework_api/tsrc/group/T_ContentListingFramework.pkg
mds_pub/content_listing_framework_api/tsrc/group/bld.inf
mds_pub/content_listing_framework_api/tsrc/inc/ContentListingFrameworkTest.h
mds_pub/content_listing_framework_api/tsrc/inc/T_CLFApiModuleTests.h
mds_pub/content_listing_framework_api/tsrc/init/ContentListingFrameworkTest.ini
mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTest.cpp
mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTest.rss
mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTestBlocks.cpp
mds_pub/content_listing_framework_api/tsrc/src/CreateTestSuite.cpp
mds_pub/content_listing_framework_api/tsrc/src/T_CLFApiModuleTests.cpp
mds_pub/content_listing_framework_api/tsrc/src/T_ContentListingFramework.rss
metadataengine/server/inc/mdsnotifier.h
metadataengine/server/inc/mdsserver.h
metadataengine/server/inc/mdsserversession.h
metadataengine/server/src/mdsfindsqlclause.cpp
metadataengine/server/src/mdsmaintenanceengine.cpp
metadataengine/server/src/mdsnotifier.cpp
metadataengine/server/src/mdsserver.cpp
metadataengine/server/src/mdsserversession.cpp
metadataengine/server/src/mdssqlobjectmanipulate.cpp
package_definition.xml
rom/ContentListingFramework.iby
sis/mds/mds_stub.sis
sis/mds/package.pkg
sis/mds/package_separate.pkg
sis/mds/stub.pkg
watchdog/src/watchdog.cpp
--- a/contextengine/plugins/locationplugin/src/locationcontextplugin.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/contextengine/plugins/locationplugin/src/locationcontextplugin.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -235,7 +235,6 @@
 	        	{
 	        	ret = KErrNone;
 	        	}
-
     		}
         }
 
@@ -255,6 +254,7 @@
 void CLocationContextPlugin::GetMdeObjectCreationTimeL( CMdEObject& aObject, 
 	CMdEProperty*& aProperty )
     {
+    User::LeaveIfNull( iMdeSession );
     CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL();
 
     CMdEObjectDef& objectDef = namespaceDef.GetObjectDefL( Object::KBaseObject );
--- a/harvester/blacklistclient/src/blacklistclient.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/blacklistclient/src/blacklistclient.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -55,30 +55,19 @@
     {
     WRITELOG( "RBlacklistClient::Connect - begin" );
 
-    TInt retryCount = 2;
-    TInt error = KErrNone;
-    
     iSessionOk = EFalse;
-    
-    while ( retryCount )
+      
+    TInt error = StartServer();
+
+    if ( error == KErrNone || error == KErrAlreadyExists )
         {
-        // try create session, if ok, then break out and return KErrNone
+        WRITELOG( "RBlacklistClient::Connect() - creating session" );
         error = CreateSession( KBlacklistServerName, Version() );
-        if( error != KErrNotFound && error != KErrServerTerminated )
-            {
-            iSessionOk = ETrue;
-            break;
-            }
-        
-        // Cannot create session, start server
-        error = StartServer();
-        
-        if ( error != KErrNone && error != KErrAlreadyExists )
-            {
-            break;
-            }
-       
-        --retryCount;
+        }
+    
+    if( error == KErrNone )
+        {
+        iSessionOk = ETrue;
         }
     
     WRITELOG( "RBlacklistClient::Connect - end" );
@@ -105,10 +94,8 @@
 //
 TInt RBlacklistClient::StartServer()
     {
-    WRITELOG( "RBlacklistClient::CustomSecurityCheckL - begin" );
-
-    const TUidType serverUid = ( KNullUid, KNullUid, KUidKBlacklistServer );
-
+    WRITELOG( "RBlacklistClient::StartServer - begin" );
+    
     RProcess server;
     TInt error = server.Create( KBlacklistServerExe, KNullDesC );
     if( error != KErrNone )
@@ -132,7 +119,7 @@
     error = server.ExitType() == EExitPanic ? KErrGeneral : status.Int();
     server.Close();
 
-    WRITELOG( "RBlacklistClient::Version - end" );
+    WRITELOG( "RBlacklistClient::StartServer - end" );
 
     return error;
     }
--- a/harvester/client/src/harvesterclient.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/client/src/harvesterclient.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -261,9 +261,13 @@
 //
 EXPORT_C TInt RHarvesterClient::RemoveHarvesterEventObserver( MHarvesterEventObserver& aHarvesterEventObserver )
 	{
-	TRAPD( err, iHEO->RemoveHarvesterEventObserverL( aHarvesterEventObserver ) );
+    if( iHEO )
+          {
+          TRAPD( err, iHEO->RemoveHarvesterEventObserverL( aHarvesterEventObserver ) );
+          return err;
+          }
 	
-	return err;
+	return KErrNone;
 	}
 
 // ----------------------------------------------------------------------------------------
--- a/harvester/data/default_origin_mappings.db	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/data/default_origin_mappings.db	Wed Mar 31 22:19:07 2010 +0300
@@ -8,19 +8,21 @@
 101FFA86	1
 2000D16B	1
 10208A6D	1
-101f857a    1
-10003a3f	2
-101f4d90	2
-1028242D	2
-1028242E	2
-10281F1D	2
-101FFB51	2
+101f857a  1
+10003a3f	2 
+101f4d90	2 
+1028242D	2 
+1028242E	2 
+101FFB51	2 
 101F8839	2
-101FFAAB	2
+101FFAAB	2 
 200071D8	2
 10008D60	2
-10008d39   	2
-1028190b    2
+10008d39  2 
+1028190b  2 
+10008D5F  2 
+10008D60  2 
+10008D61  2 
 100058CA	4
 1028290B	4
 10281FA8	4
--- a/harvester/harvesterplugins/AudioPlugin/group/harvesteraudioplugin.mmp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/AudioPlugin/group/harvesteraudioplugin.mmp	Wed Mar 31 22:19:07 2010 +0300
@@ -58,6 +58,8 @@
 LIBRARY     metadatautility.lib 
 LIBRARY     thumbnailmanager.lib 
 LIBRARY     centralrepository.lib
+LIBRARY     caf.lib
+LIBRARY     cafutils.lib
 
 PAGED
 BYTEPAIRCOMPRESSTARGET
--- a/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h	Wed Mar 31 22:19:07 2010 +0300
@@ -54,6 +54,7 @@
 		CMdEPropertyDef* iCopyrightPropertyDef;
 		CMdEPropertyDef* iThumbnailPropertyDef;
 		CMdEPropertyDef* iDatePropertyDef;
+		CMdEPropertyDef* iDrmPropertyDef;
 
 		// Audio property definitions
 		CMdEPropertyDef* iAlbumPropertyDef;
--- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -22,6 +22,7 @@
 #include <mdeobjectdef.h>
 #include <mdeobject.h>
 #include <centralrepository.h>
+#include <caf/caf.h>
 
 #include "harvestercommon.h"
 #include "harvesteraudioplugin.h"
@@ -34,6 +35,8 @@
 const TUid KHarvesterRepoUid = { 0x200009FE };
 const TUint32 KEnableAlbumArtHarvest = 0x00090001;
 
+_LIT( KExtensionWma,    "wma" );
+
 CHarvesterAudioPluginPropertyDefs::CHarvesterAudioPluginPropertyDefs() : CBase()
 	{
 	}
@@ -61,6 +64,7 @@
 	iTrackPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KTrackProperty );
 	iThumbnailPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KThumbnailPresentProperty );
 	iDatePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KReleaseDateProperty );
+    iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
 
 	// Audio property definitions
 	CMdEObjectDef& audioDef = nsDef.GetObjectDefL( MdeConstants::Audio::KAudioObject );
@@ -127,6 +131,7 @@
 	WRITELOG( "CHarvesterAudioPlugin::ConstructL()" );
 	
     CRepository* rep = CRepository::NewLC( KHarvesterRepoUid );
+    // If data could not be fetched, default to non-album art mode
     rep->Get( KEnableAlbumArtHarvest, iHarvestAlbumArt );
     CleanupStack::PopAndDestroy( rep );   
 	
@@ -332,6 +337,31 @@
     
     CMdEObject& mdeObject = aHD->MdeObject();
     const TDesC& uri = mdeObject.Uri();
+ 
+    if( !iPropDefs )
+        {
+        CMdEObjectDef& audioObjectDef = mdeObject.Def();
+        iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef );
+        }
+    
+    TPtrC ext;
+    MdsUtils::GetExt( uri, ext );
+    
+    // Check for possibly protected content
+    if( ext.CompareF( KExtensionWma ) == 0 )
+        {
+        ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
+        ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
+        
+        TBool protectedContent( EFalse );
+        TInt err = data->GetAttribute( ContentAccess::EIsProtected, protectedContent );
+        if( err == KErrNone && protectedContent )
+            {
+            CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, 
+                    *iPropDefs->iDrmPropertyDef, &protectedContent, aIsAdd );
+            }
+        CleanupStack::PopAndDestroy( 2 ); // content, data
+        }
     
     TBool parsed( EFalse );
     TRAPD( parseError, parsed = iAudioParser->ParseL( uri ) );
@@ -352,16 +382,10 @@
     TPtrC orgArtist = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldOriginalArtist );
     TPtrC track     = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldTrack );
     TPtrC duration  = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldDuration );
-    TPtrC copyright     = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldCopyright);
+    TPtrC copyright     = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldCopyright );
     TPtrC date     = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldDate );
     
     TPtrC8 jpeg = iAudioParser->MetaDataField8L( CAudioMDParser::EAudioMDFieldJpeg );
-    
-	if( !iPropDefs )
-		{
-	    CMdEObjectDef& audioObjectDef = mdeObject.Def();
-		iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef );
-		}
  
     // Time offset
     TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
--- a/harvester/harvesterplugins/OMADRMPlugin/group/harvesteromadrmplugin.mmp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/OMADRMPlugin/group/harvesteromadrmplugin.mmp	Wed Mar 31 22:19:07 2010 +0300
@@ -48,11 +48,11 @@
 LIBRARY       euser.lib
 LIBRARY       efsrv.lib
 LIBRARY       caf.lib
-LIBRARY	  cafutils.lib
+LIBRARY	      cafutils.lib
 LIBRARY       harvesterplugininterface.lib
 LIBRARY       mdeclient.lib
-LIBRARY	  harvesterdata.lib
-LIBRARY	  harvestercommon.lib
+LIBRARY	      harvesterdata.lib
+LIBRARY	      harvestercommon.lib
 
 PAGED
 BYTEPAIRCOMPRESSTARGET
--- a/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h	Wed Mar 31 22:19:07 2010 +0300
@@ -58,6 +58,7 @@
         TBuf<KMaxDataTypeLength> iDescription;
         TBuf<KMaxDataTypeLength> iTitle;
         TBuf<KMaxDataTypeLength> iAuthor;
+        TBuf<KMaxDataTypeLength> iGenre;
         TInt64 iFileSize;
         TTime iModified;
         TBool iDrmProtected;
@@ -81,6 +82,7 @@
 		CMdEPropertyDef* iDrmPropertyDef;
 		CMdEPropertyDef* iDescriptionPropertyDef;
 		CMdEPropertyDef* iAuthorPropertyDef;
+		CMdEPropertyDef* iGenrePropertyDef;
 	
 	private:
 		CHarvesterOmaDrmPluginPropertyDefs();
--- a/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -59,6 +59,7 @@
 	iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
 	iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty );
 	iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty );
+	iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
 	}
 
 CHarvesterOmaDrmPluginPropertyDefs* CHarvesterOmaDrmPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
@@ -169,8 +170,8 @@
     aVHD.iFileSize = (TUint)entry->iSize;
     CleanupStack::PopAndDestroy( entry );
     
-    ContentAccess::CContent* content = NULL;
-    content = ContentAccess::CContent::NewLC( uri );
+    ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );   
+    ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
     
     ContentAccess::RStringAttributeSet attrSet;
     CleanupClosePushL( attrSet );
@@ -179,8 +180,9 @@
     attrSet.AddL( ContentAccess::EMimeType );
     attrSet.AddL( ContentAccess::ETitle );
     attrSet.AddL( ContentAccess::EAuthor );
-    
-    User::LeaveIfError( content->GetStringAttributeSet(attrSet) );
+    attrSet.AddL( ContentAccess::EGenre );
+
+    User::LeaveIfError( data->GetStringAttributeSet(attrSet) );
     
     TInt err = attrSet.GetValue( ContentAccess::EDescription, aVHD.iDescription );
     if ( err != KErrNone)
@@ -225,6 +227,17 @@
         {
         WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no author" );
         }
+
+    err = attrSet.GetValue( ContentAccess::EGenre, aVHD.iGenre );
+    if ( err != KErrNone)
+        {
+        WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting genre failed %d", err );
+        }
+        
+    if ( aVHD.iGenre.Length() <= 0 )
+        {
+        WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no genre" );
+        }
     
     err = content->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected );
     if ( err != KErrNone)
@@ -232,7 +245,7 @@
         WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting protection info failed %d", err );
         }
         
-    CleanupStack::PopAndDestroy( 2, content );
+    CleanupStack::PopAndDestroy( 3 ); // content, data, attrSet
     }
 
 // ---------------------------------------------------------------------------
@@ -305,6 +318,12 @@
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
     			*iPropDefs->iAuthorPropertyDef, &aVHD.iAuthor, aIsAdd );
     	}
+    // Genre
+    if(aVHD.iGenre.Length() > 0)
+        {
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iGenrePropertyDef, &aVHD.iGenre, aIsAdd );
+        }
     }
 
 // ---------------------------------------------------------------------------
--- a/harvester/harvesterplugins/VideoPlugin/group/harvestervideoplugin.mmp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/VideoPlugin/group/harvestervideoplugin.mmp	Wed Mar 31 22:19:07 2010 +0300
@@ -50,8 +50,10 @@
 LIBRARY       3GPMP4Lib.lib
 LIBRARY       harvesterplugininterface.lib
 LIBRARY       mdeclient.lib
-LIBRARY	  harvesterdata.lib
-LIBRARY	  harvestercommon.lib
+LIBRARY	      harvesterdata.lib
+LIBRARY	      harvestercommon.lib
+LIBRARY       caf.lib
+LIBRARY       cafutils.lib
 
 STATICLIBRARY       hxmetadatautil.lib
 
--- a/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h	Wed Mar 31 22:19:07 2010 +0300
@@ -90,6 +90,8 @@
 
         HBufC* iMimeBuf;
         TUint32 iCodec;
+        
+        TBool iDrmProtected;
 
         CVideoHarvestData() : CBase()
         	{
@@ -135,6 +137,7 @@
 		CMdEPropertyDef* iGenrePropertyDef;
 		CMdEPropertyDef* iArtistPropertyDef;
 		CMdEPropertyDef* iDescriptionPropertyDef;
+		CMdEPropertyDef* iDrmPropertyDef;
 		
 		CMdEPropertyDef* iAudioFourCCDef;
 	
--- a/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -20,6 +20,7 @@
 #include <3gplibrary/mp4lib.h>
 #include <hxmetadatautil.h>
 #include <hxmetadatakeys.h>
+#include <caf/caf.h>
 
 #include "mdsutils.h"
 #include "harvestervideoplugin.h"
@@ -109,6 +110,7 @@
 	iGenrePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KGenreProperty );
 	iArtistPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KArtistProperty );
 	iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDescriptionProperty );
+    iDrmPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDRMProperty );
 	
 	iAudioFourCCDef = &mediaDef.GetPropertyDefL( MediaObject::KAudioFourCCProperty );
 
@@ -554,6 +556,19 @@
     	// doesn't own pointers to MIME types
     	RPointerArray<HBufC> mimes;
     	CleanupClosePushL( mimes );
+
+        TPtrC ext;
+        MdsUtils::GetExt( uri, ext );
+        
+        // Check for possibly protected content
+        if( ext.CompareF( KExtensionWmv ) == 0 )
+            {
+            ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
+            ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
+            
+            data->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected );
+            CleanupStack::PopAndDestroy( 2 ); // content, data
+            }
     	
     	CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL();
         CleanupStack::PushL( helixMetadata );
@@ -746,6 +761,77 @@
         
         // don't destory mime type pointers just clean array
         CleanupStack::PopAndDestroy( &mimes );
+        
+        // If parsing failed, check for possible protected content
+        if( error == KErrNotSupported || 
+            error == KErrAccessDenied ||
+            error == KErrPermissionDenied )
+            {
+            ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
+            ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
+        
+            if( !aVHD.iDrmProtected )
+                {
+                data->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected );
+                }
+            if( aVHD.iDrmProtected )
+                {
+                ContentAccess::RStringAttributeSet attrSet;
+                CleanupClosePushL( attrSet );
+                
+                attrSet.AddL( ContentAccess::EDescription );
+                attrSet.AddL( ContentAccess::ETitle );
+                attrSet.AddL( ContentAccess::EAuthor );
+                attrSet.AddL( ContentAccess::EGenre );
+
+                if( data->GetStringAttributeSet(attrSet) == KErrNone )
+                    {
+                    TBuf<KMaxDataTypeLength> value;
+                    
+                    TInt err = attrSet.GetValue( ContentAccess::EDescription, value );
+                    if ( err != KErrNone)
+                        {
+                        WRITELOG1( "CHarvesterVideoPlugin::GatherDataL - ERROR: getting description failed %d", err );
+                        }
+                    else if( value.Length() > 0 )
+                        {
+                        aVHD.iDescription = value.Alloc();
+                        }
+                
+                    err = attrSet.GetValue( ContentAccess::ETitle, value );
+                    if ( err != KErrNone)
+                        {
+                        WRITELOG1( "CHarvesterVideoPlugin::GatherDataL - ERROR: getting title failed %d", err );
+                        }
+                    else if( value.Length() > 0 )
+                        {
+                        aVHD.iTitle = value.Alloc();
+                        }
+                
+                    err = attrSet.GetValue( ContentAccess::EAuthor, value );
+                    if ( err != KErrNone)
+                        {
+                        WRITELOG1( "CHarvesterVideoPlugin::GatherDataL - ERROR: getting author failed %d", err );
+                        }
+                    else if( value.Length() > 0 )
+                        {
+                        aVHD.iAuthor = value.Alloc();
+                        }
+
+                    err = attrSet.GetValue( ContentAccess::EGenre, value );
+                    if ( err != KErrNone)
+                        {
+                        WRITELOG1( "CHarvesterVideoPlugin::GatherDataL - ERROR: getting genre failed %d", err );
+                        }
+                    else if( value.Length() > 0 )
+                        {
+                        aVHD.iGenre = value.Alloc();
+                        }
+                    }
+                CleanupStack::PopAndDestroy(); // attrSet
+                }
+            CleanupStack::PopAndDestroy( 2 ); // content, data
+            }
         }
     else if( mapping->iHandler.iLibrary == TVideoMetadataHandling::EMp4LibHandling )
         {
@@ -946,11 +1032,17 @@
     	{
     	if( aVHD.iVideoObject )
     		{
-    		CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iVideoBitrate, aIsAdd );
+    	    if( aVHD.iVideoBitrate != 0 )
+    	        {
+    		    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iVideoBitrate, aIsAdd );
+    	        }
     		}
     	else // audio object
     		{
-    		CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iAudioBitrate, aIsAdd );
+    	    if( aVHD.iAudioBitrate != 0 )
+    	        {
+    		    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iAudioBitrate, aIsAdd );
+    	        }
     		}
     	}
 
@@ -995,6 +1087,12 @@
         {
         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTitlePropertyDef, aVHD.iTitle, EFalse );
         }
+    
+    // DRM protection
+    if( aVHD.iDrmProtected )
+        {
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDrmPropertyDef, &aVHD.iDrmProtected, aIsAdd );
+        }
     }
 
 void CHarvesterVideoPlugin::GetMp4Type( RFile64& aFile, TDes& aType )
--- a/harvester/harvesterplugins/WMVPlugin/group/harvesterwmvplugin.mmp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/WMVPlugin/group/harvesterwmvplugin.mmp	Wed Mar 31 22:19:07 2010 +0300
@@ -43,15 +43,15 @@
 MW_LAYER_SYSTEMINCLUDE
 
 SYSTEMINCLUDE /epoc32/include/ecom
-SYSTEMINCLUDE /epoc32/include/caf
 
 LIBRARY       caf.lib
+LIBRARY       cafutils.lib
 LIBRARY       euser.lib
 LIBRARY       efsrv.lib
 LIBRARY       harvestercommon.lib
 LIBRARY       harvesterplugininterface.lib
 LIBRARY       mdeclient.lib
-LIBRARY	  harvesterdata.lib
+LIBRARY	      harvesterdata.lib
 
 PAGED
 BYTEPAIRCOMPRESSTARGET
--- a/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h	Wed Mar 31 22:19:07 2010 +0300
@@ -40,6 +40,13 @@
 		CMdEPropertyDef* iLastModifiedDatePropertyDef;
 		CMdEPropertyDef* iSizePropertyDef;
 		CMdEPropertyDef* iItemTypePropertyDef;
+        CMdEPropertyDef* iTitlePropertyDef;
+		
+        // Media property definitions
+        CMdEPropertyDef* iDrmPropertyDef;
+        CMdEPropertyDef* iDescriptionPropertyDef;
+        CMdEPropertyDef* iAuthorPropertyDef;
+        CMdEPropertyDef* iGenrePropertyDef;
 		
 	private:
 		CHarvesterWmvPluginPropertyDefs();
@@ -89,6 +96,12 @@
     */
     TUint32 iFileSize;
 
+    TBuf<KMaxDataTypeLength> iDescription;
+    TBuf<KMaxDataTypeLength> iTitle;
+    TBuf<KMaxDataTypeLength> iAuthor;
+    TBuf<KMaxDataTypeLength> iGenre;
+    TBool iDrmProtected;  
+    
 private:
 
     /**
--- a/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -11,12 +11,12 @@
 *
 * Contributors:
 *
-* Description:  Harvests metadata from wmv video file 
+* Description:  Harvests metadata from wm video file 
 *
 */
 
 #include <e32std.h>
-#include <caf/content.h>
+#include <caf/caf.h>
 
 #include "mdsutils.h"
 #include "harvesterdata.h"
@@ -43,6 +43,13 @@
 	iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
 	iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
+    iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
+	
+    CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
+    iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
+    iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty );
+    iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty );
+    iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
 	}
 
 CHarvesterWmvPluginPropertyDefs* CHarvesterWmvPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
@@ -169,7 +176,6 @@
        
     const TDesC& uri = aMetadataObject.Uri();
 
-    TInt error ( KErrNone );
     TEntry* entry = new (ELeave) TEntry();
     CleanupStack::PushL( entry );
 
@@ -181,16 +187,81 @@
     CleanupStack::PopAndDestroy( entry );
     
     ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
+    ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
+   
+    ContentAccess::RStringAttributeSet attrSet;
+    CleanupClosePushL( attrSet );
+    
+    attrSet.AddL( ContentAccess::EDescription );
+    attrSet.AddL( ContentAccess::EMimeType );
+    attrSet.AddL( ContentAccess::ETitle );
+    attrSet.AddL( ContentAccess::EAuthor );
+    attrSet.AddL( ContentAccess::EGenre );
 
-    //Mime type check
-    error = content->GetStringAttribute( ContentAccess::EMimeType, aClipDetails.iMimeType );
-    if (  error != KErrNone )
+    User::LeaveIfError( data->GetStringAttributeSet(attrSet) );
+
+    TInt err = attrSet.GetValue( ContentAccess::EMimeType, aClipDetails.iMimeType );
+    if ( err != KErrNone)
+        {
+        WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting mimetype failed %d", err );
+        }
+        
+    if ( aClipDetails.iMimeType.Length() <= 0 )
+        {
+        WRITELOG( "CHarvesterWMVPlugin::GatherDataL - no mimetype" );
+        }
+    
+    err = attrSet.GetValue( ContentAccess::EDescription, aClipDetails.iDescription );
+    if ( err != KErrNone)
+        {
+        WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting description failed %d", err );
+        }
+        
+    if ( aClipDetails.iDescription.Length() <= 0 )
         {
-        WRITELOG( "CHarvesterWMVPlugin - Could not resolve mime type, leave!" );
-        User::Leave( KErrNotSupported );
+        WRITELOG( "CHarvesterWMVPlugin::GatherDataL - no description" );
+        }
+    
+    err = attrSet.GetValue( ContentAccess::ETitle, aClipDetails.iTitle );
+    if ( err != KErrNone)
+        {
+        WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting title failed %d", err );
+        }
+        
+    if ( aClipDetails.iTitle.Length() <= 0 )
+        {
+        WRITELOG( "CHarvesterWMVPlugin::GatherDataL - no title" );
+        }
+    
+    err = attrSet.GetValue( ContentAccess::EAuthor, aClipDetails.iAuthor );
+    if ( err != KErrNone)
+        {
+        WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting author failed %d", err );
+        }
+        
+    if ( aClipDetails.iAuthor.Length() <= 0 )
+        {
+        WRITELOG( "CHarvesterWMVPlugin::GatherDataL - no author" );
         }
 
-    CleanupStack::PopAndDestroy( content );  
+    err = attrSet.GetValue( ContentAccess::EGenre, aClipDetails.iGenre );
+    if ( err != KErrNone)
+        {
+        WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting genre failed %d", err );
+        }
+        
+    if ( aClipDetails.iGenre.Length() <= 0 )
+        {
+        WRITELOG( "CHarvesterWMVPlugin::GatherDataL - no genre" );
+        }
+    
+    err = content->GetAttribute( ContentAccess::EIsProtected, aClipDetails.iDrmProtected );
+    if ( err != KErrNone)
+        {
+        WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting protection info failed %d", err );
+        }
+        
+    CleanupStack::PopAndDestroy( 3 ); // content, data, attrSet
     }
 
 // ---------------------------------------------------------------------------
@@ -229,5 +300,36 @@
         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
                 *iPropDefs->iItemTypePropertyDef, &aClipDetails.iMimeType, aIsAdd );
     	}
+    
+    // DRM protection
+    if( aClipDetails.iDrmProtected )
+        {
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iDrmPropertyDef, &aClipDetails.iDrmProtected, aIsAdd );
+        } 
+    // Title (is set from URI by default)
+    if(aClipDetails.iTitle.Length() > 0)
+        {
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iTitlePropertyDef, &aClipDetails.iTitle, EFalse );
+        }
+    // Description
+    if(aClipDetails.iDescription.Length() > 0)
+        {
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iDescriptionPropertyDef, &aClipDetails.iDescription, aIsAdd );
+        }   
+    // Author
+    if(aClipDetails.iAuthor.Length() > 0)
+        {
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iAuthorPropertyDef, &aClipDetails.iAuthor, aIsAdd );
+        }
+    // Genre
+    if(aClipDetails.iGenre.Length() > 0)
+        {
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iGenrePropertyDef, &aClipDetails.iGenre, aIsAdd );
+        }   
     }
 
--- a/harvester/server/src/harvesterao.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/server/src/harvesterao.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -233,11 +233,14 @@
 
 	User::LeaveIfError( iFs.Connect() );
 
+	// Pump up priority for getting the MDE session up as fast as possible for other
+	// initialization to continue
+    RProcess process;
+    process.SetPriority( EPriorityForeground );
+    process.Close();
+	
     // Setting up MdE Session
 	iMdESession = CMdESession::NewL( *this );
- 	
-    // Setting up context Engine (initialization is ready when ContextInitializationStatus -callback is called)
-    iCtxEngine = CContextEngine::GetInstanceL( this ); // Create the context engine
 
     iBackupSubscriber = CBackupSubscriber::NewL( *this );
 	
@@ -1259,6 +1262,12 @@
 void CHarvesterAO::HandleSessionOpened( CMdESession& aSession, TInt aError )
     {
     WRITELOG( "HarvesterThread::HandleSessionOpened()" );
+    
+    // Revert back to default Harvester process priority when MDE Session is up and running
+    RProcess process;
+    process.SetPriority( EPriorityBackground );
+    process.Close();
+    
     if ( KErrNone == aError )
         {
         TBool isTNMDaemonEnabled( EFalse );
@@ -1279,6 +1288,13 @@
             WRITELOG( "CHarvesterAO::HandleSessionOpened() - error creating mde harvester session" );
         	}
 
+        // Setting up context Engine (initialization is ready when ContextInitializationStatus -callback is called)
+        TRAP( errorTrap, iCtxEngine = CContextEngine::GetInstanceL( this ) ); // Create the context engine 
+        if ( errorTrap != KErrNone )
+                {
+                WRITELOG( "CHarvesterAO::HandleSessionOpened() - Context Engine creation failed" );
+                }
+        
 #ifdef _DEBUG        
         TRAP( errorTrap, iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
         if ( errorTrap != KErrNone )
@@ -1314,11 +1330,6 @@
         TRAP_IGNORE( StartComposersL() );        
 #endif
 
-        if ( iContextEngineInitialized )
-            {
-            iCtxEngine->SetMdeSession( iMdESession );
-            }
-
             // Starting monitor plugins
         StartMonitoring();
 
--- a/harvester/server/src/pauseobserverao.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/server/src/pauseobserverao.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -57,7 +57,7 @@
 
 	WRITELOG1("CPauseObserverAO::ConstructL() Define error: %d", error);
 
-	if( KErrAlreadyExists != error )
+	if( KErrAlreadyExists != error && KErrNone != error )
 		{
 		User::LeaveIfError( error );
 		}
--- a/inc/harvesterlog.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/inc/harvesterlog.h	Wed Mar 31 22:19:07 2010 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  Harvester server commands*
+* Description:  
 */
 
 
--- a/inc/mdeharvestersession.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/inc/mdeharvestersession.h	Wed Mar 31 22:19:07 2010 +0300
@@ -279,7 +279,7 @@
 	/**
 	 * Update current C-drive media id to all objects in DB that have the old media id.
 	 */
-	void ChangeCDriveMediaId();
+	IMPORT_C void ChangeCDriveMediaId();
 
 	/**
 	 * Set "binary composing to file" pending flag to objects
@@ -329,7 +329,7 @@
 	/**
 	 * Update DB with current internal mass storage media id
 	 */
-    void CheckMassStorageMediaId( const TUint32 aMediaId );
+	IMPORT_C void CheckMassStorageMediaId( const TUint32 aMediaId );
 
 private:
 	CMdESessionImpl* iSession;
--- a/inc/mdscommoninternal.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/inc/mdscommoninternal.h	Wed Mar 31 22:19:07 2010 +0300
@@ -41,6 +41,8 @@
 
 const TUint32 KBaseObjectBasicValueColumnOffset = 8;
 
+const TItemId KSystemFavouritesAlbumId = 1;
+
 const TInt KMaxUintValueLength   = 10;
 const TInt KMaxUint64ValueLength = 20;
 
--- a/layers.sysdef.xml	Mon Mar 15 12:42:24 2010 +0200
+++ b/layers.sysdef.xml	Wed Mar 31 22:19:07 2010 +0300
@@ -22,6 +22,8 @@
       	<unit unitID="imm.mds.harvester_framework_api.monitorplugin" mrp="" bldFile="sf/mw/mds/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/group"  name="harvester_framework_api.monitorplugin"  />
         <unit unitID="imm.mds.location_manager_api" mrp="" bldFile="sf/mw/mds/mds_plat/location_manager_api/tsrc/group"  name="location_manager_api"  />
         <unit unitID="imm.mds.metadata_engine_api" mrp="" bldFile="sf/mw/mds/mds_plat/metadata_engine_api/tsrc/group"  name="metadata_engine_api"  />
+        
+        <unit unitID="imm.mds.content_listing_framework" mrp="" bldFile="sf/mw/mds/mds_pub/content_listing_framework_api/tsrc/group"  name="content_listing_framework_api"  />   
       </module>
     </layer>
     
--- a/locationmanager/client/src/rlocationmanager.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/client/src/rlocationmanager.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -72,7 +72,6 @@
 //
 EXPORT_C RLocationManager::RLocationManager()
     {
-    iNameBuf = NULL;
     }
 
 // --------------------------------------------------------------------------
@@ -104,8 +103,6 @@
     {
     LOG( "RLocationManager::Close(), begin" );
     // close session    
-    delete iNameBuf;
-    iNameBuf = NULL;
     RSessionBase::Close();
     LOG( "RLocationManager::Close(), end" );
     }
Binary file locationmanager/conf/200071BE.txt has changed
Binary file locationmanager/conf/locationmanager.confml has changed
Binary file locationmanager/data/200071BE.txt has changed
--- a/locationmanager/locationtrail/group/locationtrail.mmp	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/locationtrail/group/locationtrail.mmp	Wed Mar 31 22:19:07 2010 +0300
@@ -60,7 +60,4 @@
 BYTEPAIRCOMPRESSTARGET
 OPTION ARMCC -O3 -OTime
 
-#ifdef __VFP_HW_SUPPORT
-OPTION ARMCC --fpu vfpv2 --fpmode fast
-#endif
 
--- a/locationmanager/locationtrail/inc/clocationrecord.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/locationtrail/inc/clocationrecord.h	Wed Mar 31 22:19:07 2010 +0300
@@ -54,13 +54,13 @@
     /**
      * This method is used to notify about location trail state changes.
      */
-    virtual void LocationTrailStateChange() __SOFTFP = 0;
+    virtual void LocationTrailStateChange() = 0;
     
     virtual void CurrentLocation( const TPositionSatelliteInfo& aSatelliteInfo, 
     							  const CTelephony::TNetworkInfoV1& aNetworkInfo,
-                                  const TInt aError ) __SOFTFP = 0;
+                                  const TInt aError ) = 0;
     
-    virtual void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) __SOFTFP = 0;
+    virtual void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo )  = 0;
     
     /**
      * Callback method to notify observer that during waiting for positioning stop timeout remap is done.
@@ -93,7 +93,7 @@
 	 * This method is used to notify about new locations added to location trail
 	 */
 	virtual void LocationAdded( const TLocationTrailItem& aTrailItem, 
-								const TPositionSatelliteInfo& aSatellites ) __SOFTFP = 0;
+								const TPositionSatelliteInfo& aSatellites ) = 0;
 	};    
 
 /**
@@ -159,7 +159,7 @@
     								  TLocationData& aLocationData,
                                       /*TLocality& aPosition,
                                       CTelephony::TNetworkInfoV1& aNetworkInfo,*/
-                                      TLocTrailState& aState ) __SOFTFP;
+                                      TLocTrailState& aState );
 
     /**
      * Request location info. The result is returned by calllback method.
@@ -183,7 +183,7 @@
      * @param aCellId, Network cell is written into this param.
      * @return None.
      */
-    IMPORT_C void GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP;
+    IMPORT_C void GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo );
     
     /**
      * Set observer for notifying state changes.
@@ -201,11 +201,11 @@
     static TInt UpdateNetworkInfo( TAny* aAny );
     
     IMPORT_C void CreateLocationObjectL( const TLocationData& aLocationData,
-    		const TUint& aObjectId ) __SOFTFP;
+    		const TUint& aObjectId );
     
     IMPORT_C void LocationSnapshotL( const TUint& aObjectId );
     
-    TItemId DoCreateLocationL( const TLocationData& aLocationData ) __SOFTFP;
+    TItemId DoCreateLocationL( const TLocationData& aLocationData );
     
     TItemId CreateRelationL( const TUint& aObjectId, const TUint& aLocationId );
     
@@ -224,7 +224,7 @@
      * @param 
      * @return 
      */
-    void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, TInt aError ) __SOFTFP;
+    void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, TInt aError );
     
 public: // from MPositionInfoObserver    
     /**
@@ -233,7 +233,7 @@
      * @param 
      * @return  
      */
-    void Position( const TPositionInfo& aPositionInfo, const TInt aError ) __SOFTFP;
+    void Position( const TPositionInfo& aPositionInfo, const TInt aError );
     
     
 public: // From MMdEQueryObserver
--- a/locationmanager/locationtrail/inc/clocationwrite.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/locationtrail/inc/clocationwrite.h	Wed Mar 31 22:19:07 2010 +0300
@@ -34,7 +34,7 @@
     /**
      * 2-phased constructor.
      */
-    IMPORT_C static CLocationWrite* NewL( CLocationRecord& aLocRecord ) __SOFTFP;
+    IMPORT_C static CLocationWrite* NewL( CLocationRecord& aLocRecord );
     
     /**
      * C++ destructor.
--- a/locationmanager/locationtrail/inc/cnetworkinfo.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/locationtrail/inc/cnetworkinfo.h	Wed Mar 31 22:19:07 2010 +0300
@@ -33,7 +33,7 @@
      * This method is used for setting the network cell id to the 
      * location trail.
      */
-    virtual void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, const TInt aError ) __SOFTFP  = 0;
+    virtual void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, const TInt aError ) = 0;
     };
 
 /**
--- a/locationmanager/locationtrail/inc/cpositioninfo.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/locationtrail/inc/cpositioninfo.h	Wed Mar 31 22:19:07 2010 +0300
@@ -36,7 +36,7 @@
      * location trail.
      */
     virtual void Position( const TPositionInfo& aPositionInfo, 
-                           const TInt aError ) __SOFTFP = 0;
+                           const TInt aError ) = 0;
     };
 
 /**
--- a/locationmanager/locationtrail/inc/ctracklog.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/locationtrail/inc/ctracklog.h	Wed Mar 31 22:19:07 2010 +0300
@@ -66,7 +66,7 @@
 	 * This method is used to notify about converted GPX files
 	 */
 	virtual void GpxFileCreated( const TDesC& aFileName, TItemId aTagId, TReal32 aLength,
-			TTime aStart, TTime aEnd ) __SOFTFP = 0;
+			TTime aStart, TTime aEnd ) = 0;
 	};    
 
 class CTrackLog : public CBase, public MLocationAddObserver
@@ -111,7 +111,7 @@
 	/*
 	 * from MLocationAddObserver
 	 */
-	void LocationAdded( const TLocationTrailItem& aTrailItem, const TPositionSatelliteInfo& aSatellites ) __SOFTFP;
+	void LocationAdded( const TLocationTrailItem& aTrailItem, const TPositionSatelliteInfo& aSatellites );
 		
 	IMPORT_C void AddGpxObserver( MGpxConversionObserver* aObserver );
 	
--- a/locationmanager/locationtrail/inc/locationtraildefs.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/locationtrail/inc/locationtraildefs.h	Wed Mar 31 22:19:07 2010 +0300
@@ -34,13 +34,13 @@
 
 const TInt KTrackLogBufSize = 10;
 
-const TInt KLocationTrailShutdownDelay = 60;
+const TInt KLocationTrailShutdownDelay = 30;
 
 const TInt KLocationTrailRemappingCheckDelay = 15;
 
-const TInt KLocationTrailRemapShutdownDelay = 360;
+const TInt KLocationTrailRemapShutdownDelay = 320;
 
-const TInt KLocationDelta = 20;
+const TInt KLocationDelta = 25;
 
 const TInt KRemappingTime = 480;
 
--- a/locationmanager/locationtrail/src/cgpxconverterao.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/locationtrail/src/cgpxconverterao.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -70,6 +70,12 @@
     
     iObservers.Reset();
     
+    iFileQueue.ResetAndDestroy();
+    iFileQueue.Close();
+    
+    iBoundQueue.ResetAndDestroy();
+    iBoundQueue.Close();
+    
     delete iWriteBuf;
     delete iFormatBuf;
     }
@@ -105,8 +111,10 @@
 	{
 	LOG("CGpxConverterAO::AddToQueueL");
 	TFileName *filename = new (ELeave) TFileName(aFileName);
-	iFileQueue.Append(filename);
-	iBoundQueue.Append( aBoundaries );
+	CleanupStack::PushL( filename );
+	iFileQueue.AppendL( filename );
+	CleanupStack::Pop( filename );
+	iBoundQueue.AppendL( aBoundaries );
 	
 	if ( iState == EIdle )
 		{
--- a/locationmanager/locationtrail/src/clocationrecord.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/locationtrail/src/clocationrecord.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -212,7 +212,7 @@
 //
 EXPORT_C void CLocationRecord::GetLocationByTimeL( const TTime aTime, 
 												   TLocationData& aLocationData,
-                                                   TLocTrailState& aState ) __SOFTFP 
+                                                   TLocTrailState& aState ) 
     {
     LOG( "CLocationRecord::GetLocationByTimeL(), begin" );
     TInt posFound( EFalse );
@@ -317,7 +317,7 @@
 // CLocationRecord::GetNetworkInfo
 // --------------------------------------------------------------------------
 //
-EXPORT_C void CLocationRecord::GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP 
+EXPORT_C void CLocationRecord::GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) 
     {
     LOG("CLocationRecord::GetNetworkInfo");
 
@@ -348,7 +348,7 @@
 // --------------------------------------------------------------------------
 //    
 void CLocationRecord::Position( const TPositionInfo& aPositionInfo,
-                                const TInt aError  ) __SOFTFP
+                                const TInt aError  )
     {    
     const TPositionSatelliteInfo& positionSatelliteInfo = 
     	static_cast<const TPositionSatelliteInfo&>(aPositionInfo);
@@ -464,7 +464,7 @@
 // --------------------------------------------------------------------------
 //    
 void CLocationRecord::NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, 
-		const TInt aError ) __SOFTFP
+		const TInt aError )
     {
     LOG("CLocationRecord::NetworkInfo");
     if ( aError == KErrNone )
@@ -592,7 +592,7 @@
 
 
 EXPORT_C void CLocationRecord::CreateLocationObjectL( const TLocationData& aLocationData,
-		const TUint& aObjectId ) __SOFTFP
+		const TUint& aObjectId )
 	{
 	TItemId locationId = DoCreateLocationL( aLocationData );
 	CreateRelationL( aObjectId, locationId );
@@ -799,7 +799,7 @@
 	}
 
 	
-TItemId CLocationRecord::DoCreateLocationL( const TLocationData& aLocationData ) __SOFTFP 
+TItemId CLocationRecord::DoCreateLocationL( const TLocationData& aLocationData ) 
 	{
 	LOG("CLocationRecord::DoCreateLocationL - start");
 	TItemId locationObjectId;
--- a/locationmanager/locationtrail/src/ctracklog.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/locationtrail/src/ctracklog.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -137,7 +137,7 @@
 	}
 
 void CTrackLog::LocationAdded( const TLocationTrailItem& aTrailItem, 
-							   const TPositionSatelliteInfo& aSatellites ) __SOFTFP
+							   const TPositionSatelliteInfo& aSatellites )
 	{
 	LOG("CTrackLog::LocationAdded start");
 
@@ -230,8 +230,8 @@
 			{
 			User::Leave( err );
 			}
-		writer << I64LOW( iTagId );
-		writer << I64HIGH( iTagId ); // Causes compiler warning due to misinterpretation by compiler parser
+		writer << I64LOW( static_cast<TUint64>(iTagId) );
+		writer << I64HIGH( static_cast<TUint64>(iTagId) );
 		}
 	else 
 		{
--- a/locationmanager/locationtrail/src/locationremappingao.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/locationtrail/src/locationremappingao.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -272,33 +272,38 @@
 	for (TInt i = 0; i < count; i++)
 		{
 		CMdEObject* location = iMdEClient->OpenObjectL(iObjectIds[i], *iObjLocationDef);
-		CleanupStack::PushL( location );
+		
+		if(location)
+		    {
+            CleanupStack::PushL( location );
 		
-		if (location->PropertyCount(*iPropLatDef) == 0)
-			{
-			location->AddReal64PropertyL(*iPropLatDef, iLocationData.iPosition.Latitude());
-			LOG( "CLocationRemappingAO::RemapObjects - wrote latitude" );
-			}
-		if (location->PropertyCount(*iPropLongDef) == 0)
-			{
-			location->AddReal64PropertyL(*iPropLongDef, iLocationData.iPosition.Longitude());
-			LOG( "CLocationRemappingAO::RemapObjects - wrote longitude" );
-			}
-		if (location->PropertyCount(*iPropAltDef) == 0)
-			{
-			location->AddReal64PropertyL(*iPropAltDef, iLocationData.iPosition.Altitude());
-			LOG( "CLocationRemappingAO::RemapObjects - wrote altitude" );
-			}
-		CMdEProperty* modProp = NULL;
-		location->Property( *iPropModifiedDef, modProp, 0 );
-		if ( modProp )
-			{
-			TTime timestamp( 0 );
-			timestamp.UniversalTime();
-			modProp->SetTimeValueL( timestamp );
-			}
-		iObjects.AppendL(location);
-		CleanupStack::Pop( location );
+            if (location->PropertyCount(*iPropLatDef) == 0)
+                {
+                location->AddReal64PropertyL(*iPropLatDef, iLocationData.iPosition.Latitude());
+                LOG( "CLocationRemappingAO::RemapObjects - wrote latitude" );
+                }
+            if (location->PropertyCount(*iPropLongDef) == 0)
+                {
+                location->AddReal64PropertyL(*iPropLongDef, iLocationData.iPosition.Longitude());
+                LOG( "CLocationRemappingAO::RemapObjects - wrote longitude" );
+                }
+            if (location->PropertyCount(*iPropAltDef) == 0)
+                {
+                location->AddReal64PropertyL(*iPropAltDef, iLocationData.iPosition.Altitude());
+                LOG( "CLocationRemappingAO::RemapObjects - wrote altitude" );
+                }
+            CMdEProperty* modProp = NULL;
+            location->Property( *iPropModifiedDef, modProp, 0 );
+            if ( modProp )
+                {
+                TTime timestamp( 0 );
+                timestamp.UniversalTime();
+                modProp->SetTimeValueL( timestamp );
+                }
+            iObjects.AppendL(location);
+            CleanupStack::Pop( location );
+            
+          }
 		}
 	count = iRemapItems.Count();
 	LOG1("CLocationRemappingAO::RemapObjectsL - updating relations, count:%d", count);
@@ -308,12 +313,16 @@
 		CMdERelation* relation = NULL;
 		relation = iMdEClient->GetRelationL( iRemapItems[i].iRelationId );
 		
-    	TTime timestamp( 0 );
-    	timestamp.UniversalTime();
-    	relation->SetLastModifiedDate( timestamp );
+		if(relation)
+		    {   
+            TTime timestamp( 0 );
+            timestamp.UniversalTime();
+            relation->SetLastModifiedDate( timestamp );
     	
-    	iMdEClient->UpdateRelationL( *relation );
+            iMdEClient->UpdateRelationL( *relation );
+		    }
 		}
+	
 	LOG("CLocationRemappingAO::RemapObjectsL - relations updated");
 	
 	iObjectIds.Reset();
--- a/locationmanager/server/group/locationmanagerserver.mmp	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/server/group/locationmanagerserver.mmp	Wed Mar 31 22:19:07 2010 +0300
@@ -57,8 +57,4 @@
 BYTEPAIRCOMPRESSTARGET
 OPTION ARMCC -O3 -OTime
 
-#ifdef __VFP_HW_SUPPORT
-OPTION ARMCC --fpu vfpv2 --fpmode fast
-#endif
-
 EPOCPROCESSPRIORITY background
--- a/locationmanager/server/inc/clocationmanagerserver.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/server/inc/clocationmanagerserver.h	Wed Mar 31 22:19:07 2010 +0300
@@ -201,7 +201,7 @@
     						 TLocationData& aLocationData,
                              /*TLocality& aPosition, 
                              CTelephony::TNetworkInfoV1& aNetworkInfo,*/
-                             TLocTrailState& aState ) __SOFTFP;
+                             TLocTrailState& aState );
 
     /**
      * Get current location.
@@ -232,7 +232,7 @@
      * @param aCurrLocReq 
      * @return None.
      */     
-    void GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP;
+    void GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo );
     
     /**
      * Create a location context object in DB and create relationships to objects
@@ -241,7 +241,7 @@
      * @param aObjectId
      */
 	void CreateLocationObjectL( const TLocationData& aLocationData, 
-    						   	   const TUint& aObjectId ) __SOFTFP;
+    						   	   const TUint& aObjectId );
 	
     /**
      * Create a location context object in DB and create relationships to objects
@@ -270,7 +270,7 @@
 	
 	void IsTrackLogRecording( TBool &aRec );
 	
-	TInt GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality) __SOFTFP;
+	TInt GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality);
 	
 	TInt DeleteTrackLogL(const TDesC& aUri);
 	
@@ -290,7 +290,7 @@
      * @param None.
      * @return None.
      */
-    void LocationTrailStateChange() __SOFTFP;
+    void LocationTrailStateChange();
     
     /**
      * Callback method to return current location.
@@ -301,14 +301,14 @@
      * @return None.
      */
     void CurrentLocation( const TPositionSatelliteInfo& aSatelliteInfo,
-    		const CTelephony::TNetworkInfoV1& aNetworkInfo, const TInt aError ) __SOFTFP;
+    		const CTelephony::TNetworkInfoV1& aNetworkInfo, const TInt aError );
     
     /**
      * Callback method to notify observer of changes in GPS signal quality.
      * @param aSatelliteInfo, includes position and satellite info
      * @return None.
      */
-    void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) __SOFTFP;
+    void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo );
     
     /**
      * Callback method to notify observer that during waiting for positioning stop timeout remap is done.
@@ -338,7 +338,7 @@
 public: // from MGpxConversionObserver
 
 	void GpxFileCreated( const TDesC& aFileName, TItemId aTagId, TReal32 aLength,
-			TTime aStart, TTime aEnd ) __SOFTFP;
+			TTime aStart, TTime aEnd );
 
 private:    
     /**
--- a/locationmanager/server/src/clocationmanagerserver.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/server/src/clocationmanagerserver.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -345,8 +345,7 @@
     
     RLocationTrail::TTrailState state;
     GetLocationTrailState( state );
-    
-    
+     
     if( state != RLocationTrail::ETrailStopped && state != RLocationTrail::ETrailStopping )
         {
         TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityUserInput ) );
@@ -481,7 +480,7 @@
 //   
 void CLocationManagerServer::GetLocationByTimeL( const TTime& aTimeStamp, 
 												 TLocationData& aLocationData,
-                                                 TLocTrailState& aState ) __SOFTFP
+                                                 TLocTrailState& aState )
     {
     iLocationRecord->GetLocationByTimeL( aTimeStamp,
     									 aLocationData,
@@ -535,7 +534,7 @@
 // CLocationManagerServer::GetCurrentCellId
 // --------------------------------------------------------------------------
 //    
-void CLocationManagerServer::GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP
+void CLocationManagerServer::GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo )
     {
     iLocationRecord->GetNetworkInfo( aNetworkInfo );
     }    
@@ -544,7 +543,7 @@
 // CLocationManagerServer::LocationTrailStateChange
 // --------------------------------------------------------------------------
 //    
-void CLocationManagerServer::LocationTrailStateChange() __SOFTFP
+void CLocationManagerServer::LocationTrailStateChange()
     {
     LOG( "CLocationManagerServer::LocationTrailStateChange(), begin" );
 
@@ -567,7 +566,7 @@
 //
 void CLocationManagerServer::CurrentLocation( const TPositionSatelliteInfo& aSatelliteInfo, 
 											  const CTelephony::TNetworkInfoV1& aNetworkInfo,
-                                              const TInt aError ) __SOFTFP
+                                              const TInt aError )
     {
     LOG( "CLocationManagerServer::CurrentLocation(), begin" );
     const TInt KParamLocationData = 0;
@@ -614,7 +613,7 @@
     LOG( "CLocationManagerServer::CurrentLocation(), end" );    
     }
 
-void CLocationManagerServer::GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) __SOFTFP
+void CLocationManagerServer::GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo )
 	{
 	LOG( "CLocationManagerServer::GPSSignalQualityChanged" );
 	const TInt KFixParam = 0;
@@ -689,7 +688,7 @@
 	}
 
 void CLocationManagerServer::CreateLocationObjectL( const TLocationData& aLocationData,
-													const TUint& aObjectId ) __SOFTFP
+													const TUint& aObjectId )
 	{
 	if ( !IsSessionReady() )
 		{
@@ -1049,7 +1048,7 @@
 	}
 
 void CLocationManagerServer::GpxFileCreated( const TDesC& aFileName, TItemId aTagId,
-		TReal32 aLength, TTime aStart, TTime aEnd ) __SOFTFP
+		TReal32 aLength, TTime aStart, TTime aEnd )
 	{
 	TRAP_IGNORE( CreateTrackLogL( aTagId, aFileName, aLength, aStart, aEnd ) );
 	}
@@ -1137,7 +1136,7 @@
     CleanupStack::PopAndDestroy( trackLog );
 	}
 
-TInt CLocationManagerServer::GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality) __SOFTFP
+TInt CLocationManagerServer::GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality)
 	{
 	if ( !iTrackLog )
 		{
--- a/locationmanager/server/src/clocationmanagersession.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/locationmanager/server/src/clocationmanagersession.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -48,6 +48,7 @@
 CLocationManagerSession::~CLocationManagerSession()
     {
     LOG( "CLocationManagerSession::~CLocationManagerSession(), begin" );
+    TRAP_IGNORE(Server().StopGPSPositioningL());
     Server().CancelNotificationRequest( iNotificationHandle );
     Server().CancelLocationRequest( iLocationHandle );
     Server().CancelTrackLogNotificationRequest( iTrackLogNotificationHandle );
--- a/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg	Mon Mar 15 12:42:24 2010 +0200
+++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg	Wed Mar 31 22:19:07 2010 +0300
@@ -122,7 +122,7 @@
 
 [Test]
 title HarvestFile 2
-timeout 180000
+timeout 300000
 create HarvesterClientTestScripter test
 request Session
 test SetUp
--- a/mds_plat/location_manager_api/inc/rlocationmanager.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/mds_plat/location_manager_api/inc/rlocationmanager.h	Wed Mar 31 22:19:07 2010 +0300
@@ -64,13 +64,7 @@
 	 * @param aError Symbian error code
 	 */
 	void CompleteRequest(TRequestStatus& aStatus, TInt aError);
-       
-protected:
-    /**
-     * Buffer for names.
-     * Own.
-     */    
-    CBufFlat* iNameBuf;
+
     };
     
 #endif // R_RLOCATIONMANAGER_H
--- a/mds_plat/metadata_engine_api/inc/mdccommon.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/mds_plat/metadata_engine_api/inc/mdccommon.h	Wed Mar 31 22:19:07 2010 +0300
@@ -31,6 +31,7 @@
 typedef TUint32 TMdCOffset;
 
 const TItemId KNoId = 0;
+const TItemId KSystemCapturedAlbumId = 2;
 const TDefId KNoDefId = 0;
 
 // CONSTANTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/bwins/ContentListingFrameworkTestu.def	Wed Mar 31 22:19:07 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &)
+
--- a/mds_pub/content_listing_framework_api/tsrc/bwins/T_CLFApiMdlTestu.def	Mon Mar 15 12:42:24 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/conf/ContentListingFrameworkTest.cfg	Wed Mar 31 22:19:07 2010 +0300
@@ -0,0 +1,272 @@
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  CLF Collection Manager API tests
+#
+
+// ---------------------------------------------------------------------------
+// CLF Collection Manager API test cases
+// ---------------------------------------------------------------------------
+
+// These should be run in sequential mode if several cases are run at the same
+// time! Be adviced, this API is no longer used or supported, it is present only
+// because of it's association to Content Listing Framework.
+
+[StifSettings]
+TestThreadStackSize= 32768
+TestThreadMinHeap= 4096
+TestThreadMaxHeap= 16777216
+[EndStifSettings]
+
+[Test]
+title Create engine
+create ContentListingFrameworkTest test
+test BaseSetup
+test CreateEngineTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Create modifiable item
+create ContentListingFrameworkTest test
+test BaseSetup
+test CreateModifiableItemTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Create sorting style
+create ContentListingFrameworkTest test
+test BaseSetup
+test CreateSortignStyleTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Create sorting style from resource
+create ContentListingFrameworkTest test
+test SortingStyleResourceSetup
+test CreateSortignStyleFromResourceTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Create list model
+create ContentListingFrameworkTest test
+test CreateModelSetup
+test CreateListModelTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Create list model from resource
+create ContentListingFrameworkTest test
+test CreateModelFromResourceSetup
+test CreateListModelFromResourceTest
+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
+#create ContentListingFrameworkTest test
+#test EngineTestSetup
+#test UpdateItemsWithIdTest
+#test Teardown
+#delete test
+#[Endtest]
+
+[Test]
+title Engine update test
+create ContentListingFrameworkTest test
+test EngineTestSetup
+test UpdateItemsWithOpaqueDataFolderTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Sorting style from resource
+create ContentListingFrameworkTest test
+test SortingStyleResourceTestSetup
+test SortingStyleResourceTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Sorting style ordering test
+create ContentListingFrameworkTest test
+test SortingStyleTestSetup
+test SortingStyleOrderingTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Sorting style data type test
+create ContentListingFrameworkTest test
+test SortingStyleTestSetup
+test SortingStyleDataTypeTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Sorting style undefined item position test
+create ContentListingFrameworkTest test
+test SortingStyleTestSetup
+test SortingStyleUndefinedItemPositionTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Sorting style field test
+create ContentListingFrameworkTest test
+test SortingStyleTestSetup
+test SortingStyleFieldTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model refresh test
+create ContentListingFrameworkTest test
+test ListModelSetup
+test RefreshTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model sorting style test
+create ContentListingFrameworkTest test
+test ListModelAllFileItemsSetup
+test SetSortingStyleTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model custom sorter test
+create ContentListingFrameworkTest test
+test ListModelAllFileItemsSetup
+test SetCustomSorterTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model grouping test
+create ContentListingFrameworkTest test
+test ListModelAllFileItemsSetup
+test GroupingTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model post filter test
+create ContentListingFrameworkTest test
+test ListModelAllFileItemsSetup
+test SetPostFilterTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model wanted mime types test
+create ContentListingFrameworkTest test
+test ListModelSetup
+test SetWantedMimeTypesTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model wanted media types test
+create ContentListingFrameworkTest test
+test ListModelSetup
+test SetWantedMediaTypesTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model wanted media and mime types
+create ContentListingFrameworkTest test
+test ListModelSetup
+test SetWantedMediaAndMimeTypesTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model multible sorters
+create ContentListingFrameworkTest test
+test MultibleSortingSetup
+test MultibleSortingTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model multible sorters
+create ContentListingFrameworkTest test
+test MultibleSortingResourceSetup
+test MultibleSortingTest
+test Teardown
+delete test
+[Endtest]
+
+#[Test]
+#title List model changed items
+#create ContentListingFrameworkTest test
+#test ListModelSetup
+#test ModelItemsChangedTest
+#test Teardown
+#delete test
+#[Endtest]
+
+[Test]
+title Modifiable item test
+create ContentListingFrameworkTest test
+test ModifiableItemTestSetup
+test MIFieldTest
+test Teardown
+delete test
+[Endtest]
+
+#[Test]
+#title Item test
+#create ContentListingFrameworkTest test
+#test ItemTestSetup
+#test ItemFieldTest
+#test Teardown
+#delete test
+#[Endtest]
--- a/mds_pub/content_listing_framework_api/tsrc/custom/preset_custom.xml	Mon Mar 15 12:42:24 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-<?xml version="1.0"?>
-<test>
-    <name>SP API Test Automation - Content Listing Framework Wrapper</name>
-    <target>
-        <device rank="none" alias="DEFAULT">
-            <property name="HARNESS" value="EUNIT" />
-        </device>
-    </target>
-    <plan name="Public API automatic tests" harness="EUNIT" enabled="true" passrate="100">
-        <session name="EUnit tests" harness="EUNIT" enabled="true" passrate="100">
-            <set name="API tests" harness="EUNIT" enabled="true" passrate="100">
-                <target>
-                    <device rank="master" alias="DEFAULT"/>
-                </target>
-                <case name="Testrun" harness="EUNIT" enabled="true" passrate="100">
-                    <step name="Create CTC log dir" harness="EUNIT" enabled="true" passrate="100" significant="false">
-                        <command>makedir</command>
-                        <params>
-                            <param dir="c:\data\ctc\"/>
-                        </params>
-                    </step>
-                    <step name="CTC start" harness="EUNIT" enabled="true" passrate="100" significant="false">
-                        <command>execute</command>
-                        <params>
-                            <param file="z:\sys\bin\ctcman.exe"/>
-                        </params>
-                    </step>
-                    <step name="Create EUnit log dir" harness="EUNIT" enabled="true" passrate="100" significant="false">
-                        <command>makedir</command>
-                        <params>
-                            <param dir="c:\DigiaEUnit\logs\"/>
-                        </params>
-                    </step>
-                    <step name="Execute Client API tests" harness="EUNIT" enabled="true" passrate="100" significant="true">
-                        <command>execute</command>
-                        <params>
-                            <param parameters="/l xml T_CLFApiMdlTest.dll"/>
-                            <param timeout="7200"/>
-                            <param result-file="c:\Shared\EUnit\logs\T_CLFApiMdlTest_log.xml"/>
-                            <param file="z:\sys\bin\EUNITEXERUNNER.EXE"/>
-                        </params>
-                    </step>
-                    <step name="Save CTC data" harness="EUNIT" enabled="true" passrate="100" significant="false">
-                        <command>execute</command>
-                        <params>
-                            <param parameters="writelocal"/>
-                            <param file="z:\sys\bin\ctcman.exe"/>
-                        </params>
-                    </step>
-                    <step name="Fetch and clean CTC data" harness="EUNIT" enabled="true" passrate="100" significant="false">
-                        <command>fetch-log</command>
-                        <params>
-                            <param delete="true"/>
-                            <param path="c:\data\ctc\ctcdata.txt"/>
-                        </params>
-                    </step>
-                </case>
-            </set>
-        </session>
-    </plan>
-</test>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/eabi/ContentListingFrameworkTestu.def	Wed Mar 31 22:19:07 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- a/mds_pub/content_listing_framework_api/tsrc/eabi/T_CLFApiMdlTestu.def	Mon Mar 15 12:42:24 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-EXPORTS
-	_Z16CreateTestSuiteLv @ 1 NONAME
-	_ZTI19T_CLFApiModuleTests @ 2 NONAME ; #<TI>#
-	_ZTV19T_CLFApiModuleTests @ 3 NONAME ; #<VT>#
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/group/ContentListingFramework.mmp	Wed Mar 31 22:19:07 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+// DEFINES
+#define         KEUnitUid3 0x1000af59
+#define         KEUnitTestDllUid2 0x1000af5a
+
+// Build target
+//TARGET          CLFApiMdlTest.dll
+TARGET          ContentListingFrameworkTest.dll
+TARGETTYPE      dll
+UID             KEUnitTestDllUid2 KEUnitUid3
+
+//CAPABILITY      ALL -TCB -DRM
+CAPABILITY      ALL -TCB
+VENDORID        VID_DEFAULT
+
+DEFFILE         ContentListingFrameworkTest.def
+
+SOURCEPATH      ../src
+SOURCE          ContentListingFrameworkTest.cpp
+SOURCE          ContentListingFrameworkTestBlocks.cpp
+
+START RESOURCE  ContentListingFrameworkTest.rss
+  HEADER
+  TARGETPATH    RESOURCE_FILES_DIR
+  LANGUAGE_IDS
+END
+
+SYSTEMINCLUDE     /epoc32/include/ecom
+USERINCLUDE     ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY         platformenv.lib
+LIBRARY         ContentListingFramework.lib 
+LIBRARY         estor.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/group/ContentListingFramework.pkg	Wed Mar 31 22:19:07 2010 +0300
@@ -0,0 +1,34 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:
+;
+; Installation file for API test
+
+; Languages
+&EN
+
+; Header
+#{"ContentListingFrameworkTest"},(0x1000af59),1,0,1,TYPE=SA
+
+; Localised Vendor name
+%{"Nokia-EN"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Files
+"\epoc32\release\armv5\urel\ContentListingFrameworkTest.dll"      -"C:\sys\bin\ContentListingFrameworkTest.dll"
+"..\init\ContentListingFrameworkTest.ini"      -"C:\testframework\ContentListingFrameworkTest.ini"
+"..\conf\ContentListingFrameworkTest.cfg"      -"C:\testframework\ContentListingFrameworkTest.cfg"
+"\epoc32\data\z\resource\ContentListingFrameworkTest.rsc"	-"!:\resource\ContentListingFrameworkTest.rsc"
\ No newline at end of file
--- a/mds_pub/content_listing_framework_api/tsrc/group/T_ContentListingFramework.mmp	Mon Mar 15 12:42:24 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-*
-*/
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-
-// DEFINES
-#define         KEUnitUid3 0x1000af59
-#define         KEUnitTestDllUid2 0x1000af5a
-
-// Build target
-TARGET          T_CLFApiMdlTest.dll
-TARGETTYPE      dll
-UID             KEUnitTestDllUid2 KEUnitUid3
-CAPABILITY      ALL -TCB -DRM
-VENDORID        VID_DEFAULT
-
-APP_LAYER_SYSTEMINCLUDE
-
-// Source files
-SOURCEPATH      ../src
-SOURCE          CreateTestSuite.cpp
-SOURCE          T_CLFApiModuleTests.cpp
-
-START RESOURCE  T_ContentListingFramework.rss
-  HEADER
-  TARGETPATH    RESOURCE_FILES_DIR
-  LANGUAGE_IDS
-END
-
-// Include paths
-USERINCLUDE     ../inc
-
-SYSTEMINCLUDE     /epoc32/include/platform/digia/eunit
-
-// Dependencies to system components
-LIBRARY         euser.lib
-LIBRARY         EUnit.lib
-LIBRARY         efsrv.lib
-LIBRARY         bafl.lib
-LIBRARY         platformenv.lib
-LIBRARY         ContentListingFramework.lib 
-LIBRARY         estor.lib
--- a/mds_pub/content_listing_framework_api/tsrc/group/T_ContentListingFramework.pkg	Mon Mar 15 12:42:24 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description:
-;
-; Installation file for API test
-
-; Languages
-&EN
-
-; Header
-#{"ContentListingFrameworkAPItest"},(0x1000af59),1,0,1,TYPE=SA
-
-; Localised Vendor name
-%{"Nokia-EN"}
-
-; Unique Vendor name
-:"Nokia"
-
-; Files
-"\epoc32\release\armv5\urel\T_CLFApiMdlTest.dll"      -"C:\sys\bin\T_CLFApiMdlTest.dll"
-
--- a/mds_pub/content_listing_framework_api/tsrc/group/bld.inf	Mon Mar 15 12:42:24 2010 +0200
+++ b/mds_pub/content_listing_framework_api/tsrc/group/bld.inf	Wed Mar 31 22:19:07 2010 +0300
@@ -22,4 +22,12 @@
 PRJ_EXPORTS
 
 PRJ_TESTMMPFILES
-    T_ContentListingFramework.mmp
+    ContentListingFramework.mmp
+
+PRJ_TESTEXPORTS
+../conf/ContentListingFrameworkTest.cfg /epoc32/winscw/c/TestFramework/ContentListingFrameworkTest.cfg
+../init/ContentListingFrameworkTest.ini /epoc32/winscw/c/TestFramework/ContentListingFrameworkTest.ini
+
+//  End of File
+
+    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/inc/ContentListingFrameworkTest.h	Wed Mar 31 22:19:07 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#ifndef CONTENTLISTINGFRAMEWORKTEST_H
+#define CONTENTLISTINGFRAMEWORKTEST_H
+
+//  INCLUDES
+#include <bautils.h>
+#include <barsc.h>
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <CLFContentListing.hrh>
+#include <CLFContentListing.h>
+
+// Logging path
+_LIT( KContentListingFrameworkTestLogPath, "\\logs\\testframework\\ContentListingFrameworkTest\\" ); 
+// Log file
+_LIT( KContentListingFrameworkTestLogFile, "ContentListingFrameworkTest.txt" ); 
+_LIT( KContentListingFrameworkTestLogFileWithTitle, "ContentListingFrameworkTest_[%S].txt" );
+
+// FORWARD DECLARATIONS
+class MCLFContentListingEngine;
+class MCLFItemListModel;
+class MCLFSortingStyle;
+class TTestOperationObserver;
+class TTestCustomSorter;
+class TTestCustomGrouper;
+class TTestPostFilter;
+class TTestChangedItemObserver;
+class MCLFModifiableItem;
+class TTestCLFProcessObserver;
+class MCLFItem;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS(CContentListingFrameworkTest) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CContentListingFrameworkTest* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CContentListingFrameworkTest();
+
+    public: // Functions from base classes
+
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CContentListingFrameworkTest( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Frees all resources allocated from test methods.
+        */
+        void Delete();
+        
+        /**
+        * Test methods are listed below. 
+        */
+        // setups
+        virtual TInt BaseSetupL( CStifItemParser& aItem );
+        virtual TInt SortingStyleResourceSetupL( CStifItemParser& aItem );
+        virtual TInt CreateModelSetupL( CStifItemParser& aItem );
+        virtual TInt CreateModelFromResourceSetupL( CStifItemParser& aItem );
+        virtual TInt ListModelSetupL( CStifItemParser& aItem );
+        virtual TInt ListModelSetupFromResourceL( CStifItemParser& aItem );
+        virtual TInt ListModelAllFileItemsSetupL( CStifItemParser& aItem );
+        virtual TInt EngineTestSetupL( CStifItemParser& aItem );
+        virtual TInt SortingStyleTestSetupL( CStifItemParser& aItem );
+        virtual TInt SortingStyleResourceTestSetupL( CStifItemParser& aItem );
+        virtual TInt ModifiableItemTestSetupL( CStifItemParser& aItem );
+        virtual TInt ItemTestSetupL( CStifItemParser& aItem );
+        virtual TInt MultibleSortingSetupL( CStifItemParser& aItem );
+        virtual TInt MultibleSortingResourceSetupL( CStifItemParser& aItem );
+
+        // teardowns
+        virtual TInt Teardown( CStifItemParser& aItem );
+
+        // tests
+        // Constructor test
+        virtual TInt CreateEngineTestL( CStifItemParser& aItem );
+        virtual TInt CreateModifiableItemTestL( CStifItemParser& aItem );
+        virtual TInt CreateSortignStyleTestL( CStifItemParser& aItem );
+        virtual TInt CreateSortignStyleFromResourceTestL( CStifItemParser& aItem );
+        virtual TInt CreateListModelTestL( CStifItemParser& aItem );
+        virtual TInt CreateListModelFromResourceTestL( CStifItemParser& aItem );
+
+        // Engine test
+        virtual TInt UpdateItemsTestL( CStifItemParser& aItem );
+        virtual TInt UpdateItemsWithIdTestL( CStifItemParser& aItem );
+        virtual TInt UpdateItemsWithOpaqueDataFolderTestL( CStifItemParser& aItem );
+
+        // Sorting Style test;
+        virtual TInt SortingStyleResourceTestL( CStifItemParser& aItem );
+        virtual TInt SortingStyleOrderingTestL( CStifItemParser& aItem );
+        virtual TInt SortingStyleDataTypeTestL( CStifItemParser& aItem );
+        virtual TInt SortingStyleUndefinedItemPositionTestL( CStifItemParser& aItem );
+        virtual TInt SortingStyleFieldTestL( CStifItemParser& aItem );
+
+        // List model test
+        virtual TInt RefreshTestL( CStifItemParser& aItem );
+        virtual TInt SetSortingStyleTestL( CStifItemParser& aItem );
+        virtual TInt SetCustomSorterTestL( CStifItemParser& aItem );
+        virtual TInt GroupingTestL( CStifItemParser& aItem );
+        virtual TInt SetPostFilterTestL( CStifItemParser& aItem );
+        virtual TInt SetWantedMimeTypesTestL( CStifItemParser& aItem );
+        virtual TInt SetWantedMediaTypesTestL( CStifItemParser& aItem );
+        virtual TInt SetWantedMediaAndMimeTypesTestL( CStifItemParser& aItem );
+        virtual TInt MultibleSortingTestL( CStifItemParser& aItem );
+        virtual TInt ModelItemsChangedTestL( CStifItemParser& aItem );
+
+        // item test
+        virtual TInt ItemFieldTestL( CStifItemParser& aItem );
+
+        // Modifiable item test
+        virtual TInt MIFieldTestL( CStifItemParser& aItem );
+        
+    private:    // Assistance methods
+        void ResourceL( TInt aResourceId );
+        void SortingStyleResourceL();
+        void ListModelResourceL();
+        void CreateNewFileL( TInt aNumber, TDes& aFileName );
+        TCLFItemId FindTestFileIdL( TInt aNumber );
+        TBool CheckFileNameShortingL();
+        TBool CheckFileSizeShortingL();
+        TBool CheckFileDateShortingL();
+        TBool CheckFileTypesL( const MDesCArray& aMimeTypeArray, const TArray<TInt>& aMediaTypes );
+        TBool CheckMimeTypesL( const MDesCArray& aMimeTypeArray, const TDesC& aMimeType );
+        TBool CheckMediaTypesL( const TArray<TInt>& aMediaTypes, TCLFMediaType aMediaType );
+        HBufC8* MakeOpaqueDataL( const MDesCArray& aFiles );
+        void MakeMultibleSortingItemsL( RPointerArray<MCLFModifiableItem>& aItemArray );
+        TBool CheckMultibleSortingShortingL();
+        TBool CheckMultibleSortingShorting2L();
+        const MCLFItem* FindItem( MCLFItemListModel& aModel, TCLFItemId aItemId );
+        
+    private:    // Data
+        MCLFContentListingEngine* iEngine;
+        MCLFItemListModel* iListModel;
+        MCLFSortingStyle* iSortingStyle;
+        MCLFSortingStyle* iSortingStyle1;
+        MCLFSortingStyle* iSortingStyle2;
+        MCLFSortingStyle* iSortingStyle3;
+        MCLFModifiableItem* iModifiableItem;
+        const MCLFItem* iItem; // ref. not owned
+
+        TTestOperationObserver* iTestObserver;
+        TTestCustomSorter* iTestSorter;
+        TTestCustomSorter* iTestSorter1;
+        TTestCustomGrouper* iTestGrouper;
+        TTestCustomGrouper* iTestGrouper1;
+        TTestPostFilter* iTestFilter;
+        TTestPostFilter* iTestFilter1;
+        TTestCLFProcessObserver* iTestCLFProcessObserver;
+        TTestCLFProcessObserver* iTestCLFProcessObserver1;
+
+        CDesCArray* iMimeTypeArray;
+        CDesCArray* iMimeTypeArray1;
+        RArray<TInt> iMediaTypeArray;
+        RArray<TInt> iMediaTypeArray1;
+
+        TTestChangedItemObserver* iChangedItemObserver;
+        TTestChangedItemObserver* iChangedItemObserver1;
+        RArray<TCLFItemId> iUpdateItemIdArray;
+        HBufC8* iOpaqueData;
+        TInt iSemanticId;
+
+        RFs iFs;
+        RResourceFile iResourceFile;
+        HBufC8* iDataBuffer;
+        TResourceReader iResourceReader;
+        CActiveSchedulerWait iWait;
+        RArray<TCLFItemId> iChangedArray;
+        TInt iItemCount;
+        RPointerArray<MCLFModifiableItem> iModifiableItems;
+        TFileName iFileName;
+    };
+
+#endif      // CONTENTLISTINGFRAMEWORKTEST_H
+
+// End of File
--- a/mds_pub/content_listing_framework_api/tsrc/inc/T_CLFApiModuleTests.h	Mon Mar 15 12:42:24 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Part of CLF API tests
-*
-*/
-
-
-// INCLUDES
-#include <ceunittestsuiteclass.h>
-#include <bautils.h>
-#include <barsc.h>
-#include <CLFContentListing.hrh>
-#include <CLFContentListing.h>
-
-// FORWARD DECLARATION
-class MCLFContentListingEngine;
-class MCLFItemListModel;
-class MCLFSortingStyle;
-class TTestOperationObserver;
-class TTestCustomSorter;
-class TTestCustomGrouper;
-class TTestPostFilter;
-class TTestChangedItemObserver;
-class MCLFModifiableItem;
-class TTestCLFProcessObserver;
-class MCLFItem;
-
-/**
- * Test suite for Content Listing Framework API
- */
-class T_CLFApiModuleTests : public CEUnitTestSuiteClass
-    {
-    public:     // Construct / destruct
-        static T_CLFApiModuleTests* NewLC();
-        ~T_CLFApiModuleTests();
-
-    private:
-        void ConstructL();
-
-    private:    // Assistance methods
-        void ResourceL( TInt aResourceId );
-        void SortingStyleResourceL();
-        void ListModelResourceL();
-        void CreateNewFileL( TInt aNumber, TDes& aFileName );
-        TCLFItemId FindTestFileIdL( TInt aNumber );
-        TBool CheckFileNameShortingL();
-        TBool CheckFileSizeShortingL();
-        TBool CheckFileDateShortingL();
-        TBool CheckFileTypesL( const MDesCArray& aMimeTypeArray, const TArray<TInt>& aMediaTypes );
-        TBool CheckMimeTypesL( const MDesCArray& aMimeTypeArray, const TDesC& aMimeType );
-        TBool CheckMediaTypesL( const TArray<TInt>& aMediaTypes, TCLFMediaType aMediaType );
-        HBufC8* MakeOpaqueDataL( const MDesCArray& aFiles );
-        void MakeMultibleSortingItemsL( RPointerArray<MCLFModifiableItem>& aItemArray );
-        TBool CheckMultibleSortingShortingL();
-        TBool CheckMultibleSortingShorting2L();
-        const MCLFItem* FindItem( MCLFItemListModel& aModel, TCLFItemId aItemId );
-
-
-    private:    // test methods
-        // setups
-        void BaseSetupL();
-        void SortingStyleResourceSetupL();
-        void CreateModelSetupL();
-        void CreateModelFromResourceSetupL();
-        void ListModelSetupL();
-        void ListModelSetupFromResourceL();
-        void ListModelAllFileItemsSetupL();
-        void EngineTestSetupL();
-        void SortingStyleTestSetupL();
-        void SortingStyleResourceTestSetupL();
-        void ModifiableItemTestSetupL();
-        void ItemTestSetupL();
-        void MultibleSortingSetupL();
-        void MultibleSortingResourceSetupL();
-
-        // teardowns
-        void Teardown();
-
-        // tests
-        // Constructor test
-        void CreateEngineTestL();
-        void CreateModifiableItemTestL();
-        void CreateSortignStyleTestL();
-        void CreateSortignStyleFromResourceTestL();
-        void CreateListModelTestL();
-        void CreateListModelFromResourceTestL();
-
-        // Engine test
-        void UpdateItemsTestL();
-        void UpdateItemsWithIdTestL();
-        void UpdateItemsWithOpaqueDataFolderTestL();
-
-        // Sorting Style test;
-        void SortingStyleResourceTestL();
-        void SortingStyleOrderingTestL();
-        void SortingStyleDataTypeTestL();
-        void SortingStyleUndefinedItemPositionTestL();
-        void SortingStyleFieldTestL();
-
-        // List model test
-        void RefreshTestL();
-        void SetSortingStyleTestL();
-        void SetCustomSorterTestL();
-        void GroupingTestL();
-        void SetPostFilterTestL();
-        void SetWantedMimeTypesTestL();
-        void SetWantedMediaTypesTestL();
-        void SetWantedMediaAndMimeTypesTestL();
-        void MultibleSortingTestL();
-        void ModelItemsChangedTestL();
-
-
-        // item test
-        void ItemFieldTestL();
-
-        // Modifiable item test
-        void MIFieldTestL();
-
-    private:    // Implementation
-
-        EUNIT_DECLARE_TEST_TABLE;
-
-    private:    // Data
-        MCLFContentListingEngine* iEngine;
-        MCLFItemListModel* iListModel;
-        MCLFSortingStyle* iSortingStyle;
-        MCLFSortingStyle* iSortingStyle1;
-        MCLFSortingStyle* iSortingStyle2;
-        MCLFSortingStyle* iSortingStyle3;
-        MCLFModifiableItem* iModifiableItem;
-        const MCLFItem* iItem; // ref. not owned
-
-        TTestOperationObserver* iTestObserver;
-        TTestCustomSorter* iTestSorter;
-        TTestCustomSorter* iTestSorter1;
-        TTestCustomGrouper* iTestGrouper;
-        TTestCustomGrouper* iTestGrouper1;
-        TTestPostFilter* iTestFilter;
-        TTestPostFilter* iTestFilter1;
-        TTestCLFProcessObserver* iTestCLFProcessObserver;
-        TTestCLFProcessObserver* iTestCLFProcessObserver1;
-
-        CDesCArray* iMimeTypeArray;
-        CDesCArray* iMimeTypeArray1;
-        RArray<TInt> iMediaTypeArray;
-        RArray<TInt> iMediaTypeArray1;
-
-        TTestChangedItemObserver* iChangedItemObserver;
-        TTestChangedItemObserver* iChangedItemObserver1;
-        RArray<TCLFItemId> iUpdateItemIdArray;
-        HBufC8* iOpaqueData;
-        TInt iSemanticId;
-
-        RFs iFs;
-        RResourceFile iResourceFile;
-        HBufC8* iDataBuffer;
-        TResourceReader iResourceReader;
-        CActiveSchedulerWait iWait;
-        RArray<TCLFItemId> iChangedArray;
-        TInt iItemCount;
-        RPointerArray<MCLFModifiableItem> iModifiableItems;
-        TFileName iFileName;
-
-    };
-
-// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/init/ContentListingFrameworkTest.ini	Wed Mar 31 22:19:07 2010 +0300
@@ -0,0 +1,80 @@
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport    # Possible values are: 'Empty', 'Summary', 'Environment',
+                                                     'TestCases' or 'FullReport'
+
+CreateTestReport= YES         # Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= ContentListingFrameworkAPItestLog
+
+TestReportFormat= TXT         # Possible values: TXT or HTML
+TestReportOutput= FILE        # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone  # Possible values are:
+              # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+              # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+              # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+              # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 600000		            # Default timeout value for each test case. In milliseconds
+#UITestingSupport= YES        # Possible values: YES or NO
+#SeparateProcesses= YES       # Possible values: YES or NO (default: NO)
+[End_Defaults]
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[New_Module]
+ModuleName= TestScripter
+TestCaseFile= c:\testframework\ContentListingFrameworkTest.cfg
+[End_Module]
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+CreateLogDirectories= YES    # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML         # Possible values: TXT or HTML
+#EmulatorOutput= FILE         # Possible values: FILE or RDEBUG
+
+HardwareBasePath= C:\
+#HardwareFormat= HTML         # Possible values: TXT or HTML
+#HardwareOutput= FILE         # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE  # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES       # Possible values: YES or NO
+#WithTimeStamp= YES           # Possible values: YES or NO
+#WithLineBreak= YES           # Possible values: YES or NO
+#WithEventRanking= YES        # Possible values: YES or NO
+
+#FileUnicode= YES             # Possible values: YES or NO
+AddTestCaseTitle= YES        # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTest.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "ContentListingFrameworkTest.h"
+#include <SettingServerClient.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CContentListingFrameworkTest::CContentListingFrameworkTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CContentListingFrameworkTest::CContentListingFrameworkTest( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CContentListingFrameworkTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(KContentListingFrameworkTestLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(KContentListingFrameworkTestLogFile);
+        }
+
+    iLog = CStifLogger::NewL( KContentListingFrameworkTestLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    }
+
+// -----------------------------------------------------------------------------
+// CContentListingFrameworkTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CContentListingFrameworkTest* CContentListingFrameworkTest::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CContentListingFrameworkTest* self = new (ELeave) CContentListingFrameworkTest( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// Destructor
+CContentListingFrameworkTest::~CContentListingFrameworkTest()
+    { 
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+    return ( CScriptBase* ) CContentListingFrameworkTest::NewL( aTestModuleIf );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTest.rss	Wed Mar 31 22:19:07 2010 +0300
@@ -0,0 +1,241 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+
+//  RESOURCE IDENTIFIER
+NAME    CLFT
+
+//  INCLUDES
+#include <eikon.rh>
+#include <PathConfiguration.hrh>
+#include <CLFContentListing.rh>
+#include <CLFContentListing.hrh>
+#include <CLFContentListingExtended.hrh>
+
+//  CONSTANTS
+//  MACROS
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// ?resource_name
+// ?description
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE { signature = 0; }
+
+// -----------------------------------------------------------------------------
+//
+// ?resource_name
+// ?description
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CLF_SORTING_STYLE r_sorting_style
+    {
+    ordering = ECLFOrderingDescending;
+    data_type = ECLFItemDataTypeDesC;
+    fields =
+        {
+        CLF_FIELD_ID { field_id = ECLFFieldIdFileName; },
+        CLF_FIELD_ID { field_id = ECLFFieldIdCollectionName; },
+        CLF_FIELD_ID { field_id = ECLFFieldIdMimeType; },
+        CLF_FIELD_ID { field_id = ECLFFieldIdArtist; }
+        };
+    }
+
+RESOURCE CLF_SORTING_STYLE r_sorting_style_empty
+    {
+    ordering = ECLFOrderingAscending;
+    data_type = ECLFItemDataTypeTInt32;
+    fields =
+        {
+        };
+    }
+
+RESOURCE CLF_SORTING_STYLE r_sorting_style_undefineditem
+    {
+    ordering = ECLFOrderingDescending;
+    data_type = ECLFItemDataTypeDesC;
+    undefined_item_position = ECLFSortingStyleUndefinedFirst;
+    fields =
+        {
+        CLF_FIELD_ID { field_id = ECLFFieldIdArtist; }
+        };
+    }
+
+RESOURCE CLF_LIST_MODEL r_list_model
+    {
+    mime_type_array = CLF_MIME_TYPE_ARRAY
+        {
+        mime_types =
+            {
+            LBUF { txt = "image/*"; }
+            };
+        };
+    media_type_array = CLF_MEDIA_TYPE_ARRAY
+        {
+        media_types =
+            {
+            CLF_MEDIA_TYPE { media_type = ECLFMediaTypeCollection; }
+            };
+        };
+    sorting_style = CLF_SORTING_STYLE
+        {
+        ordering = ECLFOrderingAscending;
+        data_type = ECLFItemDataTypeDesC;
+        fields =
+            {
+            CLF_FIELD_ID { field_id = ECLFFieldIdFileName; },
+            CLF_FIELD_ID { field_id = ECLFFieldIdCollectionName; },
+            CLF_FIELD_ID { field_id = ECLFFieldIdAlbum; }
+            };
+        };
+    }
+
+RESOURCE CLF_LIST_MODEL r_list_model_incorrect_version
+    {
+    version = 88;
+    mime_type_array = CLF_MIME_TYPE_ARRAY
+        {
+        mime_types =
+            {
+            };
+        };
+    media_type_array = CLF_MEDIA_TYPE_ARRAY
+        {
+        media_types =
+            {
+            };
+        };
+    sorting_style = CLF_SORTING_STYLE
+        {
+        ordering = ECLFOrderingAscending;
+        data_type = ECLFItemDataTypeDesC;
+        fields =
+            {
+            };
+        };
+    }
+
+
+RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array
+    {
+    mime_types =
+        {
+        LBUF { txt = "image/*"; },
+        LBUF { txt = "audio/*"; }
+        };
+    }
+
+RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array_empty
+    {
+    mime_types =
+        {
+        };
+    }
+
+RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array_incorrect_version
+    {
+    version = 88;
+    mime_types =
+        {
+        };
+    }
+
+RESOURCE CLF_MEDIA_TYPE_ARRAY r_media_type_array
+    {
+    media_types =
+        {
+        CLF_MEDIA_TYPE { media_type = ECLFMediaTypeImage; },
+        CLF_MEDIA_TYPE { media_type = ECLFMediaTypeCollection; }
+        };
+    }
+
+RESOURCE CLF_MEDIA_TYPE_ARRAY r_media_type_array_empty
+    {
+    media_types =
+        {
+        };
+    }
+
+RESOURCE CLF_LIST_MODEL_V2 r_list_model_multible
+     {
+    mime_type_array = CLF_MIME_TYPE_ARRAY
+        {
+        mime_types =
+            {
+            };
+        };
+     media_type_array = CLF_MEDIA_TYPE_ARRAY
+         {
+         media_types =
+             {
+             };
+         };
+     sorting_style_array =
+        {
+        CLF_SORTING_STYLE
+            {
+            ordering = ECLFOrderingAscending;
+            data_type = ECLFItemDataTypeTInt32;
+            undefined_item_position = ECLFSortingStyleUndefinedFirst;
+            fields =
+                {
+                CLF_FIELD_ID { field_id = 0x80000001; }
+                };
+            },
+        CLF_SORTING_STYLE
+            {
+            ordering = ECLFOrderingDescending;
+            data_type = ECLFItemDataTypeTInt32;
+            undefined_item_position = ECLFSortingStyleUndefinedEnd;
+            fields =
+                {
+                CLF_FIELD_ID { field_id = 0x80000002; }
+                };
+            },
+        CLF_SORTING_STYLE
+            {
+            ordering = ECLFOrderingAscending;
+            data_type = ECLFItemDataTypeTInt32;
+            undefined_item_position = ECLFSortingStyleUndefinedEnd;
+            fields =
+                {
+                CLF_FIELD_ID { field_id = 0x80000003; },
+                CLF_FIELD_ID { field_id = 0x80000004; }
+                };
+            },
+        CLF_SORTING_STYLE
+            {
+            ordering = ECLFOrderingAscending;
+            data_type = ECLFItemDataTypeTInt32;
+            undefined_item_position = ECLFSortingStyleUndefinedFirst;
+            fields =
+                {
+                CLF_FIELD_ID { field_id = 0x80000005; }
+                };
+            }
+        };
+    }
+
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTestBlocks.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -0,0 +1,2772 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of CLF API test 
+*
+*/
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <s32mem.h>
+#include <ecom.h>
+#include <StifParser.h>
+#include <StifTestEventInterface.h>
+#include <Stiftestinterface.h>
+#include "ContentListingFrameworkTest.h"
+
+// the header for the tested class
+#include <ContentListingFactory.h>
+#include <MCLFChangedItemObserver.h>
+#include <MCLFContentListingEngine.h>
+#include <MCLFCustomGrouper.h>
+#include <MCLFCustomSorter.h>
+#include <MCLFItem.h>
+#include <MCLFItemListModel.h>
+#include <MCLFModifiableItem.h>
+#include <MCLFOperationObserver.h>
+#include <MCLFPostFilter.h>
+#include <MCLFSortingStyle.h>
+#include <ContentListingFrameworkTest.rsg>
+#include <collate.h>
+#include <pathInfo.h>
+#include <MCLFProcessObserver.h>
+#include <CLFContentListingExtended.hrh>
+
+// CONSTANTS
+#ifdef __WINSCW__
+_LIT( KTestResourceFile, "z:\\resource\\ContentListingFrameworkTest.rsc" );
+#else
+_LIT( KTestResourceFile, "c:\\resource\\ContentListingFrameworkTest.rsc" );
+#endif
+_LIT( KTestFileNameBase, "CLFTestFiles\\TestFile" );
+_LIT( KTestFileExt, ".txt" );
+
+const TCLFFieldId KMultibleSortingTestField1 = 0x80000001;
+const TCLFFieldId KMultibleSortingTestField2 = 0x80000002;
+const TCLFFieldId KMultibleSortingTestField3 = 0x80000003;
+const TCLFFieldId KMultibleSortingTestField4 = 0x80000004;
+const TCLFFieldId KMultibleSortingTestField5 = 0x80000005;
+const TCLFFieldId KMultibleSortingTestField6 = 0x80000006;
+
+const TInt KCLFUpdateFoldersSemanticId = 0x1000;
+
+// ---------------------------------------------------------------------------
+// class CMGXAsyncCallback
+// ---------------------------------------------------------------------------
+//
+class CCLFAsyncCallback : public CBase
+    {
+    public:
+        ~CCLFAsyncCallback()
+            {
+            if ( iActiveWait.IsStarted() )
+                {
+                iActiveWait.AsyncStop();
+                }
+            }
+    public:
+        static void AfterL( TTimeIntervalMicroSeconds32 aInterval )
+            {
+            CCLFAsyncCallback* self = new( ELeave ) CCLFAsyncCallback();
+            CleanupStack::PushL( self );
+            CPeriodic* periodic = CPeriodic::NewL( CActive::EPriorityIdle );
+            CleanupStack::PushL( periodic );
+            TCallBack callBack( CallBackL, self );
+            TTimeIntervalMicroSeconds32 interval( 1000000 );
+            periodic->Start( aInterval, aInterval, callBack );
+            self->iActiveWait.Start();
+            periodic->Cancel();
+            CleanupStack::PopAndDestroy( 2 ); // periodic, self
+            }
+
+        static TInt CallBackL( TAny* aObject )
+            {
+            CCLFAsyncCallback* self = reinterpret_cast< CCLFAsyncCallback* >( aObject );
+            if ( self->iActiveWait.IsStarted() )
+                {
+                self->iActiveWait.AsyncStop();
+                }
+            return EFalse;
+            }
+            
+    private:
+        CActiveSchedulerWait iActiveWait;
+    };
+
+// ---------------------------------------------------------------------------
+// class TTestOperationObserver
+// ---------------------------------------------------------------------------
+//
+class TTestOperationObserver : public MCLFOperationObserver
+    {
+    public:
+        TTestOperationObserver()
+            // set invalid values
+            : iOperationEvent( TCLFOperationEvent( -1 ) ), iError( 1 ), iWait( NULL )
+            {}
+        void HandleOperationEventL( TCLFOperationEvent aOperationEvent,
+                                    TInt aError )
+            {
+            iError = aError;
+            iOperationEvent = aOperationEvent;
+            if( iWait &&
+                iWait->IsStarted() )
+                {
+                iWait->AsyncStop();
+                }
+            }
+        TCLFOperationEvent iOperationEvent;
+        TInt iError;
+        CActiveSchedulerWait* iWait;
+
+    };
+
+// ---------------------------------------------------------------------------
+// class TTestCustomSorter
+// ---------------------------------------------------------------------------
+//
+class TTestCustomSorter : public MCLFCustomSorter
+    {
+    public:
+        TTestCustomSorter() : iSortItems( EFalse )
+            {
+            }
+        void SortItemsL( RPointerArray<MCLFItem>& /*aItemArray*/ )
+            {
+            //aItemArray;
+            iSortItems = ETrue;
+            }
+        TBool iSortItems;
+
+    };
+
+// ---------------------------------------------------------------------------
+// class TTestCustomGrouper
+// ---------------------------------------------------------------------------
+//
+class TTestCustomGrouper : public MCLFCustomGrouper
+    {
+    public:
+        TTestCustomGrouper() : iGroupCount( 2 ), iCopyItems( EFalse ), iModifiableItems( NULL )
+            {
+            }
+        void GroupItemsL( const TArray<MCLFItem*>& /*aSourceList*/,
+                          RPointerArray<MCLFItem>& aGroupedList )
+            {
+            //aSourceList;
+            if( iCopyItems )
+                {
+                TInt count( iModifiableItems->Count() );
+                for( TInt i = 0 ; i < count ; ++i )
+                    {
+                    aGroupedList.AppendL( (*iModifiableItems)[i] );
+                    }
+                }
+            else if( iModifiableItems )
+                {
+                iModifiableItems->ResetAndDestroy();
+                for( TInt i = 0 ; i < iGroupCount ; ++i )
+                    {
+                    MCLFModifiableItem* item = ContentListingFactory::NewModifiableItemLC();
+                    iModifiableItems->AppendL( item );
+                    CleanupStack::Pop(); // item
+                    aGroupedList.AppendL( item );
+                    }
+                }
+            }
+        TInt iGroupCount;
+        TBool iCopyItems;
+        RPointerArray<MCLFModifiableItem>* iModifiableItems;
+    };
+
+// ---------------------------------------------------------------------------
+// class TTestPostFilter
+// ---------------------------------------------------------------------------
+//
+class TTestPostFilter : public MCLFPostFilter
+    {
+    public:
+        TTestPostFilter() : iShouldFilterCount( 5 ), iAllFilter( EFalse ), iFilteredCount( 0 )
+            {
+            }
+
+        void FilterItemsL( const TArray<MCLFItem*>& aItemList,
+                           RPointerArray<MCLFItem>& aFilteredItemList )
+            {
+            iFilteredCount = 0;
+            if( iAllFilter )
+                {
+                iFilteredCount = aItemList.Count();
+                return;
+                }
+            for( TInt i = 0 ; i < aItemList.Count() ; ++i )
+                {
+                if( i < iShouldFilterCount  )
+                    {
+                    iFilteredCount++;
+                    }
+                else
+                    {
+                    aFilteredItemList.AppendL( aItemList[i] );
+                    }
+                }
+            }
+        TInt iShouldFilterCount;
+        TBool iAllFilter;
+        TInt iFilteredCount;
+
+    };
+
+// ---------------------------------------------------------------------------
+// class TTestChangedItemObserver
+// ---------------------------------------------------------------------------
+//
+class TTestChangedItemObserver : public MCLFChangedItemObserver
+    {
+    public:
+        TTestChangedItemObserver()
+            : iHandleItemChange( EFalse ),
+              iLastError( KErrNone ),
+              iChangedArray( NULL ),
+              iWait( NULL )      
+            {
+            }
+        void HandleItemChangeL( const TArray<TCLFItemId>& aItemIDArray )
+            {
+            iHandleItemChange = ETrue;
+            if( iChangedArray )
+                {
+                iChangedArray->Reset();
+                for( TInt i = 0 ; i < aItemIDArray.Count() ; ++i )
+                    {
+                    iChangedArray->AppendL( aItemIDArray[i] );
+                    }
+                }
+            if( iWait && iWait->IsStarted() )
+                {
+                iWait->AsyncStop();
+                }
+
+            }
+        void HandleError( TInt aError )
+            {
+            iLastError = aError;
+            if( iWait && iWait->IsStarted() )
+                {
+                iWait->AsyncStop();
+                }
+            }
+        TInt iHandleItemChange;
+        TInt iLastError;
+        RArray<TCLFItemId>* iChangedArray;
+        CActiveSchedulerWait* iWait;
+    };
+
+// ---------------------------------------------------------------------------
+// class TTestCLFProcessObserver
+// ---------------------------------------------------------------------------
+//
+class TTestCLFProcessObserver : public MCLFProcessObserver
+    {
+    public:
+        TTestCLFProcessObserver()
+            : iStartEvent( EFalse ), iEndEvent( EFalse )
+            {}
+        void HandleCLFProcessEventL( TCLFProcessEvent aProcessEvent )
+            {
+            switch ( aProcessEvent )
+                {
+                case ECLFUpdateStart:
+                    {
+                    iStartEvent = ETrue;
+                    break;
+                    }
+                case ECLFUpdateStop:
+                    {
+                    iEndEvent = ETrue;
+                    break;
+                    }
+                default:
+                    {
+                    User::Panic( _L("CLF module test"), 1 );
+                    }
+                }
+            }
+        void Reset()
+            {
+            iStartEvent = EFalse;
+            iEndEvent = EFalse;
+            }
+        TBool iStartEvent;
+        TBool iEndEvent;
+    };
+
+void SerializeL( const MDesCArray& aDataArray, CBufBase& aBuffer )
+    {
+    const TInt count( aDataArray.MdcaCount() );
+    RBufWriteStream writeStream( aBuffer );
+    CleanupClosePushL( writeStream );
+    writeStream.WriteInt32L( count );
+    for( TInt i = 0 ; i < count ; ++i )
+        {
+        const TDesC& des = aDataArray.MdcaPoint( i );
+        TInt length( des.Length() );
+        writeStream.WriteInt32L( length );
+        writeStream.WriteL( des, length );
+        }
+    CleanupStack::PopAndDestroy( &writeStream );
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CContentListingFrameworkTest::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::Delete() 
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCollectionManagerTest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+
+        // engine		
+        ENTRY( "BaseSetup", CContentListingFrameworkTest::BaseSetupL ),
+        ENTRY( "SortingStyleResourceSetup", CContentListingFrameworkTest::SortingStyleResourceSetupL ),
+        ENTRY( "CreateModelSetup", CContentListingFrameworkTest::CreateModelSetupL ),
+        ENTRY( "CreateModelFromResourceSetup", CContentListingFrameworkTest::CreateModelFromResourceSetupL ),
+        ENTRY( "ListModelSetup", CContentListingFrameworkTest::ListModelSetupL ),
+        ENTRY( "ListModelSetupFromResource", CContentListingFrameworkTest::ListModelSetupFromResourceL ),
+        ENTRY( "ListModelAllFileItemsSetup", CContentListingFrameworkTest::ListModelAllFileItemsSetupL ),
+        ENTRY( "EngineTestSetup", CContentListingFrameworkTest::EngineTestSetupL ),
+        ENTRY( "SortingStyleTestSetup", CContentListingFrameworkTest::SortingStyleTestSetupL ),
+        ENTRY( "SortingStyleResourceTestSetup", CContentListingFrameworkTest::SortingStyleResourceTestSetupL ),
+        ENTRY( "ModifiableItemTestSetup", CContentListingFrameworkTest::ModifiableItemTestSetupL ),
+        ENTRY( "ItemTestSetup", CContentListingFrameworkTest::ItemTestSetupL ),
+        ENTRY( "MultibleSortingSetup", CContentListingFrameworkTest::MultibleSortingSetupL ),
+        ENTRY( "MultibleSortingResourceSetup", CContentListingFrameworkTest::MultibleSortingResourceSetupL ),
+        ENTRY( "Teardown", CContentListingFrameworkTest::Teardown ),
+        ENTRY( "CreateEngineTest", CContentListingFrameworkTest::CreateEngineTestL ),
+        ENTRY( "CreateModifiableItemTest", CContentListingFrameworkTest::CreateModifiableItemTestL ),
+        ENTRY( "CreateSortignStyleTest", CContentListingFrameworkTest::CreateSortignStyleTestL ),
+        ENTRY( "CreateSortignStyleFromResourceTest", CContentListingFrameworkTest::CreateSortignStyleFromResourceTestL ),
+        ENTRY( "CreateListModelTest", CContentListingFrameworkTest::CreateListModelTestL ),
+        ENTRY( "CreateListModelFromResourceTest", CContentListingFrameworkTest::CreateListModelFromResourceTestL ),
+        ENTRY( "UpdateItemsTest", CContentListingFrameworkTest::UpdateItemsTestL ),
+        ENTRY( "UpdateItemsWithIdTest", CContentListingFrameworkTest::UpdateItemsWithIdTestL ),
+        ENTRY( "UpdateItemsWithOpaqueDataFolderTest", CContentListingFrameworkTest::UpdateItemsWithOpaqueDataFolderTestL ),
+        ENTRY( "SortingStyleResourceTest", CContentListingFrameworkTest::SortingStyleResourceTestL ),
+        ENTRY( "SortingStyleOrderingTest", CContentListingFrameworkTest::SortingStyleOrderingTestL ),
+        ENTRY( "SortingStyleDataTypeTest", CContentListingFrameworkTest::SortingStyleDataTypeTestL ),
+        ENTRY( "SortingStyleUndefinedItemPositionTest", CContentListingFrameworkTest::SortingStyleUndefinedItemPositionTestL ),
+        ENTRY( "SortingStyleFieldTest", CContentListingFrameworkTest::SortingStyleFieldTestL ),
+        ENTRY( "RefreshTest", CContentListingFrameworkTest::RefreshTestL ),
+        ENTRY( "SetSortingStyleTest", CContentListingFrameworkTest::SetSortingStyleTestL ),
+        ENTRY( "SetCustomSorterTest", CContentListingFrameworkTest::SetCustomSorterTestL ),
+        ENTRY( "GroupingTest", CContentListingFrameworkTest::GroupingTestL ),
+        ENTRY( "SetPostFilterTest", CContentListingFrameworkTest::SetPostFilterTestL ),
+        ENTRY( "SetWantedMimeTypesTest", CContentListingFrameworkTest::SetWantedMimeTypesTestL ),
+        ENTRY( "SetWantedMediaTypesTest", CContentListingFrameworkTest::SetWantedMediaTypesTestL ),
+        ENTRY( "SetWantedMediaAndMimeTypesTest", CContentListingFrameworkTest::SetWantedMediaAndMimeTypesTestL ),
+        ENTRY( "MultibleSortingTest", CContentListingFrameworkTest::MultibleSortingTestL ),
+        ENTRY( "ModelItemsChangedTest", CContentListingFrameworkTest::ModelItemsChangedTestL ),
+        ENTRY( "ItemFieldTest", CContentListingFrameworkTest::ItemFieldTestL ),
+        ENTRY( "MIFieldTest", CContentListingFrameworkTest::MIFieldTestL ),
+        };
+    
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+/**
+ * Assistance methods
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ResourceL
+// ---------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::ResourceL( TInt aResourceId )
+    {
+    delete iDataBuffer;
+    iDataBuffer = NULL;
+    iDataBuffer = iResourceFile.AllocReadL( aResourceId );
+    iResourceReader.SetBuffer( iDataBuffer );
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleResourceL
+// ---------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::SortingStyleResourceL()
+    {
+    ResourceL( R_SORTING_STYLE );
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ListModelResourceL
+// ---------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::ListModelResourceL()
+    {
+    ResourceL( R_LIST_MODEL );
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateNewFileL
+// ---------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::CreateNewFileL( TInt aNumber, TDes& aFileName )
+    {
+    aFileName.Copy( PathInfo::PhoneMemoryRootPath() );
+    aFileName.Append( KTestFileNameBase );
+    TBuf<125> buf;
+    buf.Num( aNumber );
+    aFileName.Append( buf );
+    aFileName.Append( KTestFileExt );
+
+    RFile file;
+    BaflUtils::EnsurePathExistsL( iFs, aFileName );
+    TInt error( file.Replace( iFs, aFileName, EFileShareAny | EFileWrite ) );
+    if( error == KErrNone )
+        {
+        error = file.Write( _L8("Test data") );
+        }
+    file.Close();
+    User::LeaveIfError( error );
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::FindTestFileIdL
+// ---------------------------------------------------------------------------
+//
+TCLFItemId CContentListingFrameworkTest::FindTestFileIdL( TInt aNumber )
+    {
+    TCLFItemId id( 0 );
+    MCLFItemListModel* model = iEngine->CreateListModelLC( *iTestObserver );
+    iMimeTypeArray->AppendL( _L("*") );
+    
+    iTestObserver->iWait = &iWait;
+    model->SetWantedMimeTypesL( *iMimeTypeArray );
+    model->RefreshL();
+    iWait.Start();
+
+    TFileName testFileName( PathInfo::PhoneMemoryRootPath() );
+    testFileName.Append( KTestFileNameBase );
+    TBuf<125> buf;
+    buf.Num( aNumber );
+    testFileName.Append( buf );
+    testFileName.Append( KTestFileExt );
+    for( TInt i = 0 ; i < model->ItemCount() ; ++i )
+        {
+        const MCLFItem& item = model->Item( i );
+        TPtrC fileName;
+        if( item.GetField( ECLFFieldIdFileNameAndPath, fileName ) != KErrNone )
+            {
+            continue;
+            }
+        if( fileName.CompareF( testFileName ) == 0 )
+            {
+            id = item.ItemId();
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy(); // model
+    return id;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckFileNameShortingL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckFileNameShortingL()
+    {
+    TCollationMethod m = *Mem::CollationMethodByIndex( 0 );
+    m.iFlags |= TCollationMethod::EIgnoreNone | TCollationMethod::EFoldCase;
+
+    for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
+        {
+        const MCLFItem& item = iListModel->Item( i );
+        const MCLFItem& item1 = iListModel->Item( i + 1 );
+        TPtrC name;
+        TPtrC name1;
+
+        if( item.GetField( ECLFFieldIdFileName, name ) != KErrNone ||
+            item1.GetField( ECLFFieldIdFileName, name1 ) != KErrNone )
+            {
+            return EFalse;
+            }
+        if( name.CompareC( name1, 3, &m ) > 0 )
+            {
+            return EFalse;
+            }
+        }
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckFileSizeShortingL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckFileSizeShortingL()
+    {
+    for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
+        {
+        const MCLFItem& item = iListModel->Item( i );
+        const MCLFItem& item1 = iListModel->Item( i + 1 );
+        TInt32 size;
+        TInt32 size1;
+        if( item.GetField( ECLFFieldIdFileSize, size ) != KErrNone ||
+            item1.GetField( ECLFFieldIdFileSize, size1 ) != KErrNone )
+            {
+            return EFalse;
+            }
+        if( size < size1 )
+            {
+            return EFalse;
+            }
+        }
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckMultibleSortingShortingL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckMultibleSortingShortingL()
+    {
+    const MCLFItem* item = &( iListModel->Item( 0 ) );
+    TInt32 data( 0 );
+    if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
+        data != 5 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 1 ) );
+    if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
+        data != 4 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 2 ) );
+    if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
+        data != 3 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 3 ) );
+    if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
+        data != 6 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 4 ) );
+    if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
+        data != 7 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 5 ) );
+    if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
+        data != 8 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 6 ) );
+    if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
+        data != 9 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 7 ) );
+    if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
+        data != 10 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 8 ) );
+    if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
+        data != 11 )
+        {
+        return EFalse;
+        }
+// unsorted start
+    item = &( iListModel->Item( 9 ) );
+    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+        ( data < 15 || data > 17 ) )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 10 ) );
+    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+        ( data < 15 || data > 17 ) )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 11 ) );
+    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+        ( data < 15 || data > 17 ) )
+        {
+        return EFalse;
+        }
+// unsorted end
+    item = &( iListModel->Item( 12 ) );
+    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+        data != 12 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 13 ) );
+    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+        data != 13 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 14 ) );
+    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+        data != 14 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 15 ) );
+    if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
+        data != 0 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 16 ) );
+    if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
+        data != 1 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 17 ) );
+    if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
+        data != 2 )
+        {
+        return EFalse;
+        }
+
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckMultibleSortingShorting2L
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckMultibleSortingShorting2L()
+    {
+// check sorted
+    const MCLFItem* item = &( iListModel->Item( 0 ) );
+    TInt32 data( 0 );
+    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+        data != 12 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 1 ) );
+    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+        data != 13 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 2 ) );
+    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+        data != 14 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 3 ) );
+    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+        data != 15 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 4 ) );
+    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+        data != 16 )
+        {
+        return EFalse;
+        }
+    item = &( iListModel->Item( 5 ) );
+    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+        data != 17 )
+        {
+        return EFalse;
+        }
+// check unsorted
+    for( TInt i = 6 ; i < 18 ; ++i )
+        {
+        item = &( iListModel->Item( i ) );
+        if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone )
+            {
+            if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone )
+                {
+                if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone )
+                    {
+                    if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone )
+                        {
+                        return EFalse;
+                        }
+                    }
+                }
+            }
+        if( data < 0 || data > 11 )
+            {
+            return EFalse;
+            }
+        }
+
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckFileDateShortingL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckFileDateShortingL()
+    {
+    for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
+        {
+        const MCLFItem& item = iListModel->Item( i );
+        const MCLFItem& item1 = iListModel->Item( i + 1 );
+        TTime date;
+        TTime date1;
+        if( item.GetField( ECLFFieldIdFileDate, date ) != KErrNone ||
+            item1.GetField( ECLFFieldIdFileDate, date1 ) != KErrNone )
+            {
+            return EFalse;
+            }
+        if( date > date1 )
+            {
+            return EFalse;
+            }
+        }
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckFileTypesL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckFileTypesL( const MDesCArray& aMimeTypeArray,
+                                            const TArray<TInt>& aMediaTypes )
+    {
+    for( TInt i = 0 ; i < iListModel->ItemCount() ; ++i )
+        {
+        TPtrC mimeType;
+        TInt32 mediaType;
+        TInt error = iListModel->Item( i ).GetField( ECLFFieldIdMimeType, mimeType );
+        if( iListModel->Item( i ).GetField( ECLFFieldIdMediaType, mediaType ) != KErrNone )
+            {
+            return EFalse;
+            }
+        TBool mimeTypeVal( EFalse );
+        TBool mediaTypeVal( EFalse );
+        if( error == KErrNone )
+            {
+            mimeTypeVal = CheckMimeTypesL( aMimeTypeArray, mimeType );
+            }
+        mediaTypeVal = CheckMediaTypesL( aMediaTypes, TCLFMediaType( mediaType ) );
+        if( !( mimeTypeVal || mediaTypeVal ) )
+            {
+            return EFalse;
+            }
+        }
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckMimeTypesL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckMimeTypesL( const MDesCArray& aMimeTypeArray,
+                                            const TDesC& aMimeType )
+    {
+    for( TInt j = 0 ; j < aMimeTypeArray.MdcaCount() ; ++j )
+        {
+        if( aMimeTypeArray.MdcaPoint( j ).Match( aMimeType ) == KErrNotFound )
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckMediaTypesL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckMediaTypesL( const TArray<TInt>& aMediaTypes,
+                                             TCLFMediaType aMediaType )
+    {
+    for( TInt j = 0 ; j < aMediaTypes.Count() ; ++j )
+        {
+        if( aMediaTypes[j] == aMediaType )
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MakeOpaqueDataL
+// ---------------------------------------------------------------------------
+//
+HBufC8* CContentListingFrameworkTest::MakeOpaqueDataL( const MDesCArray& aFiles )
+    {
+    CDesCArray* folderArray = new ( ELeave ) CDesCArraySeg( 8 );
+    CleanupStack::PushL( folderArray );
+    TInt count( aFiles.MdcaCount() );
+    for( TInt i = 0 ; i < count ; ++i )
+        {
+        TPtrC folderPath( TParsePtrC(
+                            aFiles.MdcaPoint( i ) ).DriveAndPath() );
+        TInt tmp( 0 );
+        if( folderArray->Find( folderPath, tmp, ECmpFolded ) != 0 )
+            {
+            folderArray->AppendL( folderPath );
+            }
+        }
+
+    CBufBase* dynBuffer = CBufFlat::NewL( 64 );
+    CleanupStack::PushL( dynBuffer );
+    SerializeL( *folderArray, *dynBuffer );
+    HBufC8* ret = dynBuffer->Ptr( 0 ).AllocL();
+    CleanupStack::PopAndDestroy( 2, folderArray );
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MakeMultibleSortingItemsL
+// ---------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::MakeMultibleSortingItemsL(
+                        RPointerArray<MCLFModifiableItem>& aItemArray )
+    {
+    for( TInt i = 0 ; i < 18 ; ++i )
+        {
+        MCLFModifiableItem* item = ContentListingFactory::NewModifiableItemLC();
+        aItemArray.AppendL( item );
+        CleanupStack::Pop(); //item
+
+        if( i < 3 )
+            {
+            item->AddFieldL( KMultibleSortingTestField1, i );
+            }
+        else if( i < 6 )
+            {
+            item->AddFieldL( KMultibleSortingTestField2, i );
+            }
+        else if( i < 9 )
+            {
+            item->AddFieldL( KMultibleSortingTestField3, i );
+            }
+        else if( i < 12 )
+            {
+            item->AddFieldL( KMultibleSortingTestField4, i );
+            }
+        else if( i < 15 )
+            {
+            item->AddFieldL( KMultibleSortingTestField5, i );
+            }
+        else
+            {
+            item->AddFieldL( KMultibleSortingTestField6, i );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::FindItem
+// ---------------------------------------------------------------------------
+//
+const MCLFItem* CContentListingFrameworkTest::FindItem( MCLFItemListModel& aModel, TCLFItemId aItemId )
+    {
+    for( TInt i = 0 ; i < aModel.ItemCount() ; ++i )
+        {
+        const MCLFItem& item = aModel.Item( i );
+        if( item.ItemId() == aItemId )
+            {
+            return &item;
+            }
+        }
+    return NULL;
+    }
+
+/**
+ * Setup
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::BaseSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::BaseSetupL( CStifItemParser& /* aItem */ )
+    {
+    iFs.Close();
+    iResourceFile.Close();
+    
+    User::LeaveIfError( iFs.Connect() );
+    TFileName fileName( KTestResourceFile );
+    BaflUtils::NearestLanguageFile( iFs, fileName );
+    iResourceFile.OpenL( iFs, KTestResourceFile );
+    iResourceFile.ConfirmSignatureL( 0 );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleResourceSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::SortingStyleResourceSetupL( CStifItemParser& aItem )
+    {
+    BaseSetupL( aItem );
+    SortingStyleResourceL();
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateModelSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::CreateModelSetupL( CStifItemParser& /* aItem */ )
+    {
+    iEngine = ContentListingFactory::NewContentListingEngineLC();
+    CleanupStack::Pop(); //engine
+    iTestObserver  = new (ELeave) TTestOperationObserver;
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateModelFromResourceSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::CreateModelFromResourceSetupL( CStifItemParser& aItem )
+    {
+    BaseSetupL( aItem );
+    CreateModelSetupL( aItem );
+    ListModelResourceL();
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ListModelSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::ListModelSetupL( CStifItemParser& aItem )
+    {
+    BaseSetupL( aItem );
+    CreateModelSetupL( aItem );
+    iListModel = iEngine->CreateListModelLC( *iTestObserver );
+    CleanupStack::Pop(); //listModel
+
+    iSortingStyle = ContentListingFactory::NewSortingStyleLC();
+    CleanupStack::Pop(); // sortingStyle
+    iSortingStyle1 = ContentListingFactory::NewSortingStyleLC();
+    CleanupStack::Pop(); // sortingStyle
+    iSortingStyle2 = ContentListingFactory::NewSortingStyleLC();
+    CleanupStack::Pop(); // sortingStyle
+    iSortingStyle3 = ContentListingFactory::NewSortingStyleLC();
+    CleanupStack::Pop(); // sortingStyle
+
+    iTestSorter = new (ELeave) TTestCustomSorter;
+    iTestSorter1 = new (ELeave) TTestCustomSorter;
+    iTestGrouper = new (ELeave) TTestCustomGrouper;
+    iTestGrouper1 = new (ELeave) TTestCustomGrouper;
+    iTestFilter = new (ELeave) TTestPostFilter;
+    iTestFilter1 = new (ELeave) TTestPostFilter;
+    iMimeTypeArray = new (ELeave) CDesCArrayFlat( 8 );
+    iMimeTypeArray1 = new (ELeave) CDesCArrayFlat( 8 );
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MultibleSortingSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::MultibleSortingSetupL( CStifItemParser& aItem )
+    {
+    ListModelSetupL( aItem );
+    MakeMultibleSortingItemsL( iModifiableItems );
+
+// use custom grouper to make own items
+    iTestGrouper->iModifiableItems = &iModifiableItems;
+    iTestGrouper->iCopyItems = ETrue;
+    iListModel->SetCustomGrouper( iTestGrouper );
+
+// set sorters
+    iSortingStyle->ResetL();
+    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
+    iSortingStyle->AddFieldL( KMultibleSortingTestField1 );
+    iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
+
+    iSortingStyle1->ResetL();
+    iSortingStyle1->SetSortingDataType( ECLFItemDataTypeTInt32 );
+    iSortingStyle1->AddFieldL( KMultibleSortingTestField2 );
+    iSortingStyle1->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
+    iSortingStyle1->SetOrdering( ECLFOrderingDescending );
+
+    iSortingStyle2->ResetL();
+    iSortingStyle2->SetSortingDataType( ECLFItemDataTypeTInt32 );
+    iSortingStyle2->AddFieldL( KMultibleSortingTestField3 );
+    iSortingStyle2->AddFieldL( KMultibleSortingTestField4 );
+    iSortingStyle2->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
+
+    iSortingStyle3->ResetL();
+    iSortingStyle3->SetSortingDataType( ECLFItemDataTypeTInt32 );
+    iSortingStyle3->AddFieldL( KMultibleSortingTestField5 );
+    iSortingStyle3->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
+
+    iListModel->SetSortingStyle( iSortingStyle );
+    iListModel->AppendSecondarySortingStyleL( *iSortingStyle1 );
+    iListModel->AppendSecondarySortingStyleL( *iSortingStyle2 );
+    iListModel->AppendSecondarySortingStyleL( *iSortingStyle3 );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MultibleSortingResourceSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::MultibleSortingResourceSetupL( CStifItemParser& aItem )
+    {
+    ListModelSetupL( aItem );
+    delete iListModel;
+    iListModel = NULL;
+    ResourceL( R_LIST_MODEL_MULTIBLE );
+    iListModel = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
+    CleanupStack::Pop(); //listModel
+
+// use custom grouper to make own items
+    MakeMultibleSortingItemsL( iModifiableItems );
+    iTestGrouper->iModifiableItems = &iModifiableItems;
+    iTestGrouper->iCopyItems = ETrue;
+    iListModel->SetCustomGrouper( iTestGrouper );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ListModelAllFileItemsSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::ListModelAllFileItemsSetupL( CStifItemParser& aItem )
+    {
+    ListModelSetupL( aItem );
+    iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
+    iMediaTypeArray.AppendL( ECLFMediaTypeImage );
+    iMediaTypeArray.AppendL( ECLFMediaTypeSound );
+    iMediaTypeArray.AppendL( ECLFMediaTypeMusic );
+    iMediaTypeArray.AppendL( ECLFMediaTypeStreamingURL );
+    iMediaTypeArray.AppendL( ECLFMediaTypePlaylist );
+    iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
+    iTestObserver->iWait = &iWait;
+    iListModel->RefreshL();
+    iWait.Start();
+    iItemCount = iListModel->ItemCount();
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ListModelSetupFromResourceL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::ListModelSetupFromResourceL( CStifItemParser& aItem )
+    {
+    BaseSetupL( aItem );
+    CreateModelSetupL( aItem );
+    ListModelResourceL();
+    iListModel = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
+    CleanupStack::Pop(); //listModel
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::EngineTestSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::EngineTestSetupL( CStifItemParser& /* aItem */ )
+    {
+    User::LeaveIfError( iFs.Connect() );
+    iTestObserver  = new (ELeave) TTestOperationObserver;
+    iMimeTypeArray = new (ELeave) CDesCArrayFlat( 8 );
+    iEngine = ContentListingFactory::NewContentListingEngineLC();
+    CleanupStack::Pop(); //engine
+    iChangedItemObserver = new (ELeave) TTestChangedItemObserver;
+    iChangedItemObserver1 = new (ELeave) TTestChangedItemObserver;
+    iTestCLFProcessObserver = new (ELeave) TTestCLFProcessObserver;
+    iTestCLFProcessObserver1 = new (ELeave) TTestCLFProcessObserver;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleTestSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::SortingStyleTestSetupL( CStifItemParser& /* aItem */ )
+    {
+    iSortingStyle = ContentListingFactory::NewSortingStyleLC();
+    CleanupStack::Pop(); // sortingStyle
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleResourceTestSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::SortingStyleResourceTestSetupL( CStifItemParser& aItem )
+    {
+    SortingStyleResourceSetupL( aItem );
+    iSortingStyle1 = ContentListingFactory::NewSortingStyleLC( iResourceReader );
+    CleanupStack::Pop(); // sortingStyle
+
+    ResourceL( R_SORTING_STYLE_EMPTY );
+    iSortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
+    CleanupStack::Pop(); // sortingStyle
+
+    ResourceL( R_SORTING_STYLE_UNDEFINEDITEM );
+    iSortingStyle2 = ContentListingFactory::NewSortingStyleLC( iResourceReader );
+    CleanupStack::Pop(); // sortingStyle
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ModifiableItemTestSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::ModifiableItemTestSetupL( CStifItemParser& /* aItem */ )
+    {
+    iModifiableItem = ContentListingFactory::NewModifiableItemLC();
+    CleanupStack::Pop(); //item
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ItemTestSetupL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::ItemTestSetupL( CStifItemParser& aItem )
+    {
+    TInt ret = KErrNone;
+
+    ListModelSetupL( aItem );
+    CreateNewFileL( 12, iFileName );
+    iEngine->UpdateItemsL();
+    iMimeTypeArray->Reset();
+    iMimeTypeArray->AppendL( _L("*") );
+    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+
+    iTestObserver->iWait = &iWait;
+    iListModel->RefreshL();
+    iWait.Start();
+
+    for( TInt i = 0 ; i < iListModel->ItemCount() ; ++i )
+        {
+        const MCLFItem& item = iListModel->Item( i );
+        TPtrC fn;
+        item.GetField( ECLFFieldIdFileNameAndPath, fn );
+        if( iFileName.CompareF( fn ) == 0 )
+            {
+            iItem = &item;
+            }
+        }
+
+    if (!iItem)
+        {
+        ret = KErrUnknown;
+        }
+    return ret;
+    }
+
+/**
+ * Teardown
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::Teardown
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::Teardown( CStifItemParser& /* aItem */ )
+    {
+    iResourceFile.Close();
+    iFs.Close();
+    iMediaTypeArray.Reset();
+    iMediaTypeArray.Close();
+    iMediaTypeArray1.Reset();
+    iMediaTypeArray1.Close();
+    iUpdateItemIdArray.Reset();
+    iUpdateItemIdArray.Close();
+    iChangedArray.Reset();
+    iChangedArray.Close();
+    iModifiableItems.ResetAndDestroy();
+    iModifiableItems.Close();
+    
+    delete iListModel;
+    iListModel = NULL;
+    delete iEngine;
+    iEngine = NULL;
+    delete iSortingStyle;
+    iSortingStyle = NULL;
+    delete iSortingStyle1;
+    iSortingStyle1 = NULL;
+    delete iSortingStyle2;
+    iSortingStyle2 = NULL;
+    delete iSortingStyle3;
+    iSortingStyle3 = NULL;
+    delete iDataBuffer;
+    iDataBuffer = NULL;    
+    delete iTestObserver;
+    iTestObserver = NULL;
+    delete iTestSorter;
+    iTestSorter = NULL;
+    delete iTestSorter1;
+    iTestSorter1 = NULL;
+    delete iTestGrouper;
+    iTestGrouper = NULL;
+    delete iTestGrouper1;
+    iTestGrouper1 = NULL;
+    delete iTestFilter;
+    iTestFilter = NULL;
+    delete iTestFilter1;
+    iTestFilter1 = NULL;
+    delete iMimeTypeArray;
+    iMimeTypeArray = NULL;
+    delete iMimeTypeArray1;
+    iMimeTypeArray1 = NULL;
+    delete iChangedItemObserver;
+    iChangedItemObserver = NULL;
+    delete iChangedItemObserver1;
+    iChangedItemObserver1 = NULL;
+    delete iOpaqueData;
+    iOpaqueData = NULL;
+    delete iModifiableItem;
+    iModifiableItem = NULL;
+    delete iTestCLFProcessObserver1;
+    iTestCLFProcessObserver1 = NULL;
+    delete iTestCLFProcessObserver;
+    iTestCLFProcessObserver = NULL;
+    
+    TTimeIntervalMicroSeconds32 time = 1000000;
+    TRAP_IGNORE( CCLFAsyncCallback::AfterL( time ) );
+
+    return KErrNone;
+    }
+
+/**
+ * Tests, construction
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateEngineTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::CreateEngineTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iEngine = ContentListingFactory::NewContentListingEngineLC();
+    if (!iEngine)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::PopAndDestroy(); //engine
+    iEngine = NULL;
+    iEngine = ContentListingFactory::NewContentListingEngineLC();
+    if (!iEngine)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::Pop(); // engine
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateModifiableItemTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::CreateModifiableItemTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    MCLFModifiableItem* item = NULL;
+    item = ContentListingFactory::NewModifiableItemLC();
+    if (!item)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::PopAndDestroy(); // item
+    item = NULL;
+    item = ContentListingFactory::NewModifiableItemLC();
+    if (!item)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::Pop(); // item
+    delete item;
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateSortignStyleTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::CreateSortignStyleTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    MCLFSortingStyle* sortingStyle = NULL;
+    sortingStyle = ContentListingFactory::NewSortingStyleLC();
+    if (!sortingStyle)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::PopAndDestroy(); // sortingStyle
+    sortingStyle = NULL;
+    sortingStyle = ContentListingFactory::NewSortingStyleLC();
+    if (!sortingStyle)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::Pop(); // sortingStyle
+    delete sortingStyle;
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateSortignStyleFromResourceTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::CreateSortignStyleFromResourceTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    MCLFSortingStyle* sortingStyle = NULL;
+    sortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
+    if (!sortingStyle)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::PopAndDestroy(); // sortingStyle
+    sortingStyle = NULL;
+
+    SortingStyleResourceL(); // refresh resource reader
+    sortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
+    if (!sortingStyle)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::Pop(); // sortingStyle
+    delete sortingStyle;
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateListModelTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::CreateListModelTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    MCLFItemListModel* model = NULL;
+    model = iEngine->CreateListModelLC( *iTestObserver );
+    if (!model)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::PopAndDestroy();  //listModel
+    model = NULL;
+
+    model = iEngine->CreateListModelLC( *iTestObserver );
+    if (!model)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::Pop(); // listModel
+    delete model;
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateListModelFromResourceTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::CreateListModelFromResourceTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    MCLFItemListModel* model = NULL;
+    model = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
+    if (!model)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::PopAndDestroy(); //listModel
+    model = NULL;
+
+    ListModelResourceL();
+    model = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
+    if (!model)
+        {
+        ret = KErrUnknown;
+        }
+    CleanupStack::Pop(); // listModel
+    delete model;
+
+    ResourceL( R_LIST_MODEL_INCORRECT_VERSION );
+    TRAPD(error, iEngine->CreateListModelLC( *iTestObserver, iResourceReader ));
+    if (error != KErrNotSupported)
+        {
+        ret = KErrUnknown;
+        CleanupStack::Pop(); // listModel
+        }
+
+    return ret;
+    }
+
+/**
+ * Tests, engine
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::UpdateItemsTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::UpdateItemsTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    // MDS will do the updating automatically in the background,
+    // thus only checking that the methods return correctly
+    iChangedItemObserver->iWait = &iWait;
+    iChangedItemObserver->iChangedArray = &iChangedArray;
+    iEngine->AddChangedItemObserverL( *iChangedItemObserver );
+    iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver );
+    iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver1 );
+
+    CreateNewFileL( 0, iFileName );
+    CreateNewFileL( 1, iFileName );
+    CreateNewFileL( 2, iFileName );
+    CreateNewFileL( 3, iFileName );
+    CreateNewFileL( 4, iFileName );
+    CreateNewFileL( 5, iFileName );
+
+// update server
+// to aTInt incorrect test result
+    CreateNewFileL( 0, iFileName );
+    iEngine->UpdateItemsL();
+
+    ret = iChangedItemObserver->iLastError;
+
+    iChangedArray.Reset();
+    iEngine->RemoveCLFProcessObserver( *iTestCLFProcessObserver1 );
+    iChangedItemObserver->iHandleItemChange = EFalse;
+    iChangedItemObserver1->iHandleItemChange = EFalse;
+    iTestCLFProcessObserver->Reset();
+    iTestCLFProcessObserver1->Reset();
+    iEngine->UpdateItemsL();
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::UpdateItemsWithIdTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::UpdateItemsWithIdTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    // MDS will do the updating automatically in the background,
+    // thus only checking that the methods return correctly
+    iChangedItemObserver->iWait = &iWait;
+    iChangedItemObserver->iChangedArray = &iChangedArray;
+    iEngine->AddChangedItemObserverL( *iChangedItemObserver );
+    iEngine->AddChangedItemObserverL( *iChangedItemObserver1 );
+    iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver );
+
+    CreateNewFileL( 6, iFileName );
+    CreateNewFileL( 7, iFileName );
+    CreateNewFileL( 8, iFileName );
+
+// update server
+// to aTInt incorrect test result
+    CreateNewFileL( 6, iFileName );
+    iEngine->UpdateItemsL();
+    
+    if (iChangedItemObserver->iLastError != KErrNone)
+        {
+        ret = KErrUnknown;
+        }
+
+// start testing
+// update by id
+    TUint id1 = FindTestFileIdL( 7 );
+    TUint id0 = FindTestFileIdL( 6 );
+    TUint id2 = FindTestFileIdL( 8 );
+    iUpdateItemIdArray.AppendL( id1 );
+    iChangedItemObserver->iHandleItemChange = EFalse;
+    iChangedItemObserver1->iHandleItemChange = EFalse;
+    iTestCLFProcessObserver->Reset();
+    iTestCLFProcessObserver1->Reset();
+    CreateNewFileL( 6, iFileName );
+    CreateNewFileL( 7, iFileName );
+    iEngine->UpdateItemsL( iUpdateItemIdArray.Array() );
+    
+    if (iChangedItemObserver->iLastError != KErrNone)
+        {
+        ret = KErrUnknown;
+        }
+
+    iEngine->RemoveChangedItemObserver( *iChangedItemObserver1 );
+    iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver1 );
+
+    iChangedItemObserver->iHandleItemChange = EFalse;
+    iChangedItemObserver1->iHandleItemChange = EFalse;
+    iTestCLFProcessObserver->Reset();
+    iTestCLFProcessObserver1->Reset();
+    iUpdateItemIdArray.AppendL( id0 );
+    iUpdateItemIdArray.AppendL( id2 );
+    
+// update server
+// to aTInt incorrect test result
+    iEngine->UpdateItemsL();
+    
+    if (iChangedItemObserver->iLastError != KErrNone)
+        {
+        ret = KErrUnknown;
+        }
+    
+    CreateNewFileL( 6, iFileName );
+    CreateNewFileL( 7, iFileName );
+    CreateNewFileL( 8, iFileName );
+    iChangedArray.Reset();
+    
+    iEngine->UpdateItemsL( iUpdateItemIdArray.Array() );
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::UpdateItemsWithOpaqueDataFolderTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::UpdateItemsWithOpaqueDataFolderTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    // start testing
+    // update by opaque data
+    // folders data
+    iSemanticId = KCLFUpdateFoldersSemanticId;
+    delete iOpaqueData;
+    iOpaqueData = NULL;
+
+    CDesCArray* fileArray = new (ELeave) CDesCArraySeg( 8 );
+    iOpaqueData = MakeOpaqueDataL( *fileArray );
+    // Calls internally same MDS method as when updating all data
+    // thus only interested if this call leaves
+    iEngine->UpdateItemsL( iSemanticId, *iOpaqueData );
+
+    return ret;
+    }
+
+/**
+ * Tests, list model
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::RefreshTestL
+// ---------------------------------------------------------------------------
+//  
+TInt CContentListingFrameworkTest::RefreshTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iMimeTypeArray->Reset();
+    iMimeTypeArray->AppendL( _L("*") );
+    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+
+    iTestObserver->iWait = &iWait;
+    iTestObserver->iError = 100;
+    iListModel->RefreshL();
+    iWait.Start();
+
+    if (iTestObserver->iOperationEvent != ECLFRefreshComplete)
+        {
+        ret = KErrUnknown;
+        }
+    if (iTestObserver->iError != KErrNone)
+        {
+        ret = KErrUnknown;
+        }
+    if (iListModel->ItemCount() != 0)
+        {
+        ret = KErrUnknown;
+        }
+
+// cancel refresh
+    iListModel->RefreshL();
+    iListModel->CancelRefresh();
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetSortingStyleTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::SetSortingStyleTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iListModel->SetSortingStyle( NULL );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (CheckFileNameShortingL())
+        {
+        ret = KErrUnknown;
+        }
+
+// file name sorting
+    iSortingStyle->ResetL();
+    iSortingStyle->SetSortingDataType( ECLFItemDataTypeDesC );
+    iSortingStyle->AddFieldL( ECLFFieldIdFileName );
+    iListModel->SetSortingStyle( iSortingStyle );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (!CheckFileNameShortingL())
+        {
+        ret = KErrUnknown;
+        }
+
+// file size sorting
+    iSortingStyle1->ResetL();
+    iSortingStyle1->SetOrdering( ECLFOrderingDescending );
+    iSortingStyle1->SetSortingDataType( ECLFItemDataTypeTInt32 );
+    iSortingStyle1->AddFieldL( ECLFFieldIdFileSize );
+    iListModel->SetSortingStyle( iSortingStyle1 );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (CheckFileNameShortingL())
+        {
+        ret = KErrUnknown;
+        }
+
+    iListModel->SetSortingStyle( NULL );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (CheckFileNameShortingL() || CheckFileSizeShortingL() || CheckFileDateShortingL())
+        {
+        ret = KErrUnknown;
+        }
+
+// time sorting
+    iSortingStyle->ResetL();
+    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTTime );
+    iSortingStyle->AddFieldL( ECLFFieldIdFileDate );
+    iListModel->SetSortingStyle( iSortingStyle );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (!CheckFileDateShortingL())
+        {
+        ret = KErrUnknown;
+        }
+
+// parameter test (time)
+    iListModel->SetSortingStyle( NULL );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (CheckFileNameShortingL() || CheckFileSizeShortingL() || CheckFileDateShortingL())
+        {
+        ret = KErrUnknown;
+        }
+
+    iListModel->SetSortingStyle( iSortingStyle );
+    iListModel->RefreshL( ECLFRefreshPostFilter );
+    if (CheckFileNameShortingL() || CheckFileSizeShortingL() || CheckFileDateShortingL())
+        {
+        ret = KErrUnknown;
+        }
+
+    iListModel->RefreshL( ECLFRefreshGrouping );
+    if (CheckFileNameShortingL() || CheckFileSizeShortingL() || CheckFileDateShortingL())
+        {
+        ret = KErrUnknown;
+        }
+
+    iListModel->RefreshL( ECLFRefreshSorting );
+    if (CheckFileNameShortingL() || CheckFileSizeShortingL() || !CheckFileDateShortingL())
+        {
+        ret = KErrUnknown;
+        }
+
+// custom sorter (overwrite sorting style)
+    iTestSorter->iSortItems = EFalse;
+    iListModel->SetCustomSorter( iTestSorter );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (!(iTestSorter->iSortItems))
+        {
+        ret = KErrUnknown;
+        }
+    if (CheckFileNameShortingL() || CheckFileSizeShortingL() || CheckFileDateShortingL())
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetCustomSorterTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SetCustomSorterTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iTestSorter->iSortItems = EFalse;
+    iTestSorter1->iSortItems = EFalse;
+
+    iListModel->SetCustomSorter( NULL );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if ((iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+        {
+        ret = KErrUnknown;
+        }
+
+    iTestSorter->iSortItems = EFalse;
+    iTestSorter1->iSortItems = EFalse;
+
+    iListModel->SetCustomSorter( iTestSorter );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (!(iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+        {
+        ret = KErrUnknown;
+        }
+
+    iTestSorter->iSortItems = EFalse;
+    iTestSorter1->iSortItems = EFalse;
+
+    iListModel->SetCustomSorter( iTestSorter1 );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if ((iTestSorter->iSortItems) || !(iTestSorter1->iSortItems))
+        {
+        ret = KErrUnknown;
+        }
+
+    iTestSorter->iSortItems = EFalse;
+    iTestSorter1->iSortItems = EFalse;
+
+    iListModel->SetCustomSorter( NULL );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if ((iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+        {
+       ret = KErrUnknown;
+        }
+
+    iTestSorter->iSortItems = EFalse;
+    iTestSorter1->iSortItems = EFalse;
+
+    iListModel->SetCustomSorter( iTestSorter );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (!(iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+        {
+        ret = KErrUnknown;
+        }
+
+    iTestSorter->iSortItems = EFalse;
+    iTestSorter1->iSortItems = EFalse;
+
+    iListModel->SetCustomSorter( iTestSorter1 );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if ((iTestSorter->iSortItems) || !(iTestSorter1->iSortItems))
+        {
+        ret = KErrUnknown;
+        }
+
+// parameter test
+    iTestSorter->iSortItems = EFalse;
+    iTestSorter1->iSortItems = EFalse;
+
+    iListModel->SetCustomSorter( NULL );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if ((iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+        {
+        ret = KErrUnknown;
+        }
+
+
+    iTestSorter->iSortItems = EFalse;
+    iTestSorter1->iSortItems = EFalse;
+
+    iListModel->SetCustomSorter( iTestSorter );
+    iListModel->RefreshL( ECLFRefreshPostFilter );
+    if ((iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+        {
+        ret = KErrUnknown;
+        }
+
+    iListModel->RefreshL( ECLFRefreshGrouping );
+    if ((iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+        {
+        ret = KErrUnknown;
+        }
+
+    iListModel->RefreshL( ECLFRefreshSorting );
+    if (!(iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::GroupingTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::GroupingTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iTestGrouper->iModifiableItems = &iModifiableItems;
+    iTestGrouper1->iModifiableItems = &iModifiableItems;
+
+// No grouping
+    iListModel->SetCustomGrouper( NULL );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (iListModel->ItemCount() != iItemCount)
+        {
+        ret = KErrUnknown;
+        }
+
+// couple groups
+    iListModel->SetCustomGrouper( iTestGrouper );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (iListModel->ItemCount() != iModifiableItems.Count())
+        {
+        ret = KErrUnknown;
+        }
+
+// 0 groups
+    iTestGrouper1->iGroupCount = 0;
+    iListModel->SetCustomGrouper( iTestGrouper1 );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (iListModel->ItemCount() != iModifiableItems.Count())
+        {
+        ret = KErrUnknown;
+        }
+
+// No grouping
+    iListModel->SetCustomGrouper( NULL );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (iListModel->ItemCount() != iItemCount)
+        {
+        ret = KErrUnknown;
+        }
+// Music album grouping
+    iListModel->SetGroupingStyle( ECLFMusicAlbumGrouping );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (iListModel->ItemCount() == iItemCount)
+        {
+        ret = KErrUnknown;
+        }
+// No grouping
+    iListModel->SetGroupingStyle( ECLFNoGrouping );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (iListModel->ItemCount() != iItemCount)
+        {
+        ret = KErrUnknown;
+        }
+
+// test parameters
+    iTestGrouper->iGroupCount = 1000;
+    iListModel->SetCustomGrouper( iTestGrouper );
+    iListModel->RefreshL( ECLFRefreshPostFilter );
+    if (iListModel->ItemCount() != iItemCount)
+        {
+        ret = KErrUnknown;
+        }
+    iListModel->RefreshL( ECLFRefreshSorting );
+    if (iListModel->ItemCount() != iItemCount)
+        {
+        ret = KErrUnknown;
+        }
+    iListModel->RefreshL( ECLFRefreshGrouping );
+    if (iListModel->ItemCount() != iModifiableItems.Count())
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetPostFilterTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SetPostFilterTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+// no filter
+    iListModel->SetPostFilter( NULL );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (iListModel->ItemCount() != iItemCount)
+        {
+        ret = KErrUnknown;
+        }
+
+// filter couple items
+    iListModel->SetPostFilter( iTestFilter );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if ( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) == iItemCount )
+        {
+        ret = KErrUnknown;
+        }
+
+// filter all items
+    iListModel->SetPostFilter( iTestFilter1 );
+    iTestFilter1->iAllFilter = ETrue;
+    iListModel->RefreshL( ECLFRefreshAll );
+    if ( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) != iItemCount )
+        {
+        ret = KErrUnknown;
+        }
+
+// no filter
+    iListModel->SetPostFilter( NULL );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (iListModel->ItemCount() != iItemCount)
+        {
+        ret = KErrUnknown;
+        }
+
+// filter one item
+    iListModel->SetPostFilter( iTestFilter );
+    iTestFilter->iShouldFilterCount = 1;
+    iListModel->RefreshL( ECLFRefreshAll );
+    if ( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) == iItemCount )
+        {
+        ret = KErrUnknown;
+        }
+
+// filter couple items
+    iListModel->SetPostFilter( iTestFilter1 );
+    iTestFilter1->iAllFilter = EFalse;
+    iListModel->RefreshL( ECLFRefreshAll );
+    if ( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) != iItemCount )
+        {
+        ret = KErrUnknown;
+        }
+
+// test parameters
+    iListModel->SetPostFilter( NULL );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if (iListModel->ItemCount() != iItemCount)
+        {
+        ret = KErrUnknown;
+        }
+    iListModel->SetPostFilter( iTestFilter1 );
+    iTestFilter1->iAllFilter = ETrue;
+    iListModel->RefreshL( ECLFRefreshSorting );
+    if (iListModel->ItemCount() != iItemCount)
+        {
+       ret = KErrUnknown;
+        }
+    iListModel->RefreshL( ECLFRefreshGrouping );
+    if (iListModel->ItemCount() != iItemCount)
+        {
+        ret = KErrUnknown;
+        }
+    iListModel->RefreshL( ECLFRefreshPostFilter );
+    if ( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) != iItemCount )
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetWantedMimeTypesTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SetWantedMimeTypesTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iTestObserver->iWait = &iWait;
+
+// list not defined (mimetype)
+    iListModel->RefreshL();
+    iWait.Start();
+    if (iListModel->ItemCount() != 0)
+        {
+        ret = KErrUnknown;
+        }
+
+// couple mime types
+    iMimeTypeArray->Reset();
+    iMimeTypeArray->AppendL( _L( "audio/mpeg" ) );
+    iMimeTypeArray->AppendL( _L( "audio/aac" ) );
+    iMimeTypeArray->AppendL( _L( "audio/mp3" ) );
+    iMimeTypeArray->AppendL( _L( "audio/x-mp3" ) );
+    iMimeTypeArray->AppendL( _L( "audio/mp4" ) );
+    iMimeTypeArray->AppendL( _L( "audio/3gpp" ) );
+    iMimeTypeArray->AppendL( _L( "audio/m4a" ) );
+    iMimeTypeArray->AppendL( _L( "audio/3gpp2" ) );
+    iMimeTypeArray->AppendL( _L( "audio/mpeg4") );
+    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+    iListModel->RefreshL();
+    iWait.Start();
+    if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+        {
+        ret = KErrUnknown;
+        }
+
+// unsupported mimetype
+    iMimeTypeArray1->Reset();
+    iMimeTypeArray1->AppendL( _L("__not_supported__")  );
+    iListModel->SetWantedMimeTypesL( *iMimeTypeArray1 );
+    iListModel->RefreshL();
+    iWait.Start();
+    if (iListModel->ItemCount() != 0)
+        {
+        ret = KErrUnknown;
+        }
+
+// empty mimetype list
+    iMimeTypeArray1->Reset();
+    iListModel->SetWantedMimeTypesL( *iMimeTypeArray1 );
+    iListModel->RefreshL();
+    iWait.Start();
+    if (iListModel->ItemCount() != 0)
+        {
+        ret = KErrUnknown;
+        }
+
+// from resource (mimetype)
+    iMimeTypeArray->Reset();
+    iMimeTypeArray->AppendL( _L("image/*")  );
+    iMimeTypeArray->AppendL( _L("audio/*")  );
+
+    ResourceL( R_MIME_TYPE_ARRAY );
+    iListModel->SetWantedMimeTypesL( iResourceReader );
+    iListModel->RefreshL();
+    iWait.Start();
+    if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+        {
+        ret = KErrUnknown;
+        }
+
+    ResourceL( R_MIME_TYPE_ARRAY_EMPTY );
+    iListModel->SetWantedMimeTypesL( iResourceReader );
+    iListModel->RefreshL();
+    iWait.Start();
+    if (iListModel->ItemCount() != 0)
+        {
+        ret = KErrUnknown;
+        }
+
+// incorrect resource version
+    ResourceL( R_MIME_TYPE_ARRAY_INCORRECT_VERSION );
+    TRAPD(error, iListModel->SetWantedMimeTypesL( iResourceReader ));
+    if (error != KErrNotSupported)
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetWantedMediaTypesTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SetWantedMediaTypesTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iTestObserver->iWait = &iWait;
+
+// list not defined (mediatype)
+    iListModel->RefreshL();
+    iWait.Start();
+    if (iListModel->ItemCount() != 0)
+        {
+        ret = KErrUnknown;
+        }
+
+// couple media types
+    iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
+    iMediaTypeArray.AppendL( ECLFMediaTypeImage );
+    iMediaTypeArray.AppendL( ECLFMediaTypeSound );
+    iMediaTypeArray.AppendL( ECLFMediaTypeMusic );
+    iMediaTypeArray.AppendL( ECLFMediaTypeStreamingURL );
+    iMediaTypeArray.AppendL( ECLFMediaTypePlaylist );
+    iMediaTypeArray.AppendL( TCLFMediaType( ECLFMediaTypeCollection ) );
+
+    iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
+    iListModel->RefreshL();
+    iWait.Start();
+    if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+        {
+        ret = KErrUnknown;
+        }
+
+// empty media type list list
+    iListModel->SetWantedMediaTypesL( iMediaTypeArray1.Array() );
+    iListModel->RefreshL();
+    iWait.Start();
+    if (iListModel->ItemCount() != 0)
+        {
+        ret = KErrUnknown;
+        }
+
+// media type list from resource
+    iMediaTypeArray.Reset();
+    iMediaTypeArray.AppendL( ECLFMediaTypeImage );
+    iMediaTypeArray.AppendL( TCLFMediaType( ECLFMediaTypeCollection ) );
+    ResourceL( R_MEDIA_TYPE_ARRAY );
+    iListModel->SetWantedMediaTypesL( iResourceReader );
+    iListModel->RefreshL();
+    iWait.Start();
+    if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+        {
+        ret = KErrUnknown;
+        }
+
+// empty media type list from resource
+    ResourceL( R_MEDIA_TYPE_ARRAY_EMPTY );
+    iListModel->SetWantedMediaTypesL( iResourceReader );
+    iListModel->RefreshL();
+    iWait.Start();
+    if (iListModel->ItemCount() != 0)
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetWantedMediaAndMimeTypesTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SetWantedMediaAndMimeTypesTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iTestObserver->iWait = &iWait;
+
+    iListModel->RefreshL();
+    iWait.Start();
+    if (iListModel->ItemCount() != 0)
+        {
+        ret = KErrUnknown;
+        }
+
+// couple types
+    iMimeTypeArray->AppendL( _L( "audio/mpeg" ) );
+    iMimeTypeArray->AppendL( _L( "audio/aac" ) );
+    iMimeTypeArray->AppendL( _L( "audio/mp3" ) );
+    iMimeTypeArray->AppendL( _L( "audio/x-mp3" ) );
+    iMimeTypeArray->AppendL( _L( "audio/mp4" ) );
+    iMimeTypeArray->AppendL( _L( "audio/3gpp" ) );
+    iMimeTypeArray->AppendL( _L( "audio/m4a" ) );
+    iMimeTypeArray->AppendL( _L( "audio/3gpp2" ) );
+    iMimeTypeArray->AppendL( _L( "audio/mpeg4") );
+    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+
+    iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
+    iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
+    iListModel->RefreshL();
+    iWait.Start();
+    if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+        {
+        ret = KErrUnknown;
+        }
+
+// refresh again
+    iListModel->RefreshL();
+    iWait.Start();
+    if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+        {
+        ret = KErrUnknown;
+        }
+
+// empty lists
+    iMediaTypeArray.Reset();
+    iMimeTypeArray->Reset();
+    iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
+    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+    iListModel->RefreshL();
+    iWait.Start();
+    if (iListModel->ItemCount() != 0)
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MultibleSortingTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::MultibleSortingTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iListModel->RefreshL( ECLFRefreshAll );
+    if ( !CheckMultibleSortingShortingL() )
+        {
+        ret = KErrUnknown;
+        }
+
+// resort
+
+    iSortingStyle->ResetL();
+    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
+    iSortingStyle->AddFieldL( KMultibleSortingTestField6 );
+    iSortingStyle->AddFieldL( KMultibleSortingTestField5 );
+    iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
+    iListModel->SetSortingStyle( iSortingStyle );
+    iListModel->RefreshL( ECLFRefreshAll );
+    if ( CheckMultibleSortingShortingL() )
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+/*
+* Test model item(s) obsolate functionality
+*/
+
+// ---------------------------------------------------------------------------
+// ModelItemsChangedTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::ModelItemsChangedTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    const TInt newFileNumber( 13 );
+
+// create test files
+    CreateNewFileL( 9, iFileName );
+    CreateNewFileL( 10, iFileName );
+    CreateNewFileL( 11, iFileName );
+    CreateNewFileL( newFileNumber, iFileName );
+    User::LeaveIfError( iFs.Delete( iFileName ) );
+
+// update server
+// to aTInt incorrect test result
+    CreateNewFileL( 0, iFileName );
+    iEngine->UpdateItemsL();
+
+// create list model with all files
+    iMimeTypeArray->Reset();
+    iMimeTypeArray->AppendL( _L("*") );
+    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+
+    iTestObserver->iWait = &iWait;
+    iTestObserver->iError = 100;
+    iListModel->RefreshL();
+    iWait.Start();  // wait until model is refreshed
+
+    if ( iTestObserver->iOperationEvent != ECLFRefreshComplete
+         || iTestObserver->iError != KErrNone
+         || iListModel->ItemCount() != 0 )
+        {
+        ret = KErrUnknown;
+        }
+
+    const TInt listModelItemCount( iListModel->ItemCount() );
+    const TCLFItemId testId( FindTestFileIdL( 0 ) );
+
+// test with modified item
+    CreateNewFileL( 0, iFileName );
+    iEngine->UpdateItemsL();
+    iWait.Start(); // wait until model outdated event is received
+
+    if ( iTestObserver->iOperationEvent != ECLFModelOutdated
+         || iTestObserver->iError != KErrNone
+         || iListModel->ItemCount() != listModelItemCount
+         || FindItem( *iListModel, testId ) == NULL )
+        {
+        ret = KErrUnknown;
+        }
+
+    iTestObserver->iError = 100;
+    iListModel->RefreshL();
+    iWait.Start();  // wait until model is refreshed
+    if ( iTestObserver->iOperationEvent != ECLFRefreshComplete
+         || iTestObserver->iError != KErrNone
+         || iListModel->ItemCount() != listModelItemCount
+         || FindItem( *iListModel, testId ) == NULL )
+        {
+        ret = KErrUnknown;
+        }
+
+// test with new item
+    CreateNewFileL( newFileNumber, iFileName );
+    iEngine->UpdateItemsL();
+    iWait.Start(); // wait until model outdated event is received
+
+    if ( iTestObserver->iOperationEvent != ECLFModelOutdated
+         || iTestObserver->iError != KErrNone
+         || iListModel->ItemCount() != listModelItemCount )
+        {
+        ret = KErrUnknown;
+        }
+
+    iTestObserver->iError = 100;
+    iListModel->RefreshL();
+    iWait.Start();  // wait until model is refreshed
+    if ( iTestObserver->iOperationEvent != ECLFRefreshComplete
+         || iTestObserver->iError != KErrNone
+         || iListModel->ItemCount() != listModelItemCount + 1 )
+        {
+        ret = KErrUnknown;
+        }
+
+// delete file
+    User::LeaveIfError( iFs.Delete( iFileName ) );
+    iEngine->UpdateItemsL();
+    iWait.Start(); // wait until model outdated event is received
+
+    if ( iTestObserver->iOperationEvent != ECLFModelOutdated
+         || iTestObserver->iError != KErrNone
+         || iListModel->ItemCount() != listModelItemCount + 1 )
+        {
+        ret = KErrUnknown;
+        }
+
+    iTestObserver->iError = 100;
+    iListModel->RefreshL();
+    iWait.Start();  // wait until model is refreshed
+    if ( iTestObserver->iOperationEvent != ECLFRefreshComplete
+         || iTestObserver->iError != KErrNone
+         || iListModel->ItemCount() != listModelItemCount )
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+/**
+ * Tests, Modifiable item
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MIFieldTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::MIFieldTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    const TUint KTestField1 = 1;
+    const TUint KTestField2 = 112312312;
+    const TUint KTestField3 = 13333;
+    const TUint KTestFieldIncorrect = 2;
+
+    TTime time( 100 );
+    TInt32 integer( 12 );
+    TBuf<30> data( _L("data") );
+    iModifiableItem->AddFieldL( KTestField1, time );
+    iModifiableItem->AddFieldL( KTestField2, integer );
+    iModifiableItem->AddFieldL( KTestField3, data );
+
+// data type test
+    if ( iModifiableItem->DataType( KTestField1 ) != ECLFItemDataTypeTTime
+         || iModifiableItem->DataType( KTestField2 ) != ECLFItemDataTypeTInt32
+         || iModifiableItem->DataType( KTestField3 ) != ECLFItemDataTypeDesC
+         || iModifiableItem->DataType( KTestFieldIncorrect ) != ECLFItemDataTypeNull
+         || iModifiableItem->DataType( ECLFFieldIdNull ) != ECLFItemDataTypeNull )
+        {
+        ret = KErrUnknown;
+        }
+
+// get field
+    TTime time1( 0 );
+    TInt32 integer1( 0 );
+    TPtrC ptr;
+    if ( iModifiableItem->GetField( KTestField1, time1 ) != KErrNone
+         || time != time1 )
+        {
+        ret = KErrUnknown;
+        }
+    if ( iModifiableItem->GetField( KTestField2, integer1 ) != KErrNone
+         || integer != integer1 )
+        {
+        ret = KErrUnknown;
+        }
+    if ( iModifiableItem->GetField( KTestField3, ptr ) != KErrNone
+         || data != ptr )
+        {
+        ret = KErrUnknown;
+        }
+
+// incorrect field id
+    if ( iModifiableItem->GetField( KTestFieldIncorrect, ptr ) != KErrNotFound
+         || iModifiableItem->GetField( KTestFieldIncorrect, integer1 ) != KErrNotFound
+         || iModifiableItem->GetField( KTestFieldIncorrect, time1 ) != KErrNotFound )
+        {
+        ret = KErrUnknown;
+        }
+
+// incorrect field type
+    if ( iModifiableItem->GetField( KTestField1, ptr ) != KErrNotFound
+         || iModifiableItem->GetField( KTestField3, integer1 ) != KErrNotFound
+         || iModifiableItem->GetField( KTestField2, time1 ) != KErrNotFound )
+        {
+        ret = KErrUnknown;
+        }
+
+    if ( iModifiableItem->ItemId() == 0 )
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+/**
+ * Tests, item
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ItemFieldTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::ItemFieldTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+// data type test
+    if ( iItem->DataType( ECLFFieldIdFileDate ) != ECLFItemDataTypeTTime
+         || iItem->DataType( ECLFFieldIdFileSize ) != ECLFItemDataTypeTInt32
+         || iItem->DataType( ECLFFieldIdFileNameAndPath ) != ECLFItemDataTypeDesC
+         || iItem->DataType( ECLFFieldIdNull ) != ECLFItemDataTypeNull )
+        {
+        ret = KErrUnknown;
+        }
+
+// get field
+    TTime time1( 0 );
+    TInt32 integer1( 0 );
+    TPtrC ptr;
+    TEntry entry;
+    User::LeaveIfError( iFs.Entry( iFileName, entry ) );
+
+    if ( iModifiableItem->GetField( ECLFFieldIdFileDate, time1 ) != KErrNone
+         || entry.iModified != time1 )
+        {
+        ret = KErrUnknown;
+        }
+    if ( iModifiableItem->GetField( ECLFFieldIdFileSize, integer1 ) != KErrNone
+         || entry.iSize != integer1 )
+        {
+        ret = KErrUnknown;
+        }
+    if ( iModifiableItem->GetField( ECLFFieldIdFileNameAndPath, ptr ) != KErrNone
+         || iFileName != ptr )
+        {
+        ret = KErrUnknown;
+        }
+
+    TParsePtrC parse( iFileName );
+
+    if ( iModifiableItem->GetField( ECLFFieldIdFileExtension, ptr ) != KErrNone
+         || parse.Ext() != ptr )
+        {
+        ret = KErrUnknown;
+        }
+    if ( iModifiableItem->GetField( ECLFFieldIdFileName, ptr ) != KErrNone
+         || parse.Name() != ptr )
+        {
+        ret = KErrUnknown;
+        }
+    if ( iModifiableItem->GetField( ECLFFieldIdPath, ptr ) != KErrNone
+         || parse.Path() != ptr )
+        {
+        ret = KErrUnknown;
+        }
+    if ( iModifiableItem->GetField( ECLFFieldIdDrive, ptr ) != KErrNone
+         || parse.Drive() != ptr )
+        {
+        ret = KErrUnknown;
+        }
+
+// incorrect field id
+    if ( iItem->GetField( ECLFFieldIdNull, ptr ) != KErrNotFound
+         || iItem->GetField( ECLFFieldIdNull, integer1 ) != KErrNotFound
+         || iItem->GetField( ECLFFieldIdNull, time1 ) != KErrNotFound )
+        {
+        ret = KErrUnknown;
+        }
+
+// incorrect field type
+    if ( iItem->GetField( ECLFFieldIdFileSize, ptr ) != KErrNotSupported
+         || iItem->GetField( ECLFFieldIdFileDate, integer1 ) != KErrNotSupported
+         || iItem->GetField( ECLFFieldIdFileNameAndPath, time1 ) != KErrNotSupported )
+        {
+        ret = KErrUnknown;
+        }
+
+    if ( iItem->ItemId() == 0 )
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+/**
+ * Tests, Sorting style
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleResourceTestL
+// ---------------------------------------------------------------------------
+//  
+TInt CContentListingFrameworkTest::SortingStyleResourceTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    const TInt KArray1IdCount( 4 );
+    const TInt KArray2IdCount( 1 );
+
+
+    RArray<TCLFItemId> itemIdArray;
+    CleanupClosePushL( itemIdArray );
+
+    if ( iSortingStyle->Ordering() != ECLFOrderingAscending
+         || iSortingStyle1->Ordering() != ECLFOrderingDescending
+         || iSortingStyle2->Ordering() != ECLFOrderingDescending )
+        {
+        ret = KErrUnknown;
+        }
+    if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeTInt32
+         || iSortingStyle1->SortingDataType() != ECLFItemDataTypeDesC
+         || iSortingStyle2->SortingDataType() != ECLFItemDataTypeDesC )
+        {
+        ret = KErrUnknown;
+        }
+
+    iSortingStyle->GetFieldsL( itemIdArray );
+
+    if ( itemIdArray.Count() != 0 )
+        {
+        ret = KErrUnknown;
+        }
+
+    itemIdArray.Reset();
+    iSortingStyle1->GetFieldsL( itemIdArray );
+
+    if ( itemIdArray.Count() != KArray1IdCount )
+        {
+        ret = KErrUnknown;
+        }
+
+    itemIdArray.Reset();
+    iSortingStyle2->GetFieldsL( itemIdArray );
+
+    if ( itemIdArray.Count() != KArray2IdCount )
+        {
+        ret = KErrUnknown;
+        }
+
+    CleanupStack::PopAndDestroy( &itemIdArray ); // itemIdArray.Close
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleOrderingTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::SortingStyleOrderingTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iSortingStyle->SetOrdering( ECLFOrderingAscending );
+    if ( iSortingStyle->Ordering() != ECLFOrderingAscending )
+        {
+        ret = KErrUnknown;
+        }
+
+    iSortingStyle->SetOrdering( ECLFOrderingDescending );
+    if ( iSortingStyle->Ordering() != ECLFOrderingDescending )
+        {
+        ret = KErrUnknown;
+        }
+
+    iSortingStyle->SetOrdering( ECLFOrderingAscending );
+    if ( iSortingStyle->Ordering() != ECLFOrderingAscending )
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleDataTypeTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::SortingStyleDataTypeTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
+    if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeTInt32 )
+        {
+        ret = KErrUnknown;
+        }
+
+    iSortingStyle->SetSortingDataType( ECLFItemDataTypeDesC );
+    if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeDesC )
+        {
+        ret = KErrUnknown;
+        }
+
+    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTTime );
+    if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeTTime )
+        {
+        ret = KErrUnknown;
+        }
+
+    iSortingStyle->SetSortingDataType( ECLFItemDataTypeNull );
+    if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeNull )
+        {
+        ret = KErrUnknown;
+        }
+
+    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
+    if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeTInt32 )
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleUndefinedItemPositionTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::SortingStyleUndefinedItemPositionTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
+    if ( iSortingStyle->UndefinedItemPosition() != ECLFSortingStyleUndefinedEnd )
+        {
+        ret = KErrUnknown;
+        }
+
+    iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
+    if ( iSortingStyle->UndefinedItemPosition() != ECLFSortingStyleUndefinedFirst )
+        {
+        ret = KErrUnknown;
+        }
+
+    iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
+    if ( iSortingStyle->UndefinedItemPosition() != ECLFSortingStyleUndefinedEnd )
+        {
+        ret = KErrUnknown;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleFieldTestL
+// ---------------------------------------------------------------------------
+// 
+TInt CContentListingFrameworkTest::SortingStyleFieldTestL( CStifItemParser& /* aItem */ )
+    {
+    TInt ret = KErrNone;
+
+    RArray<TCLFItemId> itemIdArray;
+    CleanupClosePushL( itemIdArray );
+
+    iSortingStyle->GetFieldsL( itemIdArray );
+    if ( itemIdArray.Count() != 0 )
+        {
+        ret = KErrUnknown;
+        }
+
+    iSortingStyle->AddFieldL( ECLFFieldIdFileName );
+    iSortingStyle->AddFieldL( ECLFFieldIdCollectionId );
+    iSortingStyle->AddFieldL( ECLFFieldIdCollectionName );
+    iSortingStyle->AddFieldL( ECLFFieldIdArtist );
+
+    iSortingStyle->GetFieldsL( itemIdArray );
+
+    if ( itemIdArray.Count() != 4 )
+        {
+        ret = KErrUnknown;
+        }
+
+    itemIdArray.Reset();
+    iSortingStyle->ResetL();
+    iSortingStyle->GetFieldsL( itemIdArray );
+    if ( itemIdArray.Count() != 0 )
+        {
+        ret = KErrUnknown;
+        }
+
+    CleanupStack::PopAndDestroy( &itemIdArray ); // itemIdArray.Close
+
+    return ret;
+    }
+
+//  [End of File] - Do not remove
--- a/mds_pub/content_listing_framework_api/tsrc/src/CreateTestSuite.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-*
-*/
-
-
-// INCLUDES
-#include <ceunittestsuite.h>
-#include "T_CLFApiModuleTests.h"
-
-/**
- * Test suite factory function.
- */
-EXPORT_C MEUnitTest* CreateTestSuiteL()
-    {
-    CEUnitTestSuite* mainSuite = CEUnitTestSuite::NewLC(_L("Content Listing Framework API Module Tests"));
-
-    // NewLC leaves the pointer to cleanupstack until AddL finishes
-    mainSuite->AddL( T_CLFApiModuleTests::NewLC() );
-    CleanupStack::Pop();
-
-    CleanupStack::Pop( mainSuite );
-    return mainSuite;
-    }
-
--- a/mds_pub/content_listing_framework_api/tsrc/src/T_CLFApiModuleTests.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2513 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Implementation of CLF API test 
-*
-*/
-
-
-// INCLUDES
-#include "T_CLFApiModuleTests.h"
-#include <s32mem.h> 
-#include <eunitmacros.h>
-
-// the header for the tested class
-#include <ContentListingFactory.h>
-#include <MCLFChangedItemObserver.h>
-#include <MCLFContentListingEngine.h>
-#include <MCLFCustomGrouper.h>
-#include <MCLFCustomSorter.h>
-#include <MCLFItem.h>
-#include <MCLFItemListModel.h>
-#include <MCLFModifiableItem.h>
-#include <MCLFOperationObserver.h>
-#include <MCLFPostFilter.h>
-#include <MCLFSortingStyle.h>
-#include <T_ContentListingFramework.rsg>
-#include <collate.h>
-#include <pathInfo.h>
-#include <MCLFProcessObserver.h>
-#include <CLFContentListingExtended.hrh>
-
-//CONSTS
-#ifdef __WINSCW__
-_LIT( KTestResourceFile, "z:\\resource\\T_ContentListingFramework.rsc" );
-#else
-_LIT( KTestResourceFile, "c:\\sys\\bin\\T_ContentListingFramework.rsc" );
-#endif
-_LIT( KTestFileNameBase, "CLFTestFiles\\TestFile" );
-_LIT( KTestFileExt, ".txt" );
-
-const TCLFFieldId KMultibleSortingTestField1 = 0x80000001;
-const TCLFFieldId KMultibleSortingTestField2 = 0x80000002;
-const TCLFFieldId KMultibleSortingTestField3 = 0x80000003;
-const TCLFFieldId KMultibleSortingTestField4 = 0x80000004;
-const TCLFFieldId KMultibleSortingTestField5 = 0x80000005;
-const TCLFFieldId KMultibleSortingTestField6 = 0x80000006;
-
-const TInt KCLFUpdateFoldersSemanticId = 0x1000;
-
-// ---------------------------------------------------------------------------
-// class CMGXAsyncCallback
-// ---------------------------------------------------------------------------
-//
-class CCLFAsyncCallback : public CBase
-    {
-    public:
-        ~CCLFAsyncCallback()
-            {
-            if ( iActiveWait.IsStarted() )
-                {
-                iActiveWait.AsyncStop();
-                }
-            }
-    public:
-        static void AfterL( TTimeIntervalMicroSeconds32 aInterval )
-            {
-            CCLFAsyncCallback* self = new( ELeave ) CCLFAsyncCallback();
-            CleanupStack::PushL( self );
-            CPeriodic* periodic = CPeriodic::NewL( CActive::EPriorityIdle );
-            CleanupStack::PushL( periodic );
-            TCallBack callBack( CallBackL, self );
-            TTimeIntervalMicroSeconds32 interval( 1000000 );
-            periodic->Start( aInterval, aInterval, callBack );
-            self->iActiveWait.Start();
-            periodic->Cancel();
-            CleanupStack::PopAndDestroy( 2 ); // periodic, self
-            }
-
-        static TInt CallBackL( TAny* aObject )
-            {
-            CCLFAsyncCallback* self = reinterpret_cast< CCLFAsyncCallback* >( aObject );
-            if ( self->iActiveWait.IsStarted() )
-                {
-                self->iActiveWait.AsyncStop();
-                }
-            return EFalse;
-            }
-            
-    private:
-        CActiveSchedulerWait iActiveWait;
-    };
-
-// ---------------------------------------------------------------------------
-// class TTestOperationObserver
-// ---------------------------------------------------------------------------
-//
-class TTestOperationObserver : public MCLFOperationObserver
-    {
-    public:
-        TTestOperationObserver()
-            // set invalid values
-            : iOperationEvent( TCLFOperationEvent( -1 ) ), iError( 1 ), iWait( NULL )
-            {}
-        void HandleOperationEventL( TCLFOperationEvent aOperationEvent,
-                                    TInt aError )
-            {
-            iError = aError;
-            iOperationEvent = aOperationEvent;
-            if( iWait &&
-                iWait->IsStarted() )
-                {
-                iWait->AsyncStop();
-                }
-            }
-        TCLFOperationEvent iOperationEvent;
-        TInt iError;
-        CActiveSchedulerWait* iWait;
-
-    };
-
-// ---------------------------------------------------------------------------
-// class TTestCustomSorter
-// ---------------------------------------------------------------------------
-//
-class TTestCustomSorter : public MCLFCustomSorter
-    {
-    public:
-        TTestCustomSorter() : iSortItems( EFalse )
-            {
-            }
-        void SortItemsL( RPointerArray<MCLFItem>& /*aItemArray*/ )
-            {
-            //aItemArray;
-            iSortItems = ETrue;
-            }
-        TBool iSortItems;
-
-    };
-
-// ---------------------------------------------------------------------------
-// class TTestCustomGrouper
-// ---------------------------------------------------------------------------
-//
-class TTestCustomGrouper : public MCLFCustomGrouper
-    {
-    public:
-        TTestCustomGrouper() : iGroupCount( 2 ), iCopyItems( EFalse ), iModifiableItems( NULL )
-            {
-            }
-        void GroupItemsL( const TArray<MCLFItem*>& /*aSourceList*/,
-                          RPointerArray<MCLFItem>& aGroupedList )
-            {
-            //aSourceList;
-            if( iCopyItems )
-                {
-                TInt count( iModifiableItems->Count() );
-                for( TInt i = 0 ; i < count ; ++i )
-                    {
-                    aGroupedList.AppendL( (*iModifiableItems)[i] );
-                    }
-                }
-            else if( iModifiableItems )
-                {
-                iModifiableItems->ResetAndDestroy();
-                for( TInt i = 0 ; i < iGroupCount ; ++i )
-                    {
-                    MCLFModifiableItem* item = ContentListingFactory::NewModifiableItemLC();
-                    iModifiableItems->AppendL( item );
-                    CleanupStack::Pop(); // item
-                    aGroupedList.AppendL( item );
-                    }
-                }
-            }
-        TInt iGroupCount;
-        TBool iCopyItems;
-        RPointerArray<MCLFModifiableItem>* iModifiableItems;
-    };
-
-// ---------------------------------------------------------------------------
-// class TTestPostFilter
-// ---------------------------------------------------------------------------
-//
-class TTestPostFilter : public MCLFPostFilter
-    {
-    public:
-        TTestPostFilter() : iShouldFilterCount( 5 ), iAllFilter( EFalse )
-            {
-            }
-
-        void FilterItemsL( const TArray<MCLFItem*>& aItemList,
-                           RPointerArray<MCLFItem>& aFilteredItemList )
-            {
-            iFilteredCount = 0;
-            if( iAllFilter )
-                {
-                iFilteredCount = aItemList.Count();
-                return;
-                }
-            for( TInt i = 0 ; i < aItemList.Count() ; ++i )
-                {
-                if( i < iShouldFilterCount  )
-                    {
-                    iFilteredCount++;
-                    }
-                else
-                    {
-                    aFilteredItemList.AppendL( aItemList[i] );
-                    }
-                }
-            }
-        TInt iShouldFilterCount;
-        TBool iAllFilter;
-        TInt iFilteredCount;
-
-    };
-
-// ---------------------------------------------------------------------------
-// class TTestChangedItemObserver
-// ---------------------------------------------------------------------------
-//
-class TTestChangedItemObserver : public MCLFChangedItemObserver
-    {
-    public:
-        TTestChangedItemObserver()
-            : iHandleItemChange( EFalse ),
-              iLastError( KErrNone ),
-              iChangedArray( NULL ),
-              iWait( NULL )      
-            {
-            }
-        void HandleItemChangeL( const TArray<TCLFItemId>& aItemIDArray )
-            {
-            iHandleItemChange = ETrue;
-            if( iChangedArray )
-                {
-                iChangedArray->Reset();
-                for( TInt i = 0 ; i < aItemIDArray.Count() ; ++i )
-                    {
-                    iChangedArray->AppendL( aItemIDArray[i] );
-                    }
-                }
-            if( iWait && iWait->IsStarted() )
-                {
-                iWait->AsyncStop();
-                }
-
-            }
-        void HandleError( TInt aError )
-            {
-            iLastError = aError;
-            if( iWait && iWait->IsStarted() )
-                {
-                iWait->AsyncStop();
-                }
-            }
-        TInt iHandleItemChange;
-        TInt iLastError;
-        RArray<TCLFItemId>* iChangedArray;
-        CActiveSchedulerWait* iWait;
-    };
-
-// ---------------------------------------------------------------------------
-// class TTestCLFProcessObserver
-// ---------------------------------------------------------------------------
-//
-class TTestCLFProcessObserver : public MCLFProcessObserver
-    {
-    public:
-        TTestCLFProcessObserver()
-            : iStartEvent( EFalse ), iEndEvent( EFalse )
-            {}
-        void HandleCLFProcessEventL( TCLFProcessEvent aProcessEvent )
-            {
-            switch ( aProcessEvent )
-                {
-                case ECLFUpdateStart:
-                    {
-                    iStartEvent = ETrue;
-                    break;
-                    }
-                case ECLFUpdateStop:
-                    {
-                    iEndEvent = ETrue;
-                    break;
-                    }
-                default:
-                    {
-                    User::Panic( _L("CLF module test"), 1 );
-                    }
-                }
-            }
-        void Reset()
-            {
-            iStartEvent = EFalse;
-            iEndEvent = EFalse;
-            }
-        TBool iStartEvent;
-        TBool iEndEvent;
-    };
-
-void SerializeL( const MDesCArray& aDataArray, CBufBase& aBuffer )
-    {
-    const TInt count( aDataArray.MdcaCount() );
-    RBufWriteStream writeStream( aBuffer );
-    CleanupClosePushL( writeStream );
-    writeStream.WriteInt32L( count );
-    for( TInt i = 0 ; i < count ; ++i )
-        {
-        const TDesC& des = aDataArray.MdcaPoint( i );
-        TInt length( des.Length() );
-        writeStream.WriteInt32L( length );
-        writeStream.WriteL( des, length );
-        }
-    CleanupStack::PopAndDestroy( &writeStream );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::NewLC()
-// Create the testing class
-// ---------------------------------------------------------------------------
-//
-T_CLFApiModuleTests* T_CLFApiModuleTests::NewLC()
-    {
-    T_CLFApiModuleTests* self = new(ELeave) T_CLFApiModuleTests;
-
-    CleanupStack::PushL( self );
-    // need to generate the table, so call base classes
-    // second phase constructor
-    self->ConstructL();
-    return self;
-    }
-
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ConstructL()
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ConstructL()
-    {
-    CEUnitTestSuiteClass::ConstructL();
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::~T_CLFApiModuleTests()
-// ---------------------------------------------------------------------------
-//
-T_CLFApiModuleTests::~T_CLFApiModuleTests()
-    {
-    Teardown();
-    }
-
-/**
- * Assistance methods
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ResourceL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ResourceL( TInt aResourceId )
-    {
-    delete iDataBuffer;
-    iDataBuffer = NULL;
-    iDataBuffer = iResourceFile.AllocReadL( aResourceId );
-    iResourceReader.SetBuffer( iDataBuffer );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleResourceL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SortingStyleResourceL()
-    {
-    ResourceL( R_SORTING_STYLE );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ListModelResourceL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ListModelResourceL()
-    {
-    ResourceL( R_LIST_MODEL );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateNewFileL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::CreateNewFileL( TInt aNumber, TDes& aFileName )
-    {
-    aFileName.Copy( PathInfo::PhoneMemoryRootPath() );
-    aFileName.Append( KTestFileNameBase );
-    TBuf<125> buf;
-    buf.Num( aNumber );
-    aFileName.Append( buf );
-    aFileName.Append( KTestFileExt );
-
-    RFile file;
-    BaflUtils::EnsurePathExistsL( iFs, aFileName );
-    TInt error( file.Replace( iFs, aFileName, EFileShareAny | EFileWrite ) );
-    if( error == KErrNone )
-        {
-        error = file.Write( _L8("Test data") );
-        }
-    file.Close();
-    User::LeaveIfError( error );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::FindTestFileIdL
-// ---------------------------------------------------------------------------
-//
-TCLFItemId T_CLFApiModuleTests::FindTestFileIdL( TInt aNumber )
-    {
-    TCLFItemId id( 0 );
-    MCLFItemListModel* model = iEngine->CreateListModelLC( *iTestObserver );
-    iMimeTypeArray->AppendL( _L("*") );
-
-    iTestObserver->iWait = &iWait;
-    model->SetWantedMimeTypesL( *iMimeTypeArray );
-    model->RefreshL();
-    iWait.Start();
-
-    TFileName testFileName( PathInfo::PhoneMemoryRootPath() );
-    testFileName.Append( KTestFileNameBase );
-    TBuf<125> buf;
-    buf.Num( aNumber );
-    testFileName.Append( buf );
-    testFileName.Append( KTestFileExt );
-    for( TInt i = 0 ; i < model->ItemCount() ; ++i )
-        {
-        const MCLFItem& item = model->Item( i );
-        TPtrC fileName;
-        if( item.GetField( ECLFFieldIdFileNameAndPath, fileName ) != KErrNone )
-            {
-            continue;
-            }
-        if( fileName.CompareF( testFileName ) == 0 )
-            {
-            id = item.ItemId();
-            break;
-            }
-        }
-    CleanupStack::PopAndDestroy(); // model
-    return id;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckFileNameShortingL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckFileNameShortingL()
-    {
-    TCollationMethod m = *Mem::CollationMethodByIndex( 0 );
-    m.iFlags |= TCollationMethod::EIgnoreNone | TCollationMethod::EFoldCase;
-
-    for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
-        {
-        const MCLFItem& item = iListModel->Item( i );
-        const MCLFItem& item1 = iListModel->Item( i + 1 );
-        TPtrC name;
-        TPtrC name1;
-
-        if( item.GetField( ECLFFieldIdFileName, name ) != KErrNone ||
-            item1.GetField( ECLFFieldIdFileName, name1 ) != KErrNone )
-            {
-            return EFalse;
-            }
-        if( name.CompareC( name1, 3, &m ) > 0 )
-            {
-            return EFalse;
-            }
-        }
-    return ETrue;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckFileSizeShortingL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckFileSizeShortingL()
-    {
-    for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
-        {
-        const MCLFItem& item = iListModel->Item( i );
-        const MCLFItem& item1 = iListModel->Item( i + 1 );
-        TInt32 size;
-        TInt32 size1;
-        if( item.GetField( ECLFFieldIdFileSize, size ) != KErrNone ||
-            item1.GetField( ECLFFieldIdFileSize, size1 ) != KErrNone )
-            {
-            return EFalse;
-            }
-        if( size < size1 )
-            {
-            return EFalse;
-            }
-        }
-    return ETrue;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckMultibleSortingShortingL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckMultibleSortingShortingL()
-    {
-    const MCLFItem* item = &( iListModel->Item( 0 ) );
-    TInt32 data( 0 );
-    if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
-        data != 5 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 1 ) );
-    if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
-        data != 4 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 2 ) );
-    if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
-        data != 3 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 3 ) );
-    if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
-        data != 6 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 4 ) );
-    if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
-        data != 7 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 5 ) );
-    if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
-        data != 8 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 6 ) );
-    if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
-        data != 9 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 7 ) );
-    if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
-        data != 10 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 8 ) );
-    if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
-        data != 11 )
-        {
-        return EFalse;
-        }
-// unsorted start
-    item = &( iListModel->Item( 9 ) );
-    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
-        ( data < 15 || data > 17 ) )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 10 ) );
-    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
-        ( data < 15 || data > 17 ) )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 11 ) );
-    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
-        ( data < 15 || data > 17 ) )
-        {
-        return EFalse;
-        }
-// unsorted end
-    item = &( iListModel->Item( 12 ) );
-    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
-        data != 12 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 13 ) );
-    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
-        data != 13 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 14 ) );
-    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
-        data != 14 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 15 ) );
-    if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
-        data != 0 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 16 ) );
-    if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
-        data != 1 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 17 ) );
-    if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
-        data != 2 )
-        {
-        return EFalse;
-        }
-
-    return ETrue;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckMultibleSortingShorting2L
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckMultibleSortingShorting2L()
-    {
-// check sorted
-    const MCLFItem* item = &( iListModel->Item( 0 ) );
-    TInt32 data( 0 );
-    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
-        data != 12 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 1 ) );
-    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
-        data != 13 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 2 ) );
-    if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
-        data != 14 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 3 ) );
-    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
-        data != 15 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 4 ) );
-    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
-        data != 16 )
-        {
-        return EFalse;
-        }
-    item = &( iListModel->Item( 5 ) );
-    if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
-        data != 17 )
-        {
-        return EFalse;
-        }
-// check unsorted
-    for( TInt i = 6 ; i < 18 ; ++i )
-        {
-        item = &( iListModel->Item( i ) );
-        if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone )
-            {
-            if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone )
-                {
-                if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone )
-                    {
-                    if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone )
-                        {
-                        return EFalse;
-                        }
-                    }
-                }
-            }
-        if( data < 0 || data > 11 )
-            {
-            return EFalse;
-            }
-        }
-
-    return ETrue;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckFileDateShortingL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckFileDateShortingL()
-    {
-    for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
-        {
-        const MCLFItem& item = iListModel->Item( i );
-        const MCLFItem& item1 = iListModel->Item( i + 1 );
-        TTime date;
-        TTime date1;
-        if( item.GetField( ECLFFieldIdFileDate, date ) != KErrNone ||
-            item1.GetField( ECLFFieldIdFileDate, date1 ) != KErrNone )
-            {
-            return EFalse;
-            }
-        if( date > date1 )
-            {
-            return EFalse;
-            }
-        }
-    return ETrue;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckFileTypesL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckFileTypesL( const MDesCArray& aMimeTypeArray,
-                                            const TArray<TInt>& aMediaTypes )
-    {
-    for( TInt i = 0 ; i < iListModel->ItemCount() ; ++i )
-        {
-        TPtrC mimeType;
-        TInt32 mediaType;
-        TInt error = iListModel->Item( i ).GetField( ECLFFieldIdMimeType, mimeType );
-        if( iListModel->Item( i ).GetField( ECLFFieldIdMediaType, mediaType ) != KErrNone )
-            {
-            return EFalse;
-            }
-        TBool mimeTypeVal( EFalse );
-        TBool mediaTypeVal( EFalse );
-        if( error == KErrNone )
-            {
-            mimeTypeVal = CheckMimeTypesL( aMimeTypeArray, mimeType );
-            }
-        mediaTypeVal = CheckMediaTypesL( aMediaTypes, TCLFMediaType( mediaType ) );
-        if( !( mimeTypeVal || mediaTypeVal ) )
-            {
-            return EFalse;
-            }
-        }
-    return ETrue;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckMimeTypesL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckMimeTypesL( const MDesCArray& aMimeTypeArray,
-                                            const TDesC& aMimeType )
-    {
-    for( TInt j = 0 ; j < aMimeTypeArray.MdcaCount() ; ++j )
-        {
-        if( aMimeTypeArray.MdcaPoint( j ).Match( aMimeType ) == KErrNotFound )
-            {
-            return ETrue;
-            }
-        }
-    return EFalse;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckMediaTypesL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckMediaTypesL( const TArray<TInt>& aMediaTypes,
-                                             TCLFMediaType aMediaType )
-    {
-    for( TInt j = 0 ; j < aMediaTypes.Count() ; ++j )
-        {
-        if( aMediaTypes[j] == aMediaType )
-            {
-            return ETrue;
-            }
-        }
-    return EFalse;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MakeOpaqueDataL
-// ---------------------------------------------------------------------------
-//
-HBufC8* T_CLFApiModuleTests::MakeOpaqueDataL( const MDesCArray& aFiles )
-    {
-    CDesCArray* folderArray = new ( ELeave ) CDesCArraySeg( 8 );
-    CleanupStack::PushL( folderArray );
-    TInt count( aFiles.MdcaCount() );
-    for( TInt i = 0 ; i < count ; ++i )
-        {
-        TPtrC folderPath( TParsePtrC(
-                            aFiles.MdcaPoint( i ) ).DriveAndPath() );
-        TInt tmp( 0 );
-        if( folderArray->Find( folderPath, tmp, ECmpFolded ) != 0 )
-            {
-            folderArray->AppendL( folderPath );
-            }
-        }
-
-    CBufBase* dynBuffer = CBufFlat::NewL( 64 );
-    CleanupStack::PushL( dynBuffer );
-    SerializeL( *folderArray, *dynBuffer );
-    HBufC8* ret = dynBuffer->Ptr( 0 ).AllocL();
-    CleanupStack::PopAndDestroy( 2, folderArray );
-    return ret;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MakeMultibleSortingItemsL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::MakeMultibleSortingItemsL(
-                        RPointerArray<MCLFModifiableItem>& aItemArray )
-    {
-    for( TInt i = 0 ; i < 18 ; ++i )
-        {
-        MCLFModifiableItem* item = ContentListingFactory::NewModifiableItemLC();
-        aItemArray.AppendL( item );
-        CleanupStack::Pop();
-
-        if( i < 3 )
-            {
-            item->AddFieldL( KMultibleSortingTestField1, i );
-            }
-        else if( i < 6 )
-            {
-            item->AddFieldL( KMultibleSortingTestField2, i );
-            }
-        else if( i < 9 )
-            {
-            item->AddFieldL( KMultibleSortingTestField3, i );
-            }
-        else if( i < 12 )
-            {
-            item->AddFieldL( KMultibleSortingTestField4, i );
-            }
-        else if( i < 15 )
-            {
-            item->AddFieldL( KMultibleSortingTestField5, i );
-            }
-        else
-            {
-            item->AddFieldL( KMultibleSortingTestField6, i );
-            }
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::FindItem
-// ---------------------------------------------------------------------------
-//
-const MCLFItem* T_CLFApiModuleTests::FindItem( MCLFItemListModel& aModel, TCLFItemId aItemId )
-    {
-    for( TInt i = 0 ; i < aModel.ItemCount() ; ++i )
-        {
-        const MCLFItem& item = aModel.Item( i );
-        if( item.ItemId() == aItemId )
-            {
-            return &item;
-            }
-        }
-    return NULL;
-    }
-
-/**
- * Setup
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::BaseSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::BaseSetupL()
-    {
-    iFs.Close();
-    iResourceFile.Close();
-    
-    User::LeaveIfError( iFs.Connect() );
-    TFileName fileName( KTestResourceFile );
-    BaflUtils::NearestLanguageFile( iFs, fileName );
-    iResourceFile.OpenL( iFs, KTestResourceFile );
-    iResourceFile.ConfirmSignatureL( 0 );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleResourceSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::SortingStyleResourceSetupL()
-    {
-    BaseSetupL();
-    SortingStyleResourceL();
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateModelSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::CreateModelSetupL()
-    {
-    iEngine = ContentListingFactory::NewContentListingEngineLC();
-    CleanupStack::Pop();
-    iTestObserver  = new (ELeave) TTestOperationObserver;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateModelFromResourceSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::CreateModelFromResourceSetupL()
-    {
-    BaseSetupL();
-    CreateModelSetupL();
-    ListModelResourceL();
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ListModelSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::ListModelSetupL()
-    {
-    BaseSetupL();
-    CreateModelSetupL();
-    iListModel = iEngine->CreateListModelLC( *iTestObserver );
-    CleanupStack::Pop();
-
-    iSortingStyle = ContentListingFactory::NewSortingStyleLC();
-    CleanupStack::Pop();
-    iSortingStyle1 = ContentListingFactory::NewSortingStyleLC();
-    CleanupStack::Pop();
-    iSortingStyle2 = ContentListingFactory::NewSortingStyleLC();
-    CleanupStack::Pop();
-    iSortingStyle3 = ContentListingFactory::NewSortingStyleLC();
-    CleanupStack::Pop();
-
-    iTestSorter = new (ELeave) TTestCustomSorter;
-    iTestSorter1 = new (ELeave) TTestCustomSorter;
-    iTestGrouper = new (ELeave) TTestCustomGrouper;
-    iTestGrouper1 = new (ELeave) TTestCustomGrouper;
-    iTestFilter = new (ELeave) TTestPostFilter;
-    iTestFilter1 = new (ELeave) TTestPostFilter;
-    iMimeTypeArray = new (ELeave) CDesCArrayFlat( 8 );
-    iMimeTypeArray1 = new (ELeave) CDesCArrayFlat( 8 );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MultibleSortingSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::MultibleSortingSetupL()
-    {
-    ListModelSetupL();
-    MakeMultibleSortingItemsL( iModifiableItems );
-
-// use custom grouper to make own items
-    iTestGrouper->iModifiableItems = &iModifiableItems;
-    iTestGrouper->iCopyItems = ETrue;
-    iListModel->SetCustomGrouper( iTestGrouper );
-
-// set sorters
-    iSortingStyle->ResetL();
-    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
-    iSortingStyle->AddFieldL( KMultibleSortingTestField1 );
-    iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
-
-    iSortingStyle1->ResetL();
-    iSortingStyle1->SetSortingDataType( ECLFItemDataTypeTInt32 );
-    iSortingStyle1->AddFieldL( KMultibleSortingTestField2 );
-    iSortingStyle1->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
-    iSortingStyle1->SetOrdering( ECLFOrderingDescending );
-
-    iSortingStyle2->ResetL();
-    iSortingStyle2->SetSortingDataType( ECLFItemDataTypeTInt32 );
-    iSortingStyle2->AddFieldL( KMultibleSortingTestField3 );
-    iSortingStyle2->AddFieldL( KMultibleSortingTestField4 );
-    iSortingStyle2->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
-
-    iSortingStyle3->ResetL();
-    iSortingStyle3->SetSortingDataType( ECLFItemDataTypeTInt32 );
-    iSortingStyle3->AddFieldL( KMultibleSortingTestField5 );
-    iSortingStyle3->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
-
-    iListModel->SetSortingStyle( iSortingStyle );
-    iListModel->AppendSecondarySortingStyleL( *iSortingStyle1 );
-    iListModel->AppendSecondarySortingStyleL( *iSortingStyle2 );
-    iListModel->AppendSecondarySortingStyleL( *iSortingStyle3 );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MultibleSortingResourceSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::MultibleSortingResourceSetupL()
-    {
-    ListModelSetupL();
-    delete iListModel;
-    iListModel = NULL;
-    ResourceL( R_LIST_MODEL_MULTIBLE );
-    iListModel = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
-    CleanupStack::Pop();
-
-// use custom grouper to make own items
-    MakeMultibleSortingItemsL( iModifiableItems );
-    iTestGrouper->iModifiableItems = &iModifiableItems;
-    iTestGrouper->iCopyItems = ETrue;
-    iListModel->SetCustomGrouper( iTestGrouper );
-
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ListModelAllFileItemsSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::ListModelAllFileItemsSetupL()
-    {
-    ListModelSetupL();
-    iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
-    iMediaTypeArray.AppendL( ECLFMediaTypeImage );
-    iMediaTypeArray.AppendL( ECLFMediaTypeSound );
-    iMediaTypeArray.AppendL( ECLFMediaTypeMusic );
-    iMediaTypeArray.AppendL( ECLFMediaTypeStreamingURL );
-    iMediaTypeArray.AppendL( ECLFMediaTypePlaylist );
-    iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
-    iTestObserver->iWait = &iWait;
-    iListModel->RefreshL();
-    iWait.Start();
-    iItemCount = iListModel->ItemCount();
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ListModelSetupFromResourceL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::ListModelSetupFromResourceL()
-    {
-    BaseSetupL();
-    CreateModelSetupL();
-    ListModelResourceL();
-    iListModel = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
-    CleanupStack::Pop();
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::EngineTestSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::EngineTestSetupL()
-    {
-    User::LeaveIfError( iFs.Connect() );
-    iTestObserver  = new (ELeave) TTestOperationObserver;
-    iMimeTypeArray = new (ELeave) CDesCArrayFlat( 8 );
-    iEngine = ContentListingFactory::NewContentListingEngineLC();
-    CleanupStack::Pop();
-    iChangedItemObserver = new (ELeave) TTestChangedItemObserver;
-    iChangedItemObserver1 = new (ELeave) TTestChangedItemObserver;
-    iTestCLFProcessObserver = new (ELeave) TTestCLFProcessObserver;
-    iTestCLFProcessObserver1 = new (ELeave) TTestCLFProcessObserver;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleTestSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::SortingStyleTestSetupL()
-    {
-    iSortingStyle = ContentListingFactory::NewSortingStyleLC();
-    CleanupStack::Pop();
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleResourceTestSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::SortingStyleResourceTestSetupL()
-    {
-    SortingStyleResourceSetupL();
-    iSortingStyle1 = ContentListingFactory::NewSortingStyleLC( iResourceReader );
-    CleanupStack::Pop();
-
-    ResourceL( R_SORTING_STYLE_EMPTY );
-    iSortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
-    CleanupStack::Pop();
-
-    ResourceL( R_SORTING_STYLE_UNDEFINEDITEM );
-    iSortingStyle2 = ContentListingFactory::NewSortingStyleLC( iResourceReader );
-    CleanupStack::Pop();
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ModifiableItemTestSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::ModifiableItemTestSetupL()
-    {
-    iModifiableItem = ContentListingFactory::NewModifiableItemLC();
-    CleanupStack::Pop();
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ItemTestSetupL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::ItemTestSetupL()
-    {
-    ListModelSetupL();
-    CreateNewFileL( 12, iFileName );
-    iEngine->UpdateItemsL();
-    iMimeTypeArray->Reset();
-    iMimeTypeArray->AppendL( _L("*") );
-    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
-
-    iTestObserver->iWait = &iWait;
-    iListModel->RefreshL();
-    iWait.Start();
-
-    for( TInt i = 0 ; i < iListModel->ItemCount() ; ++i )
-        {
-        const MCLFItem& item = iListModel->Item( i );
-        TPtrC fn;
-        item.GetField( ECLFFieldIdFileNameAndPath, fn );
-        if( iFileName.CompareF( fn ) == 0 )
-            {
-            iItem = &item;
-            }
-        }
-
-    EUNIT_ASSERT( iItem ); // Item should be in model
-
-    }
-
-/**
- * Teardown
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::Teardown
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::Teardown()
-    {
-    iResourceFile.Close();
-    iFs.Close();
-    iMediaTypeArray.Reset();
-    iMediaTypeArray.Close();
-    iMediaTypeArray1.Reset();
-    iMediaTypeArray1.Close();
-    iUpdateItemIdArray.Reset();
-    iUpdateItemIdArray.Close();
-    iChangedArray.Reset();
-    iChangedArray.Close();
-    iModifiableItems.ResetAndDestroy();
-    iModifiableItems.Close();
-    
-    delete iListModel;
-    iListModel = NULL;
-    delete iEngine;
-    iEngine = NULL;
-    delete iSortingStyle;
-    iSortingStyle = NULL;
-    delete iSortingStyle1;
-    iSortingStyle1 = NULL;
-    delete iSortingStyle2;
-    iSortingStyle2 = NULL;
-    delete iSortingStyle3;
-    iSortingStyle3 = NULL;
-    delete iDataBuffer;
-    iDataBuffer = NULL;    
-    delete iTestObserver;
-    iTestObserver = NULL;
-    delete iTestSorter;
-    iTestSorter = NULL;
-    delete iTestSorter1;
-    iTestSorter1 = NULL;
-    delete iTestGrouper;
-    iTestGrouper = NULL;
-    delete iTestGrouper1;
-    iTestGrouper1 = NULL;
-    delete iTestFilter;
-    iTestFilter = NULL;
-    delete iTestFilter1;
-    iTestFilter1 = NULL;
-    delete iMimeTypeArray;
-    iMimeTypeArray = NULL;
-    delete iMimeTypeArray1;
-    iMimeTypeArray1 = NULL;
-    delete iChangedItemObserver;
-    iChangedItemObserver = NULL;
-    delete iChangedItemObserver1;
-    iChangedItemObserver1 = NULL;
-    delete iOpaqueData;
-    iOpaqueData = NULL;
-    delete iModifiableItem;
-    iModifiableItem = NULL;
-    delete iTestCLFProcessObserver1;
-    iTestCLFProcessObserver1 = NULL;
-    delete iTestCLFProcessObserver;
-    iTestCLFProcessObserver = NULL;
-    
-    TTimeIntervalMicroSeconds32 time = 1000000;
-    TRAP_IGNORE( CCLFAsyncCallback::AfterL( time ) );
-    }
-
-/**
- * Tests, construction
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateEngineTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::CreateEngineTestL()
-    {
-    MCLFContentListingEngine* engine = NULL;
-    engine = ContentListingFactory::NewContentListingEngineLC();
-    EUNIT_ASSERT( engine );
-    CleanupStack::PopAndDestroy();
-    engine = NULL;
-    engine = ContentListingFactory::NewContentListingEngineLC();
-    CleanupStack::Pop();
-    EUNIT_ASSERT( engine );
-    delete engine;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateModifiableItemTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::CreateModifiableItemTestL()
-    {
-    MCLFModifiableItem* item = NULL;
-    item = ContentListingFactory::NewModifiableItemLC();
-    EUNIT_ASSERT( item );
-    CleanupStack::PopAndDestroy();
-    item = NULL;
-    item = ContentListingFactory::NewModifiableItemLC();
-    CleanupStack::Pop();
-    EUNIT_ASSERT( item );
-    delete item;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateSortignStyleTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::CreateSortignStyleTestL()
-    {
-    MCLFSortingStyle* sortingStyle = NULL;
-    sortingStyle = ContentListingFactory::NewSortingStyleLC();
-    EUNIT_ASSERT( sortingStyle );
-    CleanupStack::PopAndDestroy();
-    sortingStyle = NULL;
-    sortingStyle = ContentListingFactory::NewSortingStyleLC();
-    CleanupStack::Pop();
-    EUNIT_ASSERT( sortingStyle );
-    delete sortingStyle;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateSortignStyleFromResourceTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::CreateSortignStyleFromResourceTestL()
-    {
-    MCLFSortingStyle* sortingStyle = NULL;
-    sortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
-    EUNIT_ASSERT( sortingStyle );
-    CleanupStack::PopAndDestroy();
-    sortingStyle = NULL;
-
-    SortingStyleResourceL(); // refresh resource reader
-    sortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
-    CleanupStack::Pop();
-    EUNIT_ASSERT( sortingStyle );
-    delete sortingStyle;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateListModelTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::CreateListModelTestL()
-    {
-    MCLFItemListModel* model = NULL;
-    model = iEngine->CreateListModelLC( *iTestObserver );
-    EUNIT_ASSERT( model );
-    CleanupStack::PopAndDestroy();
-    model = NULL;
-
-    model = iEngine->CreateListModelLC( *iTestObserver );
-    CleanupStack::Pop();
-    EUNIT_ASSERT( model );
-    delete model;
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateListModelFromResourceTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::CreateListModelFromResourceTestL()
-    {
-    MCLFItemListModel* model = NULL;
-    model = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
-    EUNIT_ASSERT( model );
-    CleanupStack::PopAndDestroy();
-    model = NULL;
-
-    ListModelResourceL();
-    model = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
-    CleanupStack::Pop();
-    EUNIT_ASSERT( model );
-    delete model;
-
-
-    ResourceL( R_LIST_MODEL_INCORRECT_VERSION );
-    EUNIT_ASSERT_SPECIFIC_LEAVE( iEngine->CreateListModelLC( *iTestObserver, iResourceReader ), KErrNotSupported );
-   }
-
-/**
- * Tests, engine
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::UpdateItemsTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::UpdateItemsTestL()
-    {
-    // MDS will do the updating automatically in the background,
-    // thus only checking that the methods return correctly
-    iChangedItemObserver->iWait = &iWait;
-    iChangedItemObserver->iChangedArray = &iChangedArray;
-    iEngine->AddChangedItemObserverL( *iChangedItemObserver );
-    iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver );
-    iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver1 );
-
-    CreateNewFileL( 0, iFileName );
-    CreateNewFileL( 1, iFileName );
-    CreateNewFileL( 2, iFileName );
-    CreateNewFileL( 3, iFileName );
-    CreateNewFileL( 4, iFileName );
-    CreateNewFileL( 5, iFileName );
-
-// update server
-// to avoid incorrect test result
-    CreateNewFileL( 0, iFileName );
-    iEngine->UpdateItemsL();
-
-    EUNIT_ASSERT( iChangedItemObserver->iLastError == KErrNone );
-
-    iChangedArray.Reset();
-    iEngine->RemoveCLFProcessObserver( *iTestCLFProcessObserver1 );
-    iChangedItemObserver->iHandleItemChange = EFalse;
-    iChangedItemObserver1->iHandleItemChange = EFalse;
-    iTestCLFProcessObserver->Reset();
-    iTestCLFProcessObserver1->Reset();
-    iEngine->UpdateItemsL();
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::UpdateItemsWithIdTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::UpdateItemsWithIdTestL()
-    {
-    // MDS will do the updating automatically in the background,
-    // thus only checking that the methods return correctly
-    iChangedItemObserver->iWait = &iWait;
-    iChangedItemObserver->iChangedArray = &iChangedArray;
-    iEngine->AddChangedItemObserverL( *iChangedItemObserver );
-    iEngine->AddChangedItemObserverL( *iChangedItemObserver1 );
-    iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver );
-
-    CreateNewFileL( 0, iFileName );
-    CreateNewFileL( 1, iFileName );
-    CreateNewFileL( 2, iFileName );
-
-// update server
-// to avoid incorrect test result
-    CreateNewFileL( 0, iFileName );
-    iEngine->UpdateItemsL();
-    
-    EUNIT_ASSERT( iChangedItemObserver->iLastError == KErrNone );
-
-// start testing
-// update by id
-    TUint id1 = FindTestFileIdL( 1 );
-    TUint id0 = FindTestFileIdL( 0 );
-    TUint id2 = FindTestFileIdL( 2 );
-    iUpdateItemIdArray.AppendL( id1 );
-    iChangedItemObserver->iHandleItemChange = EFalse;
-    iChangedItemObserver1->iHandleItemChange = EFalse;
-    iTestCLFProcessObserver->Reset();
-    iTestCLFProcessObserver1->Reset();
-    CreateNewFileL( 0, iFileName );
-    CreateNewFileL( 1, iFileName );
-    iEngine->UpdateItemsL( iUpdateItemIdArray.Array() );
-    
-    EUNIT_ASSERT( iChangedItemObserver->iLastError == KErrNone );
-
-    iEngine->RemoveChangedItemObserver( *iChangedItemObserver1 );
-    iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver1 );
-
-    iChangedItemObserver->iHandleItemChange = EFalse;
-    iChangedItemObserver1->iHandleItemChange = EFalse;
-    iTestCLFProcessObserver->Reset();
-    iTestCLFProcessObserver1->Reset();
-    iUpdateItemIdArray.AppendL( id0 );
-    iUpdateItemIdArray.AppendL( id2 );
-    
-// update server
-// to avoid incorrect test result
-    iEngine->UpdateItemsL();
-    
-    EUNIT_ASSERT( iChangedItemObserver->iLastError == KErrNone );
-    
-    CreateNewFileL( 0, iFileName );
-    CreateNewFileL( 1, iFileName );
-    CreateNewFileL( 2, iFileName );
-    iChangedArray.Reset();
-    
-    iEngine->UpdateItemsL( iUpdateItemIdArray.Array() );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::UpdateItemsWithOpaqueDataFolderTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::UpdateItemsWithOpaqueDataFolderTestL()
-    {
-    // update server
-    // to avoid incorrect test result
-    iEngine->UpdateItemsL();
-    iWait.Start();
-
-    // start testing
-    // update by opaque data
-    // folders data
-    iSemanticId = KCLFUpdateFoldersSemanticId;
-    delete iOpaqueData;
-    iOpaqueData = NULL;
-
-    CDesCArray* fileArray = new (ELeave) CDesCArraySeg( 8 );
-    iOpaqueData = MakeOpaqueDataL( *fileArray );
-    // Calls internally same MDS method as when updating all data
-    // thus only interested if this call leaves
-    iEngine->UpdateItemsL( iSemanticId, *iOpaqueData );
-    }
-
-/**
- * Tests, list model
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::RefreshTestL
-// ---------------------------------------------------------------------------
-//  
-void T_CLFApiModuleTests::RefreshTestL()
-    {
-    iMimeTypeArray->Reset();
-    iMimeTypeArray->AppendL( _L("*") );
-    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
-
-    iTestObserver->iWait = &iWait;
-    iTestObserver->iError = 100;
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFRefreshComplete );
-    EUNIT_ASSERT( iTestObserver->iError == KErrNone );
-    EUNIT_ASSERT( iListModel->ItemCount() > 0 );
-
-// cancel refresh
-    iListModel->RefreshL();
-    iListModel->CancelRefresh();
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetSortingStyleTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::SetSortingStyleTestL()
-    {
-    iListModel->SetSortingStyle( NULL );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( !CheckFileNameShortingL() );
-
-// file name sorting
-    iSortingStyle->ResetL();
-    iSortingStyle->SetSortingDataType( ECLFItemDataTypeDesC );
-    iSortingStyle->AddFieldL( ECLFFieldIdFileName );
-    iListModel->SetSortingStyle( iSortingStyle );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( CheckFileNameShortingL() );
-
-// file size sorting
-    iSortingStyle1->ResetL();
-    iSortingStyle1->SetOrdering( ECLFOrderingDescending );
-    iSortingStyle1->SetSortingDataType( ECLFItemDataTypeTInt32 );
-    iSortingStyle1->AddFieldL( ECLFFieldIdFileSize );
-    iListModel->SetSortingStyle( iSortingStyle1 );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( CheckFileSizeShortingL() );
-
-    iListModel->SetSortingStyle( NULL );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( !CheckFileNameShortingL() );
-    EUNIT_ASSERT( !CheckFileSizeShortingL() );
-    EUNIT_ASSERT( !CheckFileDateShortingL() );
-
-// time sorting
-    iSortingStyle->ResetL();
-    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTTime );
-    iSortingStyle->AddFieldL( ECLFFieldIdFileDate );
-    iListModel->SetSortingStyle( iSortingStyle );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( CheckFileDateShortingL() );
-
-// parameter test (time)
-    iListModel->SetSortingStyle( NULL );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( !CheckFileNameShortingL() );
-    EUNIT_ASSERT( !CheckFileSizeShortingL() );
-    EUNIT_ASSERT( !CheckFileDateShortingL() );
-
-    iListModel->SetSortingStyle( iSortingStyle );
-    iListModel->RefreshL( ECLFRefreshPostFilter );
-    EUNIT_ASSERT( !CheckFileNameShortingL() );
-    EUNIT_ASSERT( !CheckFileSizeShortingL() );
-    EUNIT_ASSERT( !CheckFileDateShortingL() );
-
-    iListModel->RefreshL( ECLFRefreshGrouping );
-    EUNIT_ASSERT( !CheckFileNameShortingL() );
-    EUNIT_ASSERT( !CheckFileSizeShortingL() );
-    EUNIT_ASSERT( !CheckFileDateShortingL() );
-
-    iListModel->RefreshL( ECLFRefreshSorting );
-    EUNIT_ASSERT( !CheckFileNameShortingL() );
-    EUNIT_ASSERT( !CheckFileSizeShortingL() );
-    EUNIT_ASSERT( CheckFileDateShortingL() );
-
-// custom sorter (overwrite sorting style)
-    iTestSorter->iSortItems = EFalse;
-
-    iListModel->SetCustomSorter( iTestSorter );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iTestSorter->iSortItems );
-    EUNIT_ASSERT( !CheckFileNameShortingL() );
-    EUNIT_ASSERT( !CheckFileSizeShortingL() );
-    EUNIT_ASSERT( !CheckFileDateShortingL() );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetCustomSorterTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SetCustomSorterTestL()
-    {
-    iTestSorter->iSortItems = EFalse;
-    iTestSorter1->iSortItems = EFalse;
-
-    iListModel->SetCustomSorter( NULL );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( !iTestSorter->iSortItems );
-    EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
-    iTestSorter->iSortItems = EFalse;
-    iTestSorter1->iSortItems = EFalse;
-
-    iListModel->SetCustomSorter( iTestSorter );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iTestSorter->iSortItems );
-    EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
-    iTestSorter->iSortItems = EFalse;
-    iTestSorter1->iSortItems = EFalse;
-
-    iListModel->SetCustomSorter( iTestSorter1 );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( !iTestSorter->iSortItems );
-    EUNIT_ASSERT( iTestSorter1->iSortItems );
-
-    iTestSorter->iSortItems = EFalse;
-    iTestSorter1->iSortItems = EFalse;
-
-    iListModel->SetCustomSorter( NULL );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( !iTestSorter->iSortItems );
-    EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
-    iTestSorter->iSortItems = EFalse;
-    iTestSorter1->iSortItems = EFalse;
-
-    iListModel->SetCustomSorter( iTestSorter );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iTestSorter->iSortItems );
-    EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
-    iTestSorter->iSortItems = EFalse;
-    iTestSorter1->iSortItems = EFalse;
-
-    iListModel->SetCustomSorter( iTestSorter1 );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( !iTestSorter->iSortItems );
-    EUNIT_ASSERT( iTestSorter1->iSortItems );
-
-// parameter test
-    iTestSorter->iSortItems = EFalse;
-    iTestSorter1->iSortItems = EFalse;
-
-    iListModel->SetCustomSorter( NULL );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( !iTestSorter->iSortItems );
-    EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
-
-    iTestSorter->iSortItems = EFalse;
-    iTestSorter1->iSortItems = EFalse;
-
-    iListModel->SetCustomSorter( iTestSorter );
-    iListModel->RefreshL( ECLFRefreshPostFilter );
-    EUNIT_ASSERT( !iTestSorter->iSortItems );
-    EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
-    iListModel->RefreshL( ECLFRefreshGrouping );
-    EUNIT_ASSERT( !iTestSorter->iSortItems );
-    EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
-    iListModel->RefreshL( ECLFRefreshSorting );
-    EUNIT_ASSERT( iTestSorter->iSortItems );
-    EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::GroupingTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::GroupingTestL()
-    {
-    iTestGrouper->iModifiableItems = &iModifiableItems;
-    iTestGrouper1->iModifiableItems = &iModifiableItems;
-
-// No grouping
-    iListModel->SetCustomGrouper( NULL );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-
-// couple groups
-    iListModel->SetCustomGrouper( iTestGrouper );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iListModel->ItemCount() == iModifiableItems.Count() );
-
-// 0 groups
-    iTestGrouper1->iGroupCount = 0;
-    iListModel->SetCustomGrouper( iTestGrouper1 );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iListModel->ItemCount() == iModifiableItems.Count() );
-
-// No grouping
-    iListModel->SetCustomGrouper( NULL );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-// Music album grouping
-    iListModel->SetGroupingStyle( ECLFMusicAlbumGrouping );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iListModel->ItemCount() != iItemCount );
-// No grouping
-    iListModel->SetGroupingStyle( ECLFNoGrouping );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-
-// test parameters
-    iTestGrouper->iGroupCount = 1000;
-    iListModel->SetCustomGrouper( iTestGrouper );
-    iListModel->RefreshL( ECLFRefreshPostFilter );
-    EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-    iListModel->RefreshL( ECLFRefreshSorting );
-    EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-    iListModel->RefreshL( ECLFRefreshGrouping );
-    EUNIT_ASSERT( iListModel->ItemCount() == iModifiableItems.Count() );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetPostFilterTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SetPostFilterTestL()
-    {
-// no filter
-    iListModel->SetPostFilter( NULL );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-
-// filter couple items
-    iListModel->SetPostFilter( iTestFilter );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( ( iListModel->ItemCount() + iTestFilter->iFilteredCount ) == iItemCount );
-
-// filter all items
-    iListModel->SetPostFilter( iTestFilter1 );
-    iTestFilter1->iAllFilter = ETrue;
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) == iItemCount );
-
-// no filter
-    iListModel->SetPostFilter( NULL );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-
-// filter one item
-    iListModel->SetPostFilter( iTestFilter );
-    iTestFilter->iShouldFilterCount = 1;
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( ( iListModel->ItemCount() + iTestFilter->iFilteredCount ) == iItemCount );
-
-// filter couple items
-    iListModel->SetPostFilter( iTestFilter1 );
-    iTestFilter1->iAllFilter = EFalse;
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) == iItemCount );
-
-// test parameters
-    iListModel->SetPostFilter( NULL );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-    iListModel->SetPostFilter( iTestFilter1 );
-    iTestFilter1->iAllFilter = ETrue;
-    iListModel->RefreshL( ECLFRefreshSorting );
-    EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-    iListModel->RefreshL( ECLFRefreshGrouping );
-    EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-    iListModel->RefreshL( ECLFRefreshPostFilter );
-    EUNIT_ASSERT( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) == iItemCount );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetWantedMimeTypesTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SetWantedMimeTypesTestL()
-    {
-    iTestObserver->iWait = &iWait;
-
-// list not defined (mimetype)
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// couple mime types
-    iMimeTypeArray->Reset();
-    iMimeTypeArray->AppendL( _L( "audio/mpeg" ) );
-    iMimeTypeArray->AppendL( _L( "audio/aac" ) );
-    iMimeTypeArray->AppendL( _L( "audio/mp3" ) );
-    iMimeTypeArray->AppendL( _L( "audio/x-mp3" ) );
-    iMimeTypeArray->AppendL( _L( "audio/mp4" ) );
-    iMimeTypeArray->AppendL( _L( "audio/3gpp" ) );
-    iMimeTypeArray->AppendL( _L( "audio/m4a" ) );
-    iMimeTypeArray->AppendL( _L( "audio/3gpp2" ) );
-    iMimeTypeArray->AppendL( _L( "audio/mpeg4") );
-    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
-// unsupported mimetype
-    iMimeTypeArray1->Reset();
-    iMimeTypeArray1->AppendL( _L("ei tämmöstä ees pitäis olla")  );
-    iListModel->SetWantedMimeTypesL( *iMimeTypeArray1 );
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// empty mimetype list
-    iMimeTypeArray1->Reset();
-    iListModel->SetWantedMimeTypesL( *iMimeTypeArray1 );
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// from resource (mimetype)
-    iMimeTypeArray->Reset();
-    iMimeTypeArray->AppendL( _L("image/*")  );
-    iMimeTypeArray->AppendL( _L("audio/*")  );
-
-    ResourceL( R_MIME_TYPE_ARRAY );
-    iListModel->SetWantedMimeTypesL( iResourceReader );
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
-    ResourceL( R_MIME_TYPE_ARRAY_EMPTY );
-    iListModel->SetWantedMimeTypesL( iResourceReader );
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// incorrect resource version
-    ResourceL( R_MIME_TYPE_ARRAY_INCORRECT_VERSION );
-    EUNIT_ASSERT_SPECIFIC_LEAVE( iListModel->SetWantedMimeTypesL( iResourceReader ), KErrNotSupported );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetWantedMediaTypesTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SetWantedMediaTypesTestL()
-    {
-    iTestObserver->iWait = &iWait;
-
-// list not defined (mediatype)
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// couple media types
-    iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
-    iMediaTypeArray.AppendL( ECLFMediaTypeImage );
-    iMediaTypeArray.AppendL( ECLFMediaTypeSound );
-    iMediaTypeArray.AppendL( ECLFMediaTypeMusic );
-    iMediaTypeArray.AppendL( ECLFMediaTypeStreamingURL );
-    iMediaTypeArray.AppendL( ECLFMediaTypePlaylist );
-    iMediaTypeArray.AppendL( TCLFMediaType( ECLFMediaTypeCollection ) );
-
-    iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
-// empty media type list list
-    iListModel->SetWantedMediaTypesL( iMediaTypeArray1.Array() );
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// media type list from resource
-    iMediaTypeArray.Reset();
-    iMediaTypeArray.AppendL( ECLFMediaTypeImage );
-    iMediaTypeArray.AppendL( TCLFMediaType( ECLFMediaTypeCollection ) );
-    ResourceL( R_MEDIA_TYPE_ARRAY );
-    iListModel->SetWantedMediaTypesL( iResourceReader );
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
-// empty media type list from resource
-    ResourceL( R_MEDIA_TYPE_ARRAY_EMPTY );
-    iListModel->SetWantedMediaTypesL( iResourceReader );
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetWantedMediaAndMimeTypesTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SetWantedMediaAndMimeTypesTestL()
-    {
-    iTestObserver->iWait = &iWait;
-
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// couple types
-    iMimeTypeArray->AppendL( _L( "audio/mpeg" ) );
-    iMimeTypeArray->AppendL( _L( "audio/aac" ) );
-    iMimeTypeArray->AppendL( _L( "audio/mp3" ) );
-    iMimeTypeArray->AppendL( _L( "audio/x-mp3" ) );
-    iMimeTypeArray->AppendL( _L( "audio/mp4" ) );
-    iMimeTypeArray->AppendL( _L( "audio/3gpp" ) );
-    iMimeTypeArray->AppendL( _L( "audio/m4a" ) );
-    iMimeTypeArray->AppendL( _L( "audio/3gpp2" ) );
-    iMimeTypeArray->AppendL( _L( "audio/mpeg4") );
-    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
-
-    iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
-    iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
-// refresh again
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
-// empty lists
-    iMediaTypeArray.Reset();
-    iMimeTypeArray->Reset();
-    iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
-    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
-    iListModel->RefreshL();
-    iWait.Start();
-    EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MultibleSortingTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::MultibleSortingTestL()
-    {
-
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( CheckMultibleSortingShortingL() );
-
-// resort
-
-    iSortingStyle->ResetL();
-    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
-    iSortingStyle->AddFieldL( KMultibleSortingTestField6 );
-    iSortingStyle->AddFieldL( KMultibleSortingTestField5 );
-    iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
-    iListModel->SetSortingStyle( iSortingStyle );
-    iListModel->RefreshL( ECLFRefreshAll );
-    EUNIT_ASSERT( CheckMultibleSortingShorting2L() );
-
-    }
-
-/*
-* Test model item(s) obsolate functionality
-*/
-
-// ---------------------------------------------------------------------------
-// ModelItemsChangedTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ModelItemsChangedTestL()
-    {
-    const TInt newFileNumber( 10 );
-
-// create test files
-    CreateNewFileL( 0, iFileName );
-    CreateNewFileL( 1, iFileName );
-    CreateNewFileL( 2, iFileName );
-    CreateNewFileL( newFileNumber, iFileName );
-    User::LeaveIfError( iFs.Delete( iFileName ) );
-
-// update server
-// to avoid incorrect test result
-    CreateNewFileL( 0, iFileName );
-    iEngine->UpdateItemsL();
-
-// create list model with all files
-    iMimeTypeArray->Reset();
-    iMimeTypeArray->AppendL( _L("*") );
-    iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
-
-    iTestObserver->iWait = &iWait;
-    iTestObserver->iError = 100;
-    iListModel->RefreshL();
-    iWait.Start();  // wait until model is refreshed
-    EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFRefreshComplete );
-    EUNIT_ASSERT( iTestObserver->iError == KErrNone );
-    EUNIT_ASSERT( iListModel->ItemCount() > 0 );
-
-    const TInt listModelItemCount( iListModel->ItemCount() );
-    const TCLFItemId testId( FindTestFileIdL( 0 ) );
-
-// test with modified item
-    CreateNewFileL( 0, iFileName );
-    iEngine->UpdateItemsL();
-    iWait.Start(); // wait until model outdated event is received
-
-    EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFModelOutdated );
-    EUNIT_ASSERT( iTestObserver->iError == KErrNone );
-    EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount );
-    EUNIT_ASSERT( NULL != FindItem( *iListModel, testId ) );
-
-    iTestObserver->iError = 100;
-    iListModel->RefreshL();
-    iWait.Start();  // wait until model is refreshed
-    EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFRefreshComplete );
-    EUNIT_ASSERT( iTestObserver->iError == KErrNone );
-    EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount );
-    EUNIT_ASSERT( NULL != FindItem( *iListModel, testId ) );
-
-// test with new item
-    CreateNewFileL( newFileNumber, iFileName );
-    iEngine->UpdateItemsL();
-    iWait.Start(); // wait until model outdated event is received
-
-    EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFModelOutdated );
-    EUNIT_ASSERT( iTestObserver->iError == KErrNone );
-    EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount );
-
-    iTestObserver->iError = 100;
-    iListModel->RefreshL();
-    iWait.Start();  // wait until model is refreshed
-    EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFRefreshComplete );
-    EUNIT_ASSERT( iTestObserver->iError == KErrNone );
-    EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount + 1 );
-
-// delete file
-    User::LeaveIfError( iFs.Delete( iFileName ) );
-    iEngine->UpdateItemsL();
-    iWait.Start(); // wait until model outdated event is received
-
-    EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFModelOutdated );
-    EUNIT_ASSERT( iTestObserver->iError == KErrNone );
-    EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount + 1 );
-
-    iTestObserver->iError = 100;
-    iListModel->RefreshL();
-    iWait.Start();  // wait until model is refreshed
-    EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFRefreshComplete );
-    EUNIT_ASSERT( iTestObserver->iError == KErrNone );
-    EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount );
-    }
-
-/**
- * Tests, Modifiable item
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MIFieldTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::MIFieldTestL()
-    {
-    const TUint KTestField1 = 1;
-    const TUint KTestField2 = 112312312;
-    const TUint KTestField3 = 13333;
-    const TUint KTestFieldIncorrect = 2;
-
-    TTime time( 100 );
-    TInt32 integer( 12 );
-    TBuf<30> data( _L("data") );
-    iModifiableItem->AddFieldL( KTestField1, time );
-    iModifiableItem->AddFieldL( KTestField2, integer );
-    iModifiableItem->AddFieldL( KTestField3, data );
-
-// data type test
-    EUNIT_ASSERT( iModifiableItem->DataType(
-                                KTestField1 ) == ECLFItemDataTypeTTime );
-    EUNIT_ASSERT( iModifiableItem->DataType(
-                                KTestField2 ) == ECLFItemDataTypeTInt32 );
-    EUNIT_ASSERT( iModifiableItem->DataType(
-                                KTestField3 ) == ECLFItemDataTypeDesC );
-    EUNIT_ASSERT( iModifiableItem->DataType(
-                                KTestFieldIncorrect ) == ECLFItemDataTypeNull );
-    EUNIT_ASSERT( iModifiableItem->DataType(
-                                ECLFFieldIdNull ) == ECLFItemDataTypeNull );
-
-// get field
-    TTime time1( 0 );
-    TInt32 integer1( 0 );
-    TPtrC ptr;
-    EUNIT_ASSERT( KErrNone == iModifiableItem->GetField(
-                                                KTestField1, time1 ) );
-    EUNIT_ASSERT( time == time1 );
-    EUNIT_ASSERT( KErrNone == iModifiableItem->GetField(
-                                                KTestField2, integer1 ) );
-    EUNIT_ASSERT( integer == integer1 );
-    EUNIT_ASSERT( KErrNone == iModifiableItem->GetField(
-                                                KTestField3, ptr ) );
-    EUNIT_ASSERT( data == ptr );
-
-// incorrect field id
-    EUNIT_ASSERT( KErrNotFound == iModifiableItem->GetField(
-                                                KTestFieldIncorrect, ptr ) );
-    EUNIT_ASSERT( KErrNotFound == iModifiableItem->GetField(
-                                                KTestFieldIncorrect, integer1 ) );
-    EUNIT_ASSERT( KErrNotFound == iModifiableItem->GetField(
-                                                KTestFieldIncorrect, time1 ) );
-
-// incorrect field type
-    EUNIT_ASSERT( KErrNotSupported == iModifiableItem->GetField(
-                                                KTestField1, ptr ) );
-    EUNIT_ASSERT( KErrNotSupported == iModifiableItem->GetField(
-                                                KTestField3, integer1 ) );
-    EUNIT_ASSERT( KErrNotSupported == iModifiableItem->GetField(
-                                                KTestField2, time1 ) );
-
-
-    EUNIT_ASSERT( iModifiableItem->ItemId() == 0 );
-    }
-
-/**
- * Tests, item
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ItemFieldTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::ItemFieldTestL()
-    {
-// data type test
-    EUNIT_ASSERT( iItem->DataType(
-                                ECLFFieldIdFileDate ) == ECLFItemDataTypeTTime );
-    EUNIT_ASSERT( iItem->DataType(
-                                ECLFFieldIdFileSize ) == ECLFItemDataTypeTInt32 );
-    EUNIT_ASSERT( iItem->DataType(
-                                ECLFFieldIdFileNameAndPath ) == ECLFItemDataTypeDesC );
-    EUNIT_ASSERT( iItem->DataType(
-                                ECLFFieldIdNull ) == ECLFItemDataTypeNull );
-
-// get field
-    TTime time1( 0 );
-    TInt32 integer1( 0 );
-    TPtrC ptr;
-    TEntry entry;
-    User::LeaveIfError( iFs.Entry( iFileName, entry ) );
-
-    EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdFileDate, time1 ) );
-    EUNIT_ASSERT( entry.iModified == time1 );
-    EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdFileSize, integer1 ) );
-    EUNIT_ASSERT( entry.iSize == integer1 );
-    EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdFileNameAndPath, ptr ) );
-    EUNIT_ASSERT( iFileName == ptr );
-
-    TParsePtrC parse( iFileName );
-
-    EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdFileExtension, ptr ) );
-    EUNIT_ASSERT( parse.Ext() == ptr );
-
-    EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdFileName, ptr ) );
-    EUNIT_ASSERT( parse.Name() == ptr );
-
-    EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdPath, ptr ) );
-    EUNIT_ASSERT( parse.Path() == ptr );
-
-    EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdDrive, ptr ) );
-    EUNIT_ASSERT( parse.Drive() == ptr );
-
-
-// incorrect field id
-    EUNIT_ASSERT( KErrNotFound == iItem->GetField(
-                                                ECLFFieldIdNull, ptr ) );
-    EUNIT_ASSERT( KErrNotFound == iItem->GetField(
-                                                ECLFFieldIdNull, integer1 ) );
-    EUNIT_ASSERT( KErrNotFound == iItem->GetField(
-                                                ECLFFieldIdNull, time1 ) );
-
-// incorrect field type
-    EUNIT_ASSERT( KErrNotSupported == iItem->GetField(
-                                                ECLFFieldIdFileSize, ptr ) );
-    EUNIT_ASSERT( KErrNotSupported == iItem->GetField(
-                                                ECLFFieldIdFileDate, integer1 ) );
-    EUNIT_ASSERT( KErrNotSupported == iItem->GetField(
-                                                ECLFFieldIdFileNameAndPath, time1 ) );
-
-
-    EUNIT_ASSERT( iItem->ItemId() != 0 );
-    }
-
-/**
- * Tests, Sorting style
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleResourceTestL
-// ---------------------------------------------------------------------------
-//  
-void T_CLFApiModuleTests::SortingStyleResourceTestL()
-    {
-    const TInt KArray1IdCount( 4 );
-    const TInt KArray2IdCount( 1 );
-
-
-    RArray<TCLFItemId> itemIdArray;
-    CleanupClosePushL( itemIdArray );
-
-    EUNIT_ASSERT( iSortingStyle->Ordering() == ECLFOrderingAscending );
-    EUNIT_ASSERT( iSortingStyle1->Ordering() == ECLFOrderingDescending );
-    EUNIT_ASSERT( iSortingStyle2->Ordering() == ECLFOrderingDescending );
-    EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeTInt32 );
-    EUNIT_ASSERT( iSortingStyle1->SortingDataType() == ECLFItemDataTypeDesC );
-    EUNIT_ASSERT( iSortingStyle2->SortingDataType() == ECLFItemDataTypeDesC );
-
-    iSortingStyle->GetFieldsL( itemIdArray );
-
-    EUNIT_ASSERT( itemIdArray.Count() == 0 );
-
-    itemIdArray.Reset();
-    iSortingStyle1->GetFieldsL( itemIdArray );
-
-    EUNIT_ASSERT( itemIdArray.Count() == KArray1IdCount );
-
-    itemIdArray.Reset();
-    iSortingStyle2->GetFieldsL( itemIdArray );
-
-    EUNIT_ASSERT( itemIdArray.Count() == KArray2IdCount );
-
-    CleanupStack::PopAndDestroy( &itemIdArray ); // itemIdArray.Close
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleOrderingTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::SortingStyleOrderingTestL()
-    {
-    iSortingStyle->SetOrdering( ECLFOrderingAscending );
-    EUNIT_ASSERT( iSortingStyle->Ordering() == ECLFOrderingAscending );
-    iSortingStyle->SetOrdering( ECLFOrderingDescending );
-    EUNIT_ASSERT( iSortingStyle->Ordering() == ECLFOrderingDescending );
-    iSortingStyle->SetOrdering( ECLFOrderingAscending );
-    EUNIT_ASSERT( iSortingStyle->Ordering() == ECLFOrderingAscending );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleDataTypeTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::SortingStyleDataTypeTestL()
-    {
-    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
-    EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeTInt32 );
-    iSortingStyle->SetSortingDataType( ECLFItemDataTypeDesC );
-    EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeDesC );
-    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTTime );
-    EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeTTime );
-    iSortingStyle->SetSortingDataType( ECLFItemDataTypeNull );
-    EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeNull );
-    iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
-    EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeTInt32 );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleUndefinedItemPositionTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::SortingStyleUndefinedItemPositionTestL()
-    {
-    iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
-    EUNIT_ASSERT( iSortingStyle->UndefinedItemPosition() == ECLFSortingStyleUndefinedEnd );
-    iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
-    EUNIT_ASSERT( iSortingStyle->UndefinedItemPosition() == ECLFSortingStyleUndefinedFirst );
-    iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
-    EUNIT_ASSERT( iSortingStyle->UndefinedItemPosition() == ECLFSortingStyleUndefinedEnd );
-    }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleFieldTestL
-// ---------------------------------------------------------------------------
-// 
-void T_CLFApiModuleTests::SortingStyleFieldTestL()
-    {
-    RArray<TCLFItemId> itemIdArray;
-    CleanupClosePushL( itemIdArray );
-
-    iSortingStyle->GetFieldsL( itemIdArray );
-    EUNIT_ASSERT( itemIdArray.Count() == 0 );
-
-    iSortingStyle->AddFieldL( ECLFFieldIdFileName );
-    iSortingStyle->AddFieldL( ECLFFieldIdCollectionId );
-    iSortingStyle->AddFieldL( ECLFFieldIdCollectionName );
-    iSortingStyle->AddFieldL( ECLFFieldIdArtist );
-
-    iSortingStyle->GetFieldsL( itemIdArray );
-
-    EUNIT_ASSERT( itemIdArray.Count() == 4 );
-
-    itemIdArray.Reset();
-    iSortingStyle->ResetL();
-    iSortingStyle->GetFieldsL( itemIdArray );
-    EUNIT_ASSERT( itemIdArray.Count() == 0 );
-
-    CleanupStack::PopAndDestroy( &itemIdArray ); // itemIdArray.Close
-    }
-
-// ---------------------------------------------------------------------------
-// Test case table for this test suite class
-// ---------------------------------------------------------------------------
-// 
-
-EUNIT_BEGIN_TEST_TABLE( T_CLFApiModuleTests, "T_CLFApiModuleTests", "MODULE" )
-
-// Constructor tests
-    EUNIT_TEST( "Create engine",
-                "",
-                "",
-                "FUNCTIONALITY",
-                BaseSetupL,
-                CreateEngineTestL,
-                Teardown )
-
-    EUNIT_TEST( "Create modifiable item",
-                "",
-                "",
-                "FUNCTIONALITY",
-                BaseSetupL,
-                CreateModifiableItemTestL,
-                Teardown )
-
-    EUNIT_TEST( "Create sorting style",
-                "",
-                "",
-                "FUNCTIONALITY",
-                BaseSetupL,
-                CreateSortignStyleTestL,
-                Teardown )
-
-    EUNIT_TEST( "Create sorting style from resource",
-                "",
-                "",
-                "FUNCTIONALITY",
-                SortingStyleResourceSetupL,
-                CreateSortignStyleFromResourceTestL,
-                Teardown )
-
-    EUNIT_TEST( "Create list model",
-                "",
-                "",
-                "FUNCTIONALITY",
-                CreateModelSetupL,
-                CreateListModelTestL,
-                Teardown )
-
-    EUNIT_TEST( "Create list model from resource",
-                "",
-                "",
-                "FUNCTIONALITY",
-                CreateModelFromResourceSetupL,
-                CreateListModelFromResourceTestL,
-                Teardown )
-
-// Engine tests
-
-    EUNIT_TEST( "Engine update test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                EngineTestSetupL,
-                UpdateItemsTestL,
-                Teardown )
-
-    EUNIT_TEST( "Engine update test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                EngineTestSetupL,
-                UpdateItemsWithIdTestL,
-                Teardown )
-
-    EUNIT_TEST( "Engine update test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                EngineTestSetupL,
-                UpdateItemsWithOpaqueDataFolderTestL,
-                Teardown )
-
-// Sorting Style tests
-    EUNIT_TEST( "Sorting style from resource",
-                "",
-                "",
-                "FUNCTIONALITY",
-                SortingStyleResourceTestSetupL,
-                SortingStyleResourceTestL,
-                Teardown )
-
-    EUNIT_TEST( "Sorting style ordering test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                SortingStyleTestSetupL,
-                SortingStyleOrderingTestL,
-                Teardown )
-
-    EUNIT_TEST( "Sorting style data type test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                SortingStyleTestSetupL,
-                SortingStyleDataTypeTestL,
-                Teardown )
-
-    EUNIT_TEST( "Sorting style undefined item position test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                SortingStyleTestSetupL,
-                SortingStyleUndefinedItemPositionTestL,
-                Teardown )
-
-    EUNIT_TEST( "Sorting style field test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                SortingStyleTestSetupL,
-                SortingStyleFieldTestL,
-                Teardown )
-
-// List model tests
-    EUNIT_TEST( "List model refresh test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                ListModelSetupL,
-                RefreshTestL,
-                Teardown )
-
-    EUNIT_TEST( "List model sorting style test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                ListModelAllFileItemsSetupL,
-                SetSortingStyleTestL,
-                Teardown )
-
-    EUNIT_TEST( "List model custom sorter test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                ListModelAllFileItemsSetupL,
-                SetCustomSorterTestL,
-                Teardown )
-
-    EUNIT_TEST( "List model grouping test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                ListModelAllFileItemsSetupL,
-                GroupingTestL,
-                Teardown )
-
-    EUNIT_TEST( "List model post filter test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                ListModelAllFileItemsSetupL,
-                SetPostFilterTestL,
-                Teardown )
-
-    EUNIT_TEST( "List model wanted mime types test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                ListModelSetupL,
-                SetWantedMimeTypesTestL,
-                Teardown )
-
-    EUNIT_TEST( "List model wanted media types test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                ListModelSetupL,
-                SetWantedMediaTypesTestL,
-                Teardown )
-
-    EUNIT_TEST( "List model wanted media and mime types",
-                "",
-                "",
-                "FUNCTIONALITY",
-                ListModelSetupL,
-                SetWantedMediaAndMimeTypesTestL,
-                Teardown )
-
-    EUNIT_TEST( "List model multible sorters",
-                "",
-                "",
-                "FUNCTIONALITY",
-                MultibleSortingSetupL,
-                MultibleSortingTestL,
-                Teardown )
-
-    EUNIT_TEST( "List model multible sorters",
-                "",
-                "",
-                "FUNCTIONALITY",
-                MultibleSortingResourceSetupL,
-                MultibleSortingTestL,
-                Teardown )
-
-    EUNIT_TEST( "List model changed items",
-                "",
-                "",
-                "FUNCTIONALITY",
-                ListModelSetupL,
-                ModelItemsChangedTestL,
-                Teardown )
-
-
-// Modifiable item tests
-    EUNIT_TEST( "Modifiable item test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                ModifiableItemTestSetupL,
-                MIFieldTestL,
-                Teardown )
-
-// Item tests
-    EUNIT_TEST( "Item test",
-                "",
-                "",
-                "FUNCTIONALITY",
-                ItemTestSetupL,
-                ItemFieldTestL,
-                Teardown )
-
-
-EUNIT_END_TEST_TABLE
-
-//  End of File
--- a/mds_pub/content_listing_framework_api/tsrc/src/T_ContentListingFramework.rss	Mon Mar 15 12:42:24 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-*
-*/
-
-
-
-//  RESOURCE IDENTIFIER
-NAME    CLFT
-
-//  INCLUDES
-#include <eikon.rh>
-#include <PathConfiguration.hrh>
-#include <CLFContentListing.rh>
-#include <CLFContentListing.hrh>
-#include <CLFContentListingExtended.hrh>
-
-//  CONSTANTS
-//  MACROS
-
-//  RESOURCE DEFINITIONS
-// -----------------------------------------------------------------------------
-//
-// ?resource_name
-// ?description
-//
-// -----------------------------------------------------------------------------
-//
-RESOURCE RSS_SIGNATURE { signature = 0; }
-
-// -----------------------------------------------------------------------------
-//
-// ?resource_name
-// ?description
-//
-// -----------------------------------------------------------------------------
-//
-RESOURCE CLF_SORTING_STYLE r_sorting_style
-    {
-    ordering = ECLFOrderingDescending;
-    data_type = ECLFItemDataTypeDesC;
-    fields =
-        {
-        CLF_FIELD_ID { field_id = ECLFFieldIdFileName; },
-        CLF_FIELD_ID { field_id = ECLFFieldIdCollectionName; },
-        CLF_FIELD_ID { field_id = ECLFFieldIdMimeType; },
-        CLF_FIELD_ID { field_id = ECLFFieldIdArtist; }
-        };
-    }
-
-RESOURCE CLF_SORTING_STYLE r_sorting_style_empty
-    {
-    ordering = ECLFOrderingAscending;
-    data_type = ECLFItemDataTypeTInt32;
-    fields =
-        {
-        };
-    }
-
-RESOURCE CLF_SORTING_STYLE r_sorting_style_undefineditem
-    {
-    ordering = ECLFOrderingDescending;
-    data_type = ECLFItemDataTypeDesC;
-    undefined_item_position = ECLFSortingStyleUndefinedFirst;
-    fields =
-        {
-        CLF_FIELD_ID { field_id = ECLFFieldIdArtist; }
-        };
-    }
-
-RESOURCE CLF_LIST_MODEL r_list_model
-    {
-    mime_type_array = CLF_MIME_TYPE_ARRAY
-        {
-        mime_types =
-            {
-            LBUF { txt = "image/*"; }
-            };
-        };
-    media_type_array = CLF_MEDIA_TYPE_ARRAY
-        {
-        media_types =
-            {
-            CLF_MEDIA_TYPE { media_type = ECLFMediaTypeCollection; }
-            };
-        };
-    sorting_style = CLF_SORTING_STYLE
-        {
-        ordering = ECLFOrderingAscending;
-        data_type = ECLFItemDataTypeDesC;
-        fields =
-            {
-            CLF_FIELD_ID { field_id = ECLFFieldIdFileName; },
-            CLF_FIELD_ID { field_id = ECLFFieldIdCollectionName; },
-            CLF_FIELD_ID { field_id = ECLFFieldIdAlbum; }
-            };
-        };
-    }
-
-RESOURCE CLF_LIST_MODEL r_list_model_incorrect_version
-    {
-    version = 88;
-    mime_type_array = CLF_MIME_TYPE_ARRAY
-        {
-        mime_types =
-            {
-            };
-        };
-    media_type_array = CLF_MEDIA_TYPE_ARRAY
-        {
-        media_types =
-            {
-            };
-        };
-    sorting_style = CLF_SORTING_STYLE
-        {
-        ordering = ECLFOrderingAscending;
-        data_type = ECLFItemDataTypeDesC;
-        fields =
-            {
-            };
-        };
-    }
-
-
-RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array
-    {
-    mime_types =
-        {
-        LBUF { txt = "image/*"; },
-        LBUF { txt = "audio/*"; }
-        };
-    }
-
-RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array_empty
-    {
-    mime_types =
-        {
-        };
-    }
-
-RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array_incorrect_version
-    {
-    version = 88;
-    mime_types =
-        {
-        };
-    }
-
-RESOURCE CLF_MEDIA_TYPE_ARRAY r_media_type_array
-    {
-    media_types =
-        {
-        CLF_MEDIA_TYPE { media_type = ECLFMediaTypeImage; },
-        CLF_MEDIA_TYPE { media_type = ECLFMediaTypeCollection; }
-        };
-    }
-
-RESOURCE CLF_MEDIA_TYPE_ARRAY r_media_type_array_empty
-    {
-    media_types =
-        {
-        };
-    }
-
-RESOURCE CLF_LIST_MODEL_V2 r_list_model_multible
-     {
-    mime_type_array = CLF_MIME_TYPE_ARRAY
-        {
-        mime_types =
-            {
-            };
-        };
-     media_type_array = CLF_MEDIA_TYPE_ARRAY
-         {
-         media_types =
-             {
-             };
-         };
-     sorting_style_array =
-        {
-        CLF_SORTING_STYLE
-            {
-            ordering = ECLFOrderingAscending;
-            data_type = ECLFItemDataTypeTInt32;
-            undefined_item_position = ECLFSortingStyleUndefinedFirst;
-            fields =
-                {
-                CLF_FIELD_ID { field_id = 0x80000001; }
-                };
-            },
-        CLF_SORTING_STYLE
-            {
-            ordering = ECLFOrderingDescending;
-            data_type = ECLFItemDataTypeTInt32;
-            undefined_item_position = ECLFSortingStyleUndefinedEnd;
-            fields =
-                {
-                CLF_FIELD_ID { field_id = 0x80000002; }
-                };
-            },
-        CLF_SORTING_STYLE
-            {
-            ordering = ECLFOrderingAscending;
-            data_type = ECLFItemDataTypeTInt32;
-            undefined_item_position = ECLFSortingStyleUndefinedEnd;
-            fields =
-                {
-                CLF_FIELD_ID { field_id = 0x80000003; },
-                CLF_FIELD_ID { field_id = 0x80000004; }
-                };
-            },
-        CLF_SORTING_STYLE
-            {
-            ordering = ECLFOrderingAscending;
-            data_type = ECLFItemDataTypeTInt32;
-            undefined_item_position = ECLFSortingStyleUndefinedFirst;
-            fields =
-                {
-                CLF_FIELD_ID { field_id = 0x80000005; }
-                };
-            }
-        };
-    }
-
-
-// End of File
-
-
--- a/metadataengine/server/inc/mdsnotifier.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/metadataengine/server/inc/mdsnotifier.h	Wed Mar 31 22:19:07 2010 +0300
@@ -100,7 +100,7 @@
 				*	Return the id of this entry
 				*	@return The id
 				*/
-				TInt Id()
+				TInt Id() const
 					{
 					return iId;
 					}
@@ -355,7 +355,11 @@
 		void NotifySchemaAddedL();
 		
 		TBool CheckForNotifier( TUint32 aNotifyTypes );
-	
+
+    private:
+		
+		static TInt Compare( const TEntry& aFirst, const TEntry& aSecond );
+		
 	private: // data members
 
         /** the entry array */
--- a/metadataengine/server/inc/mdsserver.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/metadataengine/server/inc/mdsserver.h	Wed Mar 31 22:19:07 2010 +0300
@@ -151,6 +151,8 @@
         TBool DiskFull() const;
         
         TBool BackupOrRestoreRunning() const;
+        
+        TBool ShutdownInProgress() const;
 
         TInt SetHarvestingPrioritizationChunkL( const RMessagePtr2 aMessage, TInt aParam );
 
--- a/metadataengine/server/inc/mdsserversession.h	Mon Mar 15 12:42:24 2010 +0200
+++ b/metadataengine/server/inc/mdsserversession.h	Wed Mar 31 22:19:07 2010 +0300
@@ -436,6 +436,10 @@
         * Cache of notification events
         */        
     	RPointerArray<CNotificationCacheItem> iNotificationCache;
+    	
+	private: // Compare methods
+    	
+        static TInt ComparePropertiesCacheItem( const CNotificationCacheItem& aFirst, const CNotificationCacheItem& aSecond );
     };
 
 #endif // __MDESERVERSESSION_H__
--- a/metadataengine/server/src/mdsfindsqlclause.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/metadataengine/server/src/mdsfindsqlclause.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -558,6 +558,11 @@
 		{
 		// No property filters so get all properties
 		
+	    if( !iObjectDef )
+	        {
+	        User::Leave( KErrMdEUnknownObjectDef );
+	        }
+	
 		// "SELECT BO.* "
 		iQueryBuf->AppendL( KSelectAllFromBaseObject );
 	
--- a/metadataengine/server/src/mdsmaintenanceengine.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/metadataengine/server/src/mdsmaintenanceengine.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -116,6 +116,7 @@
 //
 void CMdSMaintenanceEngine::InstallL( CMdSManipulationEngine& aManipulate, CMdsSchema& aSchema )
     {
+    __LOG1( ELogAlways, "Trying to validate MDS DB, error expected if not created(first boot): %d", 0 );
     if ( !(iMaintenance->ValidateL( ) ) )
         {
         // first-time init: re-form the database completely
--- a/metadataengine/server/src/mdsnotifier.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/metadataengine/server/src/mdsnotifier.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -465,10 +465,10 @@
     TConditionType aType, CMdCSerializationBuffer* aSerializedBuffer,
     TDefId aNamespaceDefId, CMdSServerSession& aSession, TBool aConfidential )
     {
-
-    User::LeaveIfError( iEntries.Append(
-        TEntry( aId, aType, aSerializedBuffer, aNamespaceDefId, aSession, aConfidential ) ) );
-    return iEntries[ iEntries.Count() - 1 ];
+    TEntry entry = TEntry( aId, aType, aSerializedBuffer, aNamespaceDefId, aSession, aConfidential ); 
+    User::LeaveIfError( iEntries.InsertInOrder( entry, TLinearOrder<TEntry>(CMdSNotifier::Compare) ) ); 
+    
+    return FindEntryL( aId );
     }
 
 // ------------------------------------------------
@@ -478,17 +478,29 @@
 CMdSNotifier::TEntry& CMdSNotifier::FindEntryL( TInt aId )
     {
     CMdSNotifier::TEntry* entry = NULL;
-    
-    const TInt count = iEntries.Count();
+
+    TInt low( 0 );
+    TInt high( iEntries.Count() );
     
-    for ( TInt i = 0; i < count; ++i )
+    while( low < high )
         {
-        if ( iEntries[i].iId == aId )
+        TInt mid( (low+high)>>1 );
+        
+        const TInt compare( aId - iEntries[mid].Id() );
+        if( compare == 0 )
             {
-            entry = &iEntries[i];
+            entry = &iEntries[mid];
             break;
             }
-        }
+        else if( compare > 0 )
+            {
+            low = mid + 1;
+            }
+        else
+            {
+            high = mid;
+            }
+        }    
 
     if( !entry )
     	{
@@ -504,33 +516,55 @@
 //
 void CMdSNotifier::RemoveEntryL( TInt aId )
     {
-    const TInt count = iEntries.Count();
+    CMdSNotifier::TEntry* e = NULL;
+
+    TInt low( 0 );
+    TInt mid( 0 );
+    TInt high( iEntries.Count() );
     
-    for ( TInt i = 0; i < count; ++i )
+    while( low < high )
         {
-        TEntry& e = iEntries[i];
-        if ( e.iId == aId )
+        mid = (low+high)>>1;
+        
+        const TInt compare( aId - iEntries[mid].Id() );
+        if( compare == 0 )
             {
-            if ( e.IsPending() )
-                {
-                e.TriggerError( KErrCancel );
-                }
-            
-            if ( e.iSerializedCondition )
-            	{
-            	delete e.iSerializedCondition;
-            	e.iSerializedCondition = NULL;
-            	}
-            if ( e.iDataBuffer )
-            	{
-            	delete e.iDataBuffer;
-            	e.iDataBuffer = NULL;
-            	}
-            iEntries.Remove( i );
-            return;
+            e = &iEntries[mid];
+            break;
+            }
+        else if( compare > 0 )
+            {
+            low = mid + 1;
+            }
+        else
+            {
+            high = mid;
             }
         }
-    User::Leave( KErrNotFound );
+    
+    if( e )
+        {
+        if ( e->IsPending() )
+            {
+            e->TriggerError( KErrCancel );
+            }
+    
+        if ( e->iSerializedCondition )
+            {
+            delete e->iSerializedCondition;
+            e->iSerializedCondition = NULL;
+            }
+        if ( e->iDataBuffer )
+            {
+            delete e->iDataBuffer;
+            e->iDataBuffer = NULL;
+            }
+        iEntries.Remove( mid );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
     }
 
 // ------------------------------------------------
@@ -637,12 +671,9 @@
                              matchingItemIdArray, matchingItemUriArray ) );    
                     }
             	}
-            // Copy of each uri is made to each client, which will own the returned uri
-            // Thus URI ownership is transferred and original array can be destroyed
-            matchingItemUriArray.ResetAndDestroy();
             }
 
-   		CleanupStack::PopAndDestroy( 2, &matchingItemIdArray );
+   		CleanupStack::PopAndDestroy( 2, &matchingItemIdArray ); // matchingItemIdArray, matchingItemUriArray
         }
     CleanupStack::PopAndDestroy( 2, &allItemsIdArray ); // allItemsIdArray, allItemsUriArray
     }
@@ -971,11 +1002,8 @@
                             matchingObjectIdArray, matchingItemUriArray ) );    
                     }
                 }
-            // Copy of each uri is made to each client, which will own the returned uri
-            // Thus URI ownership is transferred and original array can be destroyed
-            matchingItemUriArray.ResetAndDestroy();
             }
-		CleanupStack::PopAndDestroy( 2, &matchingObjectIdArray );
+		CleanupStack::PopAndDestroy( 2, &matchingObjectIdArray ); // matchingItemIdArray, matchingItemUriArray
         }
     CleanupStack::PopAndDestroy( 2, &allItemsIdArray ); // allItemsIdArray, allItemsUriArray
     }
@@ -1341,6 +1369,10 @@
             	}
 	        }
 		}
-
 	}
 
+TInt CMdSNotifier::Compare( const TEntry& aFirst, const TEntry& aSecond )
+    {
+    return aFirst.Id() - aSecond.Id();
+    }
+
--- a/metadataengine/server/src/mdsserver.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/metadataengine/server/src/mdsserver.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -549,21 +549,23 @@
 	{
 	return iBackupOrRestoreRunning;
 	}
-    
+  
+TBool CMdSServer::ShutdownInProgress() const
+    {
+    return iShutdown;
+    }
+
 // -----------------------------------------------------------------------------
 // CMdSServer::ShutdownNotification
 // -----------------------------------------------------------------------------
 //
 void CMdSServer::ShutdownNotification()
     {
-
-    
     if (!iShutdown)
         {    
         CActiveScheduler::Stop();
         iShutdown = ETrue;
         }
-    
     }
 
 // -----------------------------------------------------------------------------
--- a/metadataengine/server/src/mdsserversession.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/metadataengine/server/src/mdsserversession.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -115,6 +115,12 @@
 		return;
 		}
 
+    if( iServer.ShutdownInProgress() )
+        {
+        aMessage.Complete( KErrServerTerminated );
+        return;
+        }
+	
     TRAPD( err, ServiceFunctionL( aMessage ) );
     if( err != KErrNone )
         {
@@ -951,30 +957,42 @@
 
     CMdSNotifier::TEntry& entry = iServer.Notifier().FindEntryL( notifierId );
     entry.SetupForCallback( aMsg, 1 );
+
+    const TInt entryId = entry.Id();    
+
+    TInt low( 0 );
+    TInt high( iNotificationCache.Count() );
     
-	const TInt count = iNotificationCache.Count();
-	for( TInt i = 0; i < count; ++i )
-		{
-		const TInt notificationCacheId = iNotificationCache[i]->iId;
-		const TInt entryId = entry.Id();
+    while( low < high )
+        {
+        TInt mid( (low+high)>>1 );
+        
+        const TInt compare( entryId - iNotificationCache[mid]->iId );
+        if( compare == 0 )
+            {
+            // The cache holds a new notification for this notifier, trigger it
+            CNotificationCacheItem* item = iNotificationCache[mid];
+            iNotificationCache.Remove(mid);
 
-		if( notificationCacheId == entryId )
-			{
-			// The cache holds a new notification for this notifier, trigger it
-			CNotificationCacheItem* item = iNotificationCache[i];
-			iNotificationCache.Remove(i);
-
-			CleanupStack::PushL( item );
+            CleanupStack::PushL( item );
 
-			entry.TriggerCachedL( item->iCode, item->iData );
-			
-			// take ownership of iData from item and delete it
-			item->iData = NULL;
-			CleanupStack::PopAndDestroy( item );
-			
-			return;
-			}
-		}
+            entry.TriggerCachedL( item->iCode, item->iData );
+        
+            // take ownership of iData from item and delete it
+            item->iData = NULL;
+            CleanupStack::PopAndDestroy( item );
+        
+            return;
+            }
+        else if( compare > 0 )
+            {
+            low = mid + 1;
+            }
+        else
+            {
+            high = mid;
+            }
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -1174,7 +1192,8 @@
 	CleanupStack::Pop( aData );
 	CleanupStack::PushL( item );
 
-	iNotificationCache.AppendL( item );
+	iNotificationCache.InsertInOrderAllowRepeats( item, 
+	                              TLinearOrder<CNotificationCacheItem>(CMdSServerSession::ComparePropertiesCacheItem)); 
 
 	CleanupStack::Pop( item );
 	}
@@ -1634,3 +1653,8 @@
 	return KErrNone;
 	}
 
+TInt CMdSServerSession::ComparePropertiesCacheItem(const CNotificationCacheItem& aFirst, const CNotificationCacheItem& aSecond)
+    {
+    return aFirst.iId - aSecond.iId;
+    }
+
--- a/metadataengine/server/src/mdssqlobjectmanipulate.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/metadataengine/server/src/mdssqlobjectmanipulate.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -420,7 +420,7 @@
 
     RRowData var;
     CleanupClosePushL( var );
-    var.ReserveL( 5 );
+    var.ReserveL( 6 );
     var.AppendL( TColumn( EMdEObjectFlagRemoved ) );
     var.AppendL( TColumn( EMdEObjectFlagNotPresent ) ); // not present flag
     var.AppendL( TColumn( EMdEObjectFlagStartUpNotPresent ) ); // start up not present flag
@@ -509,6 +509,7 @@
 		clauseBuffer.BufferL().Format( KSetFileToPresent, KDefaultNamespaceDefId );
 
 	    RRowData var;
+	    var.ReserveL( 3 );
 	    CleanupClosePushL( var );
 	    // reset not present and start up not present flags
 	    var.AppendL( TColumn( ~(EMdEObjectFlagNotPresent | EMdEObjectFlagStartUpNotPresent) ) );
@@ -533,29 +534,33 @@
 void CMdSSqlObjectManipulate::SetRelationsToPresentL(TItemId aObjectId, 
 		RArray<TItemId>& aIdArray)
 	{
-	_LIT( KSearchNotPresentRelations, "SELECT RelationId FROM Relations%u WHERE NOT Flags&? AND Flags&? AND (LeftObjectId=? OR RightObjectId=?);" );
-	_LIT( KSetRelationsToPresent, "UPDATE Relations%u SET Flags=Flags&? WHERE Flags&? AND (LeftObjectId=? OR RightObjectId=?);" );
-
-	RClauseBuffer commonClauseOne(*this, KSearchNotPresentRelations.iTypeLength + KMaxUintValueLength);
+	_LIT( KSearchNotPresentRelations, "SELECT RelationId FROM Relations%u WHERE NOT Flags&? AND Flags&? AND LeftObjectId=? UNION SELECT RelationId FROM Relations%u WHERE NOT Flags&? AND Flags&? AND RightObjectId=?;" );
+	_LIT( KSetRelationsToPresent1, "UPDATE Relations%u SET Flags=Flags&? WHERE Flags&? AND LeftObjectId=?;" );
+	_LIT( KSetRelationsToPresent2, "UPDATE Relations%u SET Flags=Flags&? WHERE Flags&? AND RightObjectId=?;" );
+
+	RClauseBuffer commonClauseOne(*this, KSearchNotPresentRelations.iTypeLength + 2*KMaxUintValueLength);
 	CleanupClosePushL( commonClauseOne );
 	CMdsClauseBuffer& clauseBuffer = commonClauseOne.BufferL();
-	clauseBuffer.BufferL().Format( KSearchNotPresentRelations, KDefaultNamespaceDefId );
+	clauseBuffer.BufferL().Format( KSearchNotPresentRelations, KDefaultNamespaceDefId, KDefaultNamespaceDefId );
 
     CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
     RRowData var;
     CleanupClosePushL( var );
     
-    var.ReserveL( 4 ); // reserve space for flags and object IDs
+    var.ReserveL( 6 ); // reserve space for flags and object IDs
     var.AppendL( TColumn( EMdERelationFlagDeleted ) );
     var.AppendL( TColumn( EMdERelationFlagNotPresent ) );
     var.AppendL( TColumn( aObjectId ) );
+    var.AppendL( TColumn( EMdERelationFlagDeleted ) );
+    var.AppendL( TColumn( EMdERelationFlagNotPresent ) );
     var.AppendL( TColumn( aObjectId ) );
 
 	RMdsStatement statement;
 	CleanupClosePushL( statement );
 	connection.ExecuteQueryL( clauseBuffer.ConstBufferL(), statement, var );
 
-	var.Free();	var.Reset();
+	var.Free();	
+	var.Reset();
     TItemId relationId(0);
     var.AppendL( TColumn( relationId ) );
 	while( connection.NextRowL( statement, var ) )
@@ -564,8 +569,21 @@
 		aIdArray.AppendL( relationId );
 		}
 
-	clauseBuffer.ReserveSpaceL( KSetRelationsToPresent.iTypeLength + KMaxUintValueLength );
-	clauseBuffer.BufferL().Format( KSetRelationsToPresent, KDefaultNamespaceDefId );
+	clauseBuffer.ReserveSpaceL( KSetRelationsToPresent1.iTypeLength + KMaxUintValueLength );
+	clauseBuffer.BufferL().Format( KSetRelationsToPresent1, KDefaultNamespaceDefId );
+
+    var.Free(); 
+    var.Reset();
+
+    var.ReserveL( 3 );
+    var.AppendL( TColumn( ~EMdERelationFlagNotPresent ) ); // reset not present flag
+    var.AppendL( TColumn( EMdERelationFlagNotPresent ) );
+    var.AppendL( TColumn( aObjectId ) );
+
+    connection.ExecuteL( clauseBuffer.ConstBufferL(), var );
+
+    clauseBuffer.ReserveSpaceL( KSetRelationsToPresent2.iTypeLength + KMaxUintValueLength );
+    clauseBuffer.BufferL().Format( KSetRelationsToPresent2, KDefaultNamespaceDefId );
 
     var.Free(); 
     var.Reset();
@@ -573,17 +591,15 @@
     var.AppendL( TColumn( ~EMdERelationFlagNotPresent ) ); // reset not present flag
     var.AppendL( TColumn( EMdERelationFlagNotPresent ) );
     var.AppendL( TColumn( aObjectId ) );
-    var.AppendL( TColumn( aObjectId ) );
 
     connection.ExecuteL( clauseBuffer.ConstBufferL(), var );
-
+    
 	CleanupStack::PopAndDestroy( 3, &commonClauseOne ); // statement, var, clauseBuffer
 	}
 
 void CMdSSqlObjectManipulate::SetFilesToNotPresentL(TUint32 aMediaId, TBool aStartUp,
 		RArray<TItemId>& aObjectIds)
-	{
-	
+	{	
 	_LIT( KSearchPresentFilesStartUpL, "SELECT ObjectId FROM Object%u WHERE NOT Flags&? AND MediaId=?;" );
 	_LIT( KSearchPresentFilesL, "SELECT ObjectId FROM Object%u WHERE NOT Flags&? AND NOT Flags&? AND MediaId=?;" );
 	
@@ -631,23 +647,31 @@
 		aObjectIds.AppendL( objectId );
 		}
 
-	_LIT( KSetFilesToNotPresent, "UPDATE Object%u SET Flags=Flags|? WHERE MediaId=?;" );
-	clauseBuffer.ReserveSpaceL( 
-			KSetFilesToNotPresent.iTypeLength + 
-			KMaxUintValueLength ); // TUint32 max value's lenght is 10 numbers so %u + 8
-	clauseBuffer.BufferL().Format( KSetFilesToNotPresent, KDefaultNamespaceDefId );
-
-	var.Free(); 
-	var.Reset();
-
+    var.Free(); 
+    var.Reset();
+	
 	if( aStartUp )
-		{
-		var.AppendL( TColumn( EMdEObjectFlagStartUpNotPresent ) ); // set not present flag
-		}
-	else 
-		{
-		var.AppendL( TColumn( EMdEObjectFlagNotPresent ) ); // set not present flag
-		}
+	    {
+        _LIT( KSetFilesToNotPresentBoot, "UPDATE Object%u SET Flags=Flags|? WHERE MediaId=?;" );
+        clauseBuffer.ReserveSpaceL( 
+                KSetFilesToNotPresentBoot.iTypeLength + 
+                KMaxUintValueLength ); // TUint32 max value's lenght is 10 numbers so %u + 8
+        clauseBuffer.BufferL().Format( KSetFilesToNotPresentBoot, KDefaultNamespaceDefId );
+
+        var.AppendL( TColumn( EMdEObjectFlagStartUpNotPresent ) ); // set not present flag
+	    }
+	else
+	    {
+        _LIT( KSetFilesToNotPresent, "UPDATE Object%u SET Flags=Flags|? WHERE NOT (Flags&?)<>0 AND MediaId=?;" );
+        clauseBuffer.ReserveSpaceL( 
+                KSetFilesToNotPresent.iTypeLength + 
+                KMaxUintValueLength ); // TUint32 max value's lenght is 10 numbers so %u + 8
+        clauseBuffer.BufferL().Format( KSetFilesToNotPresent, KDefaultNamespaceDefId );
+
+        var.AppendL( TColumn( EMdEObjectFlagNotPresent ) ); // set not present flag	
+        var.AppendL( TColumn( EMdEObjectFlagNotPresent ) ); // check not present flag 
+	    }
+
 	var.AppendL( TColumn( aMediaId ) );
 
     connection.ExecuteL( clauseBuffer.ConstBufferL(), var );
@@ -665,7 +689,7 @@
 	// RelationIDs query sql statement
 	RClauseBuffer commonClauseOne(*this, 
 			KSearchPresentRelations.iTypeLength + 
-			2*KMaxUintValueLength  );
+			10*KMaxUintValueLength  );
     CleanupClosePushL( commonClauseOne );
 	CMdsClauseBuffer& clauseBufferOne = commonClauseOne.BufferL();
 	clauseBufferOne.BufferL().Format( KSearchPresentRelations, 
@@ -702,7 +726,8 @@
 	
     // Set objects' relations not present by MediaID
 	RClauseBuffer commonClauseTwo(*this, 
-			KSetRelationsToPresent.iTypeLength + 
+			KSetRelationsToPresent.iTypeLength + 			 
+            KMaxUintValueLength +
 			clauseBufferOne.ConstBufferL().Length() );
 	
     CleanupClosePushL( commonClauseTwo );
@@ -741,6 +766,7 @@
 
 		RRowData var;
 		CleanupClosePushL( var );
+		var.ReserveL( 4 );
 		var.AppendL( TColumn( EMdEObjectFlagRemoved ) );
 		var.AppendL( TColumn( EMdEObjectFlagNotPresent ) );
 		var.AppendL( TColumn( EMdEObjectFlagStartUpNotPresent ) );
@@ -777,6 +803,7 @@
 
     RRowData var;
     CleanupClosePushL( var );
+    var.ReserveL( 5 ); 
     var.AppendL( TColumn( EMdEObjectFlagRemoved ) );
     var.AppendL( TColumn( EMdEObjectFlagRemoved ) );
     var.AppendL( TColumn( EMdEObjectFlagNotPresent ) ); // not present flag
@@ -1735,6 +1762,7 @@
     // do remove
     RRowData varRemove;
     CleanupClosePushL( varRemove );
+    varRemove.ReserveL( 3 );
     varRemove.AppendL( TColumn( EMdEObjectFlagRemoved ) );
     varRemove.AppendL( TColumn( aObjectId ) );
     varRemove.AppendL( TColumn( aUri ) );
@@ -1828,7 +1856,8 @@
 
 	db.ExecuteQueryL( checkObjectClause.ConstBufferL(), query, rowData );
 
-	rowData.Free();	rowData.Reset();
+	rowData.Free();	
+	rowData.Reset();
 	rowData.ReserveL( 3 ); // space for SELECTs
 
 	TMdCObject object;
@@ -2002,11 +2031,14 @@
 void CMdSSqlObjectManipulate::CollectRemovedItemsL( RArray<TItemId>& aRemoveIds, RArray<TItemId>& aObjectIds,
                                                     RArray<TItemId>& aRelationIds, RArray<TItemId>& /*aEventIds*/ )
 	{
-	_LIT( KCollectGetDeleteId,          "SELECT O.ObjectId, R.RelationId FROM Object%u AS O LEFT JOIN Relations%u AS R ON O.ObjectId=R.LeftObjectId OR O.ObjectId=R.RightObjectId WHERE NOT O.Flags&? AND ObjectId IN(?" );
+    _LIT( KCollectGetDeleteId1, "SELECT O.ObjectId, R.RelationId FROM Object%u AS O LEFT JOIN Relations%u AS R ON O.ObjectId=R.LeftObjectId WHERE NOT O.Flags&? AND ObjectId IN(?");
+    _LIT( KCollectGetDeleteId2, " UNION SELECT O.ObjectId, R.RelationId FROM Object%u AS O LEFT JOIN Relations%u AS R ON O.ObjectId=R.RightObjectId WHERE NOT O.Flags&? AND ObjectId IN(?");
+
 	_LIT( KCollectUpdateObjectBegin,    "UPDATE Object%u SET Flags=Flags|? WHERE ObjectId IN(?" );
 	_LIT( KCollectUpdateRelationsBegin, "UPDATE Relations%u SET Flags=Flags|? WHERE RelationId IN(?" );
 	_LIT( KCollectMiddle, ",?" );
-	_LIT( KCollectEnd,    ");" );
+	_LIT( KCollectEnd1,    ")" );
+	_LIT( KCollectEnd2,    ");" );
 
 	const TInt removeIdsCount = aRemoveIds.Count();
 	if (removeIdsCount < 1)
@@ -2015,27 +2047,58 @@
 		}
 
 	CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
-	RClauseBuffer commonClauseOne(*this,  KCollectGetDeleteId().Length() + 2 * KMaxUintValueLength +
-											(removeIdsCount-1) * KCollectMiddle().Length() +
-											KCollectEnd().Length());
+	
+	const TInt clauseSize( KCollectGetDeleteId1().Length() + 2*KMaxUintValueLength +
+                                      (removeIdsCount-1) * KCollectMiddle().Length() +
+                                      KCollectEnd1().Length() +
+                                      KCollectGetDeleteId2().Length() + KMaxUintValueLength +
+                                      (removeIdsCount-1) * KCollectMiddle().Length() +
+                                      KCollectEnd2().Length() );
+	
+	HBufC* clause = HBufC::NewLC( clauseSize );
+	
+	TPtr clauseBuffer( clause->Des() );
+	clauseBuffer.Append( KCollectGetDeleteId1 );	
+	for( TInt i = removeIdsCount - 2; i >=0; i-- )
+        {
+	    clauseBuffer.Append( KCollectMiddle );
+        }
+	clauseBuffer.Append( KCollectEnd1 );	
+    
+	clauseBuffer.Append( KCollectGetDeleteId2 );
+    for( TInt i = removeIdsCount - 2; i >=0; i-- )
+        {
+        clauseBuffer.Append( KCollectMiddle );
+        }
+    clauseBuffer.Append( KCollectEnd2 );  
+	
+    RClauseBuffer commonClauseOne(*this,  clauseSize );
 	CleanupClosePushL( commonClauseOne );
 	CMdsClauseBuffer& buffer = commonClauseOne.BufferL();
 
 	// getting removed object id and relation id
+	buffer.BufferL().Format( clauseBuffer, 
+	                                    iNamespaceDef->GetId(), 
+	                                    iNamespaceDef->GetId(),
+	                                    iNamespaceDef->GetId(), 
+	                                    iNamespaceDef->GetId() );
+
 	RRowData dataRow;
 	CleanupClosePushL( dataRow );
-	dataRow.ReserveL( removeIdsCount );
+	dataRow.ReserveL( removeIdsCount*2 + 2 );
 	dataRow.AppendL( TColumn( EMdEObjectFlagRemoved ) );
-	buffer.BufferL().Format( KCollectGetDeleteId, iNamespaceDef->GetId(), iNamespaceDef->GetId() );
-	for (TInt i = 0; i < removeIdsCount; ++i)
-		{
-		if(i>0)
-			{
-			buffer.AppendL( KCollectMiddle );
-			}
-		dataRow.AppendL( TColumn( aRemoveIds[i] ) );
-		}
-	buffer.AppendL( KCollectEnd );
+	
+    for( TInt i = removeIdsCount - 1; i >=0; i-- )
+        {
+        dataRow.AppendL( TColumn( aRemoveIds[i] ) );
+        }
+
+    dataRow.AppendL( TColumn( EMdEObjectFlagRemoved ) );
+    
+    for( TInt i = removeIdsCount - 1; i >=0; i-- )
+        {
+        dataRow.AppendL( TColumn( aRemoveIds[i] ) );
+        }
 
 	RMdsStatement objectQuery;
 	CleanupClosePushL( objectQuery );
@@ -2043,7 +2106,8 @@
 	__LOGQUERY_16( _L("Find objects to delete:"), buffer.ConstBufferL(), dataRow);
 	connection.ExecuteQueryL( buffer.ConstBufferL(), objectQuery, dataRow );
 
-	dataRow.Free();	dataRow.Reset();
+	dataRow.Free();	
+	dataRow.Reset();
 	TItemId objectId = KNoId;
     TItemId prevId = objectId;
     TItemId relationId = KNoId;
@@ -2079,7 +2143,7 @@
 		{
 		buffer.ReserveSpaceL( KCollectUpdateObjectBegin().Length() + KMaxUintValueLength +
 							   (removeObjectCount-1) * KCollectMiddle().Length() +
-							   KCollectEnd().Length() );
+							   KCollectEnd2().Length() );
 
 		buffer.BufferL().Format( KCollectUpdateObjectBegin, iNamespaceDef->GetId() );
 
@@ -2095,7 +2159,7 @@
 				}
 			dataRow.AppendL( TColumn( aObjectIds[i] ) );
 			}
-		buffer.AppendL( KCollectEnd );
+		buffer.AppendL( KCollectEnd2 );
 
 		__LOGQUERY_16( _L("Remove objects:"), buffer.ConstBufferL(), dataRow);
 		connection.ExecuteL( buffer.ConstBufferL(), dataRow );
@@ -2108,7 +2172,7 @@
 		{
 		buffer.ReserveSpaceL( KCollectUpdateRelationsBegin().Length() + KMaxUintValueLength +
 							   (removeRelationCount-1) * KCollectMiddle().Length() +
-							   KCollectEnd().Length() );
+							   KCollectEnd2().Length() );
 
 		buffer.BufferL().Format( KCollectUpdateRelationsBegin, iNamespaceDef->GetId() );
 
@@ -2124,14 +2188,14 @@
 				}
 			dataRow.AppendL( TColumn( aRelationIds[i] ) );
 			}
-		buffer.AppendL( KCollectEnd );
+		buffer.AppendL( KCollectEnd2 );
 
 		__LOGQUERY_16( _L("Remove relations:"), buffer.ConstBufferL(), dataRow);
 		connection.ExecuteL( buffer.ConstBufferL(), dataRow );
 		}
 
 
-	CleanupStack::PopAndDestroy( 3, &commonClauseOne ); // objectQuery, dataRow, commonClauseOne
+	CleanupStack::PopAndDestroy( 4, clause ); // objectQuery, dataRow, commonClauseOne, clause
 	}
 
 void CMdSSqlObjectManipulate::RemoveObjectsByIdL( 
@@ -2153,7 +2217,9 @@
 	for (TUint32 i = 0; i < aCount; ++i)
 		{
 		aBuffer.ReceiveL( objectId );
-		if ( objectId != KNoId )
+		if ( objectId != KNoId && 
+		     objectId != KSystemFavouritesAlbumId && 
+		     objectId != KSystemCapturedAlbumId )
 			{
 			if ( iLockList.IsLocked( *iNamespaceDef, objectId ) )
 				{
@@ -2201,7 +2267,9 @@
 		{
 		TPtrC16 uri = aBuffer.ReceivePtr16L();
         objectId = SearchObjectByUriL( uri, flags );
-		if ( objectId != KNoId )
+        if ( objectId != KNoId && 
+             objectId != KSystemFavouritesAlbumId && 
+             objectId != KSystemCapturedAlbumId )
 			{
 			// unlock object, so update is no possible anymore
 			if ( iLockList.IsLocked( *iNamespaceDef, objectId ) )
@@ -2248,6 +2316,7 @@
 
     RRowData varSearch;
     CleanupClosePushL( varSearch );
+    varSearch.ReserveL( 3 );
     varSearch.AppendL( TColumn( EMdEObjectFlagNotPresent ) );
     varSearch.AppendL( TColumn( EMdEObjectFlagRemoved ) );
     varSearch.AppendL( TColumn( aUri ) );
@@ -2298,6 +2367,7 @@
 
     RRowData varSearch;
     CleanupClosePushL( varSearch );
+    varSearch.ReserveL( 2 );
     varSearch.AppendL( TColumn( EMdEObjectFlagNotPresent ) );
     varSearch.AppendL( TColumn( aId ) );
 
@@ -2805,6 +2875,7 @@
 
     RRowData varRemove;
     CleanupClosePushL( varRemove );
+    varRemove.ReserveL( 3 );
     varRemove.AppendL( TColumn( 
     		EMdERelationFlagDeleted | EMdERelationFlagGarbageDeleted ) );
     varRemove.AppendL( TColumn( relationId ) );
--- a/package_definition.xml	Mon Mar 15 12:42:24 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<SystemDefinition schema="3.0.0">
-  <package id="mds" name="Metadata Services" levels="mgr eng server int">
-    <collection id="clfwrapper" name="Content Listing Framework Wrapper" level="int">
-      <component id="clfwrapper_build" filter="s60" name="CLF Wrapper Build" introduced="^2">
-        <unit bldFile="clfwrapper/group"/>
-      </component>
-    </collection>
-    <collection id="contextengine" name="Context Engine" level="eng">
-      <component id="contextengine_plugins" filter="s60" name="Context Engine Plugins" class="plugin" introduced="^2">
-        <unit bldFile="contextengine/plugins/group"/>
-      </component>
-      <component id="contextengine_build" filter="s60" name="Context Engine Build" introduced="^2">
-        <unit bldFile="contextengine/group"/>
-      </component>
-    </collection>
-    <collection id="harvester" name="Harvester" level="eng">
-      <component id="blacklistclient" filter="s60" name="Blacklist Client" introduced="^2">
-        <unit bldFile="harvester/blacklistclient/group"/>
-      </component>
-      <component id="blacklistserver" filter="s60" name="Blacklist Server" introduced="^2">
-        <unit bldFile="harvester/blacklistserver/group"/>
-      </component>
-      <component id="harvester_common" filter="s60" name="Harvester Common" introduced="^2">
-        <unit bldFile="harvester/common/group"/>
-      </component>
-      <component id="composerplugins" filter="s60" name="Composer Plugins" class="plugin" introduced="^2">
-        <unit bldFile="harvester/composerplugins/group"/>
-      </component>
-      <component id="harvesterplugins" filter="s60" name="Harvester Plugins" class="plugin" introduced="^2">
-        <!-- <unit bldFile="harvester/harvesterplugins/audioplaylistplugin/group"/> -->
-        <unit bldFile="harvester/harvesterplugins/group"/>
-      </component>
-      <component id="monitorplugins" filter="s60" name="Monitor Plugins" class="plugin" introduced="^2">
-        <unit bldFile="harvester/monitorplugins/group"/>
-      </component>
-      <component id="harvester_server" filter="s60" name="Harvester Server" introduced="^2">
-        <unit bldFile="harvester/server/group"/>
-      </component>
-      <component id="harvester_client" filter="s60" name="Harvester Client" introduced="^2">
-        <unit bldFile="harvester/client/group"/>
-      </component>
-      <component id="harvester_build" filter="s60" name="Harvester Build" introduced="^2">
-        <unit bldFile="harvester/group"/>
-      </component>
-    </collection>
-    <collection id="locationmanager" name="Location Manager" level="mgr">
-      <component id="locationtrail" filter="s60" name="Location Trail" introduced="^2">
-        <unit bldFile="locationmanager/locationtrail/group"/>
-      </component>
-      <component id="locationmanager_server" filter="s60" name="Location Manager Server" introduced="^2">
-        <unit bldFile="locationmanager/server/group"/>
-      </component>
-      <component id="locationmanager_client" filter="s60" name="Location Manager Client" introduced="^2">
-        <unit bldFile="locationmanager/client/group"/>
-      </component>
-      <component id="locationmanager_build" filter="s60" name="Location Manager Build" introduced="^2">
-      	<!--consider making this collection a single component  -->
-        <unit bldFile="locationmanager/group"/>
-      </component>
-    </collection>
-    <collection id="metadataengine" name="Metadata Engine" level="eng">
-      <component id="metadataengine_common" filter="s60" name="Metadata Engine Common" introduced="^2">
-        <unit bldFile="metadataengine/common/group"/>
-      </component>
-      <component id="metadataengine_server" filter="s60" name="Metadata Engine Server" introduced="^2">
-        <unit bldFile="metadataengine/server/group"/>
-      </component>
-      <component id="metadataengine_client" filter="s60" name="Metadata Engine Client" introduced="^2">
-        <unit bldFile="metadataengine/client/group"/>
-      </component>
-      <component id="metadataengine_build" filter="s60" name="Metadata Engine Build" introduced="^2">
-      	<!--consider making this collection a single component  -->
-        <unit bldFile="metadataengine/group"/>
-      </component>
-    </collection>
-    <collection id="watchdog" name="Watchdog" level="server">
-      <component id="mdswatchdog" filter="s60" name="Metadata Watchdog" introduced="^2">
-        <unit bldFile="watchdog/group"/>
-      </component>
-    </collection>
-    <collection id="iadstoprestart" name="IAD Stop/Restart" level="server">
-      <component id="iadstoprestart_build" filter="s60" name="IAD Stop Restart Build" introduced="^2">
-        <!-- <unit bldFile="iadstoprestart/group"/> -->
-      </component>
-    </collection>
-    <collection id="mds_info" name="Metadata Services Info" level="int">
-      <component id="mds_pub" filter="s60" name="Metadata Services Public Interfaces" class="api" introduced="^2">
-        <unit bldFile="mds_pub/group"/>
-      </component>
-      <component id="mds_plat" filter="s60" name="Metadata Services Platform Interfaces" class="api" introduced="^2">
-        <unit bldFile="mds_plat/group"/>
-        <!--  should #include the rets if they're needed -->
-        <!-- <unit bldFile="mds_plat/content_listing_framework_collection_manager_api/tsrc/group"/> -->
-        <!-- <unit bldFile="mds_plat/context_engine_plugin_api/tsrc/group"/> -->
-        <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/composerplugintest/group"/> -->
-        <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/group"/> -->
-        <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/harvesterclienttest/group"/> -->
-        <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/harvesterdatatest/group"/> -->
-        <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/harvesterplugintest/group"/> -->
-        <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/monitorplugintest/group"/> -->
-        <!-- <unit bldFile="mds_plat/location_manager_api/tsrc/group"/> -->
-        <!-- <unit bldFile="mds_plat/metadata_engine_api/tsrc/group"/> -->
-      </component>
-      <component id="mds_build" filter="s60" name="Metadata Services Build" introduced="^2">
-      	<!-- consider distributiing this into the rest of the components in the package -->
-        <unit bldFile="group"/>
-      </component>
-    </collection>
-  </package>
-</SystemDefinition>
--- a/rom/ContentListingFramework.iby	Mon Mar 15 12:42:24 2010 +0200
+++ b/rom/ContentListingFramework.iby	Wed Mar 31 22:19:07 2010 +0300
@@ -21,9 +21,6 @@
 file=ABI_DIR\BUILD_DIR\ContentListingFramework.dll                     SHARED_LIB_DIR\ContentListingFramework.dll
 file=ABI_DIR\BUILD_DIR\MediaCollectionManager.dll                      SHARED_LIB_DIR\MediaCollectionManager.dll
 
-// Backup registration
-data=ZPRIVATE\101F8857\backup_registration.xml                         	private\101F8857\backup_registration.xml
-
 // Stubs
 //data=ZSYSTEM\install\ContentListingFrameworkStub.sis    System\Install\ContentListingFrameworkStub.sis
 
Binary file sis/mds/mds_stub.sis has changed
--- a/sis/mds/package.pkg	Mon Mar 15 12:42:24 2010 +0200
+++ b/sis/mds/package.pkg	Wed Mar 31 22:19:07 2010 +0300
@@ -17,7 +17,7 @@
 &EN
 
 ;packet-header (name, uid, major, minor, build, type)
-#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 8, TYPE=SA, RU
+#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 10, TYPE=SA, RU
 
 ; Localised vendor name
 %{"Nokia"}
--- a/sis/mds/package_separate.pkg	Mon Mar 15 12:42:24 2010 +0200
+++ b/sis/mds/package_separate.pkg	Wed Mar 31 22:19:07 2010 +0300
@@ -17,7 +17,7 @@
 &EN
 
 ;packet-header (name, uid, major, minor, build, type)
-#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 8, TYPE=SA, RU
+#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 10, TYPE=SA, RU
 
 ; Localised vendor name
 %{"Nokia"}
--- a/sis/mds/stub.pkg	Mon Mar 15 12:42:24 2010 +0200
+++ b/sis/mds/stub.pkg	Wed Mar 31 22:19:07 2010 +0300
@@ -17,7 +17,7 @@
 &EN
 
 ; Header
-#{"Metadata System"}, (0x200009F5), 9, 20, 8, TYPE=SA
+#{"Metadata System"}, (0x200009F5), 9, 20, 10, TYPE=SA
 
 ; Localised Vendor name
 %{"Nokia"}
--- a/watchdog/src/watchdog.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/watchdog/src/watchdog.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -98,25 +98,36 @@
     // Double check that harvester server is not already running
     TFullName name;
     TInt res( KErrNone );
-        
-    // find Harvester Server
+   
+    // find really Harvester Server, using TFindServer to avoid logon a dead process
+    TFindServer findServer( KHarvesterServerProcess );
+    if ( findServer.Next(name) == KErrNone )
+        {
+        TFindProcess findProcess( KHarvesterServerProcess );
+        if ( findProcess.Next(name) == KErrNone )
+            {
+            PRINT(_L("CWatchdog::Start() - server already running, start listening"));
+            
+            iProcess.Close();
+            res = iProcess.Open(name);
+            if ( res != KErrNone )
+                {
+                PRINT(_L("CWatchdog::Start() - error in starting listening "));
+                return;
+                }
+            iState = EWaitingRendezvous;
+            SetActive();
+            return;
+            }
+        }  
+    
+    // close the panic process
     TFindProcess findProcess( KHarvesterServerProcess );
     if ( findProcess.Next(name) == KErrNone )
         {                
-        PRINT(_L("CWatchdog::Start() - server already running, start listening"));
-        
         iProcess.Close();
-        res = iProcess.Open(name);
-        if ( res != KErrNone )
-            {
-            PRINT(_L("CWatchdog::Start() - error in starting listening "));
-            return;
-            }
-        iState = EWaitingRendezvous;   
-        SetActive();
-        return;
-        }        
-    
+        }
+
     // Create the server process
     // KNullDesC param causes server's E32Main() to be run
     res = iProcess.Create( KHarvesterServerExe, KNullDesC );