equal
deleted
inserted
replaced
437 |
437 |
438 EXPORT_C void CHarvesterPluginFactory::SendHarvestingStatusEventL( TBool aStarted ) |
438 EXPORT_C void CHarvesterPluginFactory::SendHarvestingStatusEventL( TBool aStarted ) |
439 { |
439 { |
440 const TInt pluginInfoCount = iHarvesterPluginInfoArray.Count(); |
440 const TInt pluginInfoCount = iHarvesterPluginInfoArray.Count(); |
441 TBool itemsLeft( EFalse ); |
441 TBool itemsLeft( EFalse ); |
|
442 TBool allPluginsOnIdle( ETrue ); |
442 for ( TInt i = pluginInfoCount; --i >= 0; ) |
443 for ( TInt i = pluginInfoCount; --i >= 0; ) |
443 { |
444 { |
444 CHarvesterPluginInfo* info = iHarvesterPluginInfoArray[i]; |
445 CHarvesterPluginInfo* info = iHarvesterPluginInfoArray[i]; |
445 if( info && info->iQueue.Count() ) |
446 if( info && info->iQueue.Count() ) |
446 { |
447 { |
447 itemsLeft = ETrue; |
448 itemsLeft = ETrue; |
448 break; |
449 if( aStarted ) |
|
450 { |
|
451 // Idle state is only checked if finished event is sent |
|
452 break; |
|
453 } |
|
454 } |
|
455 if( info && info->iPlugin && !(info->iPlugin->PluginInIdleState()) ) |
|
456 { |
|
457 allPluginsOnIdle = EFalse; |
449 } |
458 } |
450 } |
459 } |
451 |
460 |
452 if( !iHarvesting && itemsLeft && aStarted ) |
461 if( !iHarvesting && itemsLeft && aStarted ) |
453 { |
462 { |
456 // This next line is for caching the harvester started event for observers registering |
465 // This next line is for caching the harvester started event for observers registering |
457 // after harvesting has already started |
466 // after harvesting has already started |
458 iHarvesterEventManager->IncreaseItemCount( EHEObserverTypeOverall, KCacheItemCountForEventCaching ); |
467 iHarvesterEventManager->IncreaseItemCount( EHEObserverTypeOverall, KCacheItemCountForEventCaching ); |
459 return; |
468 return; |
460 } |
469 } |
461 else if( iHarvesting && !itemsLeft && !aStarted ) |
470 else if( iHarvesting && (!itemsLeft || allPluginsOnIdle) && !aStarted ) |
462 { |
471 { |
463 iHarvesting = EFalse; |
472 iHarvesting = EFalse; |
464 iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateFinished ); |
473 iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateFinished ); |
465 iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeOverall, KCacheItemCountForEventCaching ); |
474 iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeOverall, KCacheItemCountForEventCaching ); |
466 } |
475 } |