harvester/common/src/harvesterplugin.cpp
changeset 20 6dfc5f825351
parent 1 acef663c1218
child 21 50bf9db68373
--- 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
 // ---------------------------------------------------------------------------
 //