harvesterplugins/messaging/smsmms/src/cmessageplugin.cpp
changeset 26 367228f82b66
parent 9 4a2987baf8f7
child 27 7a8855317cbd
--- a/harvesterplugins/messaging/smsmms/src/cmessageplugin.cpp	Tue Sep 28 11:50:55 2010 +0530
+++ b/harvesterplugins/messaging/smsmms/src/cmessageplugin.cpp	Tue Oct 05 13:32:14 2010 +0530
@@ -131,6 +131,7 @@
     // remove notification paths before destroying iMonitor
     for (TInt i=EDriveA; i<=EDriveZ; i++)
         UnMount(TDriveNumber(i), EFalse);
+    iMountDrives.Close();    
 	delete iMessageDataHandler;
 	delete iMessageHarvester;	
 	delete iMessageMonitor;	
@@ -144,6 +145,7 @@
 //  
 void CMessagePlugin::ConstructL()
 {
+    iIndexState = ETrue;
     TInt err = iFs.Connect();
     OstTrace1( TRACE_NORMAL, CMESSAGEPLUGIN_CONSTRUCTL, "CMessagePlugin::ConstructL;iFs Connect Error=%d", err );
     CPIXLOGSTRING2("CMessagePlugin::ConstructL, iFs.Connect: %i", err);
@@ -195,7 +197,14 @@
 #ifdef __PERFORMANCE_DATA
     iStartTime.UniversalTime();
 #endif
-    iMessageHarvester->StartHarvestingL();
+    if( iIndexState )
+        {
+        iMessageHarvester->StartHarvestingL();
+        }
+    else
+        {
+        iMountDrives.Append(TDriveNumber(drive));
+        }
 	OstTraceFunctionExit0( CMESSAGEPLUGIN_STARTHARVESTINGL_EXIT );
 	}
 
@@ -536,6 +545,42 @@
     iObserver->HarvestingCompleted(this, baseAppClass, aError);
 }
 
+void CMessagePlugin::PausePluginL()
+    {
+    OstTraceFunctionEntry0( CMESSAGEPLUGIN_PAUSEPLUGINL_ENTRY );
+    iIndexState = EFalse;
+    OstTraceFunctionExit0( CMESSAGEPLUGIN_PAUSEPLUGINL_EXIT );
+    }
+
+void CMessagePlugin::ResumePluginL()
+    {
+    OstTraceFunctionEntry0( CMESSAGEPLUGIN_RESUMEPLUGINL_ENTRY );
+    iIndexState = ETrue;
+    //IndexQueuedItems();
+    iMessageDataHandler->ResumeL();
+    iMessageMonitor->ResumeL();
+    iMessageHarvester->ResumeRequest();
+    MountAvailableDrivesInQueue();
+    OstTraceFunctionExit0( CMESSAGEPLUGIN_RESUMEPLUGINL_EXIT );
+    }
+
+void CMessagePlugin::MountAvailableDrivesInQueue()
+    {
+    OstTraceFunctionEntry0( CMESSAGEPLUGIN_MOUNTAVAILABLEDRIVESINQUEUE_ENTRY );
+    for(TInt i=0;i<iMountDrives.Count();i++)
+        {
+        TDriveNumber drive = iMountDrives[i];
+        iMountDrives.Remove(i);
+        iMessageHarvester->StartHarvestingL();        
+        }
+    OstTraceFunctionExit0( CMESSAGEPLUGIN_MOUNTAVAILABLEDRIVESINQUEUE_EXIT );
+    }
+
+TBool CMessagePlugin::GetHarvesterState()
+    {
+    return iIndexState;
+    }
+
 // ---------------------------------------------------------------------------
 // CMessagePlugin::UpdatePerformaceDataL
 // ---------------------------------------------------------------------------