diff -r c53acadfccc6 -r acef663c1218 harvester/common/src/harvesterplugin.cpp --- a/harvester/common/src/harvesterplugin.cpp Mon Jan 18 20:34:07 2010 +0200 +++ b/harvester/common/src/harvesterplugin.cpp Tue Jan 26 12:13:20 2010 +0200 @@ -24,8 +24,11 @@ #include "harvesterlog.h" #include "harvestercommon.h" #include "harvesterblacklist.h" +#include "harvestereventmanager.h" #include "mdsutils.h" +const TInt KCacheItemCountForEventCaching = 1; + // --------------------------------------------------------------------------- // NewL // --------------------------------------------------------------------------- @@ -49,6 +52,7 @@ { User::LeaveIfError( iFs.Connect() ); iState = EHarvesterIdle; + iHarvesterEventManager = CHarvesterEventManager::GetInstanceL(); CActiveScheduler::Add( this ); } @@ -86,6 +90,11 @@ EXPORT_C CHarvesterPlugin::~CHarvesterPlugin() // destruct - virtual { Cancel(); + + if (iHarvesterEventManager) + { + iHarvesterEventManager->ReleaseInstance(); + } iFs.Close(); REComSession::DestroyedImplementation( iDtor_ID_Key ); @@ -139,10 +148,22 @@ if( iQueue->Count() == 0 ) { SetNextRequest( EHarvesterIdle ); + iHarvesting = EFalse; + iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateFinished ); + iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeOverall, KCacheItemCountForEventCaching ); iQueue->Compress(); } else { + if ( !iHarvesting ) + { + 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]; iQueue->Remove( 0 ); const TDesC& uri = hd->Uri();