Revision: 201007
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Mar 2010 09:38:01 +0200
changeset 20 6dfc5f825351
parent 3 b73a2e62868f
child 21 50bf9db68373
Revision: 201007 Kit: 201011
clfwrapper/ClientSrc/CCLFDbItemProvider.cpp
clfwrapper/ClientSrc/CCLFDefaultOperation.cpp
clfwrapper/ClientSrc/CCLFItemImpl.cpp
clfwrapper/ClientSrc/CCLFItemListModelImpl.cpp
clfwrapper/ClientSrc/CCLFServerProxy.cpp
clfwrapper/ClientSrc/CLFUtils.cpp
clfwrapper/group/mediacollectionmanager.mmp
contextengine/group/contextengine.mmp
contextengine/plugins/calendarplugin/group/calendarcontextplugin.mmp
contextengine/plugins/locationplugin/src/locationcontextplugin.cpp
contextengine/src/contextengineao.cpp
harvester/blacklistclient/group/blacklistclient.mmp
harvester/blacklistserver/group/blacklistserver.mmp
harvester/blacklistserver/src/blacklistserver.cpp
harvester/client/group/harvesterclient.mmp
harvester/client/inc/clientharvestitem.h
harvester/client/inc/harvesterclientao.h
harvester/client/inc/harvesterrequestactive.h
harvester/client/src/clientharvestitem.cpp
harvester/client/src/harvesterclient.cpp
harvester/client/src/harvestereventobserverao.cpp
harvester/client/src/harvesterrequestactive.cpp
harvester/common/bwincw/harvestercommonwinscw.def
harvester/common/bwincw/harvesterplugininterfacewinscw.def
harvester/common/eabi/harvestercommonarm.def
harvester/common/eabi/harvesterplugininterfacearm.def
harvester/common/inc/harvestdata.inl
harvester/common/inc/harvesterpluginfactory.h
harvester/common/src/harvestereventmanager.cpp
harvester/common/src/harvesterexifutil.cpp
harvester/common/src/harvesterplugin.cpp
harvester/common/src/harvesterpluginfactory.cpp
harvester/common/src/propertywatcher.cpp
harvester/composerplugins/imagecomposer/inc/imagepresentobserver.h
harvester/composerplugins/imagecomposer/src/imagecomposerao.cpp
harvester/composerplugins/imagecomposer/src/imagepresentobserver.cpp
harvester/composerplugins/imagecomposer/src/locationrelationobserver.cpp
harvester/data/default_origin_mappings.db
harvester/harvesterplugins/AudioPlaylistPlugin/data/200211F5.rss
harvester/harvesterplugins/AudioPlaylistPlugin/data/mdsplaylisttopcharacterset.rss
harvester/harvesterplugins/AudioPlaylistPlugin/group/bld.inf
harvester/harvesterplugins/AudioPlaylistPlugin/group/harvesteraudioplaylistplugin.mmp
harvester/harvesterplugins/AudioPlaylistPlugin/inc/harvesteraudioplaylistparser.h
harvester/harvesterplugins/AudioPlaylistPlugin/inc/harvesteraudioplaylistplugin.h
harvester/harvesterplugins/AudioPlaylistPlugin/inc/harvesterm3uplaylistparser.h
harvester/harvesterplugins/AudioPlaylistPlugin/inc/mdsplaylistcharacterset.hrh
harvester/harvesterplugins/AudioPlaylistPlugin/inc/mdsplaylistsupplementalcharsets.hrh
harvester/harvesterplugins/AudioPlaylistPlugin/inc/mdsplaylisttopcharacterset.rh
harvester/harvesterplugins/AudioPlaylistPlugin/src/harvesteraudioplaylistparser.cpp
harvester/harvesterplugins/AudioPlaylistPlugin/src/harvesteraudioplaylistplugin.cpp
harvester/harvesterplugins/AudioPlaylistPlugin/src/harvesterm3uplaylistparser.cpp
harvester/harvesterplugins/AudioPlaylistPlugin/src/proxy.cpp
harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h
harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp
harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp
harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h
harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp
harvester/harvesterplugins/MessagePlugin/group/bld.inf
harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h
harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp
harvester/harvesterplugins/RTPPlugin/inc/harvesterrtpplugin.h
harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp
harvester/harvesterplugins/VideoPlugin/data/200009f9.rss
harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h
harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp
harvester/harvesterplugins/WMVPlugin/data/2000B431.rss
harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h
harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp
harvester/harvesterplugins/group/bld.inf
harvester/monitorplugins/fileplugin/inc/fileeventhandlerao.h
harvester/monitorplugins/fileplugin/inc/filemonitorao.h
harvester/monitorplugins/fileplugin/src/FolderRenamer.cpp
harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp
harvester/monitorplugins/fileplugin/src/filemonitorao.cpp
harvester/monitorplugins/fileplugin/src/processoriginmapper.cpp
harvester/monitorplugins/mdsfileserverplugin/inc/mdsfileserverplugin.h
harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp
harvester/monitorplugins/mdsoomplugin/group/bld.inf
harvester/monitorplugins/messageplugin/group/bld.inf
harvester/monitorplugins/messageplugin/src/messagemonitorplugin.cpp
harvester/monitorplugins/mmcplugin/data/20007183.txt
harvester/monitorplugins/mmcplugin/inc/mmcmonitorao.h
harvester/monitorplugins/mmcplugin/inc/mmcmonitorplugin.h
harvester/monitorplugins/mmcplugin/inc/mmcscannerao.h
harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp
harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp
harvester/monitorplugins/mmcplugin/src/mmcscannerao.cpp
harvester/server/group/harvesterserver.mmp
harvester/server/inc/harvesterao.h
harvester/server/src/harvesterao.cpp
harvester/server/src/harvesteroomao.cpp
harvester/server/src/harvesterqueue.cpp
inc/mdssqliteconnection.h
layers.sysdef.50.xml
layers.sysdef.xml
locationmanager/client/src/rlocationmanager.cpp
locationmanager/conf/locationmanager.confml
locationmanager/conf/locationmanager_200071BE.crml
locationmanager/data/200071BE.txt
locationmanager/locationtrail/eabi/locationtrailarm.def
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/clocationrecord.cpp
locationmanager/locationtrail/src/cnetworkinfo.cpp
locationmanager/locationtrail/src/cpositioninfo.cpp
locationmanager/locationtrail/src/ctracklog.cpp
locationmanager/server/group/locationmanagerserver.mmp
locationmanager/server/inc/clocationmanagerserver.h
locationmanager/server/src/clocationmanagerserver.cpp
mds_plat/harvester_framework_api/inc/harvesterplugin.h
mds_plat/metadata_engine_api/inc/mdeobject.h
mds_plat/metadata_engine_api/inc/mdeobjectcondition.h
mds_plat/metadata_engine_api/inc/mdeobjectdef.h
mds_plat/metadata_engine_api/inc/mdeproperty.h
mds_plat/metadata_engine_api/inc/mdequery.h
metadataengine/client/bwincw/mdeclientu.def
metadataengine/client/eabi/mdeclientu.def
metadataengine/client/inc/mdeenginesession.h
metadataengine/client/inc/mdesessionimpl.h
metadataengine/client/src/mdeasynchronousfindao.cpp
metadataengine/client/src/mdelogiccondition.cpp
metadataengine/client/src/mdenotifierao.cpp
metadataengine/client/src/mdeobject.cpp
metadataengine/client/src/mdeobjectdef.cpp
metadataengine/client/src/mdequery.cpp
metadataengine/client/src/mdesessionimpl.cpp
metadataengine/data/schema.mde
metadataengine/server/inc/mdsfindengine.h
metadataengine/server/inc/mdssqlobjectmanipulate.h
metadataengine/server/src/mdsclausebuffer.cpp
metadataengine/server/src/mdsdiskspacenotifier.cpp
metadataengine/server/src/mdseventdef.cpp
metadataengine/server/src/mdsfindengine.cpp
metadataengine/server/src/mdsfindsequence.cpp
metadataengine/server/src/mdsfindsqlclause.cpp
metadataengine/server/src/mdsimportexport.cpp
metadataengine/server/src/mdsindexer.cpp
metadataengine/server/src/mdslogger.cpp
metadataengine/server/src/mdsmaintenanceengine.cpp
metadataengine/server/src/mdsmanipulationengine.cpp
metadataengine/server/src/mdsnotifier.cpp
metadataengine/server/src/mdsobjectdef.cpp
metadataengine/server/src/mdspropertydef.cpp
metadataengine/server/src/mdsrelationdef.cpp
metadataengine/server/src/mdsschema.cpp
metadataengine/server/src/mdsserver.cpp
metadataengine/server/src/mdsserversession.cpp
metadataengine/server/src/mdsshutdownobserver.cpp
metadataengine/server/src/mdssqliteconnection.cpp
metadataengine/server/src/mdssqlobjectmanipulate.cpp
rom/mds.iby
sis/mds/mds_stub.sis
sis/mds/package.pkg
sis/mds/package_separate.pkg
sis/mds/stub.pkg
watchdog/group/bld.inf
watchdog/src/wdselfshutdownobserver.cpp
--- a/clfwrapper/ClientSrc/CCLFDbItemProvider.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/clfwrapper/ClientSrc/CCLFDbItemProvider.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -93,8 +93,6 @@
 //
 void CCLFDbItemProvider::DoCancel()
     {
-    MG_DEBUG1( dr1, "[CLF]\t CCLFDbItemProvider::DoCancel" ); 
-
     if ( iObjectQuery )
         {
         iObjectQuery->Cancel();
--- a/clfwrapper/ClientSrc/CCLFDefaultOperation.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/clfwrapper/ClientSrc/CCLFDefaultOperation.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -173,8 +173,6 @@
                         const TArray<TCLFFieldId> aSortFields,
                         TCLFItemDataType aSortingDataType )
     {
-    MG_DEBUG1( MSI1, "MakeSortingItemsL start" );
-
     const TInt sortingFieldsCount( aSortFields.Count() );
     const TInt count( aItemArray.Count() );
     for( TInt i = 0 ; i < count ; ++i )
@@ -218,8 +216,6 @@
             aUndefinedItemArray.AppendL( seItem );
             }
         }
-
-    MG_DEBUG1( MSI2, "MakeSortingItemsL end" );
     }
 
 // -----------------------------------------------------------------------------
@@ -390,8 +386,6 @@
 void CCLFDefaultOperation::GroupItemsL( const TArray<MCLFItem*>& aSourceList,
                                         RPointerArray<MCLFItem>& aGroupedList )
     {
-    MG_DEBUG1( GI1, "CCLFDefaultOperation::GroupItemsL start" );
-
     iGroupedItemList.ResetAndDestroy();
     switch ( iGrouping )
         {
@@ -407,8 +401,6 @@
             break;
             }
         }
-
-    MG_DEBUG1( GI2, "CCLFDefaultOperation::GroupItemsL end" );
     }
 
 // -----------------------------------------------------------------------------
@@ -484,8 +476,6 @@
                                     const TArray<MCLFItem*>& aSourceList,
                                     RPointerArray<MCLFItem>& aGroupedList )
     {
-    MG_DEBUG1( DMAG1, "CCLFDefaultOperation::DoMusicAlbumGroupingL start" );
-
     CDesCArray* tempAlbumNameArray =
                 new (ELeave) CDesCArraySeg( KCLFGroupedItemArrayGranularity );
     CleanupStack::PushL( tempAlbumNameArray );
@@ -498,10 +488,10 @@
         if( item->GetField( ECLFFieldIdAlbum, albumName ) == KErrNone )
             {
             TInt pos( 0 );
-            if( tempAlbumNameArray->Find( albumName, pos ) )
+            if( tempAlbumNameArray->FindIsq( albumName, pos ) )
                 {
                 // not found
-                tempAlbumNameArray->AppendL( albumName );
+                tempAlbumNameArray->InsertIsqL( albumName );
 
                 // make new item
                 MCLFModifiableItem* newItem =
@@ -522,8 +512,6 @@
             }
         }
     CleanupStack::PopAndDestroy( tempAlbumNameArray );
-
-    MG_DEBUG1( DMAG2, "CCLFDefaultOperation::DoMusicAlbumGroupingL end" );
     }
 
 //  End of File
--- a/clfwrapper/ClientSrc/CCLFItemImpl.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/clfwrapper/ClientSrc/CCLFItemImpl.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -209,7 +209,7 @@
     TInt32 error = KErrNotFound;
 
     aValue = ECLFMediaTypeUnknown; // Default to this.
-    for ( TInt i = 0; i < sizeof( clfmediatypes ) / sizeof( TInt ); ++i )
+    for ( TUint i = 0; i < sizeof( clfmediatypes ) / sizeof( TInt ); ++i )
         {
         if ( name.Compare( *mdemediatypes[ i ] ) == 0 )
             {
@@ -258,7 +258,7 @@
         {
         // Get the actual data
         CMdEProperty* prop = NULL;
-        const TInt index = iMdEObject.Property( *propertyDef, prop );
+        iMdEObject.Property( *propertyDef, prop );
         if ( prop )
             {
             const TInt num = sizeof ( clfwrappermusictypes ) / sizeof( TDesC* );
--- a/clfwrapper/ClientSrc/CCLFItemListModelImpl.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/clfwrapper/ClientSrc/CCLFItemListModelImpl.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -443,17 +443,11 @@
 void CCLFItemListModelImpl::CopyArrayL( const TArray<MCLFItem*>& aSource,
                                         RPointerArray<MCLFItem>& aDest )
     {
-    MG_DEBUG3( AI1, "CCLFItemListModelImpl::CopyArrayL start, aSource: 0x%08x, aDest: 0x%08x",
-               &aSource, &aDest );
-
     const TInt count( aSource.Count() );
     for( TInt i = 0 ; i < count ; ++i )
         {
-        MG_DEBUG3( AI2, "aSource[ %d ]: 0x%08x", i, aSource[ i ] );
         aDest.AppendL( aSource[i] );
         }
-
-    MG_DEBUG1( AI3, "CCLFItemListModelImpl::CopyArrayL end" );
     }
 
 // -----------------------------------------------------------------------------
--- a/clfwrapper/ClientSrc/CCLFServerProxy.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/clfwrapper/ClientSrc/CCLFServerProxy.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -32,7 +32,7 @@
 // CONSTANTS
 const TInt KCLFDefaultBufferLength( 64 );
 const TInt KCLFDefaultArrayGranularity( 4 );
-const TInt KCLFExtensionArrayGranularity( 49 );
+const TInt KCLFExtensionArrayGranularity( 50 );
 
 _LIT( KCLFDriveLetterFormatString, ":\\" );
 const TInt KCLFDriveC( 'C' );
@@ -92,6 +92,7 @@
 _LIT( KExtensionRv,    "rv" );
 _LIT( KExtensionWmv,    "wmv" );
 _LIT( KExtensionAvi,    "avi" );
+_LIT( KExtensionDivx,    "divx" );
 
 // ======== MEMBER FUNCTIONS ========
 
@@ -733,16 +734,10 @@
 //
 TBool CUpdateFoldersHandler::IsSupportedType( const TDesC& aExtension )
     {
-    TCollationMethod m = *Mem::CollationMethodByIndex( 0 );
-    m.iFlags = ( TCollationMethod::EIgnoreNone | TCollationMethod::EFoldCase );   
-    
-    for( TInt i( 0 ); i < iExtensionArray->Count(); i++ )
+    TInt pos( 0 );
+    if ( iExtensionArray->FindIsq( aExtension, pos ) == 0 ) // found
         {
-        const TDesC& ext = iExtensionArray->MdcaPoint( i );
-        if ( ext.CompareC( aExtension, 3, &m ) == 0 )
-            {
-            return ETrue;
-            }
+        return ETrue;
         }
     return EFalse;
     }
@@ -847,9 +842,8 @@
     {
     CUpdateItemsHandler* handler = CUpdateIDsHandler::NewL( aItemIDArray );
 
-    CleanupStack::PushL( handler );
+    // Ownership tranferred
     StartHandlingL( handler );
-    CleanupStack::Pop( handler );
 
     return KErrNone;
     }
@@ -884,9 +878,8 @@
             return KErrNone;
             }
 
-        CleanupStack::PushL( handler );
+        // Ownership tranferred
         StartHandlingL( handler );
-        CleanupStack::Pop( handler );
         }
     CleanupStack::PopAndDestroy( uriArray );
 
@@ -901,9 +894,8 @@
     {
     CUpdateItemsHandler* handler = CUpdateFoldersHandler::NewL( iMdESession, 
                                                          *iUriArray, this, this, iFs, iHC, iExtensionArray );
-    CleanupStack::PushL( handler );
+    // Ownership tranferred
     StartHandlingL( handler );
-    CleanupStack::Pop( handler );
     
     return KErrNone;
     }
@@ -1007,6 +999,7 @@
     {
     if ( aHandler )
         {
+        CleanupStack::PushL( aHandler );
         // Notify pending active objects about the event.
         NotifyUpdateEvent( ECLFProcessStartEvent );
 
@@ -1017,16 +1010,17 @@
             {
             // Remove aHandler, because it is in clean up stack.
             iUpdateItemsHandlerArray.Remove( iUpdateItemsHandlerArray.Count() - 1 );
+            CleanupStack::PopAndDestroy( aHandler );
             User::LeaveIfError( err );
             }
         if ( aHandler->AllDone() )
             {
-            delete aHandler;
-            aHandler = NULL;
+            CleanupStack::PopAndDestroy( aHandler );
             iUpdateItemsHandlerArray.Remove( iUpdateItemsHandlerArray.Count() - 1 );
             }
         else
             {
+            CleanupStack::Pop( aHandler );
             aHandler->StartScheduler();
             }
         }
@@ -1238,58 +1232,59 @@
 void CCLFServerProxy::PopulateSupportedExtensionL()
     {
     iExtensionArray = new ( ELeave ) CDesCArraySeg( KCLFExtensionArrayGranularity );
-    iExtensionArray->AppendL( KExtensionMp3 );
-    iExtensionArray->AppendL( KExtensionAac );
-    iExtensionArray->AppendL( KExtensionAmr );
-    iExtensionArray->AppendL( KExtensionAwb );
-    iExtensionArray->AppendL( KExtensionMid );
-    iExtensionArray->AppendL( KExtensionMidi );
-    iExtensionArray->AppendL( KExtensionSpMid );
-    iExtensionArray->AppendL( KExtensionRng );
-    iExtensionArray->AppendL( KExtensionMxmf );
-    iExtensionArray->AppendL( KExtensionWav );
-    iExtensionArray->AppendL( KExtensionAu );
-    iExtensionArray->AppendL( KExtensionNrt );
-    iExtensionArray->AppendL( KExtensionWma );
-    iExtensionArray->AppendL( KExtensionRa );
+    iExtensionArray->InsertIsqL( KExtensionMp3 );
+    iExtensionArray->InsertIsqL( KExtensionAac );
+    iExtensionArray->InsertIsqL( KExtensionAmr );
+    iExtensionArray->InsertIsqL( KExtensionAwb );
+    iExtensionArray->InsertIsqL( KExtensionMid );
+    iExtensionArray->InsertIsqL( KExtensionMidi );
+    iExtensionArray->InsertIsqL( KExtensionSpMid );
+    iExtensionArray->InsertIsqL( KExtensionRng );
+    iExtensionArray->InsertIsqL( KExtensionMxmf );
+    iExtensionArray->InsertIsqL( KExtensionWav );
+    iExtensionArray->InsertIsqL( KExtensionAu );
+    iExtensionArray->InsertIsqL( KExtensionNrt );
+    iExtensionArray->InsertIsqL( KExtensionWma );
+    iExtensionArray->InsertIsqL( KExtensionRa );
     
-    iExtensionArray->AppendL( KExtJpg );
-    iExtensionArray->AppendL( KExtJpeg );
-    iExtensionArray->AppendL( KExtJp2 );
-    iExtensionArray->AppendL( KExtJ2k );
-    iExtensionArray->AppendL( KExtJpx );
-    iExtensionArray->AppendL( KExtJpf );
-    iExtensionArray->AppendL( KExtMbm );
-    iExtensionArray->AppendL( KExtPng );
-    iExtensionArray->AppendL( KExtGif );
-    iExtensionArray->AppendL( KExtBmp );
-    iExtensionArray->AppendL( KExtTif );
-    iExtensionArray->AppendL( KExtTiff );
-    iExtensionArray->AppendL( KExtOta );
-    iExtensionArray->AppendL( KExtWbmp );
-    iExtensionArray->AppendL( KExtWmf );
-    iExtensionArray->AppendL( KExtOtb );
+    iExtensionArray->InsertIsqL( KExtJpg );
+    iExtensionArray->InsertIsqL( KExtJpeg );
+    iExtensionArray->InsertIsqL( KExtJp2 );
+    iExtensionArray->InsertIsqL( KExtJ2k );
+    iExtensionArray->InsertIsqL( KExtJpx );
+    iExtensionArray->InsertIsqL( KExtJpf );
+    iExtensionArray->InsertIsqL( KExtMbm );
+    iExtensionArray->InsertIsqL( KExtPng );
+    iExtensionArray->InsertIsqL( KExtGif );
+    iExtensionArray->InsertIsqL( KExtBmp );
+    iExtensionArray->InsertIsqL( KExtTif );
+    iExtensionArray->InsertIsqL( KExtTiff );
+    iExtensionArray->InsertIsqL( KExtOta );
+    iExtensionArray->InsertIsqL( KExtWbmp );
+    iExtensionArray->InsertIsqL( KExtWmf );
+    iExtensionArray->InsertIsqL( KExtOtb );
     
-    iExtensionArray->AppendL( KExtOma1 );
-    iExtensionArray->AppendL( KExtOma2 );
-    iExtensionArray->AppendL( KExtOma3 );
-    iExtensionArray->AppendL( KExtOma4 );
-    iExtensionArray->AppendL( KExtOma5 );
+    iExtensionArray->InsertIsqL( KExtOma1 );
+    iExtensionArray->InsertIsqL( KExtOma2 );
+    iExtensionArray->InsertIsqL( KExtOma3 );
+    iExtensionArray->InsertIsqL( KExtOma4 );
+    iExtensionArray->InsertIsqL( KExtOma5 );
     
-    iExtensionArray->AppendL( KExtensionMp4 );
-    iExtensionArray->AppendL( KExtensionMpg4 );
-    iExtensionArray->AppendL( KExtensionMpeg4 );
-    iExtensionArray->AppendL( KExtensionM4v );
-    iExtensionArray->AppendL( KExtensionM4a );
-    iExtensionArray->AppendL( KExtension3gp );
-    iExtensionArray->AppendL( KExtension3gpp );
-    iExtensionArray->AppendL( KExtension3g2 );
-    iExtensionArray->AppendL( KExtensionRm );
-    iExtensionArray->AppendL( KExtensionRmvb );
-    iExtensionArray->AppendL( KExtensionRam );
-    iExtensionArray->AppendL( KExtensionRv );
-    iExtensionArray->AppendL( KExtensionWmv );
-    iExtensionArray->AppendL( KExtensionAvi );
+    iExtensionArray->InsertIsqL( KExtensionMp4 );
+    iExtensionArray->InsertIsqL( KExtensionMpg4 );
+    iExtensionArray->InsertIsqL( KExtensionMpeg4 );
+    iExtensionArray->InsertIsqL( KExtensionM4v );
+    iExtensionArray->InsertIsqL( KExtensionM4a );
+    iExtensionArray->InsertIsqL( KExtension3gp );
+    iExtensionArray->InsertIsqL( KExtension3gpp );
+    iExtensionArray->InsertIsqL( KExtension3g2 );
+    iExtensionArray->InsertIsqL( KExtensionRm );
+    iExtensionArray->InsertIsqL( KExtensionRmvb );
+    iExtensionArray->InsertIsqL( KExtensionRam );
+    iExtensionArray->InsertIsqL( KExtensionRv );
+    iExtensionArray->InsertIsqL( KExtensionWmv );
+    iExtensionArray->InsertIsqL( KExtensionAvi );
+    iExtensionArray->InsertIsqL( KExtensionDivx );
     }
 
 //  End of File
--- a/clfwrapper/ClientSrc/CLFUtils.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/clfwrapper/ClientSrc/CLFUtils.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -30,7 +30,6 @@
 //
 const TDesC& CLFUtils::MapClfType( const TInt aType )
     {
-    MG_DEBUG2( MCT, "[CLF]\t CCLFQueryAdapter::MapClfType %d", aType );
     const TDesC* ret = &KNullDesC;
 
     switch ( aType )
@@ -67,7 +66,6 @@
         case ECLFMediaTypePresentations:
         default:
             {
-            MG_DEBUG1( MCT3, "[CLF]\t MapClfType reached default, returning KBaseObject" );   
             ret = &MdeConstants::Object::KBaseObject;
             break;
             }
--- a/clfwrapper/group/mediacollectionmanager.mmp	Tue Feb 02 00:24:33 2010 +0200
+++ b/clfwrapper/group/mediacollectionmanager.mmp	Fri Mar 19 09:38:01 2010 +0200
@@ -44,6 +44,7 @@
 
 BYTEPAIRCOMPRESSTARGET
 PAGED
+OPTION ARMCC -O3 -OSpace
 
 // End of File
 
--- a/contextengine/group/contextengine.mmp	Tue Feb 02 00:24:33 2010 +0200
+++ b/contextengine/group/contextengine.mmp	Fri Mar 19 09:38:01 2010 +0200
@@ -54,4 +54,5 @@
 
 PAGED
 BYTEPAIRCOMPRESSTARGET
+OPTION ARMCC -O3 -OTime
 
--- a/contextengine/plugins/calendarplugin/group/calendarcontextplugin.mmp	Tue Feb 02 00:24:33 2010 +0200
+++ b/contextengine/plugins/calendarplugin/group/calendarcontextplugin.mmp	Fri Mar 19 09:38:01 2010 +0200
@@ -61,4 +61,5 @@
 
 PAGED
 BYTEPAIRCOMPRESSTARGET
+OPTION ARMCC -O3 -OTime
 
--- a/contextengine/plugins/locationplugin/src/locationcontextplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/contextengine/plugins/locationplugin/src/locationcontextplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -149,6 +149,11 @@
     
     ret = iManipulator.LocationSnapshot( aHD.MdeObject().Id() );
     
+    if( ret != KErrNone )
+        {
+        ret = KErrCompletion;
+        }
+    
     aHD.SetErrorCode( ret );
     aObserver.PluginSnapshotStatus( &aHD );
     }
--- a/contextengine/src/contextengineao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/contextengine/src/contextengineao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -131,7 +131,8 @@
     {
     iMdESession = aSession;
 
-    for ( TInt i = 0; i < iPlugins.Count(); ++i )
+    const TInt count( iPlugins.Count() );
+    for ( TInt i = 0; i < count; ++i )
         {
         iPlugins[i]->SetMdeSession( *aSession );
         }
--- a/harvester/blacklistclient/group/blacklistclient.mmp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/blacklistclient/group/blacklistclient.mmp	Fri Mar 19 09:38:01 2010 +0200
@@ -51,4 +51,5 @@
 
 BYTEPAIRCOMPRESSTARGET
 PAGED
+OPTION ARMCC -O2 -OTime
 
--- a/harvester/blacklistserver/group/blacklistserver.mmp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/blacklistserver/group/blacklistserver.mmp	Fri Mar 19 09:38:01 2010 +0200
@@ -49,5 +49,6 @@
 
 PAGED
 BYTEPAIRCOMPRESSTARGET
+OPTION ARMCC -O2 -OTime
 
 EPOCPROCESSPRIORITY background
--- a/harvester/blacklistserver/src/blacklistserver.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/blacklistserver/src/blacklistserver.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -747,14 +747,16 @@
     WRITELOG( "CBlacklistServer::CommitBufferedItemsL - begin" );
    
     // First, removed items
-    for ( TInt i( 0 ); i < iBufferedRemoveItems.Count(); ++i )
+    const TInt removedCount( iBufferedRemoveItems.Count() );
+    for ( TInt i( 0 ); i < removedCount; ++i )
         {
         iSqLiteConnection->ExecuteL( KMdsBlacklistDelete, *iBufferedRemoveItems[i] );
         iBufferedRemoveItems[i]->Column( 0 ).Free();      
         }
    
     // Second, added items
-    for ( TInt i( 0 ); i < iBufferedAddedItems.Count(); ++i )
+    const TInt addedCount( iBufferedAddedItems.Count() );
+    for ( TInt i( 0 ); i < addedCount; ++i )
         {
         iSqLiteConnection->ExecuteL( KMdsBlacklistUpdate, *iBufferedAddedItems[i] );
         iBufferedAddedItems[i]->Column( 0 ).Free();  
--- a/harvester/client/group/harvesterclient.mmp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/client/group/harvesterclient.mmp	Fri Mar 19 09:38:01 2010 +0200
@@ -41,7 +41,6 @@
 SOURCEPATH        ../src
 SOURCE            harvesterclient.cpp
 SOURCE            harvesterclientao.cpp
-SOURCE            clientharvestitem.cpp
 SOURCE		      harvestereventobserverao.cpp 
 SOURCE            harvesterrequestactive.cpp
 SOURCE            harvesterrequestqueue.cpp
--- a/harvester/client/inc/clientharvestitem.h	Tue Feb 02 00:24:33 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
-* Copyright (c) 2007-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:  Client harvest item
-*
-*/
-
-
-#ifndef __CCLIENTHARVESTITEM_H__
-#define __CCLIENTHARVESTITEM_H__
-
-#include <e32base.h>
-
-#include "mdccommon.h"
-
-NONSHARABLE_CLASS( RClientHarvestItem )
-    {
-    public:
-        /**
-         * Constructor.
-         */
-        RClientHarvestItem();
-
-        /**
-         * Copy constructor.
-         */
-        RClientHarvestItem( const RClientHarvestItem& aItem );
-
-        /**
-         * Initialize with data.
-         */
-        void InitL( const TDesC& aURI, RArray<TItemId>& aAlbumIds );
-
-        /**
-         * Close (release memory).
-         */
-        void Close();
-
-        /**
-         * Resets the item. Releases memory.
-         */
-        void Reset();
-
-    private:
-
-        /** @var 	HBufC16* iUri;
-         *  @brief 	URI to harvest
-         */
-        HBufC16* iUri;
-
-        /** @var 	TTime iTimeStamp;
-         *  @brief  Timestamp for the file
-         */
-        TTime iTimeStamp;
-
-        /** @var 	RArray<TInt> iAlbumIds;
-         *  @brief  Album IDs
-         */
-        RArray<TItemId> iAlbumIds;
-    };
-
-#endif
--- a/harvester/client/inc/harvesterclientao.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/client/inc/harvesterclientao.h	Fri Mar 19 09:38:01 2010 +0200
@@ -24,7 +24,6 @@
 #include <badesca.h>
 
 #include "harvesterclient.h"
-#include "clientharvestitem.h"
 
 class RHarvesterClient;
 class MHarvestObserver;
--- a/harvester/client/inc/harvesterrequestactive.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/client/inc/harvesterrequestactive.h	Fri Mar 19 09:38:01 2010 +0200
@@ -60,7 +60,7 @@
     static CHarvesterRequestActive* NewL( 
             RHarvesterClient& aClient, MHarvestObserver* aObserver,
             TInt aService, const TDesC& aUri, 
-            HBufC8* aAlbumIds, TBool& aAddLocation,
+            HBufC8* aAlbumIds, TBool aAddLocation,
             CHarvesterRequestQueue* aQueue );
 
     /**
@@ -104,7 +104,7 @@
      */
     CHarvesterRequestActive( RHarvesterClient& aClient,
             MHarvestObserver* aObserver, TInt aService, const TDesC& aUri, 
-            HBufC8* aAlbumIds, TBool& aAddLocation,
+            HBufC8* aAlbumIds, TBool aAddLocation,
             CHarvesterRequestQueue* aQueue );
 
     /**
--- a/harvester/client/src/clientharvestitem.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
-* Copyright (c) 2007-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:  Client harvest item implementation
-*
-*/
-
-
-#include "clientharvestitem.h"
-#include "harvesterlog.h"
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-RClientHarvestItem::RClientHarvestItem()
-    {
-    WRITELOG( "RClientHarvestItem::RClientHarvestItem()" );
-    iUri = NULL;
-    }
-
-// ---------------------------------------------------------------------------
-// Copy constructor
-// ---------------------------------------------------------------------------
-//
-RClientHarvestItem::RClientHarvestItem( const RClientHarvestItem& aItem )
-    {
-    iUri = aItem.iUri;
-    iTimeStamp = aItem.iTimeStamp;
-    const TInt count = aItem.iAlbumIds.Count();
-    iAlbumIds.Reserve( count );
-    for ( TInt i = 0; i < count; i++ )
-        {
-        iAlbumIds.Append( aItem.iAlbumIds[i] );
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// InitL
-// ---------------------------------------------------------------------------
-//
-void RClientHarvestItem::InitL( const TDesC& aUri, RArray<TItemId>& aAlbumIds ) 
-    {
-    if ( aUri.Length() <= 0 || aUri.Length() > KMaxFileName )
-        {
-        User::Leave( KErrArgument );
-        }
-
-    this->Reset();
-
-    iTimeStamp.UniversalTime();
-    iUri = aUri.AllocL();
-    const TInt count = aAlbumIds.Count();
-    
-    iAlbumIds.Reserve( count );
-    for ( TInt i = 0; i < count; i++ )
-        {
-        iAlbumIds.Append( aAlbumIds[i] );
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// Reset
-// ---------------------------------------------------------------------------
-//
-void RClientHarvestItem::Reset() 
-    {
-    if ( iUri )
-        {
-        delete iUri;
-        iUri = NULL;
-        }
-
-    iAlbumIds.Reset();
-    }
-
-// ---------------------------------------------------------------------------
-// Close
-// ---------------------------------------------------------------------------
-//
-void RClientHarvestItem::Close()
-    {
-    Reset();
-    iAlbumIds.Close();
-    }
-
-
-
-
--- a/harvester/client/src/harvesterclient.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/client/src/harvesterclient.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -114,11 +114,11 @@
 #ifdef _DEBUG
     if ( err != KErrNone )
         {
-        WRITELOG( "RHarvesterClient::Connect() - Server is not running or could not be started" );
+        WRITELOG1( "RHarvesterClient::Connect() - Server is not running or could not be started, error &d", err );
         }
     else
         {
-        WRITELOG1( "RHarvesterClient::Connect() - no errors: %d", err );
+        WRITELOG( "RHarvesterClient::Connect() - no errors" );
         }
     WRITELOG( "RHarvesterClient::Connect() - end" );
 #endif
@@ -463,8 +463,9 @@
     {
     WRITELOG( "RHarvesterClient::Version()" );
         
-    return TVersion( KHarvesterServerMajorVersion, KHarvesterServerMinorVersion,
-    	KHarvesterServerBuildVersion );
+    TVersion version( KHarvesterServerMajorVersion, KHarvesterServerMinorVersion,
+                              KHarvesterServerBuildVersion );
+    return version;
     }
 
 // ----------------------------------------------------------------------------------------
@@ -486,10 +487,19 @@
         // Server already running
         return KErrNone;
         }
+#ifdef _DEBUG
     else
         {
-        WRITELOG1( "StartServer() error - error code: %d", result );
+        if( result == KErrNotFound )
+            {
+            WRITELOG( "StartServer() - server not found running" );
+            }
+        else
+            {
+            WRITELOG1( "StartServer() error - error code: %d", result );
+            }
         }
+#endif
     
     result = CreateServerProcess();
     if ( result != KErrNone )
--- a/harvester/client/src/harvestereventobserverao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/client/src/harvestereventobserverao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -135,6 +135,8 @@
 		Cancel();
 		iHarvesterEventQueue.Close();
 		}
+	
+	iObservers.Compress();
 	}
 
 void CHarvesterEventObserverAO::RunL()
@@ -144,7 +146,8 @@
 	THarvesterEventNotification received;
 	while( iHarvesterEventQueue.Receive( received ) != KErrUnderflow )
 		{
-		for(TInt i = iObservers.Count(); --i >= 0;)
+	    const TInt count( iObservers.Count() );
+		for(TInt i = count; --i >= 0;)
 			{
 			THarvesterEventObserver& observer = *(iObservers[i]);
 			if( observer.iObserverInfo.iObserverId == received.iObserverId )
--- a/harvester/client/src/harvesterrequestactive.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/client/src/harvesterrequestactive.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -50,7 +50,7 @@
 CHarvesterRequestActive* CHarvesterRequestActive::NewL(
         RHarvesterClient& aClient, MHarvestObserver* aObserver,
         TInt aService, const TDesC& aUri, 
-        HBufC8* aAlbumIds, TBool& aAddLocation,
+        HBufC8* aAlbumIds, TBool aAddLocation,
         CHarvesterRequestQueue* aQueue )
     {
     CHarvesterRequestActive* self = new( ELeave )CHarvesterRequestActive( aClient, aObserver,
@@ -65,7 +65,7 @@
 //
 CHarvesterRequestActive::CHarvesterRequestActive( RHarvesterClient& aClient,
     MHarvestObserver* aObserver, TInt aService, const TDesC& aUri, 
-    HBufC8* aAlbumIds, TBool& aAddLocation, CHarvesterRequestQueue* aQueue )
+    HBufC8* aAlbumIds, TBool aAddLocation, CHarvesterRequestQueue* aQueue )
     : CActive( CActive::EPriorityStandard ), iClient( aClient ), iObserver( aObserver ), 
     iService( aService ), iUri( aUri ), iAlbumIds( aAlbumIds ), iAddLocation( aAddLocation ),
     iRequestQueue( aQueue ), iLocation( EFalse ), iCancelled( EFalse )
--- a/harvester/common/bwincw/harvestercommonwinscw.def	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/common/bwincw/harvestercommonwinscw.def	Fri Mar 19 09:38:01 2010 +0200
@@ -64,4 +64,5 @@
 	?RegisterEventObserverL@CHarvesterEventManager@@QAEXABVRMessage2@@@Z @ 63 NONAME ; void CHarvesterEventManager::RegisterEventObserverL(class RMessage2 const &)
 	?UnregisterEventObserver@CHarvesterEventManager@@QAEHABVRMessage2@@@Z @ 64 NONAME ; int CHarvesterEventManager::UnregisterEventObserver(class RMessage2 const &)
 	?HandleObjectPropertyL@CMdeObjectWrapper@@SAXAAVCMdEObject@@AAVCMdEPropertyDef@@PAXH@Z @ 65 NONAME ; void CMdeObjectWrapper::HandleObjectPropertyL(class CMdEObject &, class CMdEPropertyDef &, void *, int)
+	?SendHarvestingStatusEventL@CHarvesterPluginFactory@@QAEXH@Z @ 66 NONAME ; void CHarvesterPluginFactory::SendHarvestingStatusEventL(int)
 
--- a/harvester/common/bwincw/harvesterplugininterfacewinscw.def	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/common/bwincw/harvesterplugininterfacewinscw.def	Fri Mar 19 09:38:01 2010 +0200
@@ -10,4 +10,6 @@
 	?SetQueue@CHarvesterPlugin@@UAEXAAV?$RPointerArray@VCHarvesterData@@@@@Z @ 9 NONAME ; void CHarvesterPlugin::SetQueue(class RPointerArray<class CHarvesterData> &)
 	?StartHarvest@CHarvesterPlugin@@UAEXXZ @ 10 NONAME ; void CHarvesterPlugin::StartHarvest(void)
 	?SetBlacklist@CHarvesterPlugin@@UAEXAAVCHarvesterBlacklist@@@Z @ 11 NONAME ; void CHarvesterPlugin::SetBlacklist(class CHarvesterBlacklist &)
+	?GetMimeType@CHarvesterPlugin@@UAEXABVTDesC16@@AAVTDes16@@@Z @ 12 NONAME ; void CHarvesterPlugin::GetMimeType(class TDesC16 const &, class TDes16 &)
+	?SetHarvesterPluginFactory@CHarvesterPlugin@@QAEXAAVCHarvesterPluginFactory@@@Z @ 13 NONAME ; void CHarvesterPlugin::SetHarvesterPluginFactory(class CHarvesterPluginFactory &)
 
--- a/harvester/common/eabi/harvestercommonarm.def	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/common/eabi/harvestercommonarm.def	Fri Mar 19 09:38:01 2010 +0200
@@ -81,4 +81,8 @@
 	_ZN22CHarvesterEventManager22RegisterEventObserverLERK9RMessage2 @ 80 NONAME
 	_ZN22CHarvesterEventManager23UnregisterEventObserverERK9RMessage2 @ 81 NONAME
 	_ZN17CMdeObjectWrapper21HandleObjectPropertyLER10CMdEObjectR15CMdEPropertyDefPvi @ 82 NONAME
+	_ZN23CHarvesterPluginFactory26SendHarvestingStatusEventLEi @ 83 NONAME
+	_ZN18CHarvesterExifUtilD0Ev @ 84 NONAME
+	_ZN18CHarvesterExifUtilD1Ev @ 85 NONAME
+	_ZN18CHarvesterExifUtilD2Ev @ 86 NONAME
 
--- a/harvester/common/eabi/harvesterplugininterfacearm.def	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/common/eabi/harvesterplugininterfacearm.def	Fri Mar 19 09:38:01 2010 +0200
@@ -14,4 +14,6 @@
 	_ZTI16CHarvesterPlugin @ 13 NONAME ; #<TI>#
 	_ZTV16CHarvesterPlugin @ 14 NONAME ; #<VT>#
 	_ZN16CHarvesterPlugin12SetBlacklistER19CHarvesterBlacklist @ 15 NONAME
+	_ZN16CHarvesterPlugin11GetMimeTypeERK7TDesC16R6TDes16 @ 16 NONAME
+	_ZN16CHarvesterPlugin25SetHarvesterPluginFactoryER23CHarvesterPluginFactory @ 17 NONAME
 
--- a/harvester/common/inc/harvestdata.inl	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/common/inc/harvestdata.inl	Fri Mar 19 09:38:01 2010 +0200
@@ -101,6 +101,21 @@
     iMdeObjectArray.Remove( aIndex );
     iLocationArray.Remove( aIndex );
     iQueryArray.Remove( aIndex );
+    
+    if( iMdeObjectArray.Count() == 0 )
+        {
+        iMdeObjectArray.Compress();
+        }
+
+    if( iLocationArray.Count() == 0 )
+        {
+        iLocationArray.Compress();
+        }
+
+    if( iQueryArray.Count() == 0 )
+        {
+        iQueryArray.Compress();
+        }    
     }
 
 // ---------------------------------------------------------------------------
--- a/harvester/common/inc/harvesterpluginfactory.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/common/inc/harvesterpluginfactory.h	Fri Mar 19 09:38:01 2010 +0200
@@ -25,6 +25,7 @@
 class CHarvesterPlugin;
 class CHarvesterData;
 class CHarvesterBlacklist;
+class CHarvesterEventManager;
 
 NONSHARABLE_CLASS( CHarvesterPluginFactory ) : public CBase
 	{
@@ -40,6 +41,8 @@
 		IMPORT_C void SetBlacklist( CHarvesterBlacklist& aBlacklist );
 		IMPORT_C TBool IsSupportedFileExtension( const TDesC& aFileName );
 		IMPORT_C TBool IsContainerFileL( const TDesC& aURI );
+		
+		IMPORT_C void SendHarvestingStatusEventL( TBool aStarted );
 
 	private:
 		CHarvesterPluginFactory();
@@ -47,10 +50,14 @@
 		void SetupHarvesterPluginInfoL();
 		void AddNewPluginL( const TDesC8& aType, const TDesC8& aOpaque, TUid aPluginUid );
 		void GetSupportedPluginsL( RPointerArray<CHarvesterPluginInfo>& aSupportedPlugins, const TDesC& aExt );
+		void SetPluginInfo( CHarvesterData* aHD );
 		
 	private:
 		RPointerArray<CHarvesterPluginInfo> iHarvesterPluginInfoArray;
 		CHarvesterBlacklist* iBlacklist;
+		  
+	    TBool iHarvesting;
+		CHarvesterEventManager* iHarvesterEventManager;
 	};
 
 #endif
--- a/harvester/common/src/harvestereventmanager.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/common/src/harvestereventmanager.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -407,8 +407,10 @@
 					break;
 					}
 				}
+			iEventQueues.Compress();
 			}
 
+		iRegisteredObservers.Compress();
 		return KErrNone;
 		}
 	else
--- a/harvester/common/src/harvesterexifutil.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/common/src/harvesterexifutil.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -100,7 +100,7 @@
 }
 
 
-CHarvesterExifUtil::~CHarvesterExifUtil()
+EXPORT_C CHarvesterExifUtil::~CHarvesterExifUtil()
 {
 }
 
--- a/harvester/common/src/harvesterplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/common/src/harvesterplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -24,11 +24,9 @@
 #include "harvesterlog.h"
 #include "harvestercommon.h"
 #include "harvesterblacklist.h"
-#include "harvestereventmanager.h"
+#include "harvesterpluginfactory.h"
 #include "mdsutils.h"
 
-const TInt KCacheItemCountForEventCaching = 1;
-
 // ---------------------------------------------------------------------------
 // NewL
 // ---------------------------------------------------------------------------
@@ -52,7 +50,6 @@
 	{
 	User::LeaveIfError( iFs.Connect() );
 	iState = EHarvesterIdle;
-	iHarvesterEventManager = CHarvesterEventManager::GetInstanceL();
 	CActiveScheduler::Add( this );
 	}
 
@@ -67,9 +64,9 @@
 	iBlacklist( NULL ),
     iDtor_ID_Key( KNullUid ),
     iOriginPropertyDef( NULL ),
-    iTitlePropertyDef( NULL )
+    iTitlePropertyDef( NULL ),
+    iHarvesting( NULL )
 	{
-	
 	}
 
 // ---------------------------------------------------------------------------
@@ -90,11 +87,6 @@
 EXPORT_C CHarvesterPlugin::~CHarvesterPlugin() // destruct - virtual
 	{
 	Cancel();
-
-    if (iHarvesterEventManager)
-        {
-        iHarvesterEventManager->ReleaseInstance();
-        }
 	
 	iFs.Close();
 	REComSession::DestroyedImplementation( iDtor_ID_Key );
@@ -148,20 +140,19 @@
             if( iQueue->Count() == 0 )
                 {
                 SetNextRequest( EHarvesterIdle );
-                iHarvesting = EFalse;                       
-                iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateFinished );
-                iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeOverall, KCacheItemCountForEventCaching );
+                if( iHarvesting )
+                    {
+                    TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( EFalse ) );
+                    iHarvesting = EFalse;     
+                    }
                 iQueue->Compress();
                 }
             else
             	{
                 if ( !iHarvesting )
                     {
+                    TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( ETrue ) );
                     iHarvesting = ETrue;
-                    iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateStarted );
-                    // This next line is for caching the harvester started event for observers registering
-                    // after harvesting has already started
-                    iHarvesterEventManager->IncreaseItemCount( EHEObserverTypeOverall, KCacheItemCountForEventCaching );
                     }
             
             	CHarvesterData* hd = (*iQueue)[0];
@@ -169,6 +160,16 @@
             	const TDesC& uri = hd->Uri();
             	TUint32 mediaId = hd->MdeObject().MediaId();
             	
+            	if( hd->ObjectType() == EFastHarvest || hd->Origin() == MdeConstants::Object::ECamera )
+            	    {
+            	    iFastModeEnabled = ETrue;
+            	    }
+            	else if( iFastModeEnabled )
+            	    {
+                    iFastModeEnabled = EFalse;
+                    SetPriority( KHarvesterPriorityHarvestingPlugin );
+            	    }
+            	
 				if( iBlacklist )
 					{
 					WRITELOG( "CHarvesterPlugin::RunL - Adding URI to blacklist" );
@@ -313,6 +314,24 @@
 	}
 
 // ---------------------------------------------------------------------------
+// GetMimeType
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CHarvesterPlugin::GetMimeType( const TDesC& /*aUri*/, TDes& aMimeType )
+    {
+    aMimeType.Zero();
+    }
+
+// ---------------------------------------------------------------------------
+// SetHarvesterPluginFactory
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CHarvesterPlugin::SetHarvesterPluginFactory( CHarvesterPluginFactory& aFactory )
+    {
+    iFactory = &aFactory;
+    }
+
+// ---------------------------------------------------------------------------
 // E32Dll
 // ---------------------------------------------------------------------------
 //
--- a/harvester/common/src/harvesterpluginfactory.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/common/src/harvesterpluginfactory.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -22,18 +22,22 @@
 #include <harvesterplugin.h>
 #include <mdeobject.h>
 #include <harvesterdata.h>
-
+#include "harvestereventmanager.h"
 #include "harvesterpluginfactory.h"
 #include "harvesterplugininfo.h"
 #include "mdsutils.h"
 #include "harvesterlog.h"
 
+const TInt KCacheItemCountForEventCaching = 1;
+
 // ---------------------------------------------------------------------------
 // Constructor
 // ---------------------------------------------------------------------------
 //
 CHarvesterPluginFactory::CHarvesterPluginFactory() :
-    iBlacklist( NULL )
+    iBlacklist( NULL ),
+    iHarvesting( NULL ),
+    iHarvesterEventManager( NULL )
 	{
 	WRITELOG( "CHarvesterPluginFactory::CHarvesterPluginFactory()" );
 	}
@@ -60,6 +64,12 @@
 CHarvesterPluginFactory::~CHarvesterPluginFactory()
 	{
 	WRITELOG( "CHarvesterPluginFactory::~CHarvesterPluginFactory()" );
+	
+    if (iHarvesterEventManager)
+        {
+        iHarvesterEventManager->ReleaseInstance();
+        }
+	
 	iHarvesterPluginInfoArray.ResetAndDestroy();
 	iHarvesterPluginInfoArray.Close();
 	REComSession::FinalClose();
@@ -72,6 +82,7 @@
 void CHarvesterPluginFactory::ConstructL()
 	{
 	WRITELOG( "CHarvesterPluginFactory::ConstructL()" );
+	iHarvesterEventManager = CHarvesterEventManager::GetInstanceL();
 	SetupHarvesterPluginInfoL();
 	}
 
@@ -107,6 +118,8 @@
 				{
 				info->iPlugin = CHarvesterPlugin::NewL( info->iPluginUid );
 				info->iPlugin->SetQueue( info->iQueue );
+				info->iPlugin->SetHarvesterPluginFactory( *this );  
+				info->iPlugin->SetBlacklist( *iBlacklist );
 				}
 			info->iPlugin->GetObjectType( aHD.Uri(), aObjectDef );
 			if( aObjectDef.Length() > 0 )
@@ -127,10 +140,42 @@
 // GetMimeType
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void CHarvesterPluginFactory::GetMimeType(const TDesC& /*aUri*/, TDes& aMimeType)
+EXPORT_C void CHarvesterPluginFactory::GetMimeType(const TDesC& aUri, TDes& aMimeType)
 	{
-	_LIT( KJPGMimeType, "image/jpeg" );
-	aMimeType.Copy( KJPGMimeType );
+    TPtrC extPtr;
+    if( MdsUtils::GetExt( aUri, extPtr ) )
+        {
+        RPointerArray<CHarvesterPluginInfo> supportedPlugins;
+        TRAP_IGNORE( GetSupportedPluginsL( supportedPlugins, extPtr ) );
+        
+        const TInt sCount = supportedPlugins.Count();
+        for( TInt i = 0; i < sCount; i++ )
+            {
+            CHarvesterPluginInfo* info = supportedPlugins[i];
+            if ( !(info->iPlugin) )
+                {
+                TRAPD( error, info->iPlugin = CHarvesterPlugin::NewL( info->iPluginUid ) );
+                if( error != KErrNone )
+                    {
+                    aMimeType.Zero();
+                    return;
+                    }
+                info->iPlugin->SetQueue( info->iQueue );
+                info->iPlugin->SetHarvesterPluginFactory( *this );  
+                info->iPlugin->SetBlacklist( *iBlacklist );
+                }
+                info->iPlugin->GetMimeType( aUri, aMimeType );
+                if( aMimeType.Length() > 0 )
+                    {
+                    break;
+                    }
+            }
+        supportedPlugins.Close();
+        }
+    else
+        {
+        aMimeType.Zero();
+        }
 	}
 
 // ---------------------------------------------------------------------------
@@ -143,20 +188,31 @@
 	WRITELOG1("CHarvesterPluginFactory::HarvestL - aHD->Uri: %S", &aHD->Uri() );
 #endif
 	CHarvesterPluginInfo* hpi = aHD->HarvesterPluginInfo();
-		
+	
+	if( !hpi )
+	    {
+	    SetPluginInfo( aHD );
+	    hpi = aHD->HarvesterPluginInfo();
+	    }
+	
 	if ( hpi )
 		{
 		if ( ! hpi->iPlugin )
 	   		{
 	   		hpi->iPlugin = CHarvesterPlugin::NewL( hpi->iPluginUid );
 	   		hpi->iPlugin->SetQueue( hpi->iQueue );
+	   		hpi->iPlugin->SetHarvesterPluginFactory( *this );  
 	   		hpi->iPlugin->SetBlacklist( *iBlacklist );
 	   		}
 			
 		if( aHD->ObjectType() == EFastHarvest || aHD->Origin() == MdeConstants::Object::ECamera )
 		   	{
 		   	hpi->iQueue.Insert( aHD, 0 );
-		    	}
+		   	if( !hpi->iPlugin->IsActive() )
+		   	    {
+	            hpi->iPlugin->SetPriority( KHarvesterPriorityHarvestingPlugin + 2 );
+		   	    }
+		    }
 	    else
 			{
 			hpi->iQueue.AppendL( aHD );
@@ -270,7 +326,8 @@
     
     // Load plugin
     pluginInfo->iPlugin = CHarvesterPlugin::NewL( pluginInfo->iPluginUid );
-    pluginInfo->iPlugin->SetQueue( pluginInfo->iQueue );    
+    pluginInfo->iPlugin->SetQueue( pluginInfo->iQueue );
+    pluginInfo->iPlugin->SetHarvesterPluginFactory( *this );  
     
     iHarvesterPluginInfoArray.AppendL( pluginInfo );
     CleanupStack::Pop( pluginInfo );
@@ -279,7 +336,7 @@
 void CHarvesterPluginFactory::GetSupportedPluginsL(
 		RPointerArray<CHarvesterPluginInfo>& aSupportedPlugins, const TDesC& aExt )
 	{
-	TInt pluginInfoCount = iHarvesterPluginInfoArray.Count();
+	const TInt pluginInfoCount = iHarvesterPluginInfoArray.Count();
 	TInt extCount = 0;
 	for ( TInt i = pluginInfoCount; --i >= 0; )
         {
@@ -351,3 +408,53 @@
 		}
 	return isContainerFile;
 	}
+
+void CHarvesterPluginFactory::SetPluginInfo( CHarvesterData* aHD )
+    {
+    TPtrC extPtr;
+    if( MdsUtils::GetExt( aHD->Uri(), extPtr ) )
+        {
+        RPointerArray<CHarvesterPluginInfo> supportedPlugins;
+        TRAP_IGNORE( GetSupportedPluginsL( supportedPlugins, extPtr ) );
+        
+        if( supportedPlugins.Count() > 0 )
+            {
+            CHarvesterPluginInfo* info = supportedPlugins[0];
+            aHD->SetHarvesterPluginInfo( info );
+            }
+
+        supportedPlugins.Close();
+        }
+    }
+
+EXPORT_C void CHarvesterPluginFactory::SendHarvestingStatusEventL( TBool aStarted )
+    {
+    const TInt pluginInfoCount = iHarvesterPluginInfoArray.Count();
+    TBool itemsLeft( EFalse );
+    for ( TInt i = pluginInfoCount; --i >= 0; )
+        {
+        CHarvesterPluginInfo* info = iHarvesterPluginInfoArray[i];
+        if( info && info->iQueue.Count() )
+            {
+            itemsLeft = ETrue;
+            break;
+            }
+        }
+    
+    if( !iHarvesting && itemsLeft && aStarted )
+        {
+        iHarvesting = ETrue;
+        iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateStarted );
+        // This next line is for caching the harvester started event for observers registering
+        // after harvesting has already started
+        iHarvesterEventManager->IncreaseItemCount( EHEObserverTypeOverall, KCacheItemCountForEventCaching );
+        return;
+        }
+    else if( iHarvesting && !itemsLeft && !aStarted )
+        {
+        iHarvesting = EFalse;                       
+        iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateFinished );
+        iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeOverall, KCacheItemCountForEventCaching );
+        }
+    }
+
--- a/harvester/common/src/propertywatcher.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/common/src/propertywatcher.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -203,7 +203,8 @@
 	
     TInt listenerIndex ( KErrNotFound );
     
-    for ( TInt i = iListenersArray.Count(); --i >= 0; )
+    const TInt count( iListenersArray.Count() );
+    for ( TInt i = count; --i >= 0; )
     	{
     	CListener& listenerItem = *iListenersArray[i];
     	
--- a/harvester/composerplugins/imagecomposer/inc/imagepresentobserver.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/composerplugins/imagecomposer/inc/imagepresentobserver.h	Fri Mar 19 09:38:01 2010 +0200
@@ -125,8 +125,6 @@
 	 */
 	CComposerImagePlugin* iComposer;	
 	
-	TGetPendingPgckWrapper* iPendingPckWrapper;
-	
 	RArray<TItemId> iPresentObjectIds;
 	RArray<TItemId> iPendingObjectIds;
 	RArray<TItemId> iComposeObjectIds;
--- a/harvester/composerplugins/imagecomposer/src/imagecomposerao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/composerplugins/imagecomposer/src/imagecomposerao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -240,6 +240,7 @@
             {
             if( iItemQueue.Count() <= 0 )
             	{
+                iItemQueue.Compress();
             	SetNextRequest( ERequestReady );
             	}
             else
@@ -294,6 +295,7 @@
             
         case ERequestReady:
             {
+            iForceObjectIds.Compress();
             }
             break;
             
@@ -359,10 +361,6 @@
     	aMdEObjectId = objectId;
     	iItemQueue.Remove( 0 );
     	}
-    else
-    	{
-    	iItemQueue.Compress();
-    	}
     
     // get object from db (NULL if not found)
     CMdEObject* mdeObject = iSession->GetObjectL( objectId, *iImageObjectDef );
--- a/harvester/composerplugins/imagecomposer/src/imagepresentobserver.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/composerplugins/imagecomposer/src/imagepresentobserver.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -34,7 +34,6 @@
 		iSession( NULL ),
 		iMdEHarvesterSession( NULL ),
 		iComposer( NULL ),
-		iPendingPckWrapper( NULL ),
 		iNextRequest( ERequestIdle ),
 		iPendingCount( 0 ),
 		iPendingBuffer( NULL ),
--- a/harvester/composerplugins/imagecomposer/src/locationrelationobserver.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/composerplugins/imagecomposer/src/locationrelationobserver.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -42,6 +42,12 @@
 		{
 		TRAP_IGNORE( iSession->RemoveRelationObserverL( *this ) );
 		}
+	
+	if( iQuery )
+	    {
+	    iQuery->Cancel();
+	    delete iQuery;
+	    }
 	}
 
 CLocationRelationObserver* CLocationRelationObserver::NewL( CMdESession* aSession, CComposerImagePlugin* aComposer )
--- a/harvester/data/default_origin_mappings.db	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/data/default_origin_mappings.db	Fri Mar 19 09:38:01 2010 +0200
@@ -28,9 +28,10 @@
 10281FA5	4
 10281FA6	4
 101FFA91  254
-10208A29  254
 20026F35  254
 20026F2F  254
 200009F5	255
 2000A7AE	255
 200071BE	255
+101f7771  255
+1020e519  255 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/data/200211F5.rss	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* 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: 
+*
+*/
+
+
+// 1F2F3F4F.RSS
+
+#include "registryinfov2.rh"
+
+// Declares info for one test implementation
+RESOURCE REGISTRY_INFO theInfo
+	{
+	
+  // resource_format_version must always be set as follows
+  resource_format_version = RESOURCE_FORMAT_VERSION_2;
+
+	// UID for the DLL
+	dll_uid = 0x200211F5;
+	// Declare array of interface info
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// UID of interface that is implemented
+			interface_uid = 0x200009F8;
+			implementations = 
+				{
+				// Info for CHarvesterVideoPlugin
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x200211F6; 
+					version_no = 1;
+					display_name = "Harvester audio playlist plugin";
+					default_data = "Album";
+					opaque_data = "m3u";
+          rom_only = 0;
+					}
+				};
+			}
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/data/mdsplaylisttopcharacterset.rss	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,787 @@
+/*
+* 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:  Resource file.
+*
+*/
+
+
+//  INCLUDES
+#include <bldvariant.hrh>
+#include <languages.hrh>
+#include "mdsplaylisttopcharacterset.rh"
+#include "mdsplaylistsupplementalcharsets.hrh"
+
+//  RESOURCE DEFINITIONS 
+
+//----------------------------------------------------
+// Resource     : r_mds_playlist_albanian_char_set
+// Description  : Albanian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_albanian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso88592
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_arabic_char_set
+// Description  : Arabic character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_arabic_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88596,
+    	// windows 1256
+    	KCharacterSetIdentifierCp1256
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_bosnian_char_set
+// Description  : Bosnian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_bosnian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88592
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_bulgarian_char_set
+// Description  : Bulgarian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_bulgarian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88595,
+    	// Windows 1251
+    	KCharacterSetIdentifierCp1251
+    	};
+    }
+
+//----------------------------------------------------
+// Resource     : r_mds_playlist_taiwan_hk_chinese_char_set
+// Description  : Taiwan HongKong Chinese character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_taiwan_hk_chinese_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierBig5
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_chinese_char_set
+// Description  : Chinese character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_chinese_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierGb2312,
+    	KCharacterSetIdentifierGbk
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_croatian_char_set
+// Description  : Croatian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_croatian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88592,
+    	// windows 1250
+    	KCharacterSetIdentifierCp1250
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_czech_char_set
+// Description  : Czech character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_czech_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88592,
+    	// windows 1250
+    	KCharacterSetIdentifierCp1250
+    	};
+    }    
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_danish_char_set
+// Description  : Danish character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_danish_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// windows 1252
+    	KCharacterSetIdentifierCp1252
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_dutch_char_set
+// Description  : Dutch character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_dutch_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// windows 1252
+    	KCharacterSetIdentifierCp1252
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_english_char_set
+// Description  : English character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_english_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierAscii,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// windows 1252
+    	KCharacterSetIdentifierCp1252
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_estonian_char_set
+// Description  : Estonian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_estonian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso88594,
+    	KCharacterSetIdentifierIso885910,
+    	KCharacterSetIdentifierIso885913,
+    	// windows 1257
+    	KCharacterSetIdentifierCp1257
+
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_farsi_char_set
+// Description  : Farsi character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_farsi_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88596,
+    	// Windows-1256
+    	KCharacterSetIdentifierCp1256
+    	};
+    }    
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_finnish_char_set
+// Description  : Finnish character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_finnish_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// windows 1252
+    	KCharacterSetIdentifierCp1252
+    	};
+    }    
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_french_char_set
+// Description  : English character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_french_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// windows 1252
+    	KCharacterSetIdentifierCp1252
+    	};
+    }
+
+//----------------------------------------------------
+// Resource     : r_mds_playlist_german_char_set
+// Description  : German character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_german_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// windows 1252
+    	KCharacterSetIdentifierCp1252
+    	};
+    }
+    
+
+//----------------------------------------------------
+// Resource     : r_mds_playlist_greek_char_set
+// Description  : Greek character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_greek_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88597,
+    	// windows 1253
+    	KCharacterSetIdentifierCp1253
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_hebrew_char_set
+// Description  : Hebrew character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_hebrew_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88598,
+    	// windows 1255
+    	KCharacterSetIdentifierCp1255
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_hungarian_char_set
+// Description  : Hungarian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_hungarian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88592,
+    	// windows 1250
+    	KCharacterSetIdentifierCp1250
+    	};
+    }    
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_icelandic_char_set
+// Description  : Icelandic character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_icelandic_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso88599,
+    	KCharacterSetIdentifierIso885915,
+    	// windows 1252
+    	KCharacterSetIdentifierCp1252
+    	};
+    }        
+
+//----------------------------------------------------
+// Resource     : r_mds_playlist_indian_char_set
+// Description  : Indian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_indian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	// ISCII
+    	KCharacterSetIdentifierISCII
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_indonesian_char_set
+// Description  : Indonesian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_indonesian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierAscii,
+    	KCharacterSetIdentifierIso88591,
+    	// Windows 1252
+    	KCharacterSetIdentifierCp1252
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_irish_char_set
+// Description  : Irish character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_irish_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885914
+    	};
+    }
+        
+//----------------------------------------------------
+// Resource     : r_mds_playlist_italian_char_set
+// Description  : Italian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_italian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// Windows 1252
+    	KCharacterSetIdentifierCp1252
+    	};
+    }
+    
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_japanese_char_set
+// Description  : Japanese character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_japanese_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierShiftJis,
+    	KCharacterSetIdentifierIso2022Jp,
+    	KCharacterSetIdentifierEucJpPacked
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_latvian_char_set
+// Description  : Latvian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_latvian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88594,
+    	KCharacterSetIdentifierIso885910,
+    	KCharacterSetIdentifierIso885913,
+    	// Windows 1257
+    	KCharacterSetIdentifierCp1257    	
+    	};
+    }               
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_lithuanian_char_set
+// Description  : Lithuanian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_lithuanian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88594,
+    	KCharacterSetIdentifierIso885910,
+    	KCharacterSetIdentifierIso885913,
+    	// Windows 1257
+    	KCharacterSetIdentifierCp1257    	
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_malay_char_set
+// Description  : Malay character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_malay_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierAscii,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// Windows 1252
+    	KCharacterSetIdentifierCp1252    	
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_maltese_char_set
+// Description  : Maltese character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_maltese_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88593    	
+    	};
+    }
+
+//----------------------------------------------------
+// Resource     : r_mds_playlist_norwegian_char_set
+// Description  : Norwegian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_norwegian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// Windows 1252
+    	KCharacterSetIdentifierCp1252    	    	
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_pilipino_char_set
+// Description  : Pilipino character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_pilipino_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	// Windows 1252
+    	KCharacterSetIdentifierCp1252    	    	
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_polish_char_set
+// Description  : Polish character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_polish_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88592,
+    	// Windows 1250
+    	KCharacterSetIdentifierCp1250    	    	
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_portuguese_char_set
+// Description  : Portuguese character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_portuguese_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// Windows 1252
+    	KCharacterSetIdentifierCp1252    	    	
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_romanian_char_set
+// Description  : Romanian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_romanian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88592,
+    	// Windows 1250
+    	KCharacterSetIdentifierCp1250    	    	
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_russian_char_set
+// Description  : Russian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_russian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,    	
+    	KCharacterSetIdentifierIso88595,
+    	// Windows 1251
+    	KCharacterSetIdentifierCp1251,
+    	// KOI8-R
+    	KCharacterSetIdentifierKOI8R    	
+    	};
+    }    
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_sami_char_set
+// Description  : Sami character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_sami_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88594,
+    	KCharacterSetIdentifierIso885910
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_serbian_char_set
+// Description  : Serbian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_serbian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88592,
+    	KCharacterSetIdentifierIso88595,
+   	// Windows 1250
+    	KCharacterSetIdentifierCp1250
+    	};
+    }
+
+//----------------------------------------------------
+// Resource     : r_mds_playlist_slovak_char_set
+// Description  : Slovak character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_slovak_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88592,
+    	// Windows 1250
+    	KCharacterSetIdentifierCp1250
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_slovenian_char_set
+// Description  : Slovenian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_slovenian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88592,
+    	// Windows 1250
+    	KCharacterSetIdentifierCp1250
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_spanish_char_set
+// Description  : Spanish character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_spanish_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// Windows 1252
+    	KCharacterSetIdentifierCp1252
+    	};
+    }    
+    
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_swedish_char_set
+// Description  : Swedish character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_swedish_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88591,
+    	KCharacterSetIdentifierIso885915,
+    	// Windows 1252
+    	KCharacterSetIdentifierCp1252
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_thai_char_set
+// Description  : Thai character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_thai_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	// TIS-620
+    	KCharacterSetIdentifierTIS620,
+    	// Windows-874
+    	KCharacterSetIdentifierCp874
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_turkish_char_set
+// Description  : Turkish character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_turkish_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88593,
+    	// Windows 1254
+    	KCharacterSetIdentifierCp1254
+    	};
+    }
+    
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_ukrainian_char_set
+// Description  : Ukrainian character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_ukrainian_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88595,
+    	// KOI8-U
+    	KCharacterSetIdentifierKOI8U
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_urdu_char_set
+// Description  : Urdu character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_urdu_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	KCharacterSetIdentifierIso88595,
+    	KCharacterSetIdentifierIso88596,
+    	// Windows-1256
+    	KCharacterSetIdentifierCp1256
+    	};
+    }
+    
+//----------------------------------------------------
+// Resource     : r_mds_playlist_vietnamese_char_set
+// Description  : Vietnamese character sets
+//----------------------------------------------------
+//
+RESOURCE MDS_PLAYLIST_CHARACTER_SET_ENCODING r_mds_playlist_vietnamese_char_set
+    {
+    character_set_id =
+    	{
+    	KCharacterSetIdentifierUtf8,
+    	// Windows-1258
+    	KCharacterSetIdentifierCp1258
+    	};
+    }
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/group/bld.inf	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* 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: 
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+    DEFAULT
+
+PRJ_MMPFILES
+harvesteraudioplaylistplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/group/harvesteraudioplaylistplugin.mmp	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,75 @@
+/*
+* 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: 
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+CAPABILITY CAP_ECOM_PLUGIN
+
+TARGET        harvesteraudioplaylistplugin.dll
+TARGETTYPE    PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID           0x10009D8D 0x200211F5
+
+START RESOURCE ../data/200211F5.rss
+TARGET harvesteraudioplaylistplugin.rsc
+END
+
+START RESOURCE ../data/mdsplaylisttopcharacterset.rss
+HEADER
+TARGET mdsplaylisttopcharacterset.rsc
+TARGETPATH    RESOURCE_FILES_DIR 
+END
+
+USERINCLUDE   ../../../../inc
+USERINCLUDE   ../../../common/inc
+USERINCLUDE   ../inc
+
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE /epoc32/include/connect
+
+SOURCEPATH    ../src
+SOURCE        harvesteraudioplaylistplugin.cpp
+SOURCE        proxy.cpp 
+SOURCE        harvesterm3uplaylistparser.cpp
+SOURCE        harvesteraudioplaylistparser.cpp 
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib
+LIBRARY     ecom.lib
+LIBRARY     efsrv.lib
+LIBRARY     apgrfx.lib  // RApaLsSession
+LIBRARY     apmime.lib  // TDataType
+LIBRARY     bafl.lib //BaflUtils
+
+LIBRARY     harvesterplugininterface.lib
+LIBRARY     mdeclient.lib
+LIBRARY		harvesterdata.lib
+LIBRARY		harvestercommon.lib
+LIBRARY     syslangutil.lib
+LIBRARY     charconv.lib
+LIBRARY         platformenv.lib
+
+PAGED
+BYTEPAIRCOMPRESSTARGET
+OPTION ARMCC -O3 -OTime
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/inc/harvesteraudioplaylistparser.h	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,82 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef __CHARVESTERAUDIOPLAYLISTPARSER_H__
+#define __CHARVESTERAUDIOPLAYLISTPARSER_H__
+
+#include <charconv.h>
+#include <barsc.h>
+
+#include "harvesterm3uplaylistparser.h"
+
+//
+// CAudioMDParser
+//
+class CHarvesterAudioPlaylistParser : public CBase
+	{
+	public:
+		static CHarvesterAudioPlaylistParser* NewL();
+		virtual ~CHarvesterAudioPlaylistParser();
+        
+        TBool ParseMimeType( const TDesC& aFileName, TDes& aMimeType );
+        TBool ParseL( const TDesC& aFileName, RPointerArray<HBufC>& aUriArray, TPtrC aMimeType );
+        void Reset();
+		
+	private:
+        CHarvesterAudioPlaylistParser();
+        void ConstructL();
+        
+        /**
+        * Generate to character sets based on locale.
+        */
+        void GenerateTopCharacterSetsL();
+        
+        /**
+        * Select character set(s) for the specified language.
+        * @param aLanguage language to select character sets for
+        */
+        void SelectCharacterSetsForLanguageL( TInt aLanguage );
+     
+        /**
+        * reads the character set for the specified resource.
+        * @param aResourceId id of the resource to read from the resource file
+        */
+        void ReadCharacterSetResourceL( TInt aResourceId );
+
+        /**
+        * Determine whether the given character set is specified
+        * as top character set.
+        * @param aCharacterSetId id of the character set to be tested
+        */
+        TBool IsInTopCharacterSet( TUint aCharacterSetId );
+        
+    private:
+        RFs iFs;
+        
+        CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iTopCharacterSet;
+        CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iAvailableCharacterSet;
+        
+        RResourceFile iRscFile;
+        
+        CHarvesterM3UPlaylistParser* iM3UParser;
+	};
+
+
+
+#endif  // __CHARVESTERAUDIOPLAYLISTPARSER_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/inc/harvesteraudioplaylistplugin.h	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,134 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef __CHARVESTERAUDIOPLAYLISTPLUGIN_H__
+#define __CHARVESTERAUDIOPLAYLISTPLUGIN_H__
+
+#include <mdeobject.h>
+#include <fbs.h>
+#include <imageconversion.h>
+#include <harvesterplugin.h>
+#include <monitorplugin.h>
+#include <mdesession.h>
+#include "harvesteraudioplaylistparser.h"
+
+class CHarvestData;
+
+/**
+ * Helper class to hold all property definitions 
+ * (pointers are not owned) used in harvester audio plug-in.
+ */
+class CHarvesterAudioPlaylistPluginPropertyDefs : public CBase
+    {
+    public:
+        // Common property definitions
+        CMdEPropertyDef* iCreationDatePropertyDef;
+        CMdEPropertyDef* iLastModifiedDatePropertyDef;
+        CMdEPropertyDef* iSizePropertyDef;
+        CMdEPropertyDef* iItemTypePropertyDef;
+        CMdEPropertyDef* iTitlePropertyDef;
+        
+        CMdEPropertyDef* iAlbumTypeDef;
+        
+        CMdEPropertyDef* iAlbumIDDef;
+        CMdEPropertyDef* iAudioObjectIDDef;
+        CMdEPropertyDef* iPositionDef;
+
+    private:
+        CHarvesterAudioPlaylistPluginPropertyDefs();
+    
+        void ConstructL(CMdEObjectDef& aObjectDef);
+
+    public: 
+        static CHarvesterAudioPlaylistPluginPropertyDefs* NewL(CMdEObjectDef& aObjectDef);
+    };
+
+
+class CHarvesterAudioPlaylistPlugin : public CHarvesterPlugin
+	{
+	public:
+		/**
+		* Construction
+		* @return Harvester audio plugin
+		*/
+		static CHarvesterAudioPlaylistPlugin* NewL();
+
+		/**
+		* Destruction
+		*/
+		virtual ~CHarvesterAudioPlaylistPlugin();
+
+    private:
+		// Default constructor
+		CHarvesterAudioPlaylistPlugin();
+		
+		// 2nd phase constructor
+		void ConstructL();
+    
+    
+    public: // from CHarvesterPlugin
+    
+		/**
+		* Harvesting multiple files
+		* @param aHarvesterData  CHarvesterData datatype containing needed harvest data
+ 		* @return None
+		*/
+		void HarvestL( CHarvesterData* aHD );
+
+	private:
+	     
+		/**
+		* Harvesting multiple files
+		* @param aHarvesterData  CHarvesterData datatype containing needed harvest data
+ 		* 
+		*/
+		void DoHarvestL( CHarvesterData* aHD );
+
+		/**
+		 * Handles creation of new mde objects.
+		 */
+		void GetPropertiesL( CHarvesterData* aHarvesterData, TBool aIsAdd );
+		 		
+		/**
+		 * Get placeholder properties (creation time, modify time and file size).
+		 */
+        void GetPlaceHolderPropertiesL( CHarvesterData* aHD, TBool aIsAdd );
+		
+		/**
+		 * Get media file mime type (eg. "audio/mp3").
+		 */
+        TBool GetMimeTypePropertyL( CHarvesterData* aHD, TBool aIsAdd );
+
+		/**
+		 * Get song name, artist, album, genre and composer from normal music
+         * file (eg. mp3).
+		 */
+        void GetMusicPropertiesL( CHarvesterData* aHD, TBool aIsAdd );
+
+	private:
+		CHarvesterAudioPlaylistParser* iPlaylistParser;
+		HBufC* iMime;
+		
+	    CHarvesterAudioPlaylistPluginPropertyDefs* iPropDefs;
+
+        TInt iError;
+	};
+
+
+#endif  // __CHARVESTERAUDIOPLAYLISTPLUGIN_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/inc/harvesterm3uplaylistparser.h	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,128 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef __CHARVESTERM3UPLAYLISTPARSER_H__
+#define __CHARVESTERM3UPLAYLISTPARSER_H__
+
+#include <charconv.h>
+
+//
+// CAudioMDParser
+//
+class CHarvesterM3UPlaylistParser : public CBase
+	{
+	public:
+		static CHarvesterM3UPlaylistParser* NewL( RFs& aFs,
+		        CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* aAvailableCharacterSet,
+		        CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* aTopCharacterSet );
+		virtual ~CHarvesterM3UPlaylistParser();
+        
+        TBool ParseL( const TDesC& aFileName, RPointerArray<HBufC>& aUriArray );
+        void Reset();
+		
+	private:
+        CHarvesterM3UPlaylistParser( RFs& aFs,
+                CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* aAvailableCharacterSet,
+                CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* aTopCharacterSet );
+
+        /**
+        * Reads data from playlist file to the buffer
+        */
+        void ReadPlaylistFileToBufferL();
+        
+        /**
+        * Parses the buffer where playlist file was read to.
+        */
+        void ParsePlaylistBufferL(
+        		RPointerArray<HBufC>& aPlaylist,
+                TInt& aInvalidItemCount);
+    
+        /**
+        * Auto detects the character encoding from the supplied character
+        * set
+        * @param aSample a sample of the file
+        * @param aCharSetId auto-detected character set for the supplied
+        *        sample
+        * @param aCharacterSet a character set to detect the encoding from
+        * @return KErrNone if a character set is found; otherwise
+        *         KErrNotFound.
+        */
+        TInt DetectCharacterSetL(
+            const TDesC8& aSample,
+            const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aCharacterSet,
+            TUint& aCharSetId );
+        
+        /**
+        * Reads next line from iBuffer and stores it to iLine. Returns EFalse
+        * if there are no more new lines.
+        */
+        TBool ReadNextLineL();
+        
+        /**
+        * Decides what to do with an iLine read from iBuffer
+        */
+        void ProcessLineL(
+        		RPointerArray<HBufC>& aPlaylist,
+                TInt& aInvalidItemCount);
+        
+        /**
+        * Parses path or extended info from an iLine and stores them to iItem
+        */
+        TInt ParseLineL(
+                TFileName& aItem,
+                TInt& aInvalidItemCount);
+        
+        /**
+        * Parses and returns an absolute path if aPath is relative to playlist
+        * file's path. If path is not valid or it doesn't exist, error code is
+        * returned in aError.
+        *
+        * caller assumes ownership of the returned HBufC
+        */
+        HBufC* ParseAbsolutePathLC(
+                const TDesC& aPath,
+                TInt& aError);
+        
+    private:
+        RFs& iFs;
+        
+        TPtrC iPlaylistFilePath;
+        
+        TInt iInvalidItems;
+        
+        HBufC* iBuffer;
+        TPtrC iBufferPtr;
+        
+        // Not owned.
+        CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iAvailableCharacterSet;
+        CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iTopCharacterSet;
+        
+        TInt iEndLineNumber;  
+        TInt iCurrentLineNumber;
+        
+        HBufC* iLine;
+        
+        TBool iExtendedFormat;
+        
+        TFileName iItem;
+	};
+
+
+
+#endif  // __CHARVESTERM3UPLAYLISTPARSER_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/inc/mdsplaylistcharacterset.hrh	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,213 @@
+/*
+* 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:  All needed character set IDs are included here
+*
+*/
+
+
+
+#ifndef __MDSPLAYLISTCHARACTERSET_HRH__
+#define __MDSPLAYLISTCHARACTERSET_HRH__
+
+// INCLUDES
+
+/** 
+UTF-7 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierUtf7 0x1000582c 
+/** 
+UTF-8 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierUtf8 0x1000582d 
+/** 
+IMAP UTF-7 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierImapUtf7 0x1000582e 
+/** 
+Java UTF-8 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierJavaConformantUtf8 0x1000582f 
+/** 
+Code Page 1252 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierCodePage1252 0x100012b6 
+/** 
+ISO 8859-1 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso88591 0x10003b10 
+/** 
+ISO 8859-2 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso88592 0x1000507e 
+/** 
+ISO 8859-3 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso88593 0x10008a28 
+/** 
+ISO 8859-4 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso88594 0x1000507f 
+/** 
+ISO 8859-5 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso88595 0x10005080 
+/** 
+ISO 8859-6 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso88596 0x10008a29 
+/** 
+ISO 8859-7 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso88597 0x10005081 
+/** 
+ISO 8859-8 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso88598 0x10008a2a 
+/** 
+ISO 8859-9 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso88599 0x10005082 
+/** 
+ISO 8859-10 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso885910 0x10008a2b 
+/** 
+ISO 8859-13 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso885913 0x10008a2c 
+/** 
+ISO 8859-14 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso885914 0x10008a2d 
+/** 
+ISO 8859-15 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso885915 0x10008a2e 
+/** 
+ASCII 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierAscii 0x10004cc6 
+/** 
+SMS 7-bit 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierSms7Bit 0x100053ab 
+/** 
+GB 2312 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierGb2312 0x10000fbe 
+/** 
+HZ-GB-2312 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierHz 0x10006065 
+/** 
+GB 12345 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierGb12345 0x1000401a 
+/** 
+GBK 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierGbk 0x10003ecb 
+/** 
+Big 5 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierBig5 0x10000fbf 
+/** 
+Shift-JIS 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierShiftJis 0x10000fbd 
+/** 
+ISO-2022-JP 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso2022Jp 0x100066a0 
+/** 
+ISO-2022-JP-1 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierIso2022Jp1 0x100066a3 
+/** 
+JIS Encoding 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierJis 0x10006066 
+/** 
+EUC-JP 
+@publishedAll
+@released
+*/
+#define KCharacterSetIdentifierEucJpPacked 0x10006067 
+#define KCharacterSetIdentifierUnicodeLittle 0x101f3fae   //Little Endian Unicode
+#define KCharacterSetIdentifierUnicodeBig 0x101f4052  // Big Endian Unicode 
+#define KCharacterSetIdentifierUcs2 0x101ff492  
+
+#define KCharacterSetIdentifierWindows874  0x101F854A
+#endif // __MDSPLAYLISTCHARACTERSET_HRH__
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/inc/mdsplaylistsupplementalcharsets.hrh	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* 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:  supplemental character set IDs are included here
+*
+*/
+
+
+#ifndef __MDSPLAYLISTSUPPLEMENTALCHARSET_HRH__
+#define __MDSPLAYLISTSUPPLEMENTALCHARSET_HRH__
+
+/** 
+EucJpDirectmap
+*/
+#define KCharacterSetIdentifierEucJpDirectmap 0x10207353
+/** 
+ShiftJisDirectmap
+*/
+#define KCharacterSetIdentifierShiftJisDirectmap 0x10207354 
+/** 
+KOI8-R
+*/
+#define KCharacterSetIdentifierKOI8R 0x10207401 
+/** 
+KOI8-U
+*/
+#define KCharacterSetIdentifierKOI8U 0x10207402 
+/** 
+TIS_620
+*/
+#define KCharacterSetIdentifierTIS620 0x10207403 
+/** 
+Windows-1250
+*/
+#define KCharacterSetIdentifierCp1250 0x10207404 
+/** 
+Windows-1251
+*/
+#define KCharacterSetIdentifierCp1251 0x10207405 
+/** 
+Windows-1252
+*/
+#define KCharacterSetIdentifierCp1252 0x10207406 
+/** 
+Windows-1253
+*/
+#define KCharacterSetIdentifierCp1253 0x10207407 
+/** 
+Windows-1254
+*/
+#define KCharacterSetIdentifierCp1254 0x10207408 
+/** 
+Windows-1255
+*/
+#define KCharacterSetIdentifierCp1255 0x10207409 
+/** 
+Windows-1256
+*/
+#define KCharacterSetIdentifierCp1256 0x1020740A 
+/** 
+Windows-1257
+*/
+#define KCharacterSetIdentifierCp1257 0x1020740B 
+/** 
+Windows-1258
+*/
+#define KCharacterSetIdentifierCp1258 0x1020740C 
+/** 
+Windows-874
+*/
+#define KCharacterSetIdentifierCp874 0x1020740D 
+/** 
+ISCII
+*/
+#define KCharacterSetIdentifierISCII 0x1027508D 
+
+#endif // __MDSPLAYLISTSUPPLEMENTALCHARSET_HRH__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/inc/mdsplaylisttopcharacterset.rh	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* 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:  Contains definitions for structures used in Top Character Set 
+*                resource files.
+*
+*/
+
+
+
+#ifndef __MDSPLAYLISTTOPCHARACTERSET_RH__
+#define __MDSPLAYLISTTOPCHARACTERSET_RH__
+
+// INCLUDES
+#include "mdsplaylistcharacterset.hrh"         // Enumerations
+
+// STRUCTURE DEFINITIONS
+
+// -----------------------------------------------------------------------------
+// MDS_PLAYLIST_CHARACTER_SET
+// Structure definition character encoding 
+// -----------------------------------------------------------------------------
+//
+STRUCT MDS_PLAYLIST_CHARACTER_SET_ENCODING
+    {
+    LONG	character_set_id[];
+    }
+
+#endif // __MDSPLAYLISTTOPCHARACTERSET_RH__
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/src/harvesteraudioplaylistparser.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,382 @@
+/*
+* 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: 
+*
+*/
+
+
+#include <e32base.h>
+#include <bautils.h>
+#include <syslangutil.h>
+#include <PathInfo.h>
+#include <data_caging_path_literals.hrh>
+#include <mdsplaylisttopcharacterset.rsg>
+
+#include "harvesteraudioplaylistparser.h"
+
+#include "mdsutils.h"
+#include "harvesterlog.h"
+
+_LIT( KMimeTypeM3U,   "audio/x-mpegurl" );
+_LIT( KExtensionM3U,    "m3u" );
+
+_LIT( KMDSPlaylistCharacterSetRscFile, "mdsplaylisttopcharacterset.rsc" );
+
+const TInt KMDSArrayGranularity = 12;
+
+// -----------------------------------------------------------------------------
+// CHarvesterAudioPlaylistParser::NewL
+// -----------------------------------------------------------------------------
+//
+CHarvesterAudioPlaylistParser* CHarvesterAudioPlaylistParser::NewL()
+    {
+    CHarvesterAudioPlaylistParser* self = new ( ELeave ) CHarvesterAudioPlaylistParser();
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+
+	return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CHarvesterAudioPlaylistParser::~CHarvesterAudioPlaylistParser()
+    {
+    delete iTopCharacterSet;
+    
+    delete iAvailableCharacterSet;
+    
+    iFs.Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHarvesterAudioPlaylistParser::CHarvesterAudioPlaylistParser
+// -----------------------------------------------------------------------------
+//
+CHarvesterAudioPlaylistParser::CHarvesterAudioPlaylistParser() 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHarvesterAudioPlaylistParser::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CHarvesterAudioPlaylistParser::ConstructL()
+    {
+    User::LeaveIfError( iFs.Connect() );
+    iAvailableCharacterSet = CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableL( iFs );
+    iTopCharacterSet =
+        new (ELeave) CArrayFixFlat<CCnvCharacterSetConverter::SCharacterSet>( KMDSArrayGranularity );
+    GenerateTopCharacterSetsL();
+    iM3UParser = CHarvesterM3UPlaylistParser::NewL( iFs, iAvailableCharacterSet, iTopCharacterSet );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHarvesterAudioPlaylistParser::ParseMimeType
+// -----------------------------------------------------------------------------
+//
+TBool CHarvesterAudioPlaylistParser::ParseMimeType( 
+		const TDesC& aFileName, TDes& aMimeType )
+    {
+    TPtrC ext;
+    if( MdsUtils::GetExt( aFileName, ext ) )
+    	{
+    	if( ext == KExtensionM3U )
+    	    {
+    	    aMimeType = KMimeTypeM3U;
+    	    return ETrue;
+    	    }
+    	}
+
+    aMimeType = KNullDesC;
+    return EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHarvesterAudioPlaylistParser::ParseL
+// -----------------------------------------------------------------------------
+//
+TBool CHarvesterAudioPlaylistParser::ParseL( const TDesC& aFileName,
+		RPointerArray<HBufC>& aUriArray, TPtrC aMimeType )
+    {
+    if( aMimeType == KMimeTypeM3U )
+        {
+        return iM3UParser->ParseL( aFileName, aUriArray );
+        }
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CHarvesterAudioPlaylistParser::ResetL
+// -----------------------------------------------------------------------------
+//
+void CHarvesterAudioPlaylistParser::Reset()
+    {
+    iM3UParser->Reset();
+    }
+
+// -----------------------------------------------------------------------------
+// CHarvesterAudioPlaylistParser::GenerateTopCharacterSetsL
+// -----------------------------------------------------------------------------
+//
+void CHarvesterAudioPlaylistParser::GenerateTopCharacterSetsL()
+     {
+     CArrayFixFlat<TInt>* installedLanguages = NULL;
+     SysLangUtil::GetInstalledLanguages( installedLanguages );
+     CleanupStack::PushL( installedLanguages );
+     
+     TFileName fileName;
+     
+     TParsePtrC memory( PathInfo::RomRootPath() );
+     fileName.Copy( memory.Drive() );
+     fileName.Append( KDC_RESOURCE_FILES_DIR );
+     fileName.Append( KMDSPlaylistCharacterSetRscFile );
+
+     TRAPD( err, iRscFile.OpenL( iFs, fileName ) );
+     
+     // if there is no resource file, then there is no top character set list
+     if( err )
+         {
+         CleanupStack::PopAndDestroy( installedLanguages );
+         return;
+         }
+
+     const TInt count( installedLanguages->Count() );
+     for( TInt i=0; i < count; i++ )
+          {
+          SelectCharacterSetsForLanguageL( (*installedLanguages)[i] );
+          }
+     iTopCharacterSet->Compress();
+     installedLanguages->Reset();
+     CleanupStack::PopAndDestroy( installedLanguages );
+     iRscFile.Close();
+     }
+
+// -----------------------------------------------------------------------------
+// CHarvesterAudioPlaylistParser::SelectCharacterSetsForLanguageL
+// -----------------------------------------------------------------------------
+//
+void CHarvesterAudioPlaylistParser::SelectCharacterSetsForLanguageL( TInt aLanguage )
+     {
+     switch( aLanguage )
+          {
+          case ELangEnglish:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_ENGLISH_CHAR_SET );
+               break;
+          case ELangFrench:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_FRENCH_CHAR_SET );
+               break;
+          case ELangGerman:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_GERMAN_CHAR_SET );
+               break;
+          case ELangTurkish:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_TURKISH_CHAR_SET );
+               break;
+          case ELangFinnish:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_FINNISH_CHAR_SET );
+               break;
+          case ELangSwedish:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_SWEDISH_CHAR_SET );
+               break;
+          case ELangRussian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_RUSSIAN_CHAR_SET );
+               break;
+          case ELangArabic:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_ARABIC_CHAR_SET );
+               break;
+          case ELangHebrew:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_HEBREW_CHAR_SET );
+               break;
+          case ELangFarsi:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_FARSI_CHAR_SET );
+               break;
+          case ELangItalian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_ITALIAN_CHAR_SET );
+               break;
+          case ELangPolish:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_POLISH_CHAR_SET );
+               break;
+          case ELangHungarian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_HUNGARIAN_CHAR_SET );
+               break;
+          case ELangSpanish:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_SPANISH_CHAR_SET );
+               break;
+          case ELangDutch:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_DUTCH_CHAR_SET );
+               break;
+          case ELangPortuguese:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_PORTUGUESE_CHAR_SET );
+               break;
+          case ELangAmerican:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_ENGLISH_CHAR_SET );
+               break;
+          case ELangCanadianFrench:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_FRENCH_CHAR_SET );
+               break;
+          case ELangBrazilianPortuguese:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_PORTUGUESE_CHAR_SET );
+               break;
+          case ELangLatinAmericanSpanish:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_SPANISH_CHAR_SET );
+               break;
+          case ELangLatvian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_LATVIAN_CHAR_SET );
+               break;
+          case ELangGreek:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_GREEK_CHAR_SET );
+               break;
+          case ELangEstonian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_ESTONIAN_CHAR_SET );
+               break;
+          case ELangLithuanian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_LITHUANIAN_CHAR_SET );
+               break;
+          case ELangRomanian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_ROMANIAN_CHAR_SET );
+               break;
+          case ELangUkrainian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_UKRAINIAN_CHAR_SET );
+               break;
+          case ELangBulgarian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_BULGARIAN_CHAR_SET );
+               break;
+          case ELangCroatian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_CROATIAN_CHAR_SET );
+               break;
+          case ELangSerbian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_SERBIAN_CHAR_SET );
+               break;
+          case ELangIndonesian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_INDONESIAN_CHAR_SET );
+               break;
+          case ELangMalay:
+          case ELangTagalog:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_MALAY_CHAR_SET );
+               break;
+          case ELangIcelandic:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_ICELANDIC_CHAR_SET );
+               break;
+          case ELangDanish:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_DANISH_CHAR_SET );
+               break;
+          case ELangNorwegian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_NORWEGIAN_CHAR_SET );
+               break;
+          case ELangHindi:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_INDIAN_CHAR_SET );
+               break;
+          case ELangUrdu:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_URDU_CHAR_SET );
+               break;
+          case ELangCzech:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_CZECH_CHAR_SET );
+               break;
+          case ELangSlovak:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_SLOVAK_CHAR_SET );
+               break;
+          case ELangSlovenian:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_SLOVENIAN_CHAR_SET );
+               break;
+          case ELangTaiwanChinese:
+          case ELangHongKongChinese:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_TAIWAN_HK_CHINESE_CHAR_SET );
+               break;
+          case ELangPrcChinese:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_CHINESE_CHAR_SET );
+               break;
+          case ELangEnglish_Taiwan:
+          case ELangEnglish_Prc:
+          case ELangEnglish_Japan:
+          case ELangEnglish_Thailand:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_ENGLISH_CHAR_SET );
+               break;
+          case ELangJapanese:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_JAPANESE_CHAR_SET );
+               break;
+          case ELangThai:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_THAI_CHAR_SET );
+               break;
+          case ELangVietnamese:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_VIETNAMESE_CHAR_SET );
+               break;
+          case ELangMalay_Apac:
+               ReadCharacterSetResourceL( R_MDS_PLAYLIST_MALAY_CHAR_SET );
+               break;
+          default:
+               break;
+          }
+     }
+
+// -----------------------------------------------------------------------------
+// CHarvesterAudioPlaylistParser::ReadCharacterSetResourceL
+// -----------------------------------------------------------------------------
+//
+void CHarvesterAudioPlaylistParser::ReadCharacterSetResourceL( TInt aResourceId )
+     {
+     TResourceReader rscReader;                       // Resource reader
+     HBufC8* rscBuf;                                      // Buffer where resource is read
+
+     rscBuf = iRscFile.AllocReadL( aResourceId );
+     rscReader.SetBuffer( rscBuf );
+     CleanupStack::PushL( rscBuf );
+
+     TUint characterSetElementId;
+     TInt numCharacterSetElements = rscReader.ReadInt16();
+     TUint elemId;
+     CCnvCharacterSetConverter::SCharacterSet elem;
+
+     for( TInt i = 0; i < numCharacterSetElements; i++ )
+          {
+          characterSetElementId = rscReader.ReadInt32();
+          const TInt count( iAvailableCharacterSet->Count() );
+          for( TInt j = 0; j < count; j++ )
+               {
+               elem = (*iAvailableCharacterSet)[j];
+               elemId = elem.Identifier();
+               if ( elemId == characterSetElementId && !IsInTopCharacterSet(characterSetElementId) )
+                    {
+                    iTopCharacterSet->AppendL( elem );
+                    }
+               }
+          }
+
+     CleanupStack::PopAndDestroy( rscBuf );
+     }     
+     
+// -----------------------------------------------------------------------------
+// CHarvesterAudioPlaylistParser::IsInTopCharacterSet
+// -----------------------------------------------------------------------------
+//
+TBool CHarvesterAudioPlaylistParser::IsInTopCharacterSet( TUint aCharacterSetId )
+     {
+     const TInt count( iTopCharacterSet->Count() ); 
+     for( TInt i = 0; i < count; i++ )
+          {
+          if( (*iTopCharacterSet)[i].Identifier() == aCharacterSetId )
+               {
+               return ETrue;
+               }
+          }
+     return EFalse;
+     }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/src/harvesteraudioplaylistplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,336 @@
+/*
+* 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: 
+*
+*/
+
+
+#include <e32base.h>
+#include <harvesterdata.h>
+
+#include <mderelation.h>
+#include <mdeobjectdef.h>
+
+#include "harvesteraudioplaylistplugin.h"
+#include "mdeobjectwrapper.h"
+#include "mdsutils.h"
+
+#include "harvesterlog.h"
+
+// for CleanupResetAndDestroyPushL
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+CHarvesterAudioPlaylistPluginPropertyDefs::CHarvesterAudioPlaylistPluginPropertyDefs() : CBase()
+    {
+    }
+
+void CHarvesterAudioPlaylistPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef)
+    {
+    CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
+    
+    // Property definitions
+    CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject );
+    iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty );
+    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& albumObjectDef = nsDef.GetObjectDefL( MdeConstants::Album::KAlbumObject );
+    iAlbumTypeDef = &albumObjectDef.GetPropertyDefL( MdeConstants::Album::KTypeProperty );
+    
+    CMdEObjectDef& playlistObjectDef = nsDef.GetObjectDefL( MdeConstants::AudioPlaylistItem::KAudioPlaylistItem );
+    iAlbumIDDef = &playlistObjectDef.GetPropertyDefL( MdeConstants::AudioPlaylistItem::KPlaylistIDProperty );
+    iAudioObjectIDDef = &playlistObjectDef.GetPropertyDefL( MdeConstants::AudioPlaylistItem::KAudioObjectIDProperty );
+    iPositionDef = &playlistObjectDef.GetPropertyDefL( MdeConstants::AudioPlaylistItem::KPositionProperty );
+    }
+
+CHarvesterAudioPlaylistPluginPropertyDefs* CHarvesterAudioPlaylistPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
+    {
+    CHarvesterAudioPlaylistPluginPropertyDefs* self = 
+        new (ELeave) CHarvesterAudioPlaylistPluginPropertyDefs();
+    CleanupStack::PushL( self );
+    self->ConstructL( aObjectDef );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+using namespace MdeConstants;
+
+// ---------------------------------------------------------------------------
+// CHarvesterAudioPlugin::CHarvesterAudioPlugin
+// ---------------------------------------------------------------------------
+//    
+CHarvesterAudioPlaylistPlugin::CHarvesterAudioPlaylistPlugin() : 
+	CHarvesterPlugin()
+	{
+	}
+
+// ---------------------------------------------------------------------------
+// CHarvesterAudioPlaylistPlugin::NewL
+// ---------------------------------------------------------------------------
+//    
+CHarvesterAudioPlaylistPlugin* CHarvesterAudioPlaylistPlugin::NewL()
+	{
+	WRITELOG( "CHarvesterAudioPlaylistPlugin::NewL()" );
+	CHarvesterAudioPlaylistPlugin* self = new (ELeave) CHarvesterAudioPlaylistPlugin();
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// CHarvesterAudioPlaylistPlugin::~CHarvesterAudioPlaylistPlugin
+// ---------------------------------------------------------------------------
+//    
+CHarvesterAudioPlaylistPlugin::~CHarvesterAudioPlaylistPlugin()
+	{
+	WRITELOG( "CHarvesterAudioPlaylistPlugin::~CHarvesterAudioPlaylistPlugin()" );
+	
+	delete iPlaylistParser;
+	delete iPropDefs;
+	delete iMime;
+	}
+
+// ---------------------------------------------------------------------------
+// CHarvesterAudioPlaylistPlugin::ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterAudioPlaylistPlugin::ConstructL()
+	{
+	WRITELOG( "CHarvesterAudioPlaylistPlugin::ConstructL()" );
+	
+	iPlaylistParser =  CHarvesterAudioPlaylistParser::NewL();
+	}
+
+// ---------------------------------------------------------------------------
+// CHarvesterAudioPlaylistPlugin::HarvestL (from CHarvesterPlugin)
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterAudioPlaylistPlugin::HarvestL( CHarvesterData* aHD )
+	{
+	WRITELOG( "CHarvesterAudioPlaylistPlugin::HarvestL()" );
+	
+	TRAPD( err, DoHarvestL( aHD ) );
+	
+	if ( err != KErrNone )
+	    {
+	    aHD->SetErrorCode( err );
+	    }
+	}
+
+// ---------------------------------------------------------------------------
+// CHarvesterAudioPlaylistPlugin::DoHarvestL
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterAudioPlaylistPlugin::DoHarvestL( CHarvesterData* aHD )
+	{
+	WRITELOG( "CHarvesterAudioPlaylistPlugin::DoHarvestL()" );
+    CMdEObject& mdeObject = aHD->MdeObject();
+        
+    TBool isAdd = EFalse;
+    if ( mdeObject.Placeholder() || mdeObject.Id() == KNoId ) // is a new object or placeholder
+        {
+        isAdd = ETrue;
+        }
+    else
+        {
+        return; // Once playlist has been imported, changes made to it by Music Player
+                     // will not get written back to original playlist file. Thus changes to playlist
+                     // should be done within Music Player, and MDS will prevent playlist that
+                     // have already been imported to be changes so that there will not be 
+                     // several versions of same playlist imported by accident.
+        }
+
+    GetPropertiesL( aHD, isAdd );
+	}
+
+
+// ---------------------------------------------------------------------------
+// CHarvesterAudioPlaylistPlugin::GetPropertiesL
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterAudioPlaylistPlugin::GetPropertiesL( CHarvesterData* aHD,
+                                            TBool aIsAdd )
+    {
+    CMdEObject& mdeObject = aHD->MdeObject();
+    
+    // get creation time, modified time and file size
+    if( !mdeObject.Placeholder() )
+        {
+        GetPlaceHolderPropertiesL( aHD, aIsAdd );
+        }
+    
+    const TDesC& uri = mdeObject.Uri();
+    
+    TBool isSupported( GetMimeTypePropertyL( aHD, aIsAdd ) );
+
+    if( isSupported )
+    	{
+    	GetMusicPropertiesL( aHD, aIsAdd );
+    	}
+    }
+
+// ---------------------------------------------------------------------------
+// CHarvesterAudioPlaylistPlugin::GetPlaceHolderPropertiesL
+// Get placeholder properties (creation time, modify time and file size).
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterAudioPlaylistPlugin::GetPlaceHolderPropertiesL( CHarvesterData* aHD,
+                               TBool aIsAdd )
+    {
+    CMdEObject& mdeObject = aHD->MdeObject();
+    
+    const TDesC& uri = mdeObject.Uri();
+    
+    TEntry entry;
+    TInt err = iFs.Entry( uri, entry );
+    
+    if ( err!= KErrNone )
+        {
+        User::Leave( err ); // metadata cannot be gathered!
+        }
+    
+	TTime now;
+	now.HomeTime();
+	
+    if( !iPropDefs )
+        {
+        CMdEObjectDef& objectDef = mdeObject.Def();
+        iPropDefs = CHarvesterAudioPlaylistPluginPropertyDefs::NewL( objectDef );
+        }
+    
+	CMdeObjectWrapper::HandleObjectPropertyL(
+                 mdeObject, *iPropDefs->iCreationDatePropertyDef, &now, aIsAdd );
+
+	CMdeObjectWrapper::HandleObjectPropertyL(
+             mdeObject, *iPropDefs->iLastModifiedDatePropertyDef, &entry.iModified, aIsAdd );
+
+	CMdeObjectWrapper::HandleObjectPropertyL(
+              mdeObject, *iPropDefs->iSizePropertyDef, &entry.iSize, aIsAdd );
+    }
+
+// ---------------------------------------------------------------------------
+// CHarvesterAudioPlaylistPlugin::GetMimeTypePropertyL
+// Get mime type.
+// ---------------------------------------------------------------------------
+//    
+TBool CHarvesterAudioPlaylistPlugin::GetMimeTypePropertyL( 
+		CHarvesterData* aHD, TBool aIsAdd )
+    {
+    CMdEObject& mdeObject = aHD->MdeObject();
+ 
+    TBuf<40> mimeType( KNullDesC );
+    TBool supported( EFalse );
+    supported = iPlaylistParser->ParseMimeType( mdeObject.Uri(), mimeType );
+    delete iMime;
+    iMime = NULL;
+    iMime = mimeType.AllocL();
+        
+    if( !iPropDefs )
+        {
+        CMdEObjectDef& objectDef = mdeObject.Def();
+        iPropDefs = CHarvesterAudioPlaylistPluginPropertyDefs::NewL( objectDef );
+        }
+    
+    CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, 
+            *iPropDefs->iItemTypePropertyDef, (TAny*)&(mimeType), 
+        	aIsAdd );
+    
+    return supported;
+    }
+
+// ---------------------------------------------------------------------------
+// CHarvesterAudioPlaylistPlugin::GetMusicPropertiesL
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterAudioPlaylistPlugin::GetMusicPropertiesL( CHarvesterData* aHD,
+                                      TBool aIsAdd )
+    {
+    CMdEObject& mdeObject = aHD->MdeObject();
+    
+    if( !iPropDefs )
+        {
+        CMdEObjectDef& objectDef = mdeObject.Def();
+        iPropDefs = CHarvesterAudioPlaylistPluginPropertyDefs::NewL( objectDef );
+        }
+    
+    CMdESession& session = mdeObject.Session();
+
+#ifdef MDS_PLAYLIST_HARVESTING_ENABLED
+	TInt playlistType( MdeConstants::Album::EAlbumMusicPlaylist );
+	CMdeObjectWrapper::HandleObjectPropertyL( 
+              mdeObject, *iPropDefs->iAlbumTypeDef, &playlistType, aIsAdd );
+#endif
+    
+    RPointerArray<HBufC> playlistItems;
+    TCleanupItem cleanupItem( MdsUtils::CleanupPtrArray<HBufC>, &playlistItems );
+    CleanupStack::PushL( cleanupItem );
+    
+    const TBool parsed( iPlaylistParser->ParseL( mdeObject.Uri(), playlistItems, iMime->Des() ) ); 
+
+    if( parsed )
+        {
+        TTime curtime( 0 );
+        curtime.UniversalTime();
+
+        const TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
+        const TTime localTime = curtime + timeOffsetSeconds;
+        
+        RPointerArray<CMdEObject> objectArray;
+        
+        CMdENamespaceDef& nsDef = session.GetDefaultNamespaceDefL();
+        CMdEObjectDef& playlistObjectDef = nsDef.GetObjectDefL( MdeConstants::AudioPlaylistItem::KAudioPlaylistItem );
+        
+        const TInt count( playlistItems.Count() );
+        for( TInt i = 0; i < count; i++)
+            {
+            CMdEObject* mdeAudioObject = session.GetObjectL( playlistItems[i]->Des() );
+            if( mdeAudioObject )
+                {
+                CMdEObject* object = session.NewObjectLC( playlistObjectDef, Object::KAutomaticUri );
+                
+                object->AddTimePropertyL( *iPropDefs->iCreationDatePropertyDef, localTime );
+                object->AddTimePropertyL( *iPropDefs->iLastModifiedDatePropertyDef, curtime );
+                object->AddUint32PropertyL( *iPropDefs->iSizePropertyDef, 0 );
+                object->AddTextPropertyL( *iPropDefs->iItemTypePropertyDef, AudioPlaylistItem::KAudioPlaylistItemType );
+                
+                object->AddInt32PropertyL( *iPropDefs->iAlbumIDDef, mdeObject.Id() );
+                object->AddInt32PropertyL( *iPropDefs->iAudioObjectIDDef, mdeAudioObject->Id() );
+                
+                // position is considered to represent items relative position in the list
+                // if item is removed from the middle of the list, position is still valid even though
+                // the actual position value is not updated
+                object->AddInt32PropertyL( *iPropDefs->iPositionDef, (i+1) ); // playlist position starts from 1
+                objectArray.AppendL( object );
+                CleanupStack::Pop(); // object
+                }
+            delete mdeAudioObject;
+            }
+        CleanupResetAndDestroyPushL( objectArray );
+        TRAPD( addError, session.AddObjectsL( objectArray ) );
+        if ( addError != KErrNone )
+            {
+            WRITELOG1( "CHarvesterAudioPlaylistPlugin::GetMusicPropertiesL - Add items to MDE error: %d", addError );
+            }
+        CleanupStack::PopAndDestroy( &objectArray );
+        }
+
+    CleanupStack::PopAndDestroy( &playlistItems );
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/src/harvesterm3uplaylistparser.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,534 @@
+/*
+* 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: 
+*
+*/
+
+
+#include <e32base.h>
+#include <bautils.h>
+#include <syslangutil.h>
+#include <PathInfo.h>
+#include <data_caging_path_literals.hrh>
+#include <mdsplaylisttopcharacterset.rsg>
+
+#include "harvesterm3uplaylistparser.h"
+
+#include "mdsutils.h"
+#include "harvesterlog.h"
+
+_LIT( KMDSM3ULineChange, "\n" );
+_LIT( KMDSM3UTagExtm3u, "#EXTM3U" );
+_LIT (KMDSM3UTagExtinf, "#EXTINF:" );
+_LIT( KMDSM3UPoint, ",");
+_LIT( KMDSM3UTagExt, "#");
+_LIT( KMDSM3UAbsPath, ":\\");
+
+const TInt KMDSM3UCarriageReturn = 13;
+const TInt KMDSM3UNoOffset = 0;
+const TInt KPlaylistSampleLength = 10000; 
+const TUint KUnicodeBOM = 0xFEFF;
+const TInt KPlaylistMaxSampleLength = 130000;
+const TInt KMinimumConfidenceRequired = 75;
+const TInt KMDSM3UPlaylistMaxItemCount = KMaxTInt;
+const TInt KPathStartingChars = 3;
+
+// MODULE DATA STRUCTURES
+enum TMDSM3UPlaylistLineType
+    {
+    EMDSM3UPlaylistLineTypeExtinf = 1,
+    EMDSM3UPlaylistLineTypePath = 2,
+    EMDSM3UPlaylistLineTypeNotSupported = 3,
+    EMDSM3UPlaylistLineTypeCorrupted = 4
+    };
+
+// -----------------------------------------------------------------------------
+// CHarvesterM3UPlaylistParser::NewL
+// -----------------------------------------------------------------------------
+//
+CHarvesterM3UPlaylistParser* CHarvesterM3UPlaylistParser::NewL( RFs& aFs,
+        CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* aAvailableCharacterSet,
+        CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* aTopCharacterSet )
+    {
+    CHarvesterM3UPlaylistParser* self = new ( ELeave ) CHarvesterM3UPlaylistParser(
+            aFs, aAvailableCharacterSet, aTopCharacterSet );
+
+	return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CHarvesterM3UPlaylistParser::~CHarvesterM3UPlaylistParser()
+    {
+    Reset();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHarvesterM3UPlaylistParser::CHarvesterM3UPlaylistParser
+// -----------------------------------------------------------------------------
+//
+CHarvesterM3UPlaylistParser::CHarvesterM3UPlaylistParser( RFs& aFs,
+        CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* aAvailableCharacterSet,
+        CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* aTopCharacterSet ) 
+    :iFs( aFs ), iAvailableCharacterSet( aAvailableCharacterSet ),
+     iTopCharacterSet( aTopCharacterSet ), iEndLineNumber( KMDSM3UPlaylistMaxItemCount )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CHarvesterM3UPlaylistParser::ParseL
+// -----------------------------------------------------------------------------
+//
+TBool CHarvesterM3UPlaylistParser::ParseL( const TDesC& aFileName,
+		RPointerArray<HBufC>& aUriArray )
+    {
+    iPlaylistFilePath.Set( aFileName );
+    ReadPlaylistFileToBufferL();
+    ParsePlaylistBufferL( aUriArray, iInvalidItems );
+    
+    // If at the moment, we know that there is at least one error parsing
+    // with auto detect encoding, we don't need to proceed until end of
+    // file anymore, this playlist file is concluded to be corrupted
+    if ( iInvalidItems > 0 )
+        {
+        aUriArray.Reset();
+        Reset();
+        User::Leave( KErrCorrupt );
+        }
+    
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CHarvesterM3UPlaylistParser::ResetL
+// -----------------------------------------------------------------------------
+//
+void CHarvesterM3UPlaylistParser::Reset()
+    {
+    delete iBuffer;
+    iBuffer = NULL;
+    delete iLine;
+    iLine = NULL;
+    iBufferPtr.Set( KNullDesC );
+    iCurrentLineNumber = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CHarvesterM3UPlaylistParser::ReadPlaylistFileToBufferL
+// -----------------------------------------------------------------------------
+//
+void CHarvesterM3UPlaylistParser::ReadPlaylistFileToBufferL()
+    {
+#ifdef _DEBUG
+    WRITELOG1( "Before reading playlist to buffer: heap size = %d", User::Heap().Size() );
+#endif
+    
+    TEntry entry;
+    User::LeaveIfError( iFs.Entry( iPlaylistFilePath, entry ) );
+    
+    HBufC* buffer = HBufC::NewLC( entry.iSize );
+    TPtr ptr = buffer->Des();
+
+    HBufC8* buf8 = HBufC8::NewLC( entry.iSize );
+    TPtr8 ptr8 = buf8->Des();
+
+    // Read the first KPlaylistSampleLength bytes of the file
+    TInt sampleLength( KPlaylistSampleLength );
+    if( sampleLength > entry.iSize )
+        {
+        sampleLength = entry.iSize;
+        }
+    User::LeaveIfError( iFs.ReadFileSection(
+                            iPlaylistFilePath, 0, ptr8, sampleLength ) );
+
+    // auto detect character encoding
+    TUint charSetId( 0 );
+    TInt error = DetectCharacterSetL( *buf8, *iTopCharacterSet, charSetId );
+    WRITELOG2("Encoding detected using top character set is 0x%x, error %d", charSetId, error);
+    
+    // when we fail to detect the encoding, use all available character set in the
+    // system to try again. If that also fails, abandon the operation.
+    if ( error )
+        {
+        User::LeaveIfError( DetectCharacterSetL( *buf8, *iAvailableCharacterSet, charSetId ) );
+        WRITELOG1( "Encoding detected using available character set is 0x%x", charSetId );     
+        }
+
+    // read the whole file if the sample taken isn't the whole file
+    if ( sampleLength != entry.iSize )
+        {
+        User::LeaveIfError( iFs.ReadFileSection(
+                                iPlaylistFilePath, 0, ptr8, entry.iSize) );
+        }
+   
+    // perform character conversion using the selected encoding
+    TInt state( CCnvCharacterSetConverter::KStateDefault );
+    TInt numOfUnconvertibleChars( 0 );
+    CCnvCharacterSetConverter* charSetConv = CCnvCharacterSetConverter::NewLC();
+    charSetConv->PrepareToConvertToOrFromL( charSetId, *iAvailableCharacterSet, iFs );
+    TInt retVal = charSetConv->ConvertToUnicode( ptr, *buf8, state, numOfUnconvertibleChars );
+    User::LeaveIfError( retVal );
+
+    // try again if the character set wasn't detected using the whole file
+    if( (retVal > 0 || numOfUnconvertibleChars > 0) && (sampleLength != entry.iSize) )
+        {
+        WRITELOG3( "retVal = %d, numOfUnconvertibleChars = %d, entry.iSize = %d",
+                retVal, numOfUnconvertibleChars, entry.iSize );  
+        numOfUnconvertibleChars = 0;
+        retVal = 0;
+        User::LeaveIfError( DetectCharacterSetL( *buf8, *iAvailableCharacterSet, charSetId ) );
+        charSetConv->PrepareToConvertToOrFromL( charSetId, *iAvailableCharacterSet, iFs );
+        retVal = charSetConv->ConvertToUnicode( ptr, *buf8, state, numOfUnconvertibleChars );
+        }
+        
+    if ( retVal > 0 || numOfUnconvertibleChars > 0 )
+        {
+        WRITELOG2( "Unable to find character encoding for the playlist file. retVal = %d, numOfUnconvertibleChars = %d",
+                    retVal, numOfUnconvertibleChars );     
+        User::Leave( KErrNotSupported );
+        }
+    
+    // remove the byte order mark (BOM) character prepended at the beginning
+    // of the stream if encoded with unicode as per Unicode section 2.4
+    if ( (charSetId == KCharacterSetIdentifierUnicodeLittle ||
+         charSetId == KCharacterSetIdentifierUnicodeBig) &&
+        ptr.Length() > 0 &&
+        ptr[0] == KUnicodeBOM )
+        {
+        ptr.Delete( 0,1 );
+        }
+        
+    iBuffer = buffer;
+    iBufferPtr.Set( *iBuffer );
+    
+    CleanupStack::PopAndDestroy (2, buf8 ); // charSetConv & buf8    
+    CleanupStack::Pop( buffer );
+        
+    // brand new buffer which hasn't been read, reset iCurrentLineNumber and
+    // iEndLineNumber
+    iCurrentLineNumber = 0;
+
+#ifdef _DEBUG
+    WRITELOG1( "After reading playlist to buffer: heap size = %d", User::Heap().Size() );
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CHarvesterM3UPlaylistParser::DetectCharacterSetL
+// -----------------------------------------------------------------------------
+//
+TInt CHarvesterM3UPlaylistParser::DetectCharacterSetL(
+            const TDesC8& aSample,
+            const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aCharacterSet,
+            TUint& aCharSetId)
+    {
+    // CCnvCharacterSetConverter::ConvertibleToCharSetL hangs if sample is too big
+    if ( aSample.Size() > KPlaylistMaxSampleLength )
+        {
+        User::Leave( KErrNotSupported );
+        }
+        
+    TInt confidence( 0 );
+    TInt highestConfidence( 0 );
+    TUint charSetId( 0 );
+    TUint highestConfidencecharSetId( 0 );
+
+    CCnvCharacterSetConverter* charSetConv = CCnvCharacterSetConverter::NewLC();
+    TInt count = aCharacterSet.Count();
+    for ( TInt i=0; i < count; i++ )
+        {
+        charSetId = aCharacterSet.At(i).Identifier();
+        charSetConv->ConvertibleToCharSetL( confidence, charSetId, aCharacterSet, aSample );
+        if ( confidence > highestConfidence )
+            {
+            highestConfidence = confidence;
+            highestConfidencecharSetId = charSetId;
+            }
+        }
+    CleanupStack::PopAndDestroy( charSetConv );
+    WRITELOG2( "CMPXM3uPlaylistImporter::DetectCharacterSetL :-> Confidence[%d] CharSetId[0x%x]",
+            confidence, aCharSetId );
+    if ( highestConfidence == 0 || highestConfidence < KMinimumConfidenceRequired )
+        {
+        return KErrNotFound;
+        }
+    else
+        {
+        aCharSetId = highestConfidencecharSetId;
+        return KErrNone;
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CHarvesterM3UPlaylistParser::ParsePlaylistBufferL
+// -----------------------------------------------------------------------------
+//
+void CHarvesterM3UPlaylistParser::ParsePlaylistBufferL(
+			RPointerArray<HBufC>& aPlaylist,
+            TInt& aInvalidItemCount)
+    {
+    // Read and process all the lines in the file
+    //
+    // the order of the following conditions is important. ReadNextLineL
+    // should be called last to avoid skipping one line
+    while ( iCurrentLineNumber < iEndLineNumber &&
+               aPlaylist.Count() < KMDSM3UPlaylistMaxItemCount &&
+               ReadNextLineL() )
+        {
+        ProcessLineL( aPlaylist, aInvalidItemCount );  
+        }
+
+    if ( aPlaylist.Count() == KMDSM3UPlaylistMaxItemCount )
+        {
+        Reset();
+        User::Leave( KErrOverflow );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CHarvesterM3UPlaylistParser::ReadNextLineL
+// -----------------------------------------------------------------------------
+//
+TBool CHarvesterM3UPlaylistParser::ReadNextLineL()
+    {
+    // iBuffer should exist when this function is called
+    __ASSERT_DEBUG( iBuffer, User::Leave( KErrBadDescriptor ) );
+
+    if ( !iBufferPtr.Length() )
+        {
+        return EFalse;
+        }
+
+    delete iLine;
+    iLine = NULL;
+
+    // Try to find line change
+    TInt offset = iBufferPtr.FindF( KMDSM3ULineChange );
+  
+    if( offset == KErrNotFound )
+        {
+        // No line change was found --> last line had no line change
+        iLine = iBufferPtr.AllocL();
+        // Set iBufferPtr to the end of buffer
+        iBufferPtr.Set( iBufferPtr.Right(0) );
+        }
+    else
+        {
+        // Found line change
+        TInt length( offset );
+        if ( (offset > KMDSM3UNoOffset) && 
+            (iBufferPtr[length - 1] == KMDSM3UCarriageReturn) )
+            {
+            --length;
+            }
+
+        iLine = iBufferPtr.Left(length).AllocL();
+
+        // Move past the line feed
+        iBufferPtr.Set( iBufferPtr.Mid(++offset) );
+        }
+
+    // Remove leading and trailing space characters from iLine's data.
+    TPtr ptr = iLine->Des();
+    ptr.Trim();
+
+    iCurrentLineNumber++;
+    return ETrue;
+    }
+    
+// -----------------------------------------------------------------------------
+// CHarvesterM3UPlaylistParser::ProcessLineL
+// -----------------------------------------------------------------------------
+//
+void CHarvesterM3UPlaylistParser::ProcessLineL(
+			RPointerArray<HBufC>& aPlaylist,
+            TInt& aInvalidItemCount)
+    {
+    if ( iCurrentLineNumber == 1 ) // first line
+        {
+        // Check whether the file is in the extented format
+        TInt offset = iLine->Find( KMDSM3UTagExtm3u );
+        if( offset == KErrNotFound || offset != KMDSM3UNoOffset ||
+            iLine->Length() != KMDSM3UTagExtm3u().Length() )
+            {
+            // The file is not in the extented format
+            iExtendedFormat = EFalse;
+            }
+        else
+            {
+            // The file is in the extented format
+            iExtendedFormat = ETrue;
+            return;
+            }        
+        }
+    
+    // Parse line and then decide what to do with it
+    switch( ParseLineL( iItem, aInvalidItemCount ) )
+        {
+        case EMDSM3UPlaylistLineTypeExtinf:
+            // Continue to next round
+            break;
+            
+        case EMDSM3UPlaylistLineTypePath:
+            {
+            // Line was a path => add item to playlist
+            aPlaylist.AppendL( iItem.AllocL() );
+            }
+            break; 
+                       
+        case EMDSM3UPlaylistLineTypeNotSupported:
+        case EMDSM3UPlaylistLineTypeCorrupted:
+        default:
+            {
+            iItem = KNullDesC;
+            }
+            break;
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CHarvesterM3UPlaylistParser::ParseLineL
+// -----------------------------------------------------------------------------
+//
+TInt CHarvesterM3UPlaylistParser::ParseLineL(
+            TFileName& aItem,
+            TInt& aInvalidItemCount)
+    {
+    __ASSERT_DEBUG( iLine, User::Leave(KErrAbort) );
+
+    if( !iLine->Length() )
+        {
+        // Empty line => line is invalid
+        return EMDSM3UPlaylistLineTypeNotSupported;
+        }
+
+    if( iExtendedFormat )
+        {
+        // File is in the extented format => check whether there is extented
+        // info in this line.
+        TInt offset = iLine->Find( KMDSM3UTagExtinf );
+        if( offset != KErrNotFound && offset == KMDSM3UNoOffset )
+            {
+            offset = iLine->Find( KMDSM3UPoint );
+
+            if( offset != KErrNotFound )
+                {
+                return EMDSM3UPlaylistLineTypeExtinf; // line type extinf
+                }    
+            }
+        }
+
+    // File is not in the extented format or supported info not found from this
+    // line.
+    switch( iLine->Find(KMDSM3UTagExt) )
+        {
+        case KMDSM3UNoOffset:
+            // Unsupported extended info tag found from this line
+            return EMDSM3UPlaylistLineTypeNotSupported;
+            
+        case KErrNotFound:
+        default:
+            // Extended info not found from the beginning of line => line is
+            // a path.
+            {
+            // Get absolute path
+            TInt error( KErrNone );
+            HBufC* uri = ParseAbsolutePathLC( *iLine, error );
+        
+            if( error )
+                {
+                CleanupStack::PopAndDestroy( uri );
+                ++aInvalidItemCount;
+                return EMDSM3UPlaylistLineTypeCorrupted;
+                }
+
+            aItem = uri->Des();
+
+            CleanupStack::PopAndDestroy( uri );
+            
+            return EMDSM3UPlaylistLineTypePath; // line type path
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CHarvesterM3UPlaylistParser::ParseAbsolutePathLC
+// -----------------------------------------------------------------------------
+//
+HBufC* CHarvesterM3UPlaylistParser::ParseAbsolutePathLC(
+            const TDesC& aPath,
+            TInt& aError)
+    {
+    HBufC* path = NULL;
+    
+    TBool isAbsolute( EFalse );
+    
+    if( aPath.Length() > KPathStartingChars && 
+        !aPath.Mid(1, 2).CompareF( KMDSM3UAbsPath ) ) // magic: the 2nd and 3rd chars
+                                               // are always ":\"
+                                               // for absolute paths
+        {
+        isAbsolute = ETrue;
+        }
+
+    if( aPath.Length() > KMaxFileName ) // Test if path is too long
+        {
+        aError = KErrCorrupt;
+        }
+    else if( isAbsolute )
+        {
+        aError = KErrNone;
+        aError = iFs.IsValidName( aPath ) ? KErrNone : KErrBadName;
+        path = aPath.AllocLC();
+        }
+    else
+        {
+        // Given path could be relative => create absolute path and test it
+        // Playlist file path
+        TParse playlistPath;
+        playlistPath.Set( iPlaylistFilePath, NULL, NULL );
+        // Path to the folder, where playlist file is located to
+        TPtrC currentFolder = playlistPath.DriveAndPath();
+        // Create absolute path
+        path = HBufC::NewLC( currentFolder.Length() + aPath.Length() );
+
+        TPtr tmpPtr( path->Des() );
+        tmpPtr = currentFolder;
+        tmpPtr += aPath;
+
+        aError = iFs.IsValidName(*path) ? KErrNone : KErrBadName;
+        }
+    
+    // It is possible that a song exists in the filesystem but isn't added to
+    // the database because it's not a supported type. If such song is included
+    // in a playlist, it will be added to the database when the playlist is added.
+    // Because of this, we cannot rely on whether the song exists in the database
+    // to conclude whether the song is a broken link. We need to check for file
+    // existence here. For the unsupported songs included in the playlist, they
+    // will then be marked as corrupted when user initiates playback of those
+    // songs.
+    if ( !aError &&
+         !BaflUtils::FileExists(iFs, *path) )
+        {
+        aError = KErrPathNotFound;
+        }
+
+    return path;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/src/proxy.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* 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: 
+*
+*/
+
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "harvesteraudioplaylistplugin.h"
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy KImplementationTable[] = 
+	{
+		{{0x200211F6},	(TProxyNewLPtr)CHarvesterAudioPlaylistPlugin::NewL}
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy);
+	return KImplementationTable;
+	}
+
--- a/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h	Fri Mar 19 09:38:01 2010 +0200
@@ -109,7 +109,11 @@
 	    
 	    void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail,
 	        TThumbnailRequestId aId );
-		
+
+    protected: // from CHarvesterPlugin
+	    
+	    void GetMimeType( const TDesC& aUri, TDes& aMimeType );
+	    
 	private:
 	     
 		/**
--- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -129,7 +129,6 @@
     CleanupStack::PopAndDestroy( rep );   
 	
 	iAudioParser = CAudioMDParser::NewL( iHarvestAlbumArt );
-    iAudioParser->ResetL();
     
     if( iHarvestAlbumArt )
         {
@@ -168,7 +167,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CHarvesterAudioPlugin::HarvestL (from CHarvesterPlugin)
+// CHarvesterAudioPlugin::ThumbnailReady
 // ---------------------------------------------------------------------------
 //    
 void CHarvesterAudioPlugin::ThumbnailReady( TInt /*aError*/, 
@@ -179,6 +178,25 @@
     }
 
 // ---------------------------------------------------------------------------
+// CHarvesterAudioPlugin::GetMimeType (from CHarvesterPlugin)
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterAudioPlugin::GetMimeType( const TDesC& aUri, TDes& aMimeType )
+    {
+    aMimeType.Zero();
+    
+    const TMimeTypeMapping<TAudioMetadataHandling>* mapping = 
+        iAudioParser->ParseMimeType( aUri );
+
+    if ( !mapping )
+        {
+        return;
+        }
+    
+    aMimeType = mapping->iMimeType;
+    }
+
+// ---------------------------------------------------------------------------
 // CHarvesterAudioPlugin::DoHarvestL
 // ---------------------------------------------------------------------------
 //    
@@ -279,7 +297,7 @@
     const TMimeTypeMapping<TAudioMetadataHandling>* mapping = 
     	iAudioParser->ParseMimeType( mdeObject.Uri() );
     
-    if ( mapping )
+    if ( mapping && !mdeObject.Placeholder() )
         {
     	if( !iPropDefs )
     		{
@@ -343,17 +361,9 @@
     
     if ( song.Length() > 0
         && song.Length() < iPropDefs->iTitlePropertyDef->MaxTextLengthL() )
-        {
-        TRAPD( error, CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, 
-        		*iPropDefs->iTitlePropertyDef, &song, aIsAdd ) );
-        if( error != KErrNone )
-            {
-            CMdEProperty* prop = NULL;
-            const TInt index = mdeObject.Property( *iPropDefs->iTitlePropertyDef, prop );
-            mdeObject.RemoveProperty( index );
-            CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, 
-            		*iPropDefs->iTitlePropertyDef, &song, aIsAdd );
-            }
+        {    
+        CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, 
+        		*iPropDefs->iTitlePropertyDef, &song, EFalse );
         }
 
     if ( artist.Length() > 0
--- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -77,6 +77,7 @@
     {
     delete iMetaDataUtility;
     
+    iMimeTypeMappings.Close();
     iWantedMetadataFields.Close();
     }
 
--- a/harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h	Fri Mar 19 09:38:01 2010 +0200
@@ -129,6 +129,10 @@
 		*/
 		void HarvestL( CHarvesterData* aHD );
 
+	protected:
+		
+	      void GetMimeType( const TDesC& aUri, TDes& aMimeType );
+		
 	private:
 	    /**
 	     * The method that actually extracts the metadata.
--- a/harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -191,6 +191,7 @@
    	
     delete iPropDefs;
     
+    iMimeTypeMappings.Close();
     iFbs.Disconnect();
 	}
 
@@ -329,6 +330,34 @@
 	}
 
 // ---------------------------------------------------------------------------
+// CHarvesterImagePlugin::GetMimeType (from CHarvesterPlugin)
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterImagePlugin::GetMimeType( const TDesC& aUri, TDes& aMimeType )
+    {
+    aMimeType.Zero();
+    
+    TPtrC ext;
+    if( !MdsUtils::GetExt( aUri, ext ) )
+        {
+        return;
+        }
+
+    TMimeTypeMapping<TImageMetadataHandling> finder(ext);
+    TLinearOrder< TMimeTypeMapping<TImageMetadataHandling> > cmp(
+            TMimeTypeMapping<TImageMetadataHandling>::CompareFunction);
+
+    const TInt pos = iMimeTypeMappings.FindInOrder( finder, cmp );
+
+    if ( pos == KErrNotFound )
+        {
+        return;
+        }
+
+    aMimeType = iMimeTypeMappings[pos].iMimeType;
+    }
+
+// ---------------------------------------------------------------------------
 // GatherData
 // ---------------------------------------------------------------------------
 //    
@@ -417,8 +446,6 @@
         // Exif couldn't be found. Open the image with ICL decoder instead.
         WRITELOG( "CHarvesterImagePlugin::GatherData() - Exif could not be read. Using ICL." );
 
-        iDecoder->Reset();
-
         TPtr8 imageDataPtr = aFileData.iImageData->Des();
         TRAP( err, iDecoder->OpenL(imageDataPtr, aFileData.iMime8,
                 CImageDecoder::TOptions( CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionIgnoreExifMetaData ) ) );
@@ -427,6 +454,7 @@
         if ( err != KErrNone )
             {
             WRITELOG1( "CHarvesterImagePlugin::GatherData() - ERROR: Decoder could not open image data! Code %d", err );
+            iDecoder->Reset();
             return KErrCompletion; // metadata item still can be created, thus KErrCompletion
             }
 
@@ -448,6 +476,7 @@
 				if ( readStatus != KErrNone )
 					{
 					CleanupStack::PopAndDestroy( additionalData );
+					iDecoder->Reset();
 					return KErrCompletion;
 					}
 				
@@ -463,6 +492,7 @@
             if ( err || !iDecoder->ValidDecoder() )
             	{
             	WRITELOG( "CHarvesterImagePlugin::GatherData() - ERROR: no valid decoder" );
+            	iDecoder->Reset();
             	return KErrCompletion; // metadata item still can be created, thus KErrCompletion
             	}
             }
@@ -475,6 +505,8 @@
         aFileData.iImageWidth = imageSize.iWidth;
         aFileData.iImageHeight = imageSize.iHeight;
         aFileData.iBitsPerPixel = info.iBitsPerPixel;
+        
+        iDecoder->Reset();
         }
 
     WRITELOG( "CHarvesterImagePlugin::GatherData() - end" );
@@ -504,7 +536,7 @@
 	TLinearOrder< TMimeTypeMapping<TImageMetadataHandling> > cmp(
 			TMimeTypeMapping<TImageMetadataHandling>::CompareFunction);
 
-	TInt pos = iMimeTypeMappings.FindInOrder( finder, cmp );
+	const TInt pos = iMimeTypeMappings.FindInOrder( finder, cmp );
 
 	TImageMetadataHandling handler( EOtherHandling ); 
 
@@ -608,9 +640,9 @@
 
     TTime localModifiedDate = aFileData.iModified + timeOffsetSeconds;
     
-    // Object - Creation date
     if( ! mdeObject.Placeholder() )
     	{
+        // Object - Creation date
 	    if ( aFileData.iExifSupported && aHd.iDateOriginal8 )
 	        {
 	        TTime originalTime = iExifUtil->ConvertExifDateTimeToSymbianTimeL(
@@ -621,12 +653,15 @@
 	        {
 	        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCreationDatePropertyDef, &localModifiedDate, aIsAdd );
 	        }
-    	}
-
-    // Object - last aFileData.iModified date
-    if( ! mdeObject.Placeholder() )
-    	{
-    	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iLastModifiedDatePropertyDef, &aFileData.iModified, aIsAdd );
+	    
+	    // Object - last aFileData.iModified date
+	    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iLastModifiedDatePropertyDef, &aFileData.iModified, aIsAdd );
+	    
+	    // Object - Size
+	    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iSizePropertyDef, &aFileData.iFileSize, aIsAdd );
+	    
+	    // Item Type
+	    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iItemTypePropertyDef, &aFileData.iMime16, aIsAdd );
     	}
 
     if( aFileData.iJpeg )
@@ -635,15 +670,6 @@
     	TInt16 timeOffsetMinutes = timeOffsetSeconds.Int() / 60;
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTimeOffsetPropertyDef, &timeOffsetMinutes, aIsAdd );
     	}
-
-    // Object - Size
-    if( ! mdeObject.Placeholder() )
-    	{
-    	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iSizePropertyDef, &aFileData.iFileSize, aIsAdd );
-    	}
-    
-    // Item Type
-	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iItemTypePropertyDef, &aFileData.iMime16, aIsAdd );
     
     // MediaObject - Width
     if ( aFileData.iExifSupported )
--- a/harvester/harvesterplugins/MessagePlugin/group/bld.inf	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/MessagePlugin/group/bld.inf	Fri Mar 19 09:38:01 2010 +0200
@@ -22,7 +22,7 @@
 PRJ_EXPORTS
 
 PRJ_MMPFILES
-harvestermessageplugin.mmp
+//harvestermessageplugin.mmp
 
 PRJ_TESTMMPFILES
 
--- a/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h	Fri Mar 19 09:38:01 2010 +0200
@@ -117,6 +117,10 @@
 		/** */
 		void GetObjectType( const TDesC& aUri, TDes& aObjectType );
 		
+    protected: // from CHarvesterPlugin
+        
+        void GetMimeType( const TDesC& aUri, TDes& aMimeType );
+	
 	private:
 		/**
 		* C++ constructor - not exported;
--- a/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -266,16 +266,25 @@
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
     			*iPropDefs->iSizePropertyDef, &aVHD.iFileSize, aIsAdd );
     	}
+    
+    // Item Type
+    if(aVHD.iMimetype.Length() > 0)
+        {
+        TBool isAdd( EFalse );
+        CMdEProperty* prop = NULL;
+        TInt index = mdeObject.Property( *iPropDefs->iItemTypePropertyDef, prop );
+        if( index < 0 )
+            {
+            isAdd = ETrue;
+            }
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iItemTypePropertyDef, &aVHD.iMimetype, isAdd );
+        }
+    
     // DRM protection
     CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
     		*iPropDefs->iDrmPropertyDef, &aVHD.iDrmProtected, aIsAdd );
     
-    // Item Type
-    if(aVHD.iMimetype.Length() > 0)
-    	{
-    	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
-    			*iPropDefs->iItemTypePropertyDef, &aVHD.iMimetype, aIsAdd );
-    	}
     // Title (is set from URI by default)
     if(aVHD.iTitle.Length() > 0)
     	{
@@ -357,3 +366,22 @@
 	WRITELOG1( "CHarvesterOMADRMPlugin::GetObjectType - ERROR: mimetype %S. No object type found", &mime );
 	aObjectType.Zero();
 	}
+
+// ---------------------------------------------------------------------------
+// CHarvesterOMADRMPlugin::GetMimeType (from CHarvesterPlugin)
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterOMADRMPlugin::GetMimeType( const TDesC& aUri, TDes& aMimeType )
+    {
+    aMimeType.Zero();
+    
+    ContentAccess::CContent* content = NULL;
+    
+    TRAPD( err, content = ContentAccess::CContent::NewL( aUri ) );
+    if (err == KErrNone) 
+        {
+        err = content->GetStringAttribute( ContentAccess::EMimeType, aMimeType );
+        delete content;
+        }
+    }
+
--- a/harvester/harvesterplugins/RTPPlugin/inc/harvesterrtpplugin.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/RTPPlugin/inc/harvesterrtpplugin.h	Fri Mar 19 09:38:01 2010 +0200
@@ -181,6 +181,10 @@
     */
     void HarvestL( CHarvesterData* aHarvesterData );
 
+protected: // from CHarvesterPlugin
+    
+    void GetMimeType( const TDesC& aUri, TDes& aMimeType );
+    
 private:
 
     /**
--- a/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -153,6 +153,15 @@
     }
 
 // ---------------------------------------------------------------------------
+// CHarvesterAudioPlugin::GetMimeType (from CHarvesterPlugin)
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterRtpPlugin::GetMimeType( const TDesC& /*aUri*/, TDes& aMimeType )
+    {
+    aMimeType = KRtpClipMimetype;
+    }
+
+// ---------------------------------------------------------------------------
 // Gather metadata
 // ---------------------------------------------------------------------------
 //
@@ -271,6 +280,9 @@
     	// File size
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
     			*iPropDefs->iSizePropertyDef, &aClipDetails.iFileSize, aIsAdd );
+        // Mime Type
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iItemTypePropertyDef, &aClipDetails.iMimeType, aIsAdd );
     	}
 
     // Title (is set from URI by default)
@@ -280,10 +292,6 @@
         		*iPropDefs->iTitlePropertyDef, &aClipDetails.iTitle, EFalse );
         }
 
-    // Mime Type
-    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
-    		*iPropDefs->iItemTypePropertyDef, &aClipDetails.iMimeType, aIsAdd );
-
     // Capture date
     CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
     		*iPropDefs->iCaptureDatePropertyDef, &localModifiedTime, aIsAdd );    
--- a/harvester/harvesterplugins/VideoPlugin/data/200009f9.rss	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/VideoPlugin/data/200009f9.rss	Fri Mar 19 09:38:01 2010 +0200
@@ -42,7 +42,7 @@
 					version_no = 1;
 					display_name = "Harvester video plugin";
 					default_data = "Video Audio";
-					opaque_data = "mp4 mpg4 mpeg4 m4v m4a 3gp 3gpp rm rv rmvb 3g2 avi mkv ra";
+					opaque_data = "mp4 mpg4 mpeg4 m4v m4a 3gp 3gpp rm rv rmvb 3g2 avi mkv ra wmv divx";
           rom_only = 0;
 					}
 				};
--- a/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h	Fri Mar 19 09:38:01 2010 +0200
@@ -86,6 +86,7 @@
         HBufC* iGenre;
         HBufC* iPerformer; // Artist
         HBufC* iDescription;
+        HBufC* iTitle;
 
         HBufC* iMimeBuf;
         TUint32 iCodec;
@@ -101,6 +102,7 @@
             delete iGenre;
             delete iPerformer;
             delete iDescription;
+            delete iTitle;
 
         	delete iMimeBuf;
         	}
@@ -119,6 +121,7 @@
 		CMdEPropertyDef* iSizePropertyDef;
 		CMdEPropertyDef* iTimeOffsetPropertyDef;
 		CMdEPropertyDef* iItemTypePropertyDef;
+		CMdEPropertyDef* iTitlePropertyDef;
 	
 		// Media property definitions
 		CMdEPropertyDef* iReleaseDatePropertyDef;
@@ -175,6 +178,10 @@
 		*/
 		void HarvestL( CHarvesterData* aHD );
 				
+    protected: // from CHarvesterPlugin
+        
+        void GetMimeType( const TDesC& aUri, TDes& aMimeType );
+		
 	private:
 		/**
 		* C++ constructor - not exported;
--- a/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -47,6 +47,8 @@
 _LIT( KMimeTypeAvi,        "video/avi");
 _LIT( KMimeTypeVideoMatroska, "video/x-matroska");
 _LIT( KMimeTypeAudioMatroska, "audio/x-matroska");
+_LIT( KMimeTypeWmv, "video/x-ms-wmv");
+_LIT( KMimeTypeDivx, "video/x-hx-divx");
 
 _LIT( KExtensionMp4,   "mp4" );
 _LIT( KExtensionMpg4,  "mpg4" );
@@ -62,6 +64,8 @@
 _LIT( KExtensionAvi,    "avi" );
 _LIT( KExtensionMkv,    "mkv" );
 _LIT( KExtensionRa,     "ra" );
+_LIT( KExtensionWmv,     "wmv" );
+_LIT( KExtensionDivx,     "divx" );
 
 _LIT(KVideo, "Video");
 _LIT(KAudio, "Audio");
@@ -91,6 +95,7 @@
 	iSizePropertyDef = &objectDef.GetPropertyDefL( Object::KSizeProperty );
 	iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty );
 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty );
+	iTitlePropertyDef = &objectDef.GetPropertyDefL( Object::KTitleProperty );
 
 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject );
 	iReleaseDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KReleaseDateProperty );
@@ -153,6 +158,7 @@
 CHarvesterVideoPlugin::~CHarvesterVideoPlugin()
 	{
 	delete iPropDefs;
+	iMimeTypeMappings.Close();
 
 	WRITELOG("CHarvesterVideoPlugin::CHarvesterVideoPlugin()");
 	}
@@ -239,12 +245,27 @@
                     KMimeTypeAvi(), KMimeTypeAvi() ) ), 
             cmp ) );
     
+    // Divx
+    User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
+            KExtensionDivx(), KMimeTypeDivx(), 
+            TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KVideo(),
+                    KMimeTypeDivx(), KMimeTypeDivx() ) ), 
+            cmp ) );
+    
     // Matroska
     User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
             KExtensionMkv(), KNullDesC(), 
             TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
                     KMimeTypeVideoMatroska(), KMimeTypeAudioMatroska() ) ), 
             cmp ) );
+    
+    // Wmv
+    User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
+            KExtensionWmv(), KMimeTypeWmv(), 
+            TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KVideo(),
+                    KMimeTypeWmv(), KMimeTypeWmv() ) ), 
+            cmp ) );
+    
     }
 
 
@@ -342,6 +363,25 @@
 	}
 
 // ---------------------------------------------------------------------------
+// CHarvesterVideoPlugin::GetMimeType (from CHarvesterPlugin)
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterVideoPlugin::GetMimeType( const TDesC& aUri, TDes& aMimeType )
+    {
+    aMimeType.Zero();
+    
+    const THarvestingHandling* mapping = FindHandler( aUri );
+
+    // no matching extension found
+    if( !mapping )
+        {
+        return;
+        }
+
+    aMimeType = mapping->iMimeType;
+    }
+
+// ---------------------------------------------------------------------------
 // GatherDataL
 // ---------------------------------------------------------------------------
 //
@@ -461,6 +501,11 @@
         		helixMetadata->GetMetaDataAt( i, metaid, buf );
         		switch (metaid)
         			{
+                    case HXMetaDataKeys::EHXTitle:
+                        {
+                        aVHD.iTitle = buf->Alloc();
+                        break;
+                        }
         			case HXMetaDataKeys::EHXVideoBitRate:
 	        			{
         				WRITELOG( "CHarvesterVideoPlugin - found videobitrate" );
@@ -612,7 +657,10 @@
 	        	// Match MIME type for audio object with "audio" substring
 	        	else if( MdsUtils::Find( mime, KAudio() ) != KErrNotFound )
 	        		{
-	        		break;
+	        	    if( !aVHD.iVideoObject )
+	        	        {
+	        	        break;
+	        	        }
 	        		}
 	        	}
 	        }
@@ -622,6 +670,7 @@
         	aVHD.iMimeBuf = mime.Alloc();
         	}
         
+        helixMetadata->ResetL();
         CleanupStack::PopAndDestroy( helixMetadata );
         
         // don't destory mime type pointers just clean array
@@ -759,6 +808,19 @@
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iSizePropertyDef, &aVHD.iFileSize, aIsAdd );
     	}
 
+    // Item Type
+    if( aVHD.iMimeBuf )
+        {
+        TBool isAdd( EFalse );
+        CMdEProperty* prop = NULL;
+        TInt index = mdeObject.Property( *iPropDefs->iItemTypePropertyDef, prop );
+        if( index < 0 )
+            {
+            isAdd = ETrue;
+            }
+            CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iItemTypePropertyDef, aVHD.iMimeBuf, isAdd );
+        }
+    
     // Release date
 	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iReleaseDatePropertyDef, &localModifiedDate, aIsAdd );
 
@@ -769,12 +831,6 @@
 	TInt16 timeOffsetMinutes = timeOffsetSeconds.Int() / 60;
 	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTimeOffsetPropertyDef, &timeOffsetMinutes, aIsAdd );
 
-    // Item Type
-	if( aVHD.iMimeBuf )
-		{
-		CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iItemTypePropertyDef, aVHD.iMimeBuf, aIsAdd );
-		}
-
     // Duration
 	if( aVHD.iDuration != 0.0f )
 		{
@@ -862,6 +918,12 @@
         {
         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iAudioFourCCDef, &aVHD.iCodec, aIsAdd );
         }
+    
+    // Title
+    if( aVHD.iTitle )
+        {
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTitlePropertyDef, aVHD.iTitle, EFalse );
+        }
     }
 
 void CHarvesterVideoPlugin::GetMp4Type( RFile64& aFile, TDes& aType )
@@ -996,6 +1058,7 @@
 		aType.Copy( KVideo );
 		}
     
+	helixMetadata->ResetL();
     CleanupStack::PopAndDestroy( helixMetadata );
 	}
 
--- a/harvester/harvesterplugins/WMVPlugin/data/2000B431.rss	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/WMVPlugin/data/2000B431.rss	Fri Mar 19 09:38:01 2010 +0200
@@ -44,7 +44,7 @@
                     version_no          =  1;
                     display_name        =  "Harvester WMV Plugin";
                     default_data        =  "Video";
-                    opaque_data         =  "wm wmv asf";
+                    opaque_data         =  "wm asf";
                     rom_only = 0;
                     }
                 };
--- a/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h	Fri Mar 19 09:38:01 2010 +0200
@@ -134,6 +134,10 @@
     */
     void HarvestL( CHarvesterData* aHarvesterData );
 
+protected: // from CHarvesterPlugin
+    
+    void GetMimeType( const TDesC& aUri, TDes& aMimeType );
+    
 private:
 
     /**
--- a/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -122,6 +122,24 @@
     }
 
 // ---------------------------------------------------------------------------
+// CHarvesterWMVPlugin::GetMimeType (from CHarvesterPlugin)
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterWMVPlugin::GetMimeType( const TDesC& aUri, TDes& aMimeType )
+    {
+    aMimeType.Zero();
+    
+    ContentAccess::CContent* content = NULL;
+    
+    TRAPD( err, content = ContentAccess::CContent::NewL( aUri ) );
+    if (err == KErrNone) 
+        {
+        err = content->GetStringAttribute( ContentAccess::EMimeType, aMimeType );
+        delete content;
+        }
+    }
+
+// ---------------------------------------------------------------------------
 // Default constructor
 // ---------------------------------------------------------------------------
 //
@@ -204,9 +222,9 @@
     	// File size
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
     			*iPropDefs->iSizePropertyDef, &aClipDetails.iFileSize, aIsAdd );
+        // Mime Type
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iItemTypePropertyDef, &aClipDetails.iMimeType, aIsAdd );
     	}
+    }
 
-    // Mime Type
-    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
-    		*iPropDefs->iItemTypePropertyDef, &aClipDetails.iMimeType, aIsAdd );
-    }
--- a/harvester/harvesterplugins/group/bld.inf	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/group/bld.inf	Fri Mar 19 09:38:01 2010 +0200
@@ -24,6 +24,10 @@
 #include "../RTPPlugin/group/bld.inf"
 #include "../AudioPlugin/group/bld.inf"
 
+#ifdef MDS_PLAYLIST_HARVESTING_ENABLED
+#include "../AudioPlaylistPlugin/group/bld.inf"
+#endif
+
 PRJ_PLATFORMS
     DEFAULT
 
--- a/harvester/monitorplugins/fileplugin/inc/fileeventhandlerao.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/fileplugin/inc/fileeventhandlerao.h	Fri Mar 19 09:38:01 2010 +0200
@@ -76,13 +76,6 @@
         void DoCancel();
         
         /**
-        * Sets a list of paths not monitor to.
-        *
-        * @param aList  Contains list of paths not monitor to.
-        */
-        void SetIgnoreListL( RPointerArray<TDesC>& aList );
-        
-        /**
          * Gets a reference to process / origin mapper, which
          * can be used to register and match which process ids
          * with a mde object's Origin value.
@@ -198,12 +191,6 @@
         RFs iFs;
 
         /**
-         * @var An ignore list. Contains paths not to monitor.
-         */
-        RPointerArray<TDesC> iIgnoreList;
-
-       
-        /**
          * 
          */
         TMdsFSPStatusPckg iStatusPckg;
--- a/harvester/monitorplugins/fileplugin/inc/filemonitorao.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/fileplugin/inc/filemonitorao.h	Fri Mar 19 09:38:01 2010 +0200
@@ -132,11 +132,6 @@
          * @var Flag to signal if iFs is connected.
          */
         TBool iFsConnectOk;
-        
-        /**
-         * @var An ignore list. Contains paths not to monitor.
-         */
-        RPointerArray<TDesC> iIgnoreList;
 
         /**
          * 
--- a/harvester/monitorplugins/fileplugin/src/FolderRenamer.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/fileplugin/src/FolderRenamer.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -112,6 +112,7 @@
 CFolderRenamer::~CFolderRenamer()
 	{
 	Cancel();
+	iRenamedFolders.ResetAndDestroy();
 	}
 
 void CFolderRenamer::ConstructL()
--- a/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -37,7 +37,7 @@
 const TUid KRepositoryUid = { 0x20007182 };
 const TUint32 KCacheSizeKey = 0x00000001;
 
-const TInt KMaxEventsAtTime = 20;
+const TInt KMaxEventsAtTime = 25;
 const TInt KMaxEventsGranularity = 20;
 
 // ---------------------------------------------------------------------------
@@ -101,9 +101,6 @@
     
     Cancel();
     
-    iIgnoreList.ResetAndDestroy();
-    iIgnoreList.Close();
-    
     iFs.Close();
     
     delete iMapper;
@@ -111,6 +108,8 @@
     delete iFolderRenamer;
     
     delete iEventArray;
+    
+    iQueue.ResetAndDestroy();
     iUriArray.Close();
     }
 
@@ -128,6 +127,9 @@
     	{
     	case ( ERequestIdle ):
     		{
+    	    iQueue.Compress();
+    	    iEventArray->Compress();
+    	    iUriArray.Compress();
         	break;
     		}
     	
@@ -218,33 +220,26 @@
     TOrigin origin = MdeConstants::Object::EOther;
     if ( iMapper )
         {
-        TRAPD( originErr, origin = iMapper->OriginL( status.iProcessId ) );
-        if( originErr == KErrNone )
-        	{
-        	if ( origin == KOriginIgnored )
-                {
-                WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored origin for %S", &status.iFileName );
-                return;
-                }
-        	else if( origin == KOriginFastHarvest )
-        	    {
-        	    WRITELOG( "CFileEventHandlerAO::HandleNotificationL - potential fast harvest file detected" );
-        	    fastHarvest = ETrue;
-        	    }
+        origin = iMapper->OriginL( status.iProcessId );
+        if ( origin == KOriginIgnored )
+            {
+            WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored origin for %S", &status.iFileName );
+            return;
+            }
+        else if( origin == KOriginFastHarvest )
+            {
+            WRITELOG( "CFileEventHandlerAO::HandleNotificationL - potential fast harvest file detected" );
+            fastHarvest = ETrue;
+            }
     
-            _LIT(KCameraTemp,"camcordertmp");
-        	if ( origin == MdeConstants::Object::ECamera &&
-        			(aEvent.iFileEventType == EMdsFileCreated || 
-					aEvent.iFileName.FindF(KCameraTemp) != KErrNotFound) )        		
-                {
-                WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored camera origin for %S", &status.iFileName );
-                return;
-                }
-        	}
-        else
-        	{
-        	origin = MdeConstants::Object::EOther;
-        	}
+        _LIT(KCameraTemp,"camcordertmp");
+        if ( origin == MdeConstants::Object::ECamera &&
+        		(aEvent.iFileEventType == EMdsFileCreated || 
+				aEvent.iFileName.FindF(KCameraTemp) != KErrNotFound) )        		
+            {
+            WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored camera origin for %S", &status.iFileName );
+            return;
+            }
         }
 
     // ignore created file event if extension is not supported by any harverter plugin
@@ -307,8 +302,10 @@
             	RenameToMDEL( status.iFileName, hd->Uri(), hd->Origin() );
             	CleanupStack::PopAndDestroy( hd );
             	}
-
-            DeleteFromMDEL( status.iFileName );
+            else
+                {
+                DeleteFromMDEL( status.iFileName );
+                }
             }
         break;
 
@@ -349,14 +346,12 @@
         TOrigin origin = MdeConstants::Object::EOther;
         if ( iMapper )
             {
-            TRAPD( originErr, origin = iMapper->OriginL( status.iProcessId ) );
-            if( originErr == KErrNone )
+            origin = iMapper->OriginL( status.iProcessId );
+            // Used only for delete events so fast harvest origin is not used
+            if ( origin == KOriginIgnored )
                 {
-                if ( origin == KOriginIgnored )
-                    {
-                    WRITELOG1( "CFileEventHandlerAO::HandleMultideletionL - ignored origin for %S", &status.iFileName );
-                    continue;
-                    }
+                WRITELOG1( "CFileEventHandlerAO::HandleMultideletionL - ignored origin for %S", &status.iFileName );
+                continue;
                 }
             }
         
@@ -369,7 +364,10 @@
             RenameToMDEL( status.iFileName, hd->Uri(), hd->Origin() );
             CleanupStack::PopAndDestroy( hd );
             }
-        iUriArray.Append( &(status.iFileName) );
+        else
+            {
+            iUriArray.Append( &(status.iFileName) );
+            }
         }
     MultiDeleteFromMDEL( iUriArray );
     }
@@ -803,29 +801,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CFileEventHandlerAO::SetIgnoreListL()
-// ---------------------------------------------------------------------------
-//
-void CFileEventHandlerAO::SetIgnoreListL( RPointerArray<TDesC>& aList )
-    {
-    WRITELOG( "CFileEventHandlerAO::SetIgnoreListL" );
-    
-    iIgnoreList.ResetAndDestroy();
-    
-    const TInt count( aList.Count() );
-    for ( TInt i = count; --i >= 0; )
-        {
-        TDesC* listPath = aList[i];
-        
-        HBufC* name = listPath->AllocLC();
-
-        iIgnoreList.AppendL( name );
-        
-        CleanupStack::Pop( name );
-        }
-    }
-
-// ---------------------------------------------------------------------------
 // CFileEventHandlerAO::Mapper()
 // Returns a handle to CProcessOriginMapper.
 // ---------------------------------------------------------------------------
--- a/harvester/monitorplugins/fileplugin/src/filemonitorao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/fileplugin/src/filemonitorao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -69,11 +69,7 @@
     Cancel();
     
     StopMonitoring();
-    
-    iIgnoreList.ResetAndDestroy();
-    iIgnoreList.Close();
 
-    
     delete iMdeSession;
     }
 
@@ -161,6 +157,9 @@
     	}
     
     Cancel();
+
+    delete iFileEventHandler;
+    iFileEventHandler = NULL;
     
     // remove mds fileserver plugin
     iEngine.Disable();
--- a/harvester/monitorplugins/fileplugin/src/processoriginmapper.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/fileplugin/src/processoriginmapper.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -151,11 +151,6 @@
         {
         origin = iProcessOriginMap[index].iOrigin;
         }
-    else
-        {
-        WRITELOG( "CProcessOriginMapper::OriginL - search for processId: not found !!" );
-        User::Leave( KErrNotFound );
-        }
 
     WRITELOG2( "CProcessOriginMapper::OriginL - processId: 0x%.8x, origin: %d", aProcessId.iUid, (TInt)origin );
     return origin;
--- a/harvester/monitorplugins/mdsfileserverplugin/inc/mdsfileserverplugin.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/mdsfileserverplugin/inc/mdsfileserverplugin.h	Fri Mar 19 09:38:01 2010 +0200
@@ -156,6 +156,7 @@
         RFs iFsSession;
 
         RPointerArray<TDesC> iCreatedFiles;
+        RPointerArray<TDesC> iModifiedFiles;
         
         TUint32 iFormatOldMediaId;
         TInt iFormatDriveNumber;
--- a/harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -50,6 +50,9 @@
     
     iCreatedFiles.ResetAndDestroy();
     iCreatedFiles.Close();
+    
+    iModifiedFiles.ResetAndDestroy();
+    iModifiedFiles.Close();
   
     iPaths.ResetAndDestroy();
     iPaths.Close();
@@ -181,6 +184,7 @@
 	TInt function = aRequest.Function();
 	
 	iFileName.Zero();
+    iNewFileName.Zero();
 	
 #ifdef _DEBUG_EVENTS
     PrintDebugEvents( function );
@@ -198,7 +202,6 @@
         }
     
     const TBool formatFunction = function == EFsFormatOpen || function == EFsFormatSubClose;
-    iNewFileName.Zero();
         
     WRITELOG1( "----- CMdsFileServerPlugin::DoRequestL() - plugin function: %d -----", function );
 
@@ -374,11 +377,42 @@
             break;
 
         case EFsFileSetModified:
-        case EFsSetEntry:
+        
             WRITELOG( "CMdsFileServerPlugin::DoRequestL() - EFsFileSetModified" );
+            iModifiedFiles.Append( iFileName.AllocL() );
             fileEventType = EMdsFileModified;
             break;
 
+        case EFsSetEntry:
+            {
+            WRITELOG( "CMdsFileServerPlugin::DoRequestL() - EFsSetEntry" );
+
+            TBool found = EFalse;
+
+            for ( TInt i = iModifiedFiles.Count(); --i >= 0; )
+                    {
+                    if ( MdsUtils::Compare( iFileName, *(iModifiedFiles[i]) ) == 0 )
+                      {
+                        delete iModifiedFiles[i];
+                        iModifiedFiles.Remove( i );
+                        found = ETrue;
+                        }
+                    }
+            
+            if( iModifiedFiles.Count() == 0 )
+                {
+                iModifiedFiles.GranularCompress();
+                }
+            
+            if ( found )
+                {
+                return KErrNone;
+                }
+            
+            fileEventType = EMdsFileModified;
+            }
+            break;            
+            
         case EFsFileReplace:
         case EFsReplace:
             WRITELOG1( "CMdsFileServerPlugin::DoRequestL() - EFsReplace/EFsFileReplace, new file: %S", &iNewFileName );
@@ -543,7 +577,7 @@
 
 
 /**
-* The destructor for the test virus scanner hook.
+* The destructor.
 * @internalComponent
 */
 CMdsFileServerPluginConn::~CMdsFileServerPluginConn()
@@ -734,7 +768,8 @@
     if ( status.iFileName.Length() > 0 )
         {
         // check if already exists
-        for ( TInt i = iPaths.Count(); --i >= 0; )
+        const TInt count( iPaths.Count() );
+        for ( TInt i = count; --i >= 0; )
             {
             TDesC* tf = iPaths[i];
             if ( MdsUtils::Compare( status.iFileName, *tf ) == 0 )
@@ -749,6 +784,10 @@
             {
             iPaths.Append( fn );
             }
+        else
+            {
+            err = KErrNoMemory;
+            }
         }
     else
         {
@@ -779,21 +818,18 @@
     
     if ( status.iFileName.Length() > 0 )
         {
-        // check if already exist
-        if ( iPaths.Count() > 0 )
+        for ( TInt i = iPaths.Count(); --i >= 0; )
             {
-            for ( TInt i = iPaths.Count(); --i >= 0; )
+            TDesC* tf = iPaths[i];
+            if ( MdsUtils::Compare( status.iFileName, *tf ) == 0 )
                 {
-                TDesC* tf = iPaths[i];
-                if ( MdsUtils::Compare( status.iFileName, *tf ) == 0 )
-                    {
-                    WRITELOG1( "CMdsFileServerPlugin::RemoveNotificationPath() - remove path: %S", &status.iFileName );
-                    delete tf;
-                    tf = NULL;
-                    iPaths.Remove( i );
-                    }
+                WRITELOG1( "CMdsFileServerPlugin::RemoveNotificationPath() - remove path: %S", &status.iFileName );
+                delete tf;
+                tf = NULL;
+                iPaths.Remove( i );
                 }
             }
+        iPaths.Compress();
         }
     else
         {
@@ -840,6 +876,10 @@
             {
             iIgnorePaths.Append( fn ); // ownership is transferred
             }
+        else
+            {
+            err = KErrNoMemory;
+            }
         }
     else
         {
@@ -882,6 +922,7 @@
                 iIgnorePaths.Remove( i );
                 }
             }
+        iIgnorePaths.Compress();
         }
     else
         {
--- a/harvester/monitorplugins/mdsoomplugin/group/bld.inf	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/mdsoomplugin/group/bld.inf	Fri Mar 19 09:38:01 2010 +0200
@@ -26,4 +26,5 @@
 
 PRJ_TESTMMPFILES
 
-PRJ_TESTEXPORTS
\ No newline at end of file
+PRJ_TESTEXPORTS
+
--- a/harvester/monitorplugins/messageplugin/group/bld.inf	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/messageplugin/group/bld.inf	Fri Mar 19 09:38:01 2010 +0200
@@ -22,7 +22,7 @@
 PRJ_EXPORTS
 
 PRJ_MMPFILES
-messagemonitorplugin.mmp
+//messagemonitorplugin.mmp
 
 PRJ_TESTMMPFILES
 
--- a/harvester/monitorplugins/messageplugin/src/messagemonitorplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/messageplugin/src/messagemonitorplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -64,6 +64,7 @@
 	{
 	WRITELOG("ENTER ~CMessageMonitorPlugin");
     delete iMsvSession;
+    delete iMessageScannerAO;
 	WRITELOG("END ~CMessageMonitorPlugin");	
 	}
 
@@ -334,28 +335,27 @@
 #ifdef __WINSCW__
 		else if (!err && KMsvDraftEntryId == aFolderId2 && KMsvGlobalOutBoxIndexEntryId == aFolderId1 )
 			{
-			CClientMtmRegistry* clientMtmReg;
-			clientMtmReg = CClientMtmRegistry::NewL(*iMsvSession);
-			CleanupStack::PushL(clientMtmReg);
-			
-			
-			CSmsClientMtm* smsMtm = static_cast<CSmsClientMtm*>(clientMtmReg->NewMtmL(KUidMsgTypeSMS));	
-			CleanupStack::PushL(smsMtm);
-			smsMtm->SwitchCurrentEntryL( msgId );
-			
-			TMsvSelectionOrdering selection;
-			selection.SetShowInvisibleEntries(ETrue);
-			
-			CMsvEntry* parentEntry = CMsvEntry::NewL( smsMtm->Session(),
-                smsMtm->Entry().Entry().Parent(), selection );
+		    if( entry.iMtm.iUid != KUidMsgTypeMultimedia.iUid )
+		        {
+                CClientMtmRegistry* clientMtmReg;
+                clientMtmReg = CClientMtmRegistry::NewL(*iMsvSession);
+                CleanupStack::PushL(clientMtmReg);
+            
+                CSmsClientMtm* smsMtm = static_cast<CSmsClientMtm*>(clientMtmReg->NewMtmL(KUidMsgTypeSMS)); 
+                CleanupStack::PushL(smsMtm);
+                smsMtm->SwitchCurrentEntryL( msgId );
+            
+                TMsvSelectionOrdering selection;
+                selection.SetShowInvisibleEntries(ETrue);
+            
+                CMsvEntry* parentEntry = CMsvEntry::NewL( smsMtm->Session(),
+                    smsMtm->Entry().Entry().Parent(), selection );
              
-             CleanupStack::PushL(parentEntry);
-        	// Move the message
-        	TRAP_IGNORE( parentEntry->MoveL( msgId, KMsvSentEntryId ) );
-        	CleanupStack::PopAndDestroy(3,clientMtmReg); // parentEntry
-        				
-
-			
+                CleanupStack::PushL(parentEntry);
+                // Move the message
+                TRAP_IGNORE( parentEntry->MoveL( msgId, KMsvSentEntryId ) );
+                CleanupStack::PopAndDestroy(3,clientMtmReg); // parentEntry
+		        }
 			}
 #endif             
 		
Binary file harvester/monitorplugins/mmcplugin/data/20007183.txt has changed
--- a/harvester/monitorplugins/mmcplugin/inc/mmcmonitorao.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/inc/mmcmonitorao.h	Fri Mar 19 09:38:01 2010 +0200
@@ -62,6 +62,7 @@
         * Starts monitoring the MMC insertions and removals.
         *
         * @param aObserver  Both events are notified via the aObserver.
+        * @param aMedias Array of present medias
         * @return ETrue if success, EFalse if not
         */
         TBool StartMonitoring( MMMCMonitorObserver& aObserver, RArray<TMdEMediaInfo>& aMedias );
--- a/harvester/monitorplugins/mmcplugin/inc/mmcmonitorplugin.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/inc/mmcmonitorplugin.h	Fri Mar 19 09:38:01 2010 +0200
@@ -138,6 +138,8 @@
 		CMmcScannerAO* iMmcScanner;
 		
 		CMmcScannerAO* iHddScanner;
+		
+		RFs iFs;
 
 	};
 
--- a/harvester/monitorplugins/mmcplugin/inc/mmcscannerao.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/inc/mmcscannerao.h	Fri Mar 19 09:38:01 2010 +0200
@@ -23,6 +23,7 @@
 #include <harvesterdata.h>
 #include "mdeharvestersession.h"
 #include "mmcfilelist.h"
+#include "harvestereventmanager.h"
 
 // FORWARD DECLARATION
 class MMonitorPluginObserver;
@@ -98,6 +99,8 @@
 	MMonitorPluginObserver* iObserver;
 	
 	RPointerArray<CHarvesterData> iHdArray;
+	
+    CHarvesterEventManager* iHEM;
 	};
 
 #endif // CMMCSCANNERAO_H
--- a/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -22,6 +22,10 @@
 #include "harvestercenreputil.h"
 #include <driveinfo.h>
 
+#ifdef __WINSCW__
+#include <pathinfo.h>
+#endif
+
 #include <e32cmn.h>
 
 _LIT( KColon, ":" );
@@ -40,6 +44,8 @@
     {
     WRITELOG( "CMMCMonitorPlugin::ConstructL" );
 
+    User::LeaveIfError( iFs.Connect() );
+    
     iMMCMonitor = CMMCMonitorAO::NewL();
     iMountTask = CMMCMountTaskAO::NewL();
     iUsbMonitor = CMMCUsbAO::NewL();
@@ -69,6 +75,8 @@
 	
 	delete iMmcScanner;
 	delete iHddScanner;
+	
+	iFs.Close();
     }
 
 TBool CMMCMonitorPlugin::StartMonitoring( MMonitorPluginObserver& aObserver,
@@ -114,12 +122,25 @@
     	if ( presentState && medias[i].iMediaId != hdMediaId )
     		{
     		// scan MMC if card was in phone
+    	
+    	    if( iMmcScanner )
+    	        {
+    	        iMmcScanner->Cancel();
+    	        delete iMmcScanner;
+    	        iMmcScanner = NULL;
+    	        }
     		TRAP_IGNORE( iMmcScanner = CMmcScannerAO::NewL( medias[i].iMediaId, iMdEClient, iObserver,
     		    				aHarvesterPluginFactory, CActive::EPriorityHigh, alreadyWaited ) );
     		alreadyWaited = ETrue;
     		}
     	}
  
+    if( hdMediaId == 0 )
+        {
+        // Try to fetch internall mass storage media id again if it was not mounted
+        hdMediaId = iMountTask->GetInternalDriveMediaId();
+        }
+    
     // scan mass storage to catch all chances even if battery dies during operation that should  be catched
     if( hdMediaId )
 		{
@@ -207,18 +228,10 @@
         }
     if( aMediaID != 0 && aEventType == EMounted)
     	{
-	    RFs fs;
-	    const TInt err = fs.Connect();
-	    if ( err != KErrNone )
-	    	{
-	        delete mountData;
-	    	return;
-	    	}
-
 	    TUint status;
 	    TInt drive;
-	    fs.CharToDrive( aDriveChar, drive );
-		if( DriveInfo::GetDriveStatus( fs, drive, status ) == KErrNone )
+	    iFs.CharToDrive( aDriveChar, drive );
+		if( DriveInfo::GetDriveStatus( iFs, drive, status ) == KErrNone )
 			{
 			//The "Out of disk space" mde query uses the MdE_Preferences table
 			if( !(status & DriveInfo::EDriveInternal) )
@@ -226,8 +239,6 @@
 				iMdEClient->AddMemoryCard( aMediaID );
 				}
 			}
-		
-		fs.Close();
     	}
 
     mountData->iDrivePath.Append( aDriveChar );
@@ -240,6 +251,10 @@
             {
             WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EMounted" );
             mountData->iMountType = TMountData::EMount;
+            if( !iMountTask->IsActive() )
+                {
+                iMountTask->SetPriority( KHarvesterPriorityMonitorPlugin );
+                }
             iMountTask->StartMount( *mountData );
             }
         break;
@@ -254,6 +269,10 @@
             	{
 	            WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EDismounted" );
 	            mountData->iMountType = TMountData::EUnmount;
+	            if( !iMountTask->IsActive() )
+	                {
+	                iMountTask->SetPriority( KHarvesterPriorityMonitorPlugin );
+	                }
 	            iMountTask->StartUnmount( *mountData );
             	}
             }
@@ -263,6 +282,10 @@
             {
             WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EFormatted" );
             mountData->iMountType = TMountData::EFormat;
+            if( !iMountTask->IsActive() )
+                {
+                iMountTask->SetPriority( KHarvesterPriorityMonitorPlugin );
+                }
             iMountTask->StartUnmount( *mountData );
             }
         break;
@@ -279,18 +302,20 @@
 void CMMCMonitorPlugin::StartMonitoringAllMMCsL( RArray<TMdEMediaInfo>& aMedias )
     {
     WRITELOG( "CMMCMonitorPlugin::StartMonitoringAllMMCs" );
-    
-    RFs fs;
-    User::LeaveIfError( fs.Connect() );
-    CleanupClosePushL( fs );
-        
+
     TDriveInfo driveInfo;
     TDriveList driveList;
     TInt numOfElements( 0 );
-    DriveInfo::GetUserVisibleDrives( fs, 
+    DriveInfo::GetUserVisibleDrives( iFs, 
                                                         driveList, 
                                                         numOfElements, 
                                                         KDriveAttExclude | KDriveAttRemote | KDriveAttRom );
+
+#ifdef __WINSCW__
+    TFileName systemPath = PathInfo::GetPath( PathInfo::EPhoneMemoryRootPath );
+    TInt systemDriveNum( -1 );
+    iFs.CharToDrive( systemPath[0], systemDriveNum );
+#endif
     
     TInt i( 0 );
     TChar drive;
@@ -302,8 +327,8 @@
     for ( i = 0; i < mediaCount; i++ )
     	{
     	TInt driveNum(0);
-    	fs.CharToDrive( aMedias[i].iDrive, driveNum );
-    	TUint32 mediaId = FSUtil::MediaID( fs, driveNum );
+    	iFs.CharToDrive( aMedias[i].iDrive, driveNum );
+    	TUint32 mediaId = FSUtil::MediaID( iFs, driveNum );
     	if ( mediaId != aMedias[i].iMediaId ) 
     		{
     		iMdEClient->SetMediaL( aMedias[i].iMediaId, aMedias[i].iDrive, EFalse );
@@ -312,10 +337,17 @@
     
     for ( i = 0; i < acount; i++ )
         {
+#ifdef __WINSCW__
+        if ( i == systemDriveNum )
+            {
+            continue;
+            }
+#endif
+    
         if ( driveList[i] > 0 )
             {
             TUint driveStatus( 0 );
-            DriveInfo::GetDriveStatus( fs, i, driveStatus ); 
+            DriveInfo::GetDriveStatus( iFs, i, driveStatus ); 
 
             if ( driveStatus & DriveInfo::EDriveUsbMemory )
                 {
@@ -323,15 +355,17 @@
                 continue;
                 }
             
-            fs.Drive( driveInfo, i );
-            if ( driveInfo.iDriveAtt & KDriveAttRemovable && driveInfo.iType != EMediaNotPresent )
+            iFs.Drive( driveInfo, i );
+            if ( ((driveInfo.iDriveAtt & KDriveAttRemovable) || (driveInfo.iDriveAtt & KDriveAttLogicallyRemovable) ||
+                   (driveInfo.iType == EMediaHardDisk && driveStatus & DriveInfo::EDriveInternal) ) &&
+                   (driveInfo.iType != EMediaNotPresent) )
                 {
                 count++; // DEBUG INFO
                 
-                fs.DriveToChar( i, drive );
+                iFs.DriveToChar( i, drive );
                 
                 // set media id to MdE
-                TUint32 mediaId = FSUtil::MediaID( fs, i );
+                TUint32 mediaId = FSUtil::MediaID( iFs, i );
                 if ( mediaId != 0 )
                     {
                     iMdEClient->SetMediaL( mediaId, drive, ETrue );
@@ -342,7 +376,6 @@
             }
         }
     
-    CleanupStack::PopAndDestroy( &fs ); 
-    
     WRITELOG1( "CMMCMonitorPlugin::StartMonitoringAllMMCs found %d MMCs", count );
     }
+
--- a/harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -16,6 +16,10 @@
 
 #include <driveinfo.h>
 
+#ifdef __WINSCW__
+#include <pathinfo.h>
+#endif
+
 #include <placeholderdata.h>
 #include "mmcmounttaskao.h"
 #include "mmcmonitorplugin.h"
@@ -56,7 +60,7 @@
 	}
 
 CMMCMountTaskAO::CMMCMountTaskAO() :
-		CActive( KHarvesterCustomImportantPriority )
+		CActive( KHarvesterPriorityMonitorPlugin )
 	{
 	WRITELOG( "CMMCMountTaskAO::CMMCMountTaskAO" );
 	}
@@ -68,6 +72,8 @@
 	iFs.Close();
 	
 	iMountDataQueue.ResetAndDestroy();
+	iEntryArray.ResetAndDestroy();
+	iHarvestEntryArray.ResetAndDestroy();
 	
 	delete iMdeSession;
   
@@ -182,6 +188,7 @@
 				}
 			else
 				{
+			    SetPriority( KHarvesterCustomImportantPriority );
 				SetNextRequest( ERequestIdle );
 				iMountDataQueue.Compress();
 				}
@@ -281,7 +288,7 @@
 						}
 					Deinitialize();
 					SetNextRequest( ERequestStartTask );
-					return;
+					break;
 					}
 				
 	            if ( iEntryArray.Count() > 0 )
@@ -342,6 +349,7 @@
 			WRITELOG( "CMMCMountTaskAO::RunL - ERequestCleanup" );
 			TBool present = (iMountData->iMountType == TMountData::EMount);
 			iMdeSession->SetMediaL( iMountData->iMediaID, iMountData->iDrivePath[0], present );
+			SetPriority( KHarvesterCustomImportantPriority );
 			Deinitialize();
 			SetNextRequest( ERequestStartTask );
 			}
@@ -522,12 +530,26 @@
     	{
     	return 0;
     	}
+ 
+#ifdef __WINSCW__
+    TFileName systemPath = PathInfo::GetPath( PathInfo::EPhoneMemoryRootPath );
+    TInt systemDriveNum( -1 );
+    iFs.CharToDrive( systemPath[0], systemDriveNum );
+#endif
     
 	TUint32 hdMediaId = 0;
 	TInt i( 0 );
 
-	for ( i = 0; i < driveList.Length(); i++ )
+	const TInt acount = driveList.Length();
+	for ( i = 0; i < acount; i++ )
 		{
+#ifdef __WINSCW__
+        if ( i == systemDriveNum )
+            {
+            continue;
+            }
+#endif
+	
 	    if ( driveList[i] > 0 )
 	    	{
 	    	iFs.Drive( driveInfo, i );
--- a/harvester/monitorplugins/mmcplugin/src/mmcscannerao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/src/mmcscannerao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -22,7 +22,7 @@
 
 _LIT( KColon, ":" );
 
-const TInt KDefaultDelay = 4;
+const TInt KDefaultDelay = 3;
 const TInt KMillion = 1000000;
 
 const TUid KRepositoryUid = { 0x20007183 };
@@ -78,6 +78,8 @@
 	    TTimeIntervalMicroSeconds32 delay( 5 ); 
 	    After( delay );
 	    }
+	
+    iHEM = CHarvesterEventManager::GetInstanceL();
 	}
 
 CMmcScannerAO::~CMmcScannerAO()
@@ -95,6 +97,11 @@
 	
     iHdArray.ResetAndDestroy();
 	iHdArray.Close();
+
+    if (iHEM)
+        {
+        iHEM->ReleaseInstance();
+        }
 	
 	iFs.Close();
 	}
@@ -136,6 +143,15 @@
 			
 			WRITELOG("CMmcScannerAO::RunL - build file list");
 			iMmcFileList->BuildFileListL( iFs, iDrive, iEntryArray );
+			
+            // send start event
+            const TInt entryCount = iEntryArray.Count();
+            if( entryCount > 0 )
+                {
+                iHEM->IncreaseItemCount( EHEObserverTypeMMC, entryCount );
+                iHEM->SendEventL( EHEObserverTypeMMC, EHEStateStarted, iHEM->ItemCount( EHEObserverTypeMMC ) );
+                }
+			
 			SetState( EProcessFiles );
 			break;
 			}
--- a/harvester/server/group/harvesterserver.mmp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/server/group/harvesterserver.mmp	Fri Mar 19 09:38:01 2010 +0200
@@ -71,6 +71,7 @@
 LIBRARY           harvestercommon.lib
 LIBRARY		      locationmanager.lib
 LIBRARY           platformenv.lib 
+LIBRARY           bafl.lib
 
 UNPAGED
 
--- a/harvester/server/inc/harvesterao.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/server/inc/harvesterao.h	Fri Mar 19 09:38:01 2010 +0200
@@ -20,6 +20,7 @@
 
 #include <e32cmn.h>
 #include <e32base.h>
+#include <badesca.h>
 
 #include "contextengine.h"
 #include "mdeharvestersession.h"
@@ -59,6 +60,8 @@
 		CMdEPropertyDef* iLastModifiedDatePropertyDef;
 		CMdEPropertyDef* iSizePropertyDef;
 		CMdEPropertyDef* iOriginPropertyDef;
+		CMdEPropertyDef* iItemTypePropertyDef;
+		CMdEPropertyDef* iTitlePropertyDef;
 		
 		// Media property definitions
 		CMdEPropertyDef* iPreinstalledPropertyDef;
@@ -292,6 +295,10 @@
          */
         void MemoryGood();
 		
+    private:
+        
+        TBool CheckForCameraItem( CHarvesterData* aHd, TDes& aObjectDef );
+        
 	private:
 		
 	struct THarvestFileRequest
@@ -536,6 +543,9 @@
         CHarvesterAoPropertyDefs* iPropDefs;
         
         TBool iMassMemoryIdChecked;
+        
+        // Own.
+        CDesCArray* iCameraExtensionArray;
 	};
 	
 #endif //__CHARVESTERAO_H__
--- a/harvester/server/src/harvesterao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/server/src/harvesterao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -51,8 +51,18 @@
 _LIT( KTAGDaemonName, "ThumbAGDaemon" );
 _LIT( KTAGDaemonExe, "thumbagdaemon.exe" );
 
+_LIT(KVideo, "Video");
 _LIT(KInUse, "InUse");
 
+_LIT(KUndefinedMime, " ");
+
+_LIT( KExtensionMp4,   "mp4" );
+_LIT( KExtensionMpg4,  "mpg4" );
+_LIT( KExtensionMpeg4, "mpeg4" );
+_LIT( KExtension3gp,   "3gp" );
+_LIT( KExtension3gpp,  "3gpp" );
+_LIT( KExtension3g2,   "3g2" );
+
 CHarvesterAoPropertyDefs::CHarvesterAoPropertyDefs() : CBase()
 	{
 	}
@@ -67,6 +77,8 @@
 	iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
 	iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
 	iOriginPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
+	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
+	iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
 	
 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
 	iPreinstalledPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KPreinstalledProperty );
@@ -113,7 +125,7 @@
 // CHarvesterAO
 // ---------------------------------------------------------------------------
 //
-CHarvesterAO::CHarvesterAO() : CActive( KHarvesterCustomImportantPriority)
+CHarvesterAO::CHarvesterAO() : CActive( KHarvesterCustomImportantPriority )
     {
     WRITELOG( "CHarvesterAO::CHarvesterAO() - begin" );
     
@@ -186,7 +198,8 @@
     
     iContainerPHArray.ResetAndDestroy();
     iContainerPHArray.Close();
-	
+    
+	delete iHarvesterOomAO;
     delete iRestoreWatcher;
 	delete iOnDemandAO;
 	delete iMdEHarvesterSession;
@@ -197,6 +210,7 @@
 	delete iUnmountHandlerAO;
 	
 	delete iPropDefs;
+	delete iCameraExtensionArray;
 	
 	RMediaIdUtil::ReleaseInstance();
     
@@ -250,6 +264,14 @@
     
     iHarvesterPluginFactory = CHarvesterPluginFactory::NewL();
     iHarvesterPluginFactory->SetBlacklist( *iBlacklist );
+    
+    iCameraExtensionArray = new ( ELeave ) CDesCArraySeg( 6 );
+    iCameraExtensionArray->InsertIsqL( KExtensionMp4 );
+    iCameraExtensionArray->InsertIsqL( KExtensionMpg4 );
+    iCameraExtensionArray->InsertIsqL( KExtensionMpeg4 );
+    iCameraExtensionArray->InsertIsqL( KExtension3gp );
+    iCameraExtensionArray->InsertIsqL( KExtension3gpp );
+    iCameraExtensionArray->InsertIsqL( KExtension3g2 );
 	
     WRITELOG( "CHarvesterAO::ConstructL() - end" );
     }
@@ -704,8 +726,12 @@
 			continue;
 			}
 		TBuf<KObjectDefStrSize> objDefStr;
-		iHarvesterPluginFactory->GetObjectDefL( *hd, objDefStr );
-	    
+		
+		if( !CheckForCameraItem( hd, objDefStr ) )
+		    {
+		    iHarvesterPluginFactory->GetObjectDefL( *hd, objDefStr );
+		    }
+		
 		if( objDefStr.Length() == 0 ||
 		    ( objDefStr == KInUse ) )
 			{
@@ -788,7 +814,7 @@
 	    
 	    if( !iPropDefs )
 	    	{
-	    	iPropDefs = CHarvesterAoPropertyDefs::NewL( mdeObjectDef );
+	    	iPropDefs = CHarvesterAoPropertyDefs::NewL( defNS.GetObjectDefL( MdeConstants::Object::KBaseObject ) );
 	    	}
 
 	    // set file size
@@ -803,7 +829,30 @@
 	    
     	// set origin
 		mdeObject->AddUint8PropertyL( *iPropDefs->iOriginPropertyDef, hd->Origin() );
-    	
+
+        TBuf<KMaxDataTypeLength> mimeType;
+        iHarvesterPluginFactory->GetMimeType( hd->Uri(), mimeType );
+        if( mimeType.Length() > 0 )
+            {
+            mdeObject->AddTextPropertyL( *iPropDefs->iItemTypePropertyDef, mimeType );
+            }
+        else
+            {
+            mdeObject->AddTextPropertyL( *iPropDefs->iItemTypePropertyDef, KUndefinedMime );
+            }
+		
+	    TPtrC name;
+	    TBool nameFound = MdsUtils::GetName( hd->Uri(), name );
+
+	    if ( nameFound )
+	        {
+	        mdeObject->AddTextPropertyL( *iPropDefs->iTitlePropertyDef, name );
+	        }
+	    else
+	        {
+	        mdeObject->AddTextPropertyL( *iPropDefs->iTitlePropertyDef, KNullDesC );
+	        }
+	    
     	CPlaceholderData* ph = NULL;
     	if( hd->TakeSnapshot() )
     	    {
@@ -1119,7 +1168,6 @@
             
             delete aHD;
 			aHD = NULL;
-			return;
             }
         else
             {
@@ -1160,14 +1208,14 @@
         	{
             WRITELOG( "CHarvesterAO::HandleSessionOpened() - error creating mde harvester session" );
         	}
-        
-        TRAPD( ohTrap, iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
-        if ( ohTrap != KErrNone )
+
+#ifdef _DEBUG        
+        TRAP( errorTrap, iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
+        if ( errorTrap != KErrNone )
                 {
                 WRITELOG( "CHarvesterAO::HandleSessionOpened() - ObjectHandler creation failed" );
                 }
         
-#ifdef _DEBUG
         TRAP( errorTrap, PreallocateNamespaceL( aSession.GetDefaultNamespaceDefL() ) );
         if ( errorTrap != KErrNone )
             {
@@ -1187,12 +1235,12 @@
             WRITELOG( "CHarvesterAO::HandleSessionOpened() - couldn't start composer plugins" );
             }
 #else
-        // The idea here is that all of these three methods needs to be called,
-        // even if some leave, thus the three TRAPs
+        // The idea here is that all of these  methods needs to be called,
+        // even if some leave, thus the several TRAPs
+        TRAP_IGNORE( iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
         TRAP_IGNORE( PreallocateNamespaceL( aSession.GetDefaultNamespaceDefL() ) );
         TRAP_IGNORE( LoadMonitorPluginsL() );
-        TRAP_IGNORE( StartComposersL() );
-        
+        TRAP_IGNORE( StartComposersL() );        
 #endif
 
         if ( iContextEngineInitialized )
@@ -1220,6 +1268,7 @@
     	
         // Initializing pause indicator
         iServerPaused = EFalse;
+		
 #ifdef _DEBUG
         WRITELOG( "HarvesterThread::HandleSessionOpened() - Succeeded!" );
         
@@ -1386,7 +1435,6 @@
             // no more items to harvest
             else
                 {
-                
                 // if container files to harvest, handle those
                 if( iContainerPHArray.Count() > 0 )
                 	{
@@ -1394,12 +1442,12 @@
                 	break;
                 	}
                 
-				if(iReadyPHArray.Count() > 0)
+                const TInt arrayCount( iReadyPHArray.Count() );
+				if( arrayCount > 0 )
             		{
 #ifdef _DEBUG
-            		WRITELOG1("CHarvesterAO::RunL - items in ready pharray: %d", iReadyPHArray.Count() );
+            		WRITELOG1("CHarvesterAO::RunL - items in ready pharray: %d", arrayCount );
 #endif   		
-            		const TInt arrayCount( iReadyPHArray.Count() );
             		TInt endIndex( KPlaceholderQueueSize );
             		if( arrayCount < KPlaceholderQueueSize )
             		    {
@@ -1721,7 +1769,7 @@
     
     CHarvesterData* hd = NULL;
     TRAP( err, hd = CHarvesterData::NewL( uri ) );
-    if ( err != KErrNone )
+    if ( err != KErrNone || !hd )
         {
         WRITELOG( "CHarvesterAO::HarvestFile - creating harvUri failed" );
         albumIds.Close();
@@ -1752,7 +1800,7 @@
         WRITELOG( "CHarvesterAO::HarvestFile - creating clientData failed" );
         }
 
-    if( iQueue && hd )
+    if( iQueue )
         {
         iQueue->Append( hd );
         
@@ -1764,6 +1812,7 @@
         }
     else
         {
+        delete hd;
         err = KErrUnknown;
         }
     
@@ -1897,7 +1946,7 @@
     
     CHarvesterData* hd = NULL;
     TRAP( err, hd = CHarvesterData::NewL( uri ) );
-    if ( err != KErrNone )
+    if ( err != KErrNone || !hd )
         {
         WRITELOG( "CHarvesterAO::HarvestFileWithUID - creating harvUri failed" );
         albumIds.Close();
@@ -1928,7 +1977,7 @@
         WRITELOG( "CHarvesterAO::HarvestFileWithUID - creating clientData failed" );
         }
 
-    if( iQueue && hd )
+    if( iQueue )
     	{
     	iQueue->Append( hd );
 
@@ -1940,6 +1989,7 @@
     	}
     else
         {
+        delete hd;
         err = KErrUnknown;
         }
 
@@ -2158,13 +2208,21 @@
     HarvestCompleted( aHD->ClientId(), aHD->Uri(), aHD->ErrorCode() );
 
     const TInt errorCode = aHD->ErrorCode();
-    if( errorCode != KErrNone )
+    if( errorCode != KErrNone && errorCode != KErrCompletion )
     	{
         WRITELOG1( "CHarvesterAO::ContextSnapshotStatus() - error occurred: %d", errorCode );    	
     	}
     else
     	{
-        WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - successfully completed" );
+        if( errorCode == KErrCompletion )
+            {
+            WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - snapshot could not be completed" );
+            WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - processing non-context data anyway" );   
+            }
+        else
+            {
+            WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - successfully completed" );
+            }
         if( aHD->Origin() == MdeConstants::Object::ECamera )
         	{
             aHD->MdeObject().SetPlaceholder( EFalse );
@@ -2252,7 +2310,11 @@
 	{
 	// check if partial restore was done before last boot
 	TBool partialRestore = iRestoreWatcher->Register();
-		
+	
+#ifdef __WINSCW__
+	partialRestore = ETrue;
+#endif
+	
 	if ( !partialRestore )
 		{
 		return;
@@ -2593,3 +2655,22 @@
 	TRAP_IGNORE( ResumeHarvesterL() );
 	}
 
+TBool CHarvesterAO::CheckForCameraItem( CHarvesterData* aHd, TDes& aObjectDef )
+    {
+    if( aHd->Origin() == MdeConstants::Object::ECamera )
+        {
+        TPtrC ext;
+        if( !MdsUtils::GetExt( aHd->Uri(), ext ) )
+            {
+            return EFalse;
+            }
+        TInt pos( 0 );
+        if( iCameraExtensionArray->FindIsq( ext, pos ) == 0 ) // video extension matched
+            {
+            aObjectDef.Copy( KVideo );
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
--- a/harvester/server/src/harvesteroomao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/server/src/harvesteroomao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -49,6 +49,7 @@
 //
 CHarvesterOomAO::~CHarvesterOomAO()
 	{
+    Cancel();
 	iOomMsgQueue.Close();
 	}
 
--- a/harvester/server/src/harvesterqueue.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/server/src/harvesterqueue.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -115,7 +115,8 @@
         item = iItemQueue[0];
         iItemQueue.Remove( 0 );	
         }
-   	else
+   	   
+   	if( iItemQueue.Count() == 0 )
         {
         WRITELOG( "Harvester queue items zero!" );
         iItemQueue.Compress();
@@ -134,7 +135,7 @@
 void CHarvesterQueue::Append( CHarvesterData* aItem )
 	{
     WRITELOG( "CHarvesterQueue::Append()" );
-    TInt err = KErrNone;
+    TInt err( KErrNone );
 
     if ( iBlacklist )
         {
@@ -152,24 +153,20 @@
             }
         }
 
-    if ( err == KErrNone )
-        {
-		// check if fast harvest file and add to start of queue
-    	if ( aItem->ObjectType() == EFastHarvest || aItem->Origin() == MdeConstants::Object::ECamera )
-    		{
-    		err = iItemQueue.Insert( aItem, 0 );
-    		}
-    	else
-    		{
-    		err = iItemQueue.Append( aItem );
-    		}
+	// check if fast harvest file and add to start of queue
+    if ( aItem->ObjectType() == EFastHarvest || aItem->Origin() == MdeConstants::Object::ECamera )
+    	{
+    	err = iItemQueue.Insert( aItem, 0 );
+    	}
+    else
+    	{
+    	err = iItemQueue.Append( aItem );
+    	}
     	
-    	if( err != KErrNone )
-			{
-			delete aItem;
-			aItem = NULL;
-			return;
-			}
+    if( err != KErrNone )
+		{
+		delete aItem;
+		aItem = NULL;
         }
     }
 
--- a/inc/mdssqliteconnection.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/inc/mdssqliteconnection.h	Fri Mar 19 09:38:01 2010 +0200
@@ -76,6 +76,16 @@
         */        
         void ConstructL();
 
+        /**
+        * Delete and re-create database.
+        * @param aDbFileName Database filename and path
+        * @param asqlSecurityPolicy sql policy
+        * @param aKMdsSqlDbaConfig database connection configure
+        */    
+        TInt DeleteAndReCreateDB( const HBufC* aDbFileName,
+                                  const RSqlSecurityPolicy& asqlSecurityPolicy,
+                                  const TDesC8* aKMdsSqlDbaConfig );
+        
     public: // Methods from CMdSSqLiteConnection
 
 		/**
@@ -130,6 +140,11 @@
         void CurrentRowL( const RMdsStatement& aQuery, RRowData& aRow );
 
         /**
+         * Returns id of the last inserted row
+         */
+        TItemId LastInsertedRowId();
+
+        /**
          * terminates a running query or execution loop
          * @param aStatement ID of the statement
          */
--- a/layers.sysdef.50.xml	Tue Feb 02 00:24:33 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
-  <!ENTITY layer_real_source_path "s60/mw/mds" >
-]>
-
-<SystemDefinition name="mds" schema="1.4.0">
-  <systemModel>
-    <layer name="mw_layer">
-      <module name="mds">
-        <unit unitID="imm.mds" mrp="" bldFile="&layer_real_source_path;/group" name="mds" />
-      </module>
-    </layer>
-    
-    <layer name="api_test_layer">
-      <module name="mds_api_tests">
-        <unit unitID="imm.mds.content_listing_framework_collection_manager_api" mrp="" bldFile="s60/mw/mds/mds_plat/content_listing_framework_collection_manager_api/tsrc/group"  name="content_listing_framework_collection_manager_api"  />
-      	<unit unitID="imm.mds.context_engine_plugin_api" mrp="" bldFile="s60/mw/mds/mds_plat/context_engine_plugin_api/tsrc/group"  name="context_engine_plugin_api"  />      	
-      	<unit unitID="imm.mds.harvester_framework_api.composerplugin" mrp="" bldFile="s60/mw/mds/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/group"  name="harvester_framework_api.composerplugin"  />
-      	<unit unitID="imm.mds.harvester_framework_api.harvesterclient" mrp="" bldFile="s60/mw/mds/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group"  name="harvester_framework_api.harvesterclient"  />
-      	<unit unitID="imm.mds.harvester_framework_api.harvesterdata" mrp="" bldFile="s60/mw/mds/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/group"  name="harvester_framework_api.harvesterdata"  />
-      	<unit unitID="imm.mds.harvester_framework_api.harvesterplugin" mrp="" bldFile="s60/mw/mds/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/group"  name="harvester_framework_api.harvesterplugin"  />
-      	<unit unitID="imm.mds.harvester_framework_api.monitorplugin" mrp="" bldFile="s60/mw/mds/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/group"  name="harvester_framework_api.monitorplugin"  />
-        <unit unitID="imm.mds.location_manager_api" mrp="" bldFile="s60/mw/mds/mds_plat/location_manager_api/tsrc/group"  name="location_manager_api"  />
-        <unit unitID="imm.mds.metadata_engine_api" mrp="" bldFile="s60/mw/mds/mds_plat/metadata_engine_api/tsrc/group"  name="metadata_engine_api"  /> 
-        
-        <unit unitID="imm.mds.content_listing_framework" mrp="" bldFile="s60/mw/mds/mds_pub/content_listing_framework_api/tsrc/group"  name="content_listing_framework_api"  />    
-      </module>
-    </layer>
-    
-    <layer name="module_test_layer">
-      <module name="mds_module_tests">
-      <unit unitID="imm.mds.performance_test" mrp="" bldFile="s60/mw/mds/internal/tsrc/MDSPerfTest/group"  name="mds_performance_test"  />	
-      </module>
-    </layer>    
-    
-    <layer name="unit_test_layer">
-      <module name="mds_unit_tests">
-      </module>
-    </layer>
-    
-  </systemModel>
-</SystemDefinition>
--- a/layers.sysdef.xml	Tue Feb 02 00:24:33 2010 +0200
+++ b/layers.sysdef.xml	Fri Mar 19 09:38:01 2010 +0200
@@ -22,8 +22,6 @@
       	<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	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/client/src/rlocationmanager.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -117,9 +117,10 @@
 //      
 TVersion RLocationManager::Version() const
     {
-    return TVersion( KLocationManagerServerMajor, 
-                     KLocationManagerServerMinor, 
-                     KLocationManagerServerBuild );
+    TVersion version( KLocationManagerServerMajor, 
+                              KLocationManagerServerMinor, 
+                              KLocationManagerServerBuild );
+    return version;
     }
 
 // --------------------------------------------------------------------------
Binary file locationmanager/conf/locationmanager.confml has changed
Binary file locationmanager/conf/locationmanager_200071BE.crml has changed
Binary file locationmanager/data/200071BE.txt has changed
--- a/locationmanager/locationtrail/eabi/locationtrailarm.def	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/eabi/locationtrailarm.def	Fri Mar 19 09:38:01 2010 +0200
@@ -41,4 +41,16 @@
 	_ZN15CLocationRecord18SetStateToStoppingEv @ 40 NONAME
 	_ZN15CLocationRecord17LocationSnapshotLERKj @ 41 NONAME
 	_ZN15CLocationRecord15RemappingNeededEv @ 42 NONAME
+	_ZN12CNetworkInfoD0Ev @ 43 NONAME
+	_ZN12CNetworkInfoD1Ev @ 44 NONAME
+	_ZN12CNetworkInfoD2Ev @ 45 NONAME
+	_ZN13CPositionInfoD0Ev @ 46 NONAME
+	_ZN13CPositionInfoD1Ev @ 47 NONAME
+	_ZN13CPositionInfoD2Ev @ 48 NONAME
+	_ZN15CLocationRecordD0Ev @ 49 NONAME
+	_ZN15CLocationRecordD1Ev @ 50 NONAME
+	_ZN15CLocationRecordD2Ev @ 51 NONAME
+	_ZN9CTrackLogD0Ev @ 52 NONAME
+	_ZN9CTrackLogD1Ev @ 53 NONAME
+	_ZN9CTrackLogD2Ev @ 54 NONAME
 
--- a/locationmanager/locationtrail/group/locationtrail.mmp	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/group/locationtrail.mmp	Fri Mar 19 09:38:01 2010 +0200
@@ -60,4 +60,7 @@
 BYTEPAIRCOMPRESSTARGET
 OPTION ARMCC -O3 -OTime
 
+#ifdef __VFP_HW_SUPPORT
+OPTION ARMCC --fpu vfpv2 --fpmode fast
+#endif
 
--- a/locationmanager/locationtrail/inc/clocationrecord.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/inc/clocationrecord.h	Fri Mar 19 09:38:01 2010 +0200
@@ -54,13 +54,13 @@
     /**
      * This method is used to notify about location trail state changes.
      */
-    virtual void LocationTrailStateChange() = 0;
+    virtual void LocationTrailStateChange() __SOFTFP = 0;
     
     virtual void CurrentLocation( const TPositionSatelliteInfo& aSatelliteInfo, 
     							  const CTelephony::TNetworkInfoV1& aNetworkInfo,
-                                  const TInt aError ) = 0;
+                                  const TInt aError ) __SOFTFP = 0;
     
-    virtual void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) = 0;
+    virtual void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) __SOFTFP = 0;
     };
 
 /**
@@ -81,7 +81,7 @@
 	 * This method is used to notify about new locations added to location trail
 	 */
 	virtual void LocationAdded( const TLocationTrailItem& aTrailItem, 
-								const TPositionSatelliteInfo& aSatellites ) = 0;
+								const TPositionSatelliteInfo& aSatellites ) __SOFTFP = 0;
 	};    
 
 /**
@@ -147,7 +147,7 @@
     								  TLocationData& aLocationData,
                                       /*TLocality& aPosition,
                                       CTelephony::TNetworkInfoV1& aNetworkInfo,*/
-                                      TLocTrailState& aState );
+                                      TLocTrailState& aState ) __SOFTFP;
 
     /**
      * Request location info. The result is returned by calllback method.
@@ -171,7 +171,7 @@
      * @param aCellId, Network cell is written into this param.
      * @return None.
      */
-    IMPORT_C void GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo );
+    IMPORT_C void GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP;
     
     /**
      * Set observer for notifying state changes.
@@ -189,11 +189,11 @@
     static TInt UpdateNetworkInfo( TAny* aAny );
     
     IMPORT_C void CreateLocationObjectL( const TLocationData& aLocationData,
-    		const TUint& aObjectId );
+    		const TUint& aObjectId ) __SOFTFP;
     
     IMPORT_C void LocationSnapshotL( const TUint& aObjectId );
     
-    TItemId DoCreateLocationL( const TLocationData& aLocationData );
+    TItemId DoCreateLocationL( const TLocationData& aLocationData ) __SOFTFP;
     
     TItemId CreateRelationL( const TUint& aObjectId, const TUint& aLocationId );
     
@@ -212,7 +212,7 @@
      * @param 
      * @return 
      */
-    void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, TInt aError );
+    void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, TInt aError ) __SOFTFP;
     
 public: // from MPositionInfoObserver    
     /**
@@ -221,7 +221,7 @@
      * @param 
      * @return  
      */
-    void Position( const TPositionInfo& aPositionInfo, const TInt aError );
+    void Position( const TPositionInfo& aPositionInfo, const TInt aError ) __SOFTFP;
     
     
 public: // From MMdEQueryObserver
@@ -340,11 +340,6 @@
      */
     TInt iInterval;
     
-    /**
-     * Buffer size for tracklog
-     */ 
-    TInt iBufferSize;
-    
     TBool                  iRequestCurrentLoc;
     TBool                  iTrailStarted;
     
--- a/locationmanager/locationtrail/inc/clocationwrite.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/inc/clocationwrite.h	Fri Mar 19 09:38:01 2010 +0200
@@ -34,7 +34,7 @@
     /**
      * 2-phased constructor.
      */
-    IMPORT_C static CLocationWrite* NewL( CLocationRecord& aLocRecord );
+    IMPORT_C static CLocationWrite* NewL( CLocationRecord& aLocRecord ) __SOFTFP;
     
     /**
      * C++ destructor.
--- a/locationmanager/locationtrail/inc/cnetworkinfo.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/inc/cnetworkinfo.h	Fri Mar 19 09:38:01 2010 +0200
@@ -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 ) = 0;
+    virtual void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, const TInt aError ) __SOFTFP  = 0;
     };
 
 /**
--- a/locationmanager/locationtrail/inc/cpositioninfo.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/inc/cpositioninfo.h	Fri Mar 19 09:38:01 2010 +0200
@@ -36,7 +36,7 @@
      * location trail.
      */
     virtual void Position( const TPositionInfo& aPositionInfo, 
-                           const TInt aError ) = 0;
+                           const TInt aError ) __SOFTFP = 0;
     };
 
 /**
--- a/locationmanager/locationtrail/inc/ctracklog.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/inc/ctracklog.h	Fri Mar 19 09:38:01 2010 +0200
@@ -22,7 +22,7 @@
 #include <f32file.h>
 #include <lbs.h>
 #include "clocationrecord.h"
-#include <lbsSatellite.h>
+#include <lbssatellite.h>
 
 class MTrackLogObserver;
 class CGpxConverterAO;
@@ -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 ) = 0;
+			TTime aStart, TTime aEnd ) __SOFTFP = 0;
 	};    
 
 class CTrackLog : public CBase, public MLocationAddObserver
@@ -111,7 +111,7 @@
 	/*
 	 * from MLocationAddObserver
 	 */
-	void LocationAdded( const TLocationTrailItem& aTrailItem, const TPositionSatelliteInfo& aSatellites );
+	void LocationAdded( const TLocationTrailItem& aTrailItem, const TPositionSatelliteInfo& aSatellites ) __SOFTFP;
 		
 	IMPORT_C void AddGpxObserver( MGpxConversionObserver* aObserver );
 	
--- a/locationmanager/locationtrail/inc/locationtraildefs.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/inc/locationtraildefs.h	Fri Mar 19 09:38:01 2010 +0200
@@ -28,20 +28,26 @@
 
 const TInt KMaxTrailLength = 480000000; // 8 min.
 
-const TInt KIntervalSeconds = KUpdateInterval / 1000000; // 10 seconds
+const TInt KMaximumIntervalSeconds = KUpdateTimeOut / 1000000; // 20 seconds
 
 const TInt KCurrentLocTimeoutCount = 48; // 48 * 10 sec -> 8 min timeout.
 
 const TInt KTrackLogBufSize = 10;
 
-const TInt KLocationTrailShutdownDelay = 180;
+const TInt KLocationTrailShutdownDelay = 60;
+
+const TInt KLocationTrailRemappingCheckDelay = 15;
 
-const TInt KLocationDelta = 30;
+const TInt KLocationTrailRemapShutdownDelay = 360;
 
-const TInt KRemappingTime = 600;
+const TInt KLocationDelta = 20;
+
+const TInt KRemappingTime = 480;
 
 const TInt KFirstInterval = 1000000; // 1 second
 
+const TInt KFirstTimeOut = 1500000; // 1.5 second
+
 //The name of the requestor
 _LIT( KRequestor,         "Location Trail" );
 
@@ -116,6 +122,12 @@
  */
 const TUint32 KRemappingTimeKey = 0x00000006;
 
+/**
+ * Key for reading location trail timeout value from 
+ * Central repository if items are still to be remapped.
+ */
+const TUint32 KLocationTrailRemapShutdownTimer = 0x00000007;
+
 #endif // __LOCATIONTRAILDEFS_H__
 
 // End of file.
--- a/locationmanager/locationtrail/src/clocationrecord.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/src/clocationrecord.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -85,7 +85,7 @@
     TRAP(err, ReadCenRepValueL(KIntervalKey, interval));
     LOG1("CLocationManagerServer::ConstructL, cenrep interval value:%d", interval);
     
-    if (interval == 0)
+    if (interval == 0 || err != KErrNone )
     	{
         LOG1("CLocationManagerServer::ConstructL, cenrep interval err:%d", err);
     	iInterval = KUpdateInterval;
@@ -94,20 +94,6 @@
     	{
     	iInterval = interval * KMillion;
     	}
-    
-    TInt trailLength( 0 );
-    TRAP(err, ReadCenRepValueL(KTrailLengthKey, trailLength));
-    LOG1("CLocationManagerServer::ConstructL, cenrep trail length value:%d", trailLength);
-    
-    if ( err != KErrNone )
-    	{
-        LOG1("CLocationManagerServer::ConstructL, cenrep trail length err:%d", err);
-    	iBufferSize = KMaxTrailLength / iInterval;
-    	}
-    else
-    	{
-    	iBufferSize = trailLength * KMillion / iInterval;
-    	}
 
     TRAP(err, ReadCenRepValueL(KLocationDeltaKey, iLocationDelta));
     LOG1("CLocationManagerServer::ConstructL, location delta value:%d", iLocationDelta);
@@ -124,7 +110,7 @@
 // CLocationRecord::~CLocationRecord
 // --------------------------------------------------------------------------
 //    
-CLocationRecord::~CLocationRecord()
+EXPORT_C CLocationRecord::~CLocationRecord()
     {
     Stop();
     iProperty.Delete( KPSUidLocationTrail, KLocationTrailState );
@@ -160,6 +146,10 @@
     iTrailCaptureSetting = aCaptureSetting;
     if ( aCaptureSetting == RLocationTrail::ECaptureAll && !iPositionInfo->IsActive() )
         {
+        if( iState == RLocationTrail::ETrailStopped  )
+            {
+            iTrail.Reset();
+            }
         iPositionInfo->StartL( aCaptureSetting, iInterval );
         }
     else if ( aCaptureSetting == RLocationTrail::ECaptureNetworkInfo )
@@ -222,7 +212,7 @@
 //
 EXPORT_C void CLocationRecord::GetLocationByTimeL( const TTime aTime, 
 												   TLocationData& aLocationData,
-                                                   TLocTrailState& aState )
+                                                   TLocTrailState& aState ) __SOFTFP 
     {
     LOG( "CLocationRecord::GetLocationByTimeL(), begin" );
     TInt posFound( EFalse );
@@ -252,7 +242,7 @@
         LOG1( "CLocationRecord::GetLocationByTimeL - timeDiff: %d", timeDiff );
 #endif
 
-        if ( err == KErrNone && timeDiff <= KIntervalSeconds )
+        if ( err == KErrNone && timeDiff <= KMaximumIntervalSeconds )
             {
             // The nearest time is in iTrail[i] or in iTrail[i-1].
             if ( i > 0 )
@@ -327,7 +317,7 @@
 // CLocationRecord::GetNetworkInfo
 // --------------------------------------------------------------------------
 //
-EXPORT_C void CLocationRecord::GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo )
+EXPORT_C void CLocationRecord::GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP 
     {
     LOG("CLocationRecord::GetNetworkInfo");
 
@@ -338,7 +328,7 @@
 // CLocationRecord::SetObserver
 // --------------------------------------------------------------------------
 //
-EXPORT_C void CLocationRecord::SetObserver( MLocationTrailObserver* aObserver)
+EXPORT_C void CLocationRecord::SetObserver( MLocationTrailObserver* aObserver) 
     {
     iObserver = aObserver;
     }
@@ -358,7 +348,7 @@
 // --------------------------------------------------------------------------
 //    
 void CLocationRecord::Position( const TPositionInfo& aPositionInfo,
-                                const TInt aError  )
+                                const TInt aError  ) __SOFTFP
     {    
     const TPositionSatelliteInfo& positionSatelliteInfo = 
     	static_cast<const TPositionSatelliteInfo&>(aPositionInfo);
@@ -467,7 +457,7 @@
 // --------------------------------------------------------------------------
 //    
 void CLocationRecord::NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, 
-		const TInt aError )
+		const TInt aError ) __SOFTFP
     {
     LOG("CLocationRecord::NetworkInfo");
     if ( aError == KErrNone )
@@ -595,7 +585,7 @@
 
 
 EXPORT_C void CLocationRecord::CreateLocationObjectL( const TLocationData& aLocationData,
-		const TUint& aObjectId )
+		const TUint& aObjectId ) __SOFTFP
 	{
 	TItemId locationId = DoCreateLocationL( aLocationData );
 	CreateRelationL( aObjectId, locationId );
@@ -802,7 +792,7 @@
 	}
 
 	
-TItemId CLocationRecord::DoCreateLocationL( const TLocationData& aLocationData )
+TItemId CLocationRecord::DoCreateLocationL( const TLocationData& aLocationData ) __SOFTFP 
 	{
 	LOG("CLocationRecord::DoCreateLocationL - start");
 	TItemId locationObjectId;
--- a/locationmanager/locationtrail/src/cnetworkinfo.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/src/cnetworkinfo.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -74,7 +74,7 @@
 // CNetworkInfo::~CNetworkInfo
 // --------------------------------------------------------------------------
 //    
-CNetworkInfo::~CNetworkInfo()
+EXPORT_C CNetworkInfo::~CNetworkInfo()
     {
     Cancel();
     delete iTelephony;
--- a/locationmanager/locationtrail/src/cpositioninfo.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/src/cpositioninfo.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -52,7 +52,7 @@
     // Set update interval.
     iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds(KFirstInterval) );
     // Set time out level. 
-    iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds(KUpdateTimeOut) );
+    iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds(KFirstTimeOut) );
     // Positions which have time stamp below KMaxAge can be reused
     iUpdateOptions.SetMaxUpdateAge( TTimeIntervalMicroSeconds(KMaxAge) );
     // Disables location framework to send partial position data
@@ -72,7 +72,7 @@
 // CPositionInfo::~CPositionInfo
 // --------------------------------------------------------------------------
 //    
-CPositionInfo::~CPositionInfo()
+EXPORT_C CPositionInfo::~CPositionInfo()
     {
     Cancel();
     iPositioner.Close();
@@ -98,6 +98,20 @@
 
     iTrailCaptureSetting = aCaptureSetting;
     iUpdateInterval = aUpdateInterval;
+    iFirstInterval = ETrue;
+    iPositionInfo = TPositionSatelliteInfo();
+    
+    
+    // Set update interval.
+     iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds(KFirstInterval) );
+     // Set time out level. 
+     iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds( KFirstTimeOut) );
+     // Positions which have time stamp below KMaxAge can be reused
+     iUpdateOptions.SetMaxUpdateAge( TTimeIntervalMicroSeconds(KMaxAge) );
+     // Disables location framework to send partial position data
+     iUpdateOptions.SetAcceptPartialUpdates( EFalse );
+    
+   
     
     if ( aCaptureSetting == RLocationTrail::ECaptureAll ) 
     	{
@@ -147,8 +161,7 @@
 //
 void CPositionInfo::Stop()
     {
-    Cancel();
-    
+    Cancel();    
     // Start shutdown timer...
     iPositioner.Close();
     iPosServer.Close();
@@ -161,17 +174,19 @@
 void CPositionInfo::RunL()
     { 
     iTrail->Position( iPositionInfo, iStatus.Int() );
+ 
     if ( iFirstInterval && IsActive() )
     	{
     	Cancel();
-    	iUpdateOptions.SetUpdateInterval( iUpdateInterval );
+    	LOG("CPositionInfo::RunL() - First Time");
+    	iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds (iUpdateInterval) );  
+    	iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds(KUpdateTimeOut ) );
         if ( iTrailCaptureSetting == RLocationTrail::ECaptureAll ) 
         	{
-        	User::LeaveIfError( iPositioner.SetUpdateOptions( iUpdateOptions ) );
+        	User::LeaveIfError( iPositioner.SetUpdateOptions( iUpdateOptions ) );        	
         	iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus );
         	}
     	SetActive();
-    	
     	iFirstInterval = EFalse;
     	}
     }    
@@ -182,7 +197,8 @@
 // 
 void CPositionInfo::DoCancel()
     {
-    if ( !IsActive() )    
+    LOG( "CPositionInfo::DoCancel()" );
+    if ( IsActive() )    
         {
         iPositioner.CancelRequest( EPositionerNotifyPositionUpdate );
         }
--- a/locationmanager/locationtrail/src/ctracklog.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/locationtrail/src/ctracklog.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -65,7 +65,7 @@
 	{
 	}
 
-CTrackLog::~CTrackLog()
+EXPORT_C CTrackLog::~CTrackLog()
 	{
 	delete iGpxConverter;
 	iFs.Close();
@@ -137,7 +137,7 @@
 	}
 
 void CTrackLog::LocationAdded( const TLocationTrailItem& aTrailItem, 
-							   const TPositionSatelliteInfo& aSatellites )
+							   const TPositionSatelliteInfo& aSatellites ) __SOFTFP
 	{
 	LOG("CTrackLog::LocationAdded start");
 
--- a/locationmanager/server/group/locationmanagerserver.mmp	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/server/group/locationmanagerserver.mmp	Fri Mar 19 09:38:01 2010 +0200
@@ -57,4 +57,8 @@
 BYTEPAIRCOMPRESSTARGET
 OPTION ARMCC -O3 -OTime
 
+#ifdef __VFP_HW_SUPPORT
+OPTION ARMCC --fpu vfpv2 --fpmode fast
+#endif
+
 EPOCPROCESSPRIORITY background
--- a/locationmanager/server/inc/clocationmanagerserver.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/server/inc/clocationmanagerserver.h	Fri Mar 19 09:38:01 2010 +0200
@@ -201,7 +201,7 @@
     						 TLocationData& aLocationData,
                              /*TLocality& aPosition, 
                              CTelephony::TNetworkInfoV1& aNetworkInfo,*/
-                             TLocTrailState& aState );
+                             TLocTrailState& aState ) __SOFTFP;
 
     /**
      * Get current location.
@@ -232,7 +232,7 @@
      * @param aCurrLocReq 
      * @return None.
      */     
-    void GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo );
+    void GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP;
     
     /**
      * 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 );
+    						   	   const TUint& aObjectId ) __SOFTFP;
 	
     /**
      * 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);
+	TInt GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality) __SOFTFP;
 	
 	TInt DeleteTrackLogL(const TDesC& aUri);
 	
@@ -290,7 +290,7 @@
      * @param None.
      * @return None.
      */
-    void LocationTrailStateChange();
+    void LocationTrailStateChange() __SOFTFP;
     
     /**
      * Callback method to return current location.
@@ -301,14 +301,14 @@
      * @return None.
      */
     void CurrentLocation( const TPositionSatelliteInfo& aSatelliteInfo,
-    		const CTelephony::TNetworkInfoV1& aNetworkInfo, const TInt aError );
+    		const CTelephony::TNetworkInfoV1& aNetworkInfo, const TInt aError ) __SOFTFP;
     
     /**
      * 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 );
+    void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) __SOFTFP;
     
 public: // from MMdeObjectObserver
 	/**
@@ -326,7 +326,7 @@
 public: // from MGpxConversionObserver
 
 	void GpxFileCreated( const TDesC& aFileName, TItemId aTagId, TReal32 aLength,
-			TTime aStart, TTime aEnd );
+			TTime aStart, TTime aEnd ) __SOFTFP;
 
 private:    
     /**
@@ -387,6 +387,13 @@
     static TInt PositioningStopTimeout( TAny* aAny );
     
     /**
+     * Callback function to check if files were added to remapping queue with delay
+     * @param aAny, a pointer to CLocationRecord object
+     * @return Error code
+     */
+    static TInt CheckForRemappingCallback( TAny* aAny );
+    
+    /**
      * Stops location trail and deletes the positioning stop timer.
      */
     void StopRecording();
@@ -456,6 +463,7 @@
     RArray<TItemId> iTargetObjectIds;
     TItemId iTagId;
     TInt iLocManStopDelay;
+    TInt iLocManStopRemapDelay;
     
     RLocationTrail::TTrailCaptureSetting iCaptureSetting;
     TBool iRemoveLocation;    
--- a/locationmanager/server/src/clocationmanagerserver.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/locationmanager/server/src/clocationmanagerserver.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -98,6 +98,7 @@
 			         iSessionReady( EFalse ),
                      iTagId( 0 ),
                      iLocManStopDelay( 0 ),
+                     iLocManStopRemapDelay( 0 ),
                      iCaptureSetting( RLocationTrail::EOff ),
                      iRemoveLocation( EFalse )
     {
@@ -133,7 +134,6 @@
     
     CRepository* repository = CRepository::NewLC( KRepositoryUid );
 	TInt err = repository->Get( KLocationTrailShutdownTimer, iLocManStopDelay );
-	CleanupStack::PopAndDestroy( repository );
 	
     LOG1("CLocationManagerServer::ConstructL, iLocManStopDelay:%d", iLocManStopDelay);
     
@@ -142,6 +142,17 @@
         LOG1("CLocationManagerServer::ConstructL, iLocManStopDelay err:%d", err);
         iLocManStopDelay = KLocationTrailShutdownDelay;
     	}
+
+    err = repository->Get( KLocationTrailRemapShutdownTimer, iLocManStopRemapDelay );
+    CleanupStack::PopAndDestroy( repository );
+    
+    LOG1("CLocationManagerServer::ConstructL, iLocManStopRemapDelay:%d", iLocManStopRemapDelay);
+    
+    if ( err != KErrNone )
+        {
+        LOG1("CLocationManagerServer::ConstructL, iLocManStopRemapDelay err:%d", err);
+        iLocManStopRemapDelay = KLocationTrailRemapShutdownDelay;
+        }
     
     LOG ("CLocationManagerServer::ConstructL() end");
     }
@@ -295,6 +306,7 @@
 //
 void CLocationManagerServer::StartGPSPositioningL( RLocationTrail::TTrailCaptureSetting aCaptureSetting )
     {
+    LOG( "CLocationManagerServer::StartGPSPositioningL" );
     if ( aCaptureSetting == RLocationTrail::EOff )
     	{
     	return;
@@ -308,6 +320,7 @@
         {
         User::Leave( KErrAlreadyExists );
         }
+    
     if ( iTimer )
     	{
     	delete iTimer;
@@ -323,34 +336,28 @@
 //    
 void CLocationManagerServer::StopGPSPositioningL()
     {
+    LOG( "CLocationManagerServer::StopGPSPositioningL()" );
     iCaptureSetting = RLocationTrail::EOff;
     
     RLocationTrail::TTrailState state;
     GetLocationTrailState( state );
-    if( state == RLocationTrail::ETrailStarted || state == RLocationTrail::ETrailStarting )
-    	{
-    	iLocationRecord->Stop();
-    	}
-    else if ( state != RLocationTrail::ETrailStopped && state != RLocationTrail::ETrailStopping )
+    
+    
+    if( state != RLocationTrail::ETrailStopped && state != RLocationTrail::ETrailStopping )
         {
-        if ( iLocationRecord->RemappingNeeded() )
-        	{
-        	TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityStandard ) );
-        	if ( error != KErrNone )
-        		{
-        		// If timer can't be created we stop the location trail immediately.
-        		iLocationRecord->Stop();
-        		StopTrackLogL();
-        		return;
-        		}
-        	iLocationRecord->SetStateToStopping();
-        	iTimer->Start( iLocManStopDelay * 1000000, 0, TCallBack( PositioningStopTimeout, this ) );
-        	}
-        else 
-        	{
-        	iLocationRecord->Stop();
-        	}
-        }
+        TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityHigh ) );
+        
+        if ( error != KErrNone )
+            {
+            // If timer can't be created we stop the location trail immediately.
+            iLocationRecord->Stop();
+            StopTrackLogL();
+            return;
+            }   
+        
+        iLocationRecord->SetStateToStopping();
+        iTimer->Start( iLocManStopDelay * 1000000, 0, TCallBack( CheckForRemappingCallback, this ) );
+    	}
     
     // Always stop tracklog.
     StopTrackLogL();
@@ -362,6 +369,7 @@
 //
 void CLocationManagerServer::StopRecording()
 	{
+    LOG( "CLocationManagerServer::StopRecording()" );
 	iLocationRecord->Stop();
 	delete iTimer;
 	iTimer = NULL;
@@ -373,6 +381,7 @@
 //
 TInt CLocationManagerServer::PositioningStopTimeout( TAny* aAny )
 	{
+    LOG( "CLocationManagerServer::PositioningStopTimeout" );
 	CLocationManagerServer* self = STATIC_CAST( CLocationManagerServer*, aAny );
 	self->StopRecording();
 	
@@ -380,6 +389,29 @@
 	}
 
 // --------------------------------------------------------------------------
+// CLocationUtilityServer::PositioningStopTimeout
+// --------------------------------------------------------------------------
+//
+TInt CLocationManagerServer::CheckForRemappingCallback( TAny* aAny )
+    {
+    LOG( "CLocationManagerServer::CheckForRemappingCallback" );
+    CLocationManagerServer* self = STATIC_CAST( CLocationManagerServer*, aAny );
+
+    self->iTimer->Cancel();    
+    
+    if ( self->iLocationRecord->RemappingNeeded() )
+        {     
+        self->iTimer->Start( self->iLocManStopRemapDelay * 1000000, 0, TCallBack( PositioningStopTimeout, self ) );
+        }
+    else
+        {        
+        self->StopRecording();
+        }
+    
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
 // CLocationManagerServer::GetLocationTrailState
 // --------------------------------------------------------------------------
 //
@@ -443,7 +475,7 @@
 //   
 void CLocationManagerServer::GetLocationByTimeL( const TTime& aTimeStamp, 
 												 TLocationData& aLocationData,
-                                                 TLocTrailState& aState )
+                                                 TLocTrailState& aState ) __SOFTFP
     {
     iLocationRecord->GetLocationByTimeL( aTimeStamp,
     									 aLocationData,
@@ -497,7 +529,7 @@
 // CLocationManagerServer::GetCurrentCellId
 // --------------------------------------------------------------------------
 //    
-void CLocationManagerServer::GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo )
+void CLocationManagerServer::GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP
     {
     iLocationRecord->GetNetworkInfo( aNetworkInfo );
     }    
@@ -506,7 +538,7 @@
 // CLocationManagerServer::LocationTrailStateChange
 // --------------------------------------------------------------------------
 //    
-void CLocationManagerServer::LocationTrailStateChange()
+void CLocationManagerServer::LocationTrailStateChange() __SOFTFP
     {
     LOG( "CLocationManagerServer::LocationTrailStateChange(), begin" );
 
@@ -529,7 +561,7 @@
 //
 void CLocationManagerServer::CurrentLocation( const TPositionSatelliteInfo& aSatelliteInfo, 
 											  const CTelephony::TNetworkInfoV1& aNetworkInfo,
-                                              const TInt aError )
+                                              const TInt aError ) __SOFTFP
     {
     LOG( "CLocationManagerServer::CurrentLocation(), begin" );
     const TInt KParamLocationData = 0;
@@ -576,7 +608,7 @@
     LOG( "CLocationManagerServer::CurrentLocation(), end" );    
     }
 
-void CLocationManagerServer::GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo )
+void CLocationManagerServer::GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) __SOFTFP
 	{
 	LOG( "CLocationManagerServer::GPSSignalQualityChanged" );
 	const TInt KFixParam = 0;
@@ -651,7 +683,7 @@
 	}
 
 void CLocationManagerServer::CreateLocationObjectL( const TLocationData& aLocationData,
-													const TUint& aObjectId )
+													const TUint& aObjectId ) __SOFTFP
 	{
 	if ( !IsSessionReady() )
 		{
@@ -1012,7 +1044,7 @@
 	}
 
 void CLocationManagerServer::GpxFileCreated( const TDesC& aFileName, TItemId aTagId,
-		TReal32 aLength, TTime aStart, TTime aEnd )
+		TReal32 aLength, TTime aStart, TTime aEnd ) __SOFTFP
 	{
 	TRAP_IGNORE( CreateTrackLogL( aTagId, aFileName, aLength, aStart, aEnd ) );
 	}
@@ -1100,7 +1132,7 @@
     CleanupStack::PopAndDestroy( trackLog );
 	}
 
-TInt CLocationManagerServer::GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality)
+TInt CLocationManagerServer::GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality) __SOFTFP
 	{
 	if ( !iTrackLog )
 		{
--- a/mds_plat/harvester_framework_api/inc/harvesterplugin.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/mds_plat/harvester_framework_api/inc/harvesterplugin.h	Fri Mar 19 09:38:01 2010 +0200
@@ -25,7 +25,7 @@
 class CHarvesterBlacklist;
 class CHarvesterData;
 class CMdEPropertyDef;
-class CHarvesterEventManager;
+class CHarvesterPluginFactory;
 
 // Uid for this interface
 const TUid KCHarvesterPluginInterfaceUid = { 0x200009F8 };
@@ -195,6 +195,18 @@
 	  * Constuctor 
 	  */
 	 IMPORT_C CHarvesterPlugin();
+
+public:
+
+    /** 
+     * Method for getting the mime type for given uri
+     */
+    IMPORT_C virtual void GetMimeType( const TDesC& aUri, TDes& aMimeType );
+    
+    /** 
+     * Method for adding reference to harvester plugin factory
+     */
+    IMPORT_C void SetHarvesterPluginFactory( CHarvesterPluginFactory& aFactory );
          
 private:
     
@@ -233,7 +245,12 @@
 	 * Pointer to blacklisting functionality
 	 */
 	CHarvesterBlacklist* iBlacklist;
-	
+
+    // Not own
+    CHarvesterPluginFactory* iFactory;
+    
+    TBool iFastModeEnabled;
+    
 private:
 	
 	/* Identification on cleanup */ 
@@ -244,7 +261,6 @@
 	
     TBool iHarvesting;
 	
-	CHarvesterEventManager* iHarvesterEventManager;
     };
 
 #endif // __CHARVESTERPLUGIN_H__
--- a/mds_plat/metadata_engine_api/inc/mdeobject.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/mds_plat/metadata_engine_api/inc/mdeobject.h	Fri Mar 19 09:38:01 2010 +0200
@@ -699,18 +699,6 @@
 	 */
 	TUint32 ModifiedPropertiesCount() const;
 
-    /**
-     * Compares two properties.
-     *
-     * @param aFirst   First property.
-     * @param aSecond  Second property.
-     *
-     * @return  0, if the properties are equal;
-     *          a negative value, if the first property is less than the second;
-     *          a positive value, if the first property is greater than the second.
-     */
-	static TInt CompareProperties(const CMdEPropertyDef* aPropertyDef, const CMdEProperty& aProperty);
-	
 private:
 
 	/** Object definition.
--- a/mds_plat/metadata_engine_api/inc/mdeobjectcondition.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/mds_plat/metadata_engine_api/inc/mdeobjectcondition.h	Fri Mar 19 09:38:01 2010 +0200
@@ -232,7 +232,7 @@
      * @param aString         Text string to look for.
      * @param aObjectIds      object IDs to look for.
      */
-    void CMdEObjectCondition::ConstructL( const RArray<TItemId>* aObjectIds,
+    void ConstructL( const RArray<TItemId>* aObjectIds,
     		const TDesC* aString, const TMdEUintRange* aRange );
 
 private:
--- a/mds_plat/metadata_engine_api/inc/mdeobjectdef.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/mds_plat/metadata_engine_api/inc/mdeobjectdef.h	Fri Mar 19 09:38:01 2010 +0200
@@ -116,31 +116,9 @@
 	CMdEPropertyDef* GetPropertyDefL(const TDesC& aName, CMdEObjectDef* aChild);
 
 	void ConstructL(CMdCSerializationBuffer& aSchemaBuffer);
+
+    static TInt CompareProperties(const CMdEPropertyDef& aFirst, const CMdEPropertyDef& aSecond);
 	
-    /**
-     * Compares two properties.
-     *
-     * @param aFirst   First property.
-     * @param aSecond  Second property.
-     *
-     * @return  0, if the properties are equal;
-     *          a negative value, if the first property is less than the second;
-     *          a positive value, if the first property is greater than the second.
-     */
-    static TInt CompareProperties( const CMdEPropertyDef& aFirst, const CMdEPropertyDef& aSecond );
-
-    /**
-     * Compares two properties.
-     *
-     * @param aFirst   First property id.
-     * @param aSecond  Second property.
-     *
-     * @return  0, if the properties are equal;
-     *          a negative value, if the first property is less than the second;
-     *          a positive value, if the first property is greater than the second.
-     */
-    static TInt CompareProperties( const TDefId* aFirst, const CMdEPropertyDef& aSecond );
-    
 private:
 	const TMdCObjectDef& iObjectDef;
 	CMdENamespaceDef& iNamespaceDef;
--- a/mds_plat/metadata_engine_api/inc/mdeproperty.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/mds_plat/metadata_engine_api/inc/mdeproperty.h	Fri Mar 19 09:38:01 2010 +0200
@@ -69,7 +69,7 @@
 	 * @param aObject owner object of property
 	 * @return new numeric property
 	 */
-	static CMdEProperty* CMdEProperty::NewL(const CMdEPropertyDef& aDef, const CMdEObject& aObject);
+	static CMdEProperty* NewL(const CMdEPropertyDef& aDef, const CMdEObject& aObject);
 
 	/**
 	 * Constructs a new property.
@@ -78,7 +78,7 @@
 	 * @param aObject owner object of property
 	 * @return new numeric property
 	 */
-	static CMdEProperty* CMdEProperty::NewLC(const CMdEPropertyDef& aDef, const CMdEObject& aObject);
+	static CMdEProperty* NewLC(const CMdEPropertyDef& aDef, const CMdEObject& aObject);
 
 
 	/**
--- a/mds_plat/metadata_engine_api/inc/mdequery.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/mds_plat/metadata_engine_api/inc/mdequery.h	Fri Mar 19 09:38:01 2010 +0200
@@ -658,6 +658,8 @@
     RPointerArray<MMdEQueryObserver> iObservers;
     
     CDesCArray* iDistinctResults;
+    
+    TBool iDestroyed;
     };
 
     
--- a/metadataengine/client/bwincw/mdeclientu.def	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/client/bwincw/mdeclientu.def	Fri Mar 19 09:38:01 2010 +0200
@@ -295,4 +295,5 @@
 	?PlaceholderOnly@CMdEObjectCondition@@QBEHXZ @ 294 NONAME ; int CMdEObjectCondition::PlaceholderOnly(void) const
 	?SetPlaceholderOnly@CMdEObjectCondition@@QAEXH@Z @ 295 NONAME ; void CMdEObjectCondition::SetPlaceholderOnly(int)
 	?CheckMassStorageMediaId@CMdEHarvesterSession@@QAEXK@Z @ 296 NONAME ; void CMdEHarvesterSession::CheckMassStorageMediaId(unsigned long)
+	?Id@CMdEObjectDef@@QBEKXZ @ 297 NONAME ; unsigned long CMdEObjectDef::Id(void) const
 
--- a/metadataengine/client/eabi/mdeclientu.def	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/client/eabi/mdeclientu.def	Fri Mar 19 09:38:01 2010 +0200
@@ -366,4 +366,5 @@
 	_ZN19CMdEObjectCondition18SetPlaceholderOnlyEi @ 365 NONAME
 	_ZNK19CMdEObjectCondition15PlaceholderOnlyEv @ 366 NONAME
 	_ZN20CMdEHarvesterSession23CheckMassStorageMediaIdEm @ 367 NONAME
+	_ZNK13CMdEObjectDef2IdEv @ 368 NONAME
 
--- a/metadataengine/client/inc/mdeenginesession.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/client/inc/mdeenginesession.h	Fri Mar 19 09:38:01 2010 +0200
@@ -37,11 +37,6 @@
 
 _LIT( KMdSServerFilename, "MdSServer" );
 
-#ifdef __WINS__
-static const TUint KServerMinHeapSize = 0x10000;
-static const TUint KServerMaxHeapSize = 0x400000; // ~4 megs
-#endif
-
 // FORWARD DECLARATIONS
 class CMdESessionImpl;
 class CMdESchemaItem;
--- a/metadataengine/client/inc/mdesessionimpl.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/client/inc/mdesessionimpl.h	Fri Mar 19 09:38:01 2010 +0200
@@ -639,9 +639,6 @@
                 
 		/** Open observer. */
 		MMdESessionObserver* iSessionObserver;
-
-		/** Schema observers. */
-		RPointerArray<MMdESchemaObserver> iSchemaObserverArray;
 		
 		RChunk iSchemaChunk;
 		
--- a/metadataengine/client/src/mdeasynchronousfindao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/client/src/mdeasynchronousfindao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -107,7 +107,7 @@
         }
 
     iConditionBuffer = 
-    	CMdEQueryCriteriaSerialization::NewLC( resultMode, iQuery.Type(),     										   
+    	CMdEQueryCriteriaSerialization::NewL( resultMode, iQuery.Type(),     										   
     										   iQuery.NamespaceDef(), 
     										   objectDef, 
     										   objectDefs, 
@@ -116,7 +116,6 @@
     										   queryOptimizationFlags, 
     										   iQuery.Conditions(), iQuery.OrderRules(),
     										   propertyFilter );
-	CleanupStack::Pop();
     iSession.DoFindAsync( 
     	iQuery.GetQueryId(), 
         *iConditionBuffer,
@@ -312,6 +311,7 @@
 
         // get rid of local results list
         iResultList.Reset();
+        iResultList.Compress();
         }
     // Notify result ids
     else if ( ( aStatus == EAsyncFindSetReady ||
--- a/metadataengine/client/src/mdelogiccondition.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/client/src/mdelogiccondition.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -331,8 +331,8 @@
 MDE_IMPLEMENT_ADD_RANGE_PROPERTY_CONDITION(Real)
 MDE_IMPLEMENT_ADD_RANGE_PROPERTY_CONDITION(Time)
 
-EXPORT_C CMdETextPropertyCondition& 
-CMdELogicCondition::AddPropertyConditionL(const CMdEPropertyDef& aPropertyDef,
+EXPORT_C CMdETextPropertyCondition& CMdELogicCondition::AddPropertyConditionL(
+                                          const CMdEPropertyDef& aPropertyDef,
                                           TTextPropertyConditionCompareMethod aCompareMethod,
                                           const TDesC& aText)
     {
--- a/metadataengine/client/src/mdenotifierao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/client/src/mdenotifierao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -238,74 +238,64 @@
         case EObjectNotifyAdd:
         	{
         	MMdEObjectObserver* obs = static_cast<MMdEObjectObserver*>( iObserver );
-        	obs->HandleObjectNotification( iSessionImpl, ENotifyAdd, iIdArray );
-            iIdArray.Reset();            
+        	obs->HandleObjectNotification( iSessionImpl, ENotifyAdd, iIdArray );     
         	break;
         	}
         case EObjectNotifyModify:
         	{
         	MMdEObjectObserver* obs = static_cast<MMdEObjectObserver*>( iObserver );
-        	obs->HandleObjectNotification( iSessionImpl, ENotifyModify, iIdArray );
-            iIdArray.Reset();            
+        	obs->HandleObjectNotification( iSessionImpl, ENotifyModify, iIdArray );         
         	break;
         	}
         case EObjectNotifyRemove:
         	{
         	MMdEObjectObserver* obs = static_cast<MMdEObjectObserver*>( iObserver );
-        	obs->HandleObjectNotification( iSessionImpl, ENotifyRemove, iIdArray );
-            iIdArray.Reset();            
+        	obs->HandleObjectNotification( iSessionImpl, ENotifyRemove, iIdArray );        
         	break;
         	}
 
         case EObjectNotifyPresent:
         	{
 	    	MMdEObjectPresentObserver* obs = static_cast<MMdEObjectPresentObserver*>( iObserver );
-            obs->HandleObjectPresentNotification( iSessionImpl, ETrue, iIdArray );
-            iIdArray.Reset();            
+            obs->HandleObjectPresentNotification( iSessionImpl, ETrue, iIdArray );      
 	    	break;
         	}
         case EObjectNotifyNotPresent:
         	{
 	    	MMdEObjectPresentObserver* obs = static_cast<MMdEObjectPresentObserver*>( iObserver );
-            obs->HandleObjectPresentNotification( iSessionImpl, EFalse, iIdArray );
-            iIdArray.Reset();            
+            obs->HandleObjectPresentNotification( iSessionImpl, EFalse, iIdArray );       
 	    	break;
         	}
     	
         case ERelationNotifyAdd:
         	{
 	        MMdERelationObserver* obs = static_cast<MMdERelationObserver*>( iObserver );
-            obs->HandleRelationNotification( iSessionImpl, ENotifyAdd, iIdArray );
-            iIdArray.Reset();            
+            obs->HandleRelationNotification( iSessionImpl, ENotifyAdd, iIdArray );           
 	        break;
         	}
         case ERelationNotifyModify:
         	{
 	        MMdERelationObserver* obs = static_cast<MMdERelationObserver*>( iObserver );
-            obs->HandleRelationNotification( iSessionImpl, ENotifyModify, iIdArray );
-            iIdArray.Reset();            
+            obs->HandleRelationNotification( iSessionImpl, ENotifyModify, iIdArray );        
 	        break;
         	}
         case ERelationNotifyRemove:
         	{
 	        MMdERelationObserver* obs = static_cast<MMdERelationObserver*>( iObserver );
-            obs->HandleRelationNotification( iSessionImpl, ENotifyRemove, iIdArray );
-            iIdArray.Reset();            
+            obs->HandleRelationNotification( iSessionImpl, ENotifyRemove, iIdArray );        
 	        break;
         	}
 
         case ERelationNotifyPresent:
         	{
 	    	MMdERelationPresentObserver* obs = static_cast<MMdERelationPresentObserver*>( iObserver );
-            obs->HandleRelationPresentNotification( iSessionImpl, ETrue, iIdArray );
-            iIdArray.Reset();            
+            obs->HandleRelationPresentNotification( iSessionImpl, ETrue, iIdArray );          
 	    	break;
         	}
         case ERelationNotifyNotPresent:
         	{
 	    	MMdERelationPresentObserver* obs = static_cast<MMdERelationPresentObserver*>( iObserver );
-            obs->HandleRelationPresentNotification( iSessionImpl, EFalse, iIdArray );
-            iIdArray.Reset();            
+            obs->HandleRelationPresentNotification( iSessionImpl, EFalse, iIdArray );         
 	    	break;
         	}
         	
@@ -313,22 +303,21 @@
         	{
         	MMdERelationItemObserver* obs = static_cast<MMdERelationItemObserver*>( iObserver );
             obs->HandleRelationItemNotification( iSessionImpl, ENotifyRemove, iRelationItemArray );
-            iRelationItemArray.Reset();            
+            iRelationItemArray.Reset();
+            iRelationItemArray.Compress();
         	break;
         	}
 
         case EEventNotifyAdd:
         	{
             MMdEEventObserver* obs = static_cast<MMdEEventObserver*>( iObserver );
-            obs->HandleEventNotification( iSessionImpl, ENotifyAdd, iIdArray);
-            iIdArray.Reset();            
+            obs->HandleEventNotification( iSessionImpl, ENotifyAdd, iIdArray);      
             break;
         	}
         case EEventNotifyRemove:
         	{
             MMdEEventObserver* obs = static_cast<MMdEEventObserver*>( iObserver );
-            obs->HandleEventNotification( iSessionImpl, ENotifyRemove, iIdArray);
-            iIdArray.Reset();            
+            obs->HandleEventNotification( iSessionImpl, ENotifyRemove, iIdArray);           
             break;
         	}
     	
@@ -343,6 +332,8 @@
         	// no observer to call - this should be skipped on server side!
         	break;
         }
+    iIdArray.Reset();
+    iIdArray.Compress();
     }
 
 void CMdENotifierAO::DecodeIdBufferL()
@@ -356,6 +347,7 @@
 	__ASSERT_DEBUG( iNamespaceDefId == itemIds.iNamespaceDefId, User::Panic( _L("Incorrect namespaceDef from returned items!"), KErrCorrupt ) );
 
     iDataBuffer->PositionL( itemIds.iObjectIds.iPtr.iOffset );
+    iIdArray.ReserveL( itemIds.iObjectIds.iPtr.iCount );
 	for( TUint32 i = 0; i < itemIds.iObjectIds.iPtr.iCount; ++i )
 		{
 		TItemId id;
@@ -374,12 +366,13 @@
     CMdENamespaceDef& namespaceDef = iSessionImpl.GetNamespaceDefL( iNamespaceDefId );
     iDataBuffer->PositionL( items.iRelations.iPtr.iOffset );
     TMdERelation relation;
+    iRelationItemArray.ReserveL( items.iRelations.iPtr.iCount );
     for (TInt i = 0; i < items.iRelations.iPtr.iCount; ++i )
     	{
     	relation.DeSerializeL( *iDataBuffer, namespaceDef );
     	if ( relation.Id() )
     		{
-    		iRelationItemArray.Append( relation );
+    		iRelationItemArray.AppendL( relation );
     		}
     	}
 	}
--- a/metadataengine/client/src/mdeobject.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/client/src/mdeobject.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -347,18 +347,39 @@
 
 EXPORT_C TInt CMdEObject::Property(const CMdEPropertyDef& aDef, CMdEProperty*& aProperty, TInt aStartAt) const
     {
-    if (aStartAt <= 0)
+    const TInt count = iPropertyArray.Count();
+
+    if( aStartAt >= 0 )
         {
-        const TInt i = iPropertyArray.FindInOrder(aDef, CMdEObject::CompareProperties );
-        if (i >= 0 && i < iPropertyArray.Count() && !iPropertyArray[i]->Removed())
+        TInt low( aStartAt );
+        TInt high( count );
+    
+        while( low < high )
             {
-            aProperty = iPropertyArray[i];
-            return i;
+            TInt mid( (low+high)>>1 );
+            
+            TInt compare( aDef.Compare( iPropertyArray[mid]->Def() ) );
+            if( compare == 0 )
+                {
+                if( !iPropertyArray[mid]->Removed() )
+                    {
+                    aProperty = iPropertyArray[mid];
+                    return mid;
+                    }
+                }
+            else if( compare > 0 )
+                {
+                low = mid + 1;
+                }
+            else
+                {
+                high = mid;
+                }
             }
         }
     return KErrNotFound;
     }
-
+    
 EXPORT_C CMdEProperty& CMdEObject::AddBoolPropertyL(CMdEPropertyDef& aDef, TBool aValue)
 	{
     if( aDef.PropertyType() != EPropertyBool )
@@ -545,7 +566,7 @@
 								TLinearOrder<CMdEProperty>(CMdEObject::CompareProperties));
 	if (err == KErrAlreadyExists)
 		{
-		TInt f = iPropertyArray.FindInOrder(&aProperty,
+		const TInt f = iPropertyArray.FindInOrder(&aProperty,
 								TLinearOrder<CMdEProperty>(CMdEObject::CompareProperties));
 
 		// this must never happen
@@ -704,13 +725,29 @@
 	// but don't remove yet from other object
 	for ( TInt i = 0; i < arraySize; ++i )
 		{
-		TRAPD( err, iPropertyArray.AppendL( aObject.iPropertyArray[i] ) );
-		if (err != KErrNone)
-			{
-			// restore this objects to original state
-			iPropertyArray.Reset();
-			User::Leave( err );
-			}
+        TInt err = iPropertyArray.InsertInOrder(aObject.iPropertyArray[i], 
+                                TLinearOrder<CMdEProperty>(CMdEObject::CompareProperties));
+    
+        if (err == KErrAlreadyExists)
+            {
+            const TInt f = iPropertyArray.FindInOrder(aObject.iPropertyArray[i],
+                                TLinearOrder<CMdEProperty>(CMdEObject::CompareProperties));
+
+            if( !iPropertyArray[f]->Removed() )
+                {
+				continue;
+                }
+
+            CMdEProperty* oldProperty = iPropertyArray[f];
+            iPropertyArray[f] = aObject.iPropertyArray[i];
+            delete oldProperty;
+            }
+        else if (err < KErrNone)
+            {
+            // restore this objects to original state
+            iPropertyArray.Reset();
+            User::Leave(err);
+            }	
 		}
 
 	// remove properties from other object
@@ -1000,7 +1037,27 @@
 					+ i * sizeof(TMdCProperty) );
 
 			CMdEProperty* property = CMdEProperty::NewLC( *newObject, aBuffer );
-			newObject->iPropertyArray.AppendL( property );
+		    TInt err = newObject->iPropertyArray.InsertInOrder(property, 
+		                                TLinearOrder<CMdEProperty>(CMdEObject::CompareProperties));
+		    
+		    if (err == KErrAlreadyExists)
+		        {
+		        const TInt f = newObject->iPropertyArray.FindInOrder(property,
+		                                TLinearOrder<CMdEProperty>(CMdEObject::CompareProperties));
+
+		        if( !newObject->iPropertyArray[f]->Removed() )
+		            {
+		            continue;
+		            }
+
+		        CMdEProperty* oldProperty = newObject->iPropertyArray[f];
+		        newObject->iPropertyArray[f] = property;
+		        delete oldProperty;
+		        }
+		    else if (err < KErrNone)
+		        {
+		        User::Leave(err);
+		        }
 			CleanupStack::Pop( property );
 			}
 		}
@@ -1028,8 +1085,3 @@
 	return EMdETypeObject;
 	}
 
-TInt CMdEObject::CompareProperties(const CMdEPropertyDef* aPropertyDef, const CMdEProperty& aProperty)
-    {
-    return aPropertyDef->Compare( aProperty.Def() );
-    }
-
--- a/metadataengine/client/src/mdeobjectdef.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/client/src/mdeobjectdef.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -59,8 +59,9 @@
         {
 		aSchemaBuffer.PositionL( propertyOffset + i * sizeof(TMdCPropertyDef) );
 		const TMdCPropertyDef& propertyDef = TMdCPropertyDef::GetFromBufferL(aSchemaBuffer);
-		CMdEPropertyDef* propertyDefImpl = CMdEPropertyDef::NewL( propertyDef, aSchemaBuffer, *this );
-		iPropertyDefs.InsertInOrder( propertyDefImpl, TLinearOrder<CMdEPropertyDef>(CMdEObjectDef::CompareProperties) );
+		
+		CMdEPropertyDef* defImpl = CMdEPropertyDef::NewL( propertyDef, aSchemaBuffer, *this );
+		iPropertyDefs.InsertInOrder(defImpl, TLinearOrder<CMdEPropertyDef>(CMdEObjectDef::CompareProperties)); 
         }
     }
 
@@ -70,7 +71,7 @@
     iPropertyDefs.Close();
     }
 
-TDefId CMdEObjectDef::Id() const
+EXPORT_C TDefId CMdEObjectDef::Id() const
     {
     return iObjectDef.iDefId;
     }
@@ -157,11 +158,48 @@
 
 CMdEPropertyDef* CMdEObjectDef::GetPropertyDefL(TDefId aId, CMdEObjectDef* aChild)
     {
-    const TInt i = iPropertyDefs.FindInOrder(aId, CMdEObjectDef::CompareProperties );
+    const TInt count = iPropertyDefs.Count();
+
+    TInt low( 0 );
+    TInt high( count );
+    TBool linearSearchRequired( EFalse );
     
-    if (i >= 0 && i < iPropertyDefs.Count() && iPropertyDefs[i] )
+    while( low < high )
         {
-        return iPropertyDefs[i];
+        TInt mid( (low+high)>>1 );
+        
+        if( !iPropertyDefs[mid] )
+            {
+            linearSearchRequired = ETrue;
+            break;
+            }
+        
+        TInt compare( aId - iPropertyDefs[mid]->Id() );
+        if( compare == 0 )
+            {
+            return iPropertyDefs[mid];
+            }
+        else if( compare > 0 )
+            {
+            low = mid + 1;
+            }
+        else
+            {
+            high = mid;
+            }
+        }
+  
+    if( linearSearchRequired )
+        {
+        for ( TInt i = 0; i < count; ++i )
+            {
+            CMdEPropertyDef* propDef = iPropertyDefs[i];
+        
+            if( propDef && propDef->Id() == aId )
+                {
+                return propDef;
+                }
+            }
         }
 
     CMdEObjectDef* parent = ParentL();
@@ -189,13 +227,8 @@
 	return iPropertyDefs[aIndex];
 	}
 
-TInt CMdEObjectDef::CompareProperties( const CMdEPropertyDef& aFirst, const CMdEPropertyDef& aSecond )
+TInt CMdEObjectDef::CompareProperties(const CMdEPropertyDef& aFirst, const CMdEPropertyDef& aSecond)
     {
     return aFirst.Id() - aSecond.Id();
     }
 
-TInt CMdEObjectDef::CompareProperties( const TDefId* aFirst, const CMdEPropertyDef& aSecond )
-    {
-    return *aFirst - aSecond.Id();
-    }
-
--- a/metadataengine/client/src/mdequery.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/client/src/mdequery.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -28,7 +28,7 @@
 CMdEQuery::CMdEQuery(TQueryType aType, CMdESession& aSession, CMdENamespaceDef& aNamespaceDef)
         : iQueryId( 0 ), iSession(aSession), iNamespaceDef(aNamespaceDef), iType(aType), 
           iResultMode(EQueryResultModeItem), iState(EStateNew), iError(KErrNone), 
-          iObjectResult(NULL), iCountResult(0), iDistinctResults(NULL)
+          iObjectResult(NULL), iCountResult(0), iDistinctResults(NULL), iDestroyed(EFalse)
     {
     }
 
@@ -41,6 +41,7 @@
 
 CMdEQuery::~CMdEQuery()
 	{
+    iDestroyed = ETrue;
 	Cancel();
   
     // This will destroy the entire conditions tree.
@@ -204,7 +205,10 @@
     if( incomplete || IsComplete() == EFalse )
     	{
     	iState = EStateError;
-    	NotifyCompleted( KErrCancel );
+    	if( !iDestroyed )
+    	    {
+            NotifyCompleted( KErrCancel );
+    	    }
     	}
     }
 
@@ -538,11 +542,14 @@
 
     // Update the latest error code.
     iError = aError;
-	for (TInt i = iObservers.Count() - 1; i >= 0; --i)
-		{
-		MMdEQueryObserver* observer = iObservers[i];
-		observer->HandleQueryCompleted(*this, aError);
-		}
+    for (TInt i = iObservers.Count() - 1; i >= 0; --i)
+        {
+        MMdEQueryObserver* observer = iObservers[i];
+        if( observer )
+            {
+            observer->HandleQueryCompleted(*this, aError);
+            }
+        }
     }
 
 
--- a/metadataengine/client/src/mdesessionimpl.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/client/src/mdesessionimpl.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -68,7 +68,11 @@
 			RMdESessionAsyncRequest::EAddRequest, 
 			aBuffer, aResultBuffer, aRequestStatus );
 
-	iRequests.Append(request);
+	const TInt error = iRequests.Append(request);
+    if( error != KErrNone )
+        {
+        return;
+        }
 
 	if( !IsActive() )
 		{
@@ -86,7 +90,11 @@
 			RMdESessionAsyncRequest::EUpdateRequest,
 			aBuffer, aResultBuffer, aRequestStatus);
 
-	iRequests.Append(request);
+	const TInt error = iRequests.Append(request);
+    if( error != KErrNone )
+        {
+        return;
+        }
 
 	if( !IsActive() )
 		{
@@ -104,7 +112,11 @@
 			RMdESessionAsyncRequest::ERemoveRequest, 
 			aBuffer, aResultBuffer, aRequestStatus);
 
-	iRequests.Append(request);
+	const TInt error = iRequests.Append(request);
+	if( error != KErrNone )
+	    {
+	    return;
+	    }
 
 	if( !IsActive() )
 		{
@@ -224,8 +236,6 @@
 	{
     // No session errors should be sent during deconstruction to avoid possible double deletion
     iSessionObserver = NULL;
-    
-	Close();
 
 	delete iSchemaBuffer;
 
@@ -253,8 +263,6 @@
 
 void CMdESessionImpl::Close()
 	{
-	iSchemaObserverArray.Reset();
-	iSchemaObserverArray.Close();
 	}
 
 TInt CMdESessionImpl::NamespaceDefCount() const
@@ -1669,7 +1677,7 @@
 	{
 	RPointerArray<CMdEInstanceItem> items;
 	CleanupClosePushL( items );
-	items.Append( &aItem );
+	items.AppendL( &aItem );
 	User::LeaveIfError( AddItemsL( items ) );
 	CleanupStack::PopAndDestroy( &items );
 	return aItem.Id();
@@ -1898,7 +1906,7 @@
     {
 	RPointerArray<CMdEInstanceItem> items;
 	CleanupClosePushL( items );
-	items.Append( &aRelation );
+	items.AppendL( &aRelation );
 	User::LeaveIfError( UpdateItemsL( items ) );
 	CleanupStack::PopAndDestroy( &items );
 	return aRelation.Id();
@@ -2269,7 +2277,7 @@
     notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef );
 
     CleanupStack::Pop( notifier );
-    iNotifiers.Append( notifier );
+    iNotifiers.AppendL( notifier );
     
     CleanupStack::PopAndDestroy( aCondition );
     }
@@ -2296,7 +2304,7 @@
     		&aObserver, NULL, namespaceDef );
 
     CleanupStack::Pop( notifier );
-    iNotifiers.Append( notifier );
+    iNotifiers.AppendL( notifier );
 	}
 
 void CMdESessionImpl::AddRelationObserverL( MMdERelationObserver& aObserver,
@@ -2352,7 +2360,7 @@
     notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef );
 
     CleanupStack::Pop( notifier );
-    iNotifiers.Append( notifier );
+    iNotifiers.AppendL( notifier );
     
     CleanupStack::PopAndDestroy( aCondition );
     }
@@ -2409,7 +2417,7 @@
 	notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef );
 	
 	CleanupStack::Pop( notifier );
-	iNotifiers.Append( notifier );
+	iNotifiers.AppendL( notifier );
 	
     CleanupStack::PopAndDestroy( aCondition );
 	}
@@ -2438,7 +2446,7 @@
     		&aObserver, NULL, namespaceDef );
 
     CleanupStack::Pop( notifier );
-    iNotifiers.Append( notifier );
+    iNotifiers.AppendL( notifier );
 	}
 
 void CMdESessionImpl::AddEventObserverL( MMdEEventObserver& aObserver,
@@ -2495,7 +2503,7 @@
     notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef );
 
     CleanupStack::Pop( notifier );
-    iNotifiers.Append( notifier );
+    iNotifiers.AppendL( notifier );
     
     CleanupStack::PopAndDestroy( aCondition );
     }
--- a/metadataengine/data/schema.mde	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/data/schema.mde	Fri Mar 19 09:38:01 2010 +0200
@@ -166,13 +166,13 @@
 property   Duration                       0    0        8    min   max
 property   ReleaseDate                    0    0        10   min   max
 property   CaptureDate                    0    0        10   min   max
-property   Artist                         0    0        11   min   max 
+property   Artist                         0    0        11   min   max   1
 property   Author                         0    0        11   min   max
 property   Copyright                      0    0        11   min   max
 property   Legal                          0    0        11   min   max
 property   Description                    0    0        11   min   max
 property   Comment                        0    0        11   min   max
-property   Genre                          0    0        11   min   max 
+property   Genre                          0    0        11   min   max   1
 property   Track                          0    0        4    min   max
 property   AudioFourCC                    0    0        6    min   max
 
@@ -231,8 +231,8 @@
 
 object http://sw.nokia.com/MdE Audio MediaObject 0
 property   SamplingFrequency              0    0        8    min   max
-property   Album                          0    0        11   min   max 
-property   Composer                       0    0        11   min   max 
+property   Album                          0    0        11   min   max   1
+property   Composer                       0    0        11   min   max   1
 property   OriginalArtist                 0    0        11   min   max
 property   AlbumArtist                    0    0        11   min   max
 
--- a/metadataengine/server/inc/mdsfindengine.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/inc/mdsfindengine.h	Fri Mar 19 09:38:01 2010 +0200
@@ -137,13 +137,7 @@
         * Transfer result set to client
         * @aError error code or KErrNone
         */
-        void SetComplete( TInt aError );
-
-        /**
-        * Transfer results to client and completes find
-        * @aError error code or KErrNone
-        */
-        void FindComplete( TInt aError );
+        void SetComplete( TInt aError, TBool aSet );
 
 		const CMdCSerializationBuffer& ResultsL() const;
 
--- a/metadataengine/server/inc/mdssqlobjectmanipulate.h	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/inc/mdssqlobjectmanipulate.h	Fri Mar 19 09:38:01 2010 +0200
@@ -502,6 +502,15 @@
 	    * Deletes BaseObject.
 	    */	   	    
         TBool DoGarbageCollectionL();    
+
+#ifdef MDS_PLAYLIST_HARVESTING_ENABLED
+    private:
+        
+        /**
+        * Deletes BaseObject.
+        */          
+        TInt CleanPlaylistsL();
+#endif
         
 	private: // Member data
 		struct TLockBuffer
--- a/metadataengine/server/src/mdsclausebuffer.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsclausebuffer.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -62,15 +62,11 @@
 //
 void CMdsClauseBuffer::ConstructL( TInt aInitialSize )
     {
-    if ( aInitialSize < 1 )
+    if ( aInitialSize < 1 || aInitialSize > 100000 )
     	{
     	aInitialSize = 1;
     	}
     iCurrentBufSize = aInitialSize;
-    if (aInitialSize > 100000 || aInitialSize < 0)
-    	{
-    	aInitialSize = 0;
-    	}
 
     iBuffer = HBufC::NewL( iCurrentBufSize );
     }
@@ -104,11 +100,11 @@
         return EFalse;
         }
 
+    // realloc and copy
+    iBuffer = iBuffer->ReAllocL( aRequired );
+    
 	iCurrentBufSize = aRequired;
 
-    // realloc and copy
-    iBuffer = iBuffer->ReAllocL( iCurrentBufSize );
-
     return ETrue;
     }
 
--- a/metadataengine/server/src/mdsdiskspacenotifier.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsdiskspacenotifier.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -57,7 +57,12 @@
 		switch( status )
 			{
 			case KErrNone:
-				iFileServerSession.Volume( volumeInfo, iDrive );
+				const TInt error = iFileServerSession.Volume( volumeInfo, iDrive );
+				if( error != KErrNone )
+				    {
+				    StartNotifier();
+				    break;
+				    }
 				
 				// Check if free space is less than threshold level
 				if( volumeInfo.iFree < iThreshold )
@@ -89,8 +94,15 @@
 	else if ( iState == CMdSDiskSpaceNotifierAO::EIterate )
 		{
 		const TInt KMaxIterations = 10;
-		
-		iFileServerSession.Volume( volumeInfo, iDrive );
+        TInt error = iFileServerSession.Volume( volumeInfo, iDrive );
+        if( error != KErrNone )
+            {
+            iState = ENormal;
+            iIterationCount = 0;
+            StartNotifier();
+            return;
+            }
+
 		if ( volumeInfo.iFree < iThreshold )
 			{
 			iObserver.HandleDiskSpaceNotificationL( MMdSDiskSpaceNotifierObserver::ELess );
@@ -104,7 +116,14 @@
 				}
 			else
 				{
-				iFileServerSession.Volume( volumeInfo, iDrive );
+		        error = iFileServerSession.Volume( volumeInfo, iDrive );
+		        if( error != KErrNone )
+		            {
+		            iState = ENormal;
+		            iIterationCount = 0;
+		            StartNotifier();
+		            return;
+		            }
 				if ( volumeInfo.iFree >= iThreshold )
 					{
 					iDiskFull = EFalse;
@@ -155,8 +174,8 @@
 	User::LeaveIfError( iFileServerSession.Connect( KMessageSlotCount ) );
 	
 	TVolumeInfo volumeInfo;
-	iFileServerSession.Volume( volumeInfo, iDrive );	
-	if ( volumeInfo.iFree < iThreshold )
+	const TInt error = iFileServerSession.Volume( volumeInfo, iDrive );	
+	if ( (error != KErrNone) || volumeInfo.iFree < iThreshold )
 		{
 		iDiskFull = ETrue;
 		}
--- a/metadataengine/server/src/mdseventdef.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdseventdef.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -74,7 +74,8 @@
     CleanupClosePushL( rowData );
 	rowData.AppendL( TColumn( aNamespaceDefId ) );
 	rowData.AppendL( TColumn( iPriority ) );
-	rowData.AppendL( TColumn( GetName().AllocL() ) );
+	rowData.AppendL( TColumn( GetName().AllocLC() ) );
+	CleanupStack::Pop(); // name
 
 	TDefId id = MMdSIndexer::ExecuteAndGetIndexL(KMdsSqlClauseAddEventDef, rowData );
 
--- a/metadataengine/server/src/mdsfindengine.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsfindengine.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -217,10 +217,20 @@
 // SetComplete
 // ---------------------------------------------------------------------------
 //
-void CMdSFindEngine::SetComplete( TInt aError )
+void CMdSFindEngine::SetComplete( TInt aError, TBool aSet )
     {
     TBool toComplete = iAsyncPending;
-    __LOG1( ELogServer, "<- Find Set Complete (%d)", aError );
+    
+#ifdef _DEBUG
+    if( aSet )
+        {
+        __LOG1( ELogServer, "<- Find Set Complete (%d)", aError );
+        }
+    else
+        {
+        __LOG1( ELogServer, "<- Find Complete (%d)", aError );    
+        }
+#endif
 
     if( aError == KErrNone )
         {
@@ -260,7 +270,14 @@
        		{        	
        		if ( toComplete && iMessage.IsNull() == EFalse ) 
        			{
-       			iMessage.Complete( EAsyncFindSetReady );
+       		    if( aSet )
+       		        {
+                    iMessage.Complete( EAsyncFindSetReady );
+       		        }
+       		    else
+       		        {
+       		        iMessage.Complete( EAsyncFindComplete );
+       		        }
        			}
        		}
         }
@@ -274,67 +291,6 @@
         }
     }
 
-// ---------------------------------------------------------------------------
-// FindComplete
-// ---------------------------------------------------------------------------
-//
-void CMdSFindEngine::FindComplete( TInt aError )
-    {
-    TBool toComplete = iAsyncPending;
-    __LOG1( ELogServer, "<- Find Complete (%d)", aError );
-
-    if( aError == KErrNone )
-        {
-        TUint32 resultSize = 0;
-
-        TInt err = KErrNone;
-
-        TRAP( err, resultSize = iSequence->ResultsL().Size() );
-
-       	if( err )
-       		{
-       		if ( toComplete && iMessage.IsNull() == EFalse )
-       			{
-       			iMessage.Complete( err );
-       			}
-       		return;
-       		}
-
-        iAsyncPending = EFalse;
-        
-        if ( iMessage.IsNull() == EFalse )
-        	{
-        	TPckgBuf<TInt> sizeBuf( resultSize );    	
-
-        	err = iMessage.Write( 2, sizeBuf );
-        	}
-
-       	if( err )
-       		{
-       		if ( toComplete && iMessage.IsNull() == EFalse ) 
-       			{
-       			iMessage.Complete( err );
-       			}
-       		return;
-       		}
-       	else
-			{
-        	if ( toComplete && iMessage.IsNull() == EFalse ) 
-        		{
-        		iMessage.Complete( EAsyncFindComplete );
-        		}
-			}
-        }
-    else
-        {
-       	if ( toComplete && iMessage.IsNull() == EFalse ) 
-       		{
-       		iMessage.Complete( aError );
-       		}
-       	return;
-        }
-    }
-
 const CMdCSerializationBuffer& CMdSFindEngine::ResultsL() const
 	{
 	return iSequence->ResultsL();
--- a/metadataengine/server/src/mdsfindsequence.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsfindsequence.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -284,7 +284,7 @@
         CMdSFindEngine* obs = iObserver;
         if ( obs )
         	{
-        	obs->SetComplete( KErrNone );
+        	obs->SetComplete( KErrNone, ETrue );
         	}
         }
     else if ( result == KErrCancel )
@@ -297,7 +297,7 @@
         CMdSFindEngine* obs = iObserver;
         if ( obs )
         	{
-        	obs->FindComplete( result );
+        	obs->SetComplete( result, EFalse );
         	}
         }
     }
@@ -311,7 +311,7 @@
     // Cleanup if RunL() leaves
     CMdSFindEngine* obs = iObserver;
     CleanUp();
-    obs->FindComplete( aError );
+    obs->SetComplete( aError, EFalse );
     return KErrNone;
     }
 
@@ -507,7 +507,7 @@
 
 		RArray<TMdCObject> objectArray;
 		CleanupClosePushL( objectArray );
-		objectArray.Reserve( items.iObjects.iPtr.iCount );
+		objectArray.ReserveL( items.iObjects.iPtr.iCount );
 		// store objects in array in correct order
 		for( TInt i = 0; i < items.iObjects.iPtr.iCount; ++i )
 			{
--- a/metadataengine/server/src/mdsfindsqlclause.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsfindsqlclause.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -2610,7 +2610,7 @@
 				// expected result for property's type
 			    iResultRow.AppendL( TColumn( propDef->GetSqlType() ) );
 
-			    iPropertyFilters.Append( propDef );
+			    iPropertyFilters.AppendL( propDef );
 				}
 			}
 		}
--- a/metadataengine/server/src/mdsimportexport.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsimportexport.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -570,6 +570,7 @@
 		    
 		    // Text properties may have an extra flag: index flag.
 		    TBool indexed( EFalse );
+		    // Ignore error code as the flag might not exist and indexing is not mandatory
 		    ImportNum( indexed, aParser );
     		// Add this property to the previously defined object.
     		iLastObjectDef->AddPropertyL( name, type, minVal32, maxVal32, readOnly, mandatory, indexed );
@@ -876,7 +877,7 @@
 	// DB version
     MMdsPreferences::GetL( KMdsDBVersionName, MMdsPreferences::EPreferenceBothGet,
     						  majorVersion, &minorVersion );
-	if ( majorVersion != KMdSServMajorVersionNumber && (TInt)minorVersion != KMdSServMinorVersionNumber )
+	if ( majorVersion != KMdSServMajorVersionNumber || (TInt64)minorVersion != KMdSServMinorVersionNumber )
 		{
 		return EFalse;
 		}
@@ -1165,6 +1166,7 @@
 			// check if uri exists
 			if ( !BaflUtils::FileExists( iFs, textValue ) )
 				{
+			    iLastObjectDef = NULL;
 				_LIT( KError, "uri is not real" );
 				LogError( KError );
 				User::Leave( KErrNotFound );
@@ -1720,7 +1722,7 @@
 			const CMdsObjectDef* objectDef = namespaceDefRestrict->GetObjectByIdL( objectDefId );
 			if (objectDef)
 				{
-				objectDefToExport.Append( objectDef );
+				objectDefToExport.AppendL( objectDef );
 				}
 			}
 		}
@@ -1741,7 +1743,7 @@
 			const CMdsEventDef* eventDef = namespaceDefRestrict->GetEventByIdL( eventDefId );
 			if (eventDef)
 				{
-				eventDefToExport.Append( eventDef );
+				eventDefToExport.AppendL( eventDef );
 				}
 			}
 		}
@@ -1762,7 +1764,7 @@
 			const CMdsRelationDef* relationDef = namespaceDefRestrict->GetRelationByIdL( relationDefId );
 			if ( relationDef )
 				{
-				relationDefToExport.Append( relationDef );
+				relationDefToExport.AppendL( relationDef );
 				}
 			}
 		}
@@ -1775,7 +1777,7 @@
 	RRowData freeTextRow;
 	CleanupClosePushL( freeTextRow );
 
-	TInt j;
+	TInt j( 0 );
 	
 	const TInt namespaceCount = aSchemaNew.iNamespaceDefs.Count();
 	
@@ -2408,11 +2410,12 @@
 //
 TInt CMdsImportExport::ImportInt64( Int64& aValue, TLex8& aParser )
     {
+    TInt error( KErrNone );
     // due to symbian int64 parser error
     // for now we will use ImportNum version
-    ImportNum( aValue, aParser );
+    error = ImportNum( aValue, aParser );
 
-    return KErrNone;
+    return error;
     }
 
 // ------------------------------------------------
--- a/metadataengine/server/src/mdsindexer.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsindexer.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -41,7 +41,7 @@
 
 void MMdSIndexer::GetLastItemIdL()
 	{
-	_LIT( KGetLastMaxId, "SELECT max(seq) FROM SQLITE_SEQUENCE WHERE name!='symbian_security';" );
+	_LIT( KGetLastMaxId, "SELECT max(seq) FROM SQLITE_SEQUENCE WHERE name!='symbian_security' LIMIT 1;" );
 	CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
 
 	RRowData getData;
@@ -64,27 +64,8 @@
 
 TItemId MMdSIndexer::GetIndexL()
 	{
-	_LIT( KIndexerQuery, "SELECT last_insert_rowid();" );
-
 	CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
-
-	RRowData getData;
-	CleanupClosePushL(getData);
-
-	RMdsStatement selectObject;
-	CleanupClosePushL(selectObject);
-
-	TItemId id = KNoId;
-	//Get one row and set first column to id
-	connection.ExecuteQueryL(KIndexerQuery,selectObject,getData);
-	getData.AppendL(TColumn(id));
-	if (connection.NextRowL(selectObject, getData))
-		{
-		getData.Column(0).Get(id);
-		}
-
-	CleanupStack::PopAndDestroy(2, &getData);
-	return id;
+	return connection.LastInsertedRowId();
 	}
 
 TItemId MMdSIndexer::ExecuteAndGetIndexL( const TDesC &aSqlClause,
--- a/metadataengine/server/src/mdslogger.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdslogger.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -56,6 +56,10 @@
 //
 CMdSLogger::~CMdSLogger()
     {
+    static CMdSLogger* singleton;
+    delete singleton;
+    singleton = NULL;
+    iValid = EFalse;
     iLog.CloseLog(); 
     iLog.Close();
     }
--- a/metadataengine/server/src/mdsmaintenanceengine.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsmaintenanceengine.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -237,7 +237,7 @@
     User::LeaveIfError( fs.Connect() );
     CleanupClosePushL( fs );
     TVolumeInfo volumeInfo;
-    fs.Volume( volumeInfo, EDriveC );
+    User::LeaveIfError( fs.Volume( volumeInfo, EDriveC ) );
     MMdsPreferences::InsertL( KCMediaIdKey, MMdsPreferences::EPreferenceValueSet,
     		(TUint32) volumeInfo.iUniqueID );
 
@@ -246,12 +246,12 @@
     if( massStorageError == KErrNone )
         {
         TVolumeInfo massStorageVolumeInfo;
-        fs.Volume( massStorageVolumeInfo, drive );
+        User::LeaveIfError( fs.Volume( massStorageVolumeInfo, drive ) );
         const TUint32 massStorageMediaId( massStorageVolumeInfo.iUniqueID );
         massStorageError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive );
         if( massStorageError == KErrNone )
             {
-            fs.Volume( massStorageVolumeInfo, drive );
+            User::LeaveIfError( fs.Volume( massStorageVolumeInfo, drive ) );
             // Update mass storage media id if the mass storage is not memory card
             if( massStorageVolumeInfo.iUniqueID != massStorageMediaId && massStorageMediaId != 0 )
                 {
--- a/metadataengine/server/src/mdsmanipulationengine.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsmanipulationengine.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -34,14 +34,6 @@
 
 __USES_LOGGER
 
-// ======== LOCAL FUNCTIONS ========
-
-static void TransactionCleanupL(void* aConn)
-   {
-   CMdSSqLiteConnection* conn = (CMdSSqLiteConnection*)aConn;
-   conn->TransactionRollbackL();
-   }
-
 // ---------------------------------------------------------------------------
 // NewL
 // ---------------------------------------------------------------------------
@@ -156,63 +148,39 @@
         RMdsStatement objStmt;
         CleanupClosePushL(objStmt);
 		
-		if( KObjectCount > 1 )
-		    {
-	        RMdSTransaction transaction( connection );
-	        CleanupClosePushL(transaction);
-	        const TInt beginError( transaction.Error() );
-	        if( beginError != KErrNone )
-	            {
-	            CleanupStack::PopAndDestroy( &transaction );
-	            }
-	    
-		    for ( TInt i = 0; i < KObjectCount; ++i )
-			    {
-			    aBuffer.PositionL( items.iObjects.iPtr.iOffset + i * sizeof(TMdCObject) );
-			    TItemId id = KNoId;
-			    TRAPD( err, id = iManipulate->AddObjectL( connection, aBuffer, 
-			            baseObjStmt, objStmt, aServerSession ) );
-			    if (err == KErrNone)
-				    {
-				    aResultBuffer.InsertL( id );
-				    }
-			    else
-				    {
-				    aResultBuffer.InsertL( KNoId );
-				    if(resultIds.iErrorCode == KErrNone)
-					    {
-					    resultIds.iErrorCode = err;
-					    }
-				    }
-			    }
-		    if( beginError == KErrNone )
-		        {
-	            transaction.CommitL();
-	            CleanupStack::PopAndDestroy( &transaction );
-		        }
-		    }
-		else
-		    {
-            for ( TInt i = 0; i < KObjectCount; ++i )
+        RMdSTransaction transaction( connection );
+        CleanupClosePushL(transaction);
+        const TInt beginError( transaction.Error() );
+        if( beginError != KErrNone )
+            {
+            CleanupStack::PopAndDestroy( &transaction );
+            }
+    
+        for ( TInt i = 0; i < KObjectCount; ++i )
+            {
+            aBuffer.PositionL( items.iObjects.iPtr.iOffset + i * sizeof(TMdCObject) );
+            TItemId id = KNoId;
+            TRAPD( err, id = iManipulate->AddObjectL( connection, aBuffer, 
+                    baseObjStmt, objStmt, aServerSession ) );
+            if (err == KErrNone)
                 {
-                aBuffer.PositionL( items.iObjects.iPtr.iOffset + i * sizeof(TMdCObject) );
-                TItemId id = KNoId;
-                TRAPD( err, id = iManipulate->AddObjectL( connection, aBuffer, 
-                        baseObjStmt, objStmt, aServerSession ) );
-                if (err == KErrNone)
+                aResultBuffer.InsertL( id );
+                }
+            else
+                {
+                aResultBuffer.InsertL( KNoId );
+                if(resultIds.iErrorCode == KErrNone)
                     {
-                    aResultBuffer.InsertL( id );
-                    }
-                else
-                    {
-                    aResultBuffer.InsertL( KNoId );
-                    if(resultIds.iErrorCode == KErrNone)
-                        {
-                        resultIds.iErrorCode = err;
-                        }
+                    resultIds.iErrorCode = err;
                     }
                 }
-		    }
+            }
+        if( beginError == KErrNone )
+            {
+            transaction.CommitL();
+            CleanupStack::PopAndDestroy( &transaction );
+            }
+
         CleanupStack::PopAndDestroy(&objStmt);
         CleanupStack::PopAndDestroy(&baseObjStmt);
 		}
@@ -229,12 +197,13 @@
 		resultIds.iEventIds.iPtr.iOffset = aResultBuffer.Position();
 		resultIds.iEventIds.iPtr.iCount = KEventCount;
 	    
-	    if( KEventCount > 1 )
-	        {
-	        //More than 1 event, transaction will be used.
-	        connection.TransactionBeginL();
-	        CleanupStack::PushL(TCleanupItem(&TransactionCleanupL, &connection));
-	        }
+        RMdSTransaction transaction( connection );
+        CleanupClosePushL(transaction);
+        const TInt beginError( transaction.Error() );
+        if( beginError != KErrNone )
+            {
+            CleanupStack::PopAndDestroy( &transaction );
+            }
 
 		for ( TInt i = 0; i < KEventCount; ++i )
 			{
@@ -257,11 +226,11 @@
 				}
 			}
 
-		if( KEventCount > 1 )
-		    {
-		    connection.TransactionCommitL();
-		    CleanupStack::Pop();  //TransactionCleanup()
-	        }
+        if( beginError == KErrNone )
+            {
+            transaction.CommitL();
+            CleanupStack::PopAndDestroy( &transaction );
+            }
 		}
 	else
 		{
@@ -276,12 +245,13 @@
 		resultIds.iRelationIds.iPtr.iOffset = aResultBuffer.Position();
 		resultIds.iRelationIds.iPtr.iCount = KRelationCount;
 	    
-	    if( KRelationCount > 1 )
-	        {
-	        //More than 1 relation, transaction will be used.
-	        connection.TransactionBeginL();
-	        CleanupStack::PushL(TCleanupItem(&TransactionCleanupL, &connection));
-	        }
+        RMdSTransaction transaction( connection );
+        CleanupClosePushL(transaction);
+        const TInt beginError( transaction.Error() );
+        if( beginError != KErrNone )
+            {
+            CleanupStack::PopAndDestroy( &transaction );
+            }
 
 	    for ( TInt i = 0; i < KRelationCount; ++i )
 			{
@@ -304,11 +274,11 @@
 				}
 			}
 
-	    if( KRelationCount > 1 )
-	        {
-	        connection.TransactionCommitL();
-	        CleanupStack::Pop();   //TransactionCleanup()
-	        }
+        if( beginError == KErrNone )
+            {
+            transaction.CommitL();
+            CleanupStack::PopAndDestroy( &transaction );
+            }
 		}
 	else
 		{
@@ -596,6 +566,14 @@
 		resultIds.iObjectIds.iPtr.iOffset = aResultBuffer.Position();
 		resultIds.iObjectIds.iPtr.iCount = items.iObjects.iPtr.iCount;
 
+        RMdSTransaction transaction( connection );
+        CleanupClosePushL(transaction);
+        const TInt beginError( transaction.Error() );
+        if( beginError != KErrNone )
+            {
+            CleanupStack::PopAndDestroy( &transaction );
+            }
+		
 		for ( TInt i = 0; i < items.iObjects.iPtr.iCount; ++i )
 			{
 			aBuffer.PositionL( items.iObjects.iPtr.iOffset + i * sizeof(TMdCObject) );
@@ -615,6 +593,11 @@
 					}
 				}
 			}
+        if( beginError == KErrNone )
+            {
+            transaction.CommitL();
+            CleanupStack::PopAndDestroy( &transaction );
+            }
 		}
 	else
 		{
--- a/metadataengine/server/src/mdsnotifier.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsnotifier.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -76,6 +76,25 @@
 CMdSNotifier::~CMdSNotifier()
     {
     delete iComparator;
+    
+    const TInt count = iEntries.Count();
+    
+    for ( TInt i = 0; i < count; ++i )
+        {
+        TEntry& e = iEntries[i];
+            
+        if ( e.iSerializedCondition )
+            {
+            delete e.iSerializedCondition;
+            e.iSerializedCondition = NULL;
+            }
+        if ( e.iDataBuffer )
+            {
+            delete e.iDataBuffer;
+            e.iDataBuffer = NULL;
+            }
+        }
+    
     iEntries.Close();
     }
 
--- a/metadataengine/server/src/mdsobjectdef.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsobjectdef.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -243,7 +243,8 @@
 		rowData.AppendL( TColumn( aNamespaceDefId ) );
 		rowData.AppendL( TColumn( iParent ? iParent->GetId() : KNoDefId ) );
 		rowData.AppendL( TColumn( (TInt32)iFlags ) );
-		rowData.AppendL( TColumn( GetName().AllocL() ) );
+		rowData.AppendL( TColumn( GetName().AllocLC() ) );
+		CleanupStack::Pop(); // name
 
 		TDefId id = MMdSIndexer::ExecuteAndGetIndexL( KMdsSqlClauseAddObjectDef,rowData );
 
--- a/metadataengine/server/src/mdspropertydef.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdspropertydef.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -285,7 +285,8 @@
 #endif
     		User::Leave( KErrMdEUnknownPropertyType );
 		}
-	rowData.AppendL( TColumn( GetName().AllocL() ) );
+	rowData.AppendL( TColumn( GetName().AllocLC() ) );
+	CleanupStack::Pop(); //name
 
 	TDefId id;
 	id =  MMdSIndexer::ExecuteAndGetIndexL( KMdsSqlClauseAddPropertyDef, rowData );
--- a/metadataengine/server/src/mdsrelationdef.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsrelationdef.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -75,7 +75,8 @@
     CleanupClosePushL( rowData );
 
 	rowData.AppendL( TColumn( aNamespaceDefId ) );
-	rowData.AppendL( TColumn( GetName().AllocL() ) );
+	rowData.AppendL( TColumn( GetName().AllocLC() ) );
+	CleanupStack::Pop(); //name
 	TDefId id =  MMdSIndexer::ExecuteAndGetIndexL( KMdsSqlClauseAddRelationDef, rowData );
 	if ( id != KNoDefId )
 		{
--- a/metadataengine/server/src/mdsschema.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsschema.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -256,7 +256,7 @@
 			{
 			// add base objectdef[number]
 			clause->BufferL().Format( KBaseObjectDefinition, &MdeConstants::Object::KBaseObject, namespaceDefId );
-			TRAP_IGNORE( connection.ExecuteL( clause->ConstBufferL(), emptyRowData ) );			
+			connection.ExecuteL( clause->ConstBufferL(), emptyRowData );			
 
 			// add relations[number]
 			clause->BufferL().Format( KCreateRelationsTable, namespaceDefId );
@@ -320,7 +320,8 @@
 
 			// add updateremovedrelations[number]
             clauseTrigger->ReserveSpaceL( KMdsTriggerUpdateRemovedRelation().Size() + ( KMaxUintValueLength * 5 ) );  
-            clauseTrigger->BufferL().Format( KMdsTriggerUpdateRemovedRelation, namespaceDefId, namespaceDefId, EMdERelationFlagNotPresent | EMdERelationFlagDeleted, EMdERelationFlagNotPresent | EMdERelationFlagDeleted, namespaceDefId );
+            clauseTrigger->BufferL().Format( KMdsTriggerUpdateRemovedRelation, namespaceDefId, namespaceDefId, 
+                    EMdERelationFlagNotPresent | EMdERelationFlagDeleted, EMdERelationFlagNotPresent | EMdERelationFlagDeleted, namespaceDefId );
             connection.ExecuteL( clauseTrigger->ConstBufferL(), emptyRowData );
 
 			// add relationleftobjectidindex[number]
@@ -357,7 +358,7 @@
 				AddObjectToSqlClauseL( objectDef, clause, ETrue );
 
 				clause->AppendL( KMdsSqlClauseObjTableEnd );
-				TRAP_IGNORE( connection.ExecuteL( clause->ConstBufferL(), emptyRowData ) );
+				connection.ExecuteL( clause->ConstBufferL(), emptyRowData );
 
 				objectDef->SetTableStoredInDB();
 				}
@@ -393,6 +394,7 @@
     CleanupClosePushL( emptyRowData );
     clause->BufferL().Format( KMdsPropertyIndexCreate, &aTableName, &aPropertyName, aNamespaceId,
     		&aTableName, aNamespaceId, &aPropertyName );
+    // Ignore possible SQL error, MDS can still live without this index
 	TRAP_IGNORE( connection.ExecuteL( clause->ConstBufferL(), emptyRowData ) );
 	CleanupStack::PopAndDestroy( 2, clause ); // emptyRowData, clause
 	}
@@ -408,9 +410,6 @@
     CreateObjectTablesL();
 	StoreSchemaToDBL();
 	CreateCol2PropTableL();
-
-    transaction.CommitL();
-    CleanupStack::PopAndDestroy( &transaction );
     
     TUint propertyCount = iProperties.Count();
     for ( TUint i = 0; i < propertyCount; ++i )
@@ -419,6 +418,10 @@
     	CreatePropertyIndexL( propertyInfo.iPropertyName, propertyInfo.iTableName,
     			propertyInfo.iNamespaceId );
     	}
+    
+    transaction.CommitL();
+    CleanupStack::PopAndDestroy( &transaction );
+    
     iProperties.Reset();
 	}
 
@@ -564,7 +567,7 @@
 	for (TUint i = 0; i < KNumClauses; i++)
 		{
 		TRAP( error,connection.ExecuteL( (*descarray)[i], emptyRowData ) );
-		if ( error != KErrNone && error != KSqlErrGeneral )
+		if ( error != KErrNone )
 			{
 			User::Leave( error );
 			}
@@ -574,12 +577,26 @@
 
 	const TInt count = iNamespaceDefs.Count();
 	
+    RMdSTransaction transaction( connection );
+    CleanupClosePushL(transaction);
+    const TInt beginError( transaction.Error() );
+    if( beginError != KErrNone )
+        {
+        CleanupStack::PopAndDestroy( &transaction );
+        }
+	
 	// add only namespaceDef to DB
 	for( TInt i = 0; i < count; ++i )
 		{
 		iNamespaceDefs[i]->StoreToDBL( ETrue );
 		}
 
+    if( beginError == KErrNone )
+        {
+        transaction.CommitL();
+        CleanupStack::PopAndDestroy( &transaction );
+        }	
+
 	CleanupStack::PopAndDestroy( &emptyRowData );
 	}
 
@@ -588,6 +605,16 @@
 	_LIT( KMdsSqlClauseDeleteBoFromOd,  "DELETE FROM ObjectDef WHERE ObjectDefId=?;" );
 	_LIT( KMdsSqlClauseDeleteBoFromPd,  "DELETE FROM PropertyDef WHERE ObjectDefId=?;" );
 
+    CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
+
+    RMdSTransaction transaction( connection );
+    CleanupClosePushL(transaction);
+    const TInt beginError( transaction.Error() );
+    if( beginError != KErrNone )
+        {
+        CleanupStack::PopAndDestroy( &transaction );
+        }
+    
 	iBaseObject->StoreToDBL( KNoDefId );
 	
 	const TInt count = iNamespaceDefs.Count();
@@ -598,11 +625,16 @@
 		iNamespaceDefs[i]->StoreToDBL();
 		}
 
+    if( beginError == KErrNone )
+        {
+        transaction.CommitL();
+        CleanupStack::PopAndDestroy( &transaction );
+        }   
+	
 	RRowData removeBo;
 	CleanupClosePushL( removeBo );
 	removeBo.AppendL( TColumn( KBaseObjectDefId ) );
 
-	CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
 	TRAPD( err, connection.ExecuteL( KMdsSqlClauseDeleteBoFromOd,  removeBo ) );
 	TRAP ( err, connection.ExecuteL( KMdsSqlClauseDeleteBoFromPd,  removeBo ) );
 	
--- a/metadataengine/server/src/mdsserver.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsserver.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -853,11 +853,11 @@
     User::LeaveIfError( fs.Connect() );
     CleanupClosePushL( fs );
     
-    RFileReadStream tmpFile;
     TBuf<KMaxFileName> privatePath;
     TBuf<KMaxFileName> schema;
     TBuf<KMaxFileName> defaultImportProfile;
     TBuf<KMaxFileName> backupRegistration;
+    RFileReadStream tmpFile;
     
     fs.PrivatePath( privatePath );
     
@@ -887,7 +887,7 @@
         else if ( err == KErrPathNotFound)
             {
             // Create private dir
-            fs.CreatePrivatePath( EDriveC );
+            User::LeaveIfError( fs.CreatePrivatePath( EDriveC ) );
             
             // Copy schema.mde
             const TInt error = fileMan->Copy( KSchemaPath, schema, CFileMan::EOverWrite );
@@ -909,7 +909,7 @@
         else if ( err == KErrPathNotFound)
             {
             // Create private dir
-            fs.CreatePrivatePath( EDriveC );
+            User::LeaveIfError( fs.CreatePrivatePath( EDriveC ) );
              
             // Copy schema.mde
             const TInt error1 = fileMan->Copy( KDefaultImportProfilePath, defaultImportProfile, CFileMan::EOverWrite );
@@ -931,7 +931,7 @@
         else if ( err == KErrPathNotFound)
             {
             // Create private dir
-            fs.CreatePrivatePath( EDriveC );
+            User::LeaveIfError( fs.CreatePrivatePath( EDriveC ) );
             
             // Copy schema.mde
             const TInt error2 = fileMan->Copy( KBackupRegistrationPath, backupRegistration, CFileMan::EOverWrite );
--- a/metadataengine/server/src/mdsserversession.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsserversession.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -741,7 +741,7 @@
 				User::Leave( KErrArgument );
 				}
 		    RBuf uri;
-		    uri.Create( uriLength );
+		    uri.CreateL( uriLength );
 		    CleanupClosePushL( uri );
 		    aMsg.ReadL( ECheckObjectArgTypeValue, uri );
 		    buffer = iServer.Manipulate().CheckObjectL( resultBufferLength, uri, namespaceDefId );
@@ -1235,7 +1235,7 @@
     	}
 
     RBuf fileName;
-    fileName.Create( fileNameLength );
+    fileName.CreateL( fileNameLength );
     CleanupClosePushL( fileName );
     aMsg.ReadL( 0, fileName );
 
@@ -1259,7 +1259,7 @@
     	}
     
     RBuf fileName;
-    fileName.Create( fileNameLength );
+    fileName.CreateL( fileNameLength );
     CleanupClosePushL( fileName );
     aMsg.ReadL( 0, fileName );
 
@@ -1287,7 +1287,7 @@
     	}
 
     RBuf fileName;
-    fileName.Create( fileNameLength );
+    fileName.CreateL( fileNameLength );
     CleanupClosePushL( fileName );
     aMsg.ReadL( 0, fileName );
 
@@ -1374,7 +1374,7 @@
 	const TInt32 KMediaInfoSize = sizeof( TMdEMediaInfo ) * KMaxDrives;
 
 	RBuf8 mediaInfoBuffer;
-	mediaInfoBuffer.Create( KMediaInfoSize );
+	mediaInfoBuffer.CreateL( KMediaInfoSize );
 	CleanupClosePushL( mediaInfoBuffer );
 
 	const TInt32 mediaCount = iServer.Manipulate().GetPresentMediasL( 
@@ -1495,12 +1495,12 @@
 		}
 
 	RBuf oldPath;
-	oldPath.Create( oldPathLength );
+	oldPath.CreateL( oldPathLength );
     CleanupClosePushL( oldPath );
     aMessage.ReadL( 0, oldPath );
 
     RBuf newPath;
-    newPath.Create( newPathLength );
+    newPath.CreateL( newPathLength );
     CleanupClosePushL( newPath );
     aMessage.ReadL( 1, newPath );
     
--- a/metadataengine/server/src/mdsshutdownobserver.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdsshutdownobserver.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -32,7 +32,7 @@
 // CMDSShutdownObserver::NewL()
 // ---------------------------------------------------------------------------
 //
-CMDSShutdownObserver* CMDSShutdownObserver::NewL( MMDSShutdownObserver& aObserver/*, const TUid& aKeyCategory */)
+EXPORT_C CMDSShutdownObserver* CMDSShutdownObserver::NewL( MMDSShutdownObserver& aObserver/*, const TUid& aKeyCategory */)
     { 
     CMDSShutdownObserver* self = new( ELeave )CMDSShutdownObserver( aObserver/*, aKeyCategory */);
     CleanupStack::PushL( self );
--- a/metadataengine/server/src/mdssqliteconnection.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdssqliteconnection.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -96,28 +96,46 @@
     	}
     /**
      * Open database:
-     *   First we try to create new db. If this fails check if db already exists and
-     *   try to open it. Otherwise we cannot open it and we leave
+     *   First we try to open db. If this fails because db not creater yer, then
+     *   try to create it. Otherwise we cannot open it and we leave
      */
-    err = iMdeSqlDb.Create( *iDbFileName, sqlSecurityPolicy, &KMdsSqlDbaConfig );
+    err = iMdeSqlDb.Open( *iDbFileName, &KMdsSqlDbaConfig );
     if ( err != KErrNone )
-    	{
-    	// it could fail because database exists
-    	if ( err == KErrAlreadyExists )
-    		{
-    		err = iMdeSqlDb.Open( *iDbFileName, &KMdsSqlDbaConfig );
-    		if ( err != KErrNone )
-    			{
-    			__LOG1( ELogDb, "Cannot open database %d", err );
-    			}
-    		}
-    	else 
-    		{
-    		__LOG1( ELogDb, "Unknown error while creating %d", err );
-    		}
-
-    	User::LeaveIfError( err );
-    	}
+        {
+        __LOG1( ELogDb, "Cannot open database %d", err );
+            
+        if( err == KErrNotFound )
+            {
+            __LOG1( ELogDb, "Cannot find database %d", err );
+            err = iMdeSqlDb.Create( *iDbFileName, sqlSecurityPolicy, &KMdsSqlDbaConfig );
+            if( err != KErrNone )
+                {
+                __LOG1( ELogDb, "Unknown error while creating %d", err );
+                User::LeaveIfError( err );
+                }
+            }
+        else if( err == KErrCorrupt ||
+                err == KSqlErrCorrupt )
+            {
+            __LOGLB( ELogDb, "Warning: Database is corrupted, will delete and re-create it." );
+            err = DeleteAndReCreateDB( iDbFileName, sqlSecurityPolicy, &KMdsSqlDbaConfig );
+        
+            if ( KErrNone == err  )
+                {
+                err = iMdeSqlDb.Open( *iDbFileName, &KMdsSqlDbaConfig );
+                if ( err != KErrNone )
+                    {
+                    __LOG1( ELogDb, "Cannot open database again after delete and re-create %d", err );
+                    User::LeaveIfError( err );
+                    }
+                } 
+            }
+        else 
+            {
+            __LOG1( ELogDb, "Unknown error while accessing database %d", err );
+            User::LeaveIfError( err );
+            }
+        }
     CleanupStack::PopAndDestroy( &sqlSecurityPolicy );
     }
 
@@ -335,6 +353,11 @@
     	}
     }
 
+TItemId CMdSSqLiteConnection::LastInsertedRowId()
+    {
+    return iMdeSqlDb.LastInsertedRowId();
+    }
+
 void CMdSSqLiteConnection::ColumnsL( const RSqlStatement& aStatement, RRowData& aRow )
     {
     const TInt count( aRow.Size() );
@@ -580,3 +603,20 @@
         }
     }
 
+
+TInt CMdSSqLiteConnection::DeleteAndReCreateDB( const HBufC* aDbFileName,
+                                                const RSqlSecurityPolicy& asqlSecurityPolicy,
+                                                const TDesC8* aKMdsSqlDbaConfig ) 
+    {    
+    TInt err = iMdeSqlDb.Delete( *aDbFileName );
+    if( err!= KErrNone )
+        {
+        __LOG1( ELogDb, "delete database err=%d.", err );
+        return err;
+        }
+
+    err = iMdeSqlDb.Create( *aDbFileName, asqlSecurityPolicy, aKMdsSqlDbaConfig );
+
+    return err;
+    }
+
--- a/metadataengine/server/src/mdssqlobjectmanipulate.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/metadataengine/server/src/mdssqlobjectmanipulate.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -191,21 +191,18 @@
 
 void CMdSSqlObjectManipulate::ConstructL( )
     {
-    
 	iGenerator = CMdSIdentifierGenerator::NewL();
 
 	iNamespaceDef = NULL;
 	
-	TLockBuffer lockBuffer;
-	lockBuffer.iLock = EFalse;
 	for (TInt i = 0; i < KMaxBuffers; ++i)
 		{
-	    CMdsClauseBuffer* buffer = CMdsClauseBuffer::NewLC( 1024 );
-		lockBuffer.iBuffer = buffer;
+	    TLockBuffer lockBuffer;
+	    lockBuffer.iLock = EFalse;
+	    lockBuffer.iBuffer = CMdsClauseBuffer::NewLC( 1024 );
 		iBuffers.AppendL( lockBuffer );
 		CleanupStack::Pop(); // buffer
 		}
-
     }
 
 TBool CMdSSqlObjectManipulate::GarbageCollectionL()
@@ -2057,7 +2054,11 @@
 		if (!dataRow.Column(1).IsNull())
 			{
 			dataRow.Column(1).Get( relationId );
-			aRelationIds.InsertInOrder( relationId, TLinearOrder<TItemId>( CompareTItemIds ) );
+			const TInt error( aRelationIds.InsertInOrder( relationId, TLinearOrder<TItemId>( CompareTItemIds ) ) );
+			if( error == KErrNoMemory )
+			    {
+			    User::Leave( error );
+			    }
 			}
 		else
 			{
@@ -2092,6 +2093,35 @@
 
 		__LOGQUERY_16( _L("Remove objects:"), buffer.ConstBufferL(), dataRow);
 		connection.ExecuteL( buffer.ConstBufferL(), dataRow );
+		
+#ifdef MDS_PLAYLIST_HARVESTING_ENABLED
+		_LIT( KSetPlaylistItemsRemoved, "UPDATE Object%u SET Flags=Flags|? WHERE ObjectId IN (SELECT ObjectId FROM AudioPlaylistItem%u WHERE AudioObjectID IN(?" );
+		_LIT( KPlaylistCollectEnd,    "));" );
+
+		buffer.ReserveSpaceL( KSetPlaylistItemsRemoved().Length() + KMaxUintValueLength +
+                               (removeObjectCount-1) * KCollectMiddle().Length() +
+                               KPlaylistCollectEnd().Length() );
+
+		TDefId nameSpaceDefID = iNamespaceDef->GetId();
+        buffer.BufferL().Format( KSetPlaylistItemsRemoved, nameSpaceDefID, nameSpaceDefID );
+
+        dataRow.Free();
+        dataRow.Reset();
+        dataRow.AppendL( TColumn( EMdEObjectFlagRemoved ) );
+
+        for (TInt i = 0; i < removeObjectCount; ++i)
+            {
+            if(i>0)
+                {
+                buffer.AppendL( KCollectMiddle );
+                }
+            dataRow.AppendL( TColumn( aObjectIds[i] ) );
+            }
+        buffer.AppendL( KPlaylistCollectEnd );
+
+        __LOGQUERY_16( _L("Remove playlist items:"), buffer.ConstBufferL(), dataRow);
+        connection.ExecuteL( buffer.ConstBufferL(), dataRow );
+#endif
 		}
 
 	// mark relations as removed
@@ -3254,9 +3284,52 @@
    	// rowDataDel, commonClauseOne
 	CleanupStack::PopAndDestroy( 7, &commonClauseOne );
 
+#ifdef MDS_PLAYLIST_HARVESTING_ENABLED	
+	if( updateResult == 0 )
+	    {
+	    updateResult = CleanPlaylistsL();
+	    }
+#endif
+
 	return updateResult != 0;
 	}
 
+#ifdef MDS_PLAYLIST_HARVESTING_ENABLED
+TInt CMdSSqlObjectManipulate::CleanPlaylistsL()
+    {
+    _LIT( KDeleteWholePlaylists, "DELETE FROM Object%u WHERE ObjectId IN (SELECT ObjectId FROM AudioPlaylistItem%u WHERE PlaylistID NOT IN (SELECT ObjectId FROM Object%u));" );
+    
+    RClauseBuffer commonClauseOne(*this, KDeleteWholePlaylists().Length());
+    CleanupClosePushL( commonClauseOne );
+    CMdsClauseBuffer& buffer = commonClauseOne.BufferL();
+
+    RRowData rowDataDel;
+    CleanupClosePushL( rowDataDel );
+
+    const RPointerArray<CMdsNamespaceDef>& namespaceDefs = 
+        iSchema.NamespaceDefs();
+
+    CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
+    const TInt updateResult = 0; // once all files to be cleaned are handled, no need to continue
+    
+    const TInt count = namespaceDefs.Count();
+    
+    for( TInt i = 0; i < count; ++i )
+        {
+        const TDefId nmspId = namespaceDefs[i]->GetId();
+
+        buffer.BufferL().Format( KDeleteWholePlaylists, nmspId, nmspId, nmspId );
+        User::LeaveIfError( connection.ExecuteL( 
+                buffer.ConstBufferL(), rowDataDel ) );    
+        }
+
+    // rowDataDel, commonClauseOne
+    CleanupStack::PopAndDestroy( 2, &commonClauseOne );
+    
+    return updateResult;
+    }
+#endif
+
 CMdSSqlObjectManipulate::RClauseBuffer::RClauseBuffer( CMdSSqlObjectManipulate& aSOM, TInt aSize )
 	: iBuffers( aSOM.iBuffers ), iBuffer( NULL ), iNr( -1 ), iSize( aSize )
 	{
@@ -3266,11 +3339,18 @@
 		{
 		if (!iBuffers[i].iLock)
 			{
-			iBuffers[i].iLock = ETrue;
-			iBuffer = iBuffers[i].iBuffer;
+		    iBuffers[i].iLock = ETrue;
+            CMdsClauseBuffer* oldBuffer( iBuffer );
+            iBuffer = iBuffers[i].iBuffer;
+            TRAPD( error, iBuffer->ReserveSpaceL(aSize) );
+            if( error != KErrNone )
+                {
+                iBuffer = oldBuffer;
+                iBuffers[i].iLock = EFalse;
+                continue;
+                }		
+            TRAP_IGNORE( iBuffer->BufferL().Zero() );			
 			iNr = i;
-			TRAP_IGNORE( iBuffer->ReserveSpaceL(aSize) );
-			TRAP_IGNORE( iBuffer->BufferL().Zero() );
 			return;
 			}
 		}
--- a/rom/mds.iby	Tue Feb 02 00:24:33 2010 +0200
+++ b/rom/mds.iby	Fri Mar 19 09:38:01 2010 +0200
@@ -45,7 +45,7 @@
 file=ABI_DIR\BUILD_DIR\mdsfileserverplugin.pxt			SHARED_LIB_DIR\mdsfileserverplugin.pxt
 ECOM_PLUGIN(HarvesterImagePlugin.dll,HarvesterImagePlugin.rsc)
 ECOM_PLUGIN(HarvesterVideoPlugin.dll,HarvesterVideoPlugin.rsc)
-ECOM_PLUGIN(HarvesterMessagePlugin.dll,HarvesterMessagePlugin.rsc)
+//ECOM_PLUGIN(HarvesterMessagePlugin.dll,HarvesterMessagePlugin.rsc)
 ECOM_PLUGIN(harvesteromadrmplugin.dll,harvesteromadrmplugin.rsc)
 ECOM_PLUGIN(harvesterwmvplugin.dll,harvesterwmvplugin.rsc)
 ECOM_PLUGIN(harvesterrtpplugin.dll,harvesterrtpplugin.rsc)
@@ -58,7 +58,7 @@
 file=ABI_DIR\BUILD_DIR\MonitorPluginInterface.dll		SHARED_LIB_DIR\MonitorPluginInterface.dll
 ECOM_PLUGIN(MMCMonitorPlugin.dll,MMCMonitorPlugin.rsc)
 ECOM_PLUGIN(FileMonitorPlugin.dll,FileMonitorPlugin.rsc)
-ECOM_PLUGIN(MessageMonitorPlugin.dll,MessageMonitorPlugin.rsc)
+//ECOM_PLUGIN(MessageMonitorPlugin.dll,MessageMonitorPlugin.rsc)
 ECOM_PLUGIN(mdsoomplugin.dll,mdsoomplugin.rsc)
 
 file=ABI_DIR\BUILD_DIR\ContextPluginInterface.dll		SHARED_LIB_DIR\ContextPluginInterface.dll
Binary file sis/mds/mds_stub.sis has changed
--- a/sis/mds/package.pkg	Tue Feb 02 00:24:33 2010 +0200
+++ b/sis/mds/package.pkg	Fri Mar 19 09:38:01 2010 +0200
@@ -17,7 +17,7 @@
 &EN
 
 ;packet-header (name, uid, major, minor, build, type)
-#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 2, TYPE=SA, RU
+#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 3, TYPE=SA, RU
 
 ; Localised vendor name
 %{"Nokia"}
--- a/sis/mds/package_separate.pkg	Tue Feb 02 00:24:33 2010 +0200
+++ b/sis/mds/package_separate.pkg	Fri Mar 19 09:38:01 2010 +0200
@@ -17,7 +17,7 @@
 &EN
 
 ;packet-header (name, uid, major, minor, build, type)
-#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 2, TYPE=SA, RU
+#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 3, TYPE=SA, RU
 
 ; Localised vendor name
 %{"Nokia"}
--- a/sis/mds/stub.pkg	Tue Feb 02 00:24:33 2010 +0200
+++ b/sis/mds/stub.pkg	Fri Mar 19 09:38:01 2010 +0200
@@ -17,7 +17,7 @@
 &EN
 
 ; Header
-#{"Metadata System"}, (0x200009F5), 9, 20, 2, TYPE=SA
+#{"Metadata System"}, (0x200009F5), 10, 10, 3, TYPE=SA
 
 ; Localised Vendor name
 %{"Nokia"}
--- a/watchdog/group/bld.inf	Tue Feb 02 00:24:33 2010 +0200
+++ b/watchdog/group/bld.inf	Fri Mar 19 09:38:01 2010 +0200
@@ -24,4 +24,5 @@
 ../sis/mdswatchdog_stub.sis  /epoc32/data/z/system/install/mdswatchdog_stub.sis
 
 PRJ_MMPFILES
-watchdog.mmp
\ No newline at end of file
+watchdog.mmp
+
--- a/watchdog/src/wdselfshutdownobserver.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/watchdog/src/wdselfshutdownobserver.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -31,7 +31,7 @@
 // CWDSelfShutdownObserver::NewL()
 // ---------------------------------------------------------------------------
 //
-CWDSelfShutdownObserver* CWDSelfShutdownObserver::NewL( MWDSelfShutdownObserver& aObserver/*, const TUid& aKeyCategory */)
+EXPORT_C CWDSelfShutdownObserver* CWDSelfShutdownObserver::NewL( MWDSelfShutdownObserver& aObserver/*, const TUid& aKeyCategory */)
     { 
     CWDSelfShutdownObserver* self = new( ELeave )CWDSelfShutdownObserver( aObserver/*, aKeyCategory */);
     CleanupStack::PushL( self );