harvester/common/src/harvesterplugin.cpp
branchRCL_3
changeset 50 85f623e1ef41
parent 49 f23c07ec56e2
child 53 29d87345eaeb
equal deleted inserted replaced
49:f23c07ec56e2 50:85f623e1ef41
    63 	iQueue( NULL ),
    63 	iQueue( NULL ),
    64 	iBlacklist( NULL ),
    64 	iBlacklist( NULL ),
    65     iDtor_ID_Key( KNullUid ),
    65     iDtor_ID_Key( KNullUid ),
    66     iOriginPropertyDef( NULL ),
    66     iOriginPropertyDef( NULL ),
    67     iTitlePropertyDef( NULL ),
    67     iTitlePropertyDef( NULL ),
    68     iHarvesting( EFalse ),
    68     iHarvesting( EFalse )
    69     iPaused( EFalse )
       
    70 	{
    69 	{
    71 	}
    70 	}
    72 
    71 
    73 // ---------------------------------------------------------------------------
    72 // ---------------------------------------------------------------------------
    74 // ListImplementationsL
    73 // ListImplementationsL
   108 //
   107 //
   109 EXPORT_C void CHarvesterPlugin::StartHarvest()
   108 EXPORT_C void CHarvesterPlugin::StartHarvest()
   110 	{
   109 	{
   111 	if( iState == EHarvesterIdle )
   110 	if( iState == EHarvesterIdle )
   112 		{
   111 		{
   113 		iPaused = EFalse;
       
   114 		SetNextRequest( EHarvesterGathering );
   112 		SetNextRequest( EHarvesterGathering );
   115 		}
   113 		}
   116 	}
   114 	}
   117 
   115 
   118 // ---------------------------------------------------------------------------
   116 // ---------------------------------------------------------------------------
   154                 iQueue->Compress();
   152                 iQueue->Compress();
   155                 SetNextRequest( EHarvesterIdle );
   153                 SetNextRequest( EHarvesterIdle );
   156                 }
   154                 }
   157             else
   155             else
   158             	{
   156             	{
   159                 WRITELOG( "CHarvesterPlugin::RunL EHarvesterGathering - items in queue" );
       
   160                 if ( !iHarvesting )
   157                 if ( !iHarvesting )
   161                     {
   158                     {
   162                     TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( ETrue ) );
   159                     TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( ETrue ) );
   163                     iHarvesting = ETrue;
   160                     iHarvesting = ETrue;
   164                     }
   161                     }
   245 	SetNextRequest( EHarvesterGathering );
   242 	SetNextRequest( EHarvesterGathering );
   246 	return KErrNone;
   243 	return KErrNone;
   247 	}
   244 	}
   248 
   245 
   249 // ---------------------------------------------------------------------------
   246 // ---------------------------------------------------------------------------
   250 // StartHarvest
       
   251 // ---------------------------------------------------------------------------
       
   252 //
       
   253 EXPORT_C void CHarvesterPlugin::StopHarvest()
       
   254     {
       
   255     Cancel();
       
   256     iState = EHarvesterIdle;
       
   257     if( iHarvesting )
       
   258         {
       
   259         TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( EFalse ) );
       
   260         iHarvesting = EFalse;     
       
   261         }
       
   262     iPaused = ETrue;
       
   263     }
       
   264 
       
   265 // ---------------------------------------------------------------------------
       
   266 // SetNextRequest
   247 // SetNextRequest
   267 // ---------------------------------------------------------------------------
   248 // ---------------------------------------------------------------------------
   268 //
   249 //
   269 void CHarvesterPlugin::SetNextRequest( THarvesterState aState )
   250 void CHarvesterPlugin::SetNextRequest( THarvesterState aState )
   270     {
   251     {
   271     if ( !IsActive() && !iPaused )
   252     if ( ! IsActive() )
   272         {
   253         {
   273         iState = aState;
   254         iState = aState;
   274         SetActive();
   255         SetActive();
   275         TRequestStatus* status = &iStatus;
   256         TRequestStatus* status = &iStatus;
   276         User::RequestComplete( status, KErrNone );
   257         User::RequestComplete( status, KErrNone );