harvesterplugins/media/image/src/imageplugin.cpp
changeset 27 7a8855317cbd
parent 26 367228f82b66
equal deleted inserted replaced
26:367228f82b66 27:7a8855317cbd
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include "imageplugin.h"
    19 #include "imageplugin.h"
    20 #include <e32base.h> 
    20 #include <e32base.h>
       
    21 #include <s32file.h>
       
    22 #include <bautils.h>
    21 #include "harvesterserverlogger.h"
    23 #include "harvesterserverlogger.h"
    22 #include "common.h"
    24 #include "common.h"
    23 #include "csearchdocument.h"
    25 #include "csearchdocument.h"
    24 #include "ccpixindexer.h"
    26 #include "ccpixindexer.h"
    25 #include "mdeharvester.h"
    27 #include "mdeharvester.h"
    37 #endif
    39 #endif
    38 
    40 
    39 
    41 
    40 //Constants
    42 //Constants
    41 _LIT(KPathTrailer, "\\root\\media\\image");
    43 _LIT(KPathTrailer, "\\root\\media\\image");
       
    44 _LIT(KManagerFileName, "ImageStore.temp");
    42 
    45 
    43 //***** MEDAI AUDIO*****
    46 //***** MEDAI AUDIO*****
    44 #define MEDIA_QBASEAPPCLASS   "@0:root media image"
    47 #define MEDIA_QBASEAPPCLASS   "@0:root media image"
    45 #define LMEDIA_QBASEAPPCLASS  L"@0:root media image"
    48 #define LMEDIA_QBASEAPPCLASS  L"@0:root media image"
    46 #define MEDIAAPPCLASS   "root media image"
    49 #define MEDIAAPPCLASS   "root media image"
    90 	   TRAP_IGNORE(iIndexerUtil->UnMountAllDrivesL(_L(MEDIAGENERICAPPCLASS)));
    93 	   TRAP_IGNORE(iIndexerUtil->UnMountAllDrivesL(_L(MEDIAGENERICAPPCLASS)));
    91 	delete iIndexerUtil;
    94 	delete iIndexerUtil;
    92 	delete iMMcMonitor;
    95 	delete iMMcMonitor;
    93 	delete iDBManager;
    96 	delete iDBManager;
    94 	delete iMdsItem;
    97 	delete iMdsItem;
       
    98 	iFs.Close();
    95 	}
    99 	}
    96 	
   100 	
    97 // -----------------------------------------------------------------------------
   101 // -----------------------------------------------------------------------------
    98 void CImagePlugin::ConstructL()
   102 void CImagePlugin::ConstructL()
    99 	{
   103 	{
   100     iObjectJobQueueManager = CMdeObjectQueueManager::NewL(this);
   104     iObjectJobQueueManager = CMdeObjectQueueManager::NewL(this);    
       
   105     // connect to file system
       
   106     User::LeaveIfError(iFs.Connect());    
       
   107     // Load the configuration
       
   108     TFileName pathWithoutDrive;
       
   109     iFs.CreatePrivatePath(EDriveC);
       
   110     iFilePath = _L("C:");        
       
   111     iFs.PrivatePath( pathWithoutDrive );
       
   112     iFilePath.Append(pathWithoutDrive);
       
   113     iFilePath.Append(KManagerFileName);
       
   114     iObjectJobQueueManager->SetFilePath(iFilePath);
   101 	}
   115 	}
   102 
   116 
   103 // -----------------------------------------------------------------------------
   117 // -----------------------------------------------------------------------------
   104 void CImagePlugin::StartPluginL()
   118 void CImagePlugin::StartPluginL()
   105 	{
   119 	{
   126 	// Start harvester for this plugin
   140 	// Start harvester for this plugin
   127 	iObserver->AddHarvestingQueue(this, _L(MEDIA_QBASEAPPCLASS) );
   141 	iObserver->AddHarvestingQueue(this, _L(MEDIA_QBASEAPPCLASS) );
   128 	TUid uidOfPlugin = {0x20029ABB};
   142 	TUid uidOfPlugin = {0x20029ABB};
   129 	iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin);
   143 	iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin);
   130 	iMdsItem = CMDSEntity::NewL();
   144 	iMdsItem = CMDSEntity::NewL();
       
   145 	if( BaflUtils::FileExists(iFs,iFilePath) )
       
   146 	        LoadL();
   131 	OstTraceFunctionExit0( CIMAGEPLUGIN_STARTPLUGINL_EXIT );
   147 	OstTraceFunctionExit0( CIMAGEPLUGIN_STARTPLUGINL_EXIT );
   132 	}
   148 	}
   133 
   149 
   134 void CImagePlugin::HarvestingCompletedL()
   150 void CImagePlugin::HarvestingCompletedL()
   135     {
   151     {
   337     OstTraceFunctionExit0( CIMAGEPLUGIN_PAUSEPLUGINL_EXIT );
   353     OstTraceFunctionExit0( CIMAGEPLUGIN_PAUSEPLUGINL_EXIT );
   338     }
   354     }
   339 
   355 
   340 void CImagePlugin::ResumePluginL()
   356 void CImagePlugin::ResumePluginL()
   341     {
   357     {
   342     OstTraceFunctionEntry0( CIMAGEPLUGIN_RESUMEPLUGINL_ENTRY );
   358     OstTraceFunctionEntry0( CIMAGEPLUGIN_RESUMEPLUGINL_ENTRY );    
   343     iObjectJobQueueManager->ResumeL();    
   359     iObjectJobQueueManager->ResumeL();    
   344     OstTraceFunctionExit0( CIMAGEPLUGIN_RESUMEPLUGINL_EXIT );
   360     OstTraceFunctionExit0( CIMAGEPLUGIN_RESUMEPLUGINL_EXIT );
       
   361     }
       
   362 
       
   363 void CImagePlugin::SaveL()
       
   364     {
       
   365     iObjectJobQueueManager->LoadQueuedItems();    
       
   366     }
       
   367 
       
   368 void CImagePlugin::LoadL()
       
   369     {
       
   370     iObjectJobQueueManager->SaveQueuedItems();
   345     }
   371     }
   346 
   372 
   347 #ifdef __PERFORMANCE_DATA
   373 #ifdef __PERFORMANCE_DATA
   348 void CImagePlugin::UpdateLogL()
   374 void CImagePlugin::UpdateLogL()
   349     {
   375     {