harvester/common/src/harvesterplugin.cpp
branchRCL_3
changeset 53 29d87345eaeb
parent 50 85f623e1ef41
child 63 e538444823de
--- a/harvester/common/src/harvesterplugin.cpp	Wed Sep 01 12:24:24 2010 +0100
+++ b/harvester/common/src/harvesterplugin.cpp	Tue Sep 14 22:10:25 2010 +0300
@@ -65,7 +65,8 @@
     iDtor_ID_Key( KNullUid ),
     iOriginPropertyDef( NULL ),
     iTitlePropertyDef( NULL ),
-    iHarvesting( EFalse )
+    iHarvesting( EFalse ),
+    iPaused( EFalse )
 	{
 	}
 
@@ -109,6 +110,7 @@
 	{
 	if( iState == EHarvesterIdle )
 		{
+		iPaused = EFalse;
 		SetNextRequest( EHarvesterGathering );
 		}
 	}
@@ -154,6 +156,7 @@
                 }
             else
             	{
+                WRITELOG( "CHarvesterPlugin::RunL EHarvesterGathering - items in queue" );
                 if ( !iHarvesting )
                     {
                     TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( ETrue ) );
@@ -244,12 +247,28 @@
 	}
 
 // ---------------------------------------------------------------------------
+// StartHarvest
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CHarvesterPlugin::StopHarvest()
+    {
+    Cancel();
+    iState = EHarvesterIdle;
+    if( iHarvesting )
+        {
+        TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( EFalse ) );
+        iHarvesting = EFalse;     
+        }
+    iPaused = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
 // SetNextRequest
 // ---------------------------------------------------------------------------
 //
 void CHarvesterPlugin::SetNextRequest( THarvesterState aState )
     {
-    if ( ! IsActive() )
+    if ( !IsActive() && !iPaused )
         {
         iState = aState;
         SetActive();