harvester/common/src/harvesterplugin.cpp
branchRCL_3
changeset 20 f23c07ec56e2
parent 19 b73252188534
child 21 85f623e1ef41
equal deleted inserted replaced
19:b73252188534 20:f23c07ec56e2
    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 )
    69 	{
    70 	{
    70 	}
    71 	}
    71 
    72 
    72 // ---------------------------------------------------------------------------
    73 // ---------------------------------------------------------------------------
    73 // ListImplementationsL
    74 // ListImplementationsL
   107 //
   108 //
   108 EXPORT_C void CHarvesterPlugin::StartHarvest()
   109 EXPORT_C void CHarvesterPlugin::StartHarvest()
   109 	{
   110 	{
   110 	if( iState == EHarvesterIdle )
   111 	if( iState == EHarvesterIdle )
   111 		{
   112 		{
       
   113 		iPaused = EFalse;
   112 		SetNextRequest( EHarvesterGathering );
   114 		SetNextRequest( EHarvesterGathering );
   113 		}
   115 		}
   114 	}
   116 	}
   115 
   117 
   116 // ---------------------------------------------------------------------------
   118 // ---------------------------------------------------------------------------
   152                 iQueue->Compress();
   154                 iQueue->Compress();
   153                 SetNextRequest( EHarvesterIdle );
   155                 SetNextRequest( EHarvesterIdle );
   154                 }
   156                 }
   155             else
   157             else
   156             	{
   158             	{
       
   159                 WRITELOG( "CHarvesterPlugin::RunL EHarvesterGathering - items in queue" );
   157                 if ( !iHarvesting )
   160                 if ( !iHarvesting )
   158                     {
   161                     {
   159                     TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( ETrue ) );
   162                     TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( ETrue ) );
   160                     iHarvesting = ETrue;
   163                     iHarvesting = ETrue;
   161                     }
   164                     }
   242 	SetNextRequest( EHarvesterGathering );
   245 	SetNextRequest( EHarvesterGathering );
   243 	return KErrNone;
   246 	return KErrNone;
   244 	}
   247 	}
   245 
   248 
   246 // ---------------------------------------------------------------------------
   249 // ---------------------------------------------------------------------------
       
   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 // ---------------------------------------------------------------------------
   247 // SetNextRequest
   266 // SetNextRequest
   248 // ---------------------------------------------------------------------------
   267 // ---------------------------------------------------------------------------
   249 //
   268 //
   250 void CHarvesterPlugin::SetNextRequest( THarvesterState aState )
   269 void CHarvesterPlugin::SetNextRequest( THarvesterState aState )
   251     {
   270     {
   252     if ( ! IsActive() )
   271     if ( !IsActive() && !iPaused )
   253         {
   272         {
   254         iState = aState;
   273         iState = aState;
   255         SetActive();
   274         SetActive();
   256         TRequestStatus* status = &iStatus;
   275         TRequestStatus* status = &iStatus;
   257         User::RequestComplete( status, KErrNone );
   276         User::RequestComplete( status, KErrNone );