harvester/common/src/harvesterpluginfactory.cpp
branchRCL_3
changeset 15 3cebc1a84278
parent 8 6752808b2036
child 22 ab88d4a85041
equal deleted inserted replaced
14:646a02f170b9 15:3cebc1a84278
   109 				aHD.SetHarvesterPluginInfo( info );
   109 				aHD.SetHarvesterPluginInfo( info );
   110 				CleanupStack::PopAndDestroy( &supportedPlugins );
   110 				CleanupStack::PopAndDestroy( &supportedPlugins );
   111 				return;
   111 				return;
   112 				}
   112 				}
   113 			}
   113 			}
   114 		for( TInt i = 0; i < sCount; i++ )
   114 		for( TInt i = sCount - 1; i >=0; i-- )
   115 			{
   115 			{
   116 			CHarvesterPluginInfo* info = supportedPlugins[i];
   116 			CHarvesterPluginInfo* info = supportedPlugins[i];
   117 			if ( !(info->iPlugin) )
   117 			if ( !(info->iPlugin) )
   118 				{
   118 				{
   119 				info->iPlugin = CHarvesterPlugin::NewL( info->iPluginUid );
   119 				info->iPlugin = CHarvesterPlugin::NewL( info->iPluginUid );
   146     if( MdsUtils::GetExt( aUri, extPtr ) )
   146     if( MdsUtils::GetExt( aUri, extPtr ) )
   147         {
   147         {
   148         RPointerArray<CHarvesterPluginInfo> supportedPlugins;
   148         RPointerArray<CHarvesterPluginInfo> supportedPlugins;
   149         TRAP_IGNORE( GetSupportedPluginsL( supportedPlugins, extPtr ) );
   149         TRAP_IGNORE( GetSupportedPluginsL( supportedPlugins, extPtr ) );
   150         
   150         
   151         const TInt sCount = supportedPlugins.Count();
   151         for( TInt i = supportedPlugins.Count() - 1; i >=0; i-- )
   152         for( TInt i = 0; i < sCount; i++ )
       
   153             {
   152             {
   154             CHarvesterPluginInfo* info = supportedPlugins[i];
   153             CHarvesterPluginInfo* info = supportedPlugins[i];
   155             if ( !(info->iPlugin) )
   154             if ( !(info->iPlugin) )
   156                 {
   155                 {
   157                 TRAPD( error, info->iPlugin = CHarvesterPlugin::NewL( info->iPluginUid ) );
   156                 TRAPD( error, info->iPlugin = CHarvesterPlugin::NewL( info->iPluginUid ) );
   162                     }
   161                     }
   163                 info->iPlugin->SetQueue( info->iQueue );
   162                 info->iPlugin->SetQueue( info->iQueue );
   164                 info->iPlugin->SetHarvesterPluginFactory( *this );  
   163                 info->iPlugin->SetHarvesterPluginFactory( *this );  
   165                 info->iPlugin->SetBlacklist( *iBlacklist );
   164                 info->iPlugin->SetBlacklist( *iBlacklist );
   166                 }
   165                 }
   167                 info->iPlugin->GetMimeType( aUri, aMimeType );
   166             info->iPlugin->GetMimeType( aUri, aMimeType );
   168                 if( aMimeType.Length() > 0 )
   167             if( aMimeType.Length() > 0 )
   169                     {
   168                 {
   170                     break;
   169                 break;
   171                     }
   170                 }
   172             }
   171             }
   173         supportedPlugins.Close();
   172         supportedPlugins.Close();
   174         }
   173         }
   175     else
   174     else
   176         {
   175         {
   208 		if( aHD->ObjectType() == EFastHarvest || aHD->Origin() == MdeConstants::Object::ECamera )
   207 		if( aHD->ObjectType() == EFastHarvest || aHD->Origin() == MdeConstants::Object::ECamera )
   209 		   	{
   208 		   	{
   210 		   	hpi->iQueue.Insert( aHD, 0 );
   209 		   	hpi->iQueue.Insert( aHD, 0 );
   211 		   	if( !hpi->iPlugin->IsActive() )
   210 		   	if( !hpi->iPlugin->IsActive() )
   212 		   	    {
   211 		   	    {
   213 	            hpi->iPlugin->SetPriority( KHarvesterPriorityHarvestingPlugin + 2 );
   212 	            hpi->iPlugin->SetPriority( KHarvesterPriorityHarvestingPlugin + 1 );
   214 		   	    }
   213 		   	    }
   215 		    }
   214 		    }
   216 	    else
   215 	    else
   217 			{
   216 			{
   218 			hpi->iQueue.AppendL( aHD );
   217 			hpi->iQueue.AppendL( aHD );
   242 EXPORT_C void CHarvesterPluginFactory::SetBlacklist( CHarvesterBlacklist& aBlacklist )
   241 EXPORT_C void CHarvesterPluginFactory::SetBlacklist( CHarvesterBlacklist& aBlacklist )
   243 	{
   242 	{
   244 	WRITELOG( "CHarvesterPluginFactory::SetBlacklist()" );
   243 	WRITELOG( "CHarvesterPluginFactory::SetBlacklist()" );
   245 	iBlacklist = &aBlacklist;
   244 	iBlacklist = &aBlacklist;
   246 	
   245 	
   247 	TInt count = iHarvesterPluginInfoArray.Count();
   246 	const TInt count = iHarvesterPluginInfoArray.Count();
   248 	for ( TInt i = 0; i < count; i++ )
   247 	for ( TInt i = count; --i >= 0; )
   249 		{
   248 		{
   250 		iHarvesterPluginInfoArray[i]->iPlugin->SetBlacklist( *iBlacklist );
   249 	    if( iHarvesterPluginInfoArray[i]->iPlugin )
   251 		}
   250 	        {
   252 	
   251 	        iHarvesterPluginInfoArray[i]->iPlugin->SetBlacklist( *iBlacklist );
       
   252 	        }
       
   253 		}	
   253 	}
   254 	}
   254 
   255 
   255 // ---------------------------------------------------------------------------
   256 // ---------------------------------------------------------------------------
   256 // SetupHarvesterPluginInfoL
   257 // SetupHarvesterPluginInfoL
   257 // ---------------------------------------------------------------------------
   258 // ---------------------------------------------------------------------------
   322         CleanupStack::Pop( str );
   323         CleanupStack::Pop( str );
   323         }
   324         }
   324     
   325     
   325     pluginInfo->iPluginUid = aPluginUid;
   326     pluginInfo->iPluginUid = aPluginUid;
   326     
   327     
   327     // Load plugin
   328 #ifdef MDS_HARVESTERPLUGINS_ON_BOOT
   328     pluginInfo->iPlugin = CHarvesterPlugin::NewL( pluginInfo->iPluginUid );
   329     pluginInfo->iPlugin = CHarvesterPlugin::NewL( pluginInfo->iPluginUid );
   329     pluginInfo->iPlugin->SetQueue( pluginInfo->iQueue );
   330     pluginInfo->iPlugin->SetQueue( pluginInfo->iQueue );
   330     pluginInfo->iPlugin->SetHarvesterPluginFactory( *this );  
   331     pluginInfo->iPlugin->SetHarvesterPluginFactory( *this );
       
   332 #endif
   331     
   333     
   332     iHarvesterPluginInfoArray.AppendL( pluginInfo );
   334     iHarvesterPluginInfoArray.AppendL( pluginInfo );
   333     CleanupStack::Pop( pluginInfo );
   335     CleanupStack::Pop( pluginInfo );
   334     }
   336     }
   335 
   337 
   392 	if( MdsUtils::GetExt( aURI, extPtr ) )
   394 	if( MdsUtils::GetExt( aURI, extPtr ) )
   393 		{
   395 		{
   394 		RPointerArray<CHarvesterPluginInfo> supportedPlugins;
   396 		RPointerArray<CHarvesterPluginInfo> supportedPlugins;
   395 		CleanupClosePushL( supportedPlugins );
   397 		CleanupClosePushL( supportedPlugins );
   396 		GetSupportedPluginsL( supportedPlugins, extPtr );
   398 		GetSupportedPluginsL( supportedPlugins, extPtr );
   397 		const TInt sCount = supportedPlugins.Count();
   399 		for( TInt i = supportedPlugins.Count() - 1; i >=0; i-- )
   398 		for( TInt i = 0; i < sCount; i++ )
       
   399 			{
   400 			{
   400 			CHarvesterPluginInfo* info = supportedPlugins[i];
   401 			CHarvesterPluginInfo* info = supportedPlugins[i];
   401 			if( info->iObjectTypes.Count() >  1 )
   402 			if( info->iObjectTypes.Count() >  1 )
   402 				{
   403 				{
   403 				isContainerFile = ETrue;
   404 				isContainerFile = ETrue;
   456         iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateFinished );
   457         iHarvesterEventManager->SendEventL( EHEObserverTypeOverall, EHEStateFinished );
   457         iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeOverall, KCacheItemCountForEventCaching );
   458         iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeOverall, KCacheItemCountForEventCaching );
   458         }
   459         }
   459     }
   460     }
   460 
   461 
       
   462 EXPORT_C void CHarvesterPluginFactory::PauseHarvester( TBool aPaused )
       
   463     {
       
   464     const TInt count = iHarvesterPluginInfoArray.Count();
       
   465     for ( TInt i = count; --i >= 0; )
       
   466         {
       
   467         if( iHarvesterPluginInfoArray[i]->iPlugin && aPaused )
       
   468             {
       
   469             iHarvesterPluginInfoArray[i]->iPlugin->Cancel();
       
   470             }
       
   471         else if( iHarvesterPluginInfoArray[i]->iPlugin )
       
   472             {
       
   473             iHarvesterPluginInfoArray[i]->iPlugin->StartHarvest();
       
   474             }
       
   475         }
       
   476     }
       
   477