harvesterplugins/media/image/src/imageplugin.cpp
changeset 27 7a8855317cbd
parent 26 367228f82b66
--- a/harvesterplugins/media/image/src/imageplugin.cpp	Tue Oct 05 13:32:14 2010 +0530
+++ b/harvesterplugins/media/image/src/imageplugin.cpp	Fri Oct 15 11:45:38 2010 +0530
@@ -17,7 +17,9 @@
 
 
 #include "imageplugin.h"
-#include <e32base.h> 
+#include <e32base.h>
+#include <s32file.h>
+#include <bautils.h>
 #include "harvesterserverlogger.h"
 #include "common.h"
 #include "csearchdocument.h"
@@ -39,6 +41,7 @@
 
 //Constants
 _LIT(KPathTrailer, "\\root\\media\\image");
+_LIT(KManagerFileName, "ImageStore.temp");
 
 //***** MEDAI AUDIO*****
 #define MEDIA_QBASEAPPCLASS   "@0:root media image"
@@ -92,12 +95,23 @@
 	delete iMMcMonitor;
 	delete iDBManager;
 	delete iMdsItem;
+	iFs.Close();
 	}
 	
 // -----------------------------------------------------------------------------
 void CImagePlugin::ConstructL()
 	{
-    iObjectJobQueueManager = CMdeObjectQueueManager::NewL(this);
+    iObjectJobQueueManager = CMdeObjectQueueManager::NewL(this);    
+    // connect to file system
+    User::LeaveIfError(iFs.Connect());    
+    // Load the configuration
+    TFileName pathWithoutDrive;
+    iFs.CreatePrivatePath(EDriveC);
+    iFilePath = _L("C:");        
+    iFs.PrivatePath( pathWithoutDrive );
+    iFilePath.Append(pathWithoutDrive);
+    iFilePath.Append(KManagerFileName);
+    iObjectJobQueueManager->SetFilePath(iFilePath);
 	}
 
 // -----------------------------------------------------------------------------
@@ -128,6 +142,8 @@
 	TUid uidOfPlugin = {0x20029ABB};
 	iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin);
 	iMdsItem = CMDSEntity::NewL();
+	if( BaflUtils::FileExists(iFs,iFilePath) )
+	        LoadL();
 	OstTraceFunctionExit0( CIMAGEPLUGIN_STARTPLUGINL_EXIT );
 	}
 
@@ -339,11 +355,21 @@
 
 void CImagePlugin::ResumePluginL()
     {
-    OstTraceFunctionEntry0( CIMAGEPLUGIN_RESUMEPLUGINL_ENTRY );
+    OstTraceFunctionEntry0( CIMAGEPLUGIN_RESUMEPLUGINL_ENTRY );    
     iObjectJobQueueManager->ResumeL();    
     OstTraceFunctionExit0( CIMAGEPLUGIN_RESUMEPLUGINL_EXIT );
     }
 
+void CImagePlugin::SaveL()
+    {
+    iObjectJobQueueManager->LoadQueuedItems();    
+    }
+
+void CImagePlugin::LoadL()
+    {
+    iObjectJobQueueManager->SaveQueuedItems();
+    }
+
 #ifdef __PERFORMANCE_DATA
 void CImagePlugin::UpdateLogL()
     {