harvester/common/src/harvesterpluginfactory.cpp
branchRCL_3
changeset 19 b73252188534
parent 18 63c982fb92f2
child 20 f23c07ec56e2
equal deleted inserted replaced
18:63c982fb92f2 19:b73252188534
    91 
    91 
    92 // ---------------------------------------------------------------------------
    92 // ---------------------------------------------------------------------------
    93 // GetObjectDef
    93 // GetObjectDef
    94 // ---------------------------------------------------------------------------
    94 // ---------------------------------------------------------------------------
    95 //
    95 //
    96 EXPORT_C void CHarvesterPluginFactory::GetObjectDefL( CHarvesterData& aHD, TDes& aObjectDef )
    96 EXPORT_C void CHarvesterPluginFactory::GetObjectDefL( CHarvesterData& /*aHD*/, TDes& aObjectDef )
    97 	{
    97 	{
    98 	TPtrC extPtr;
    98 	aObjectDef.Zero();
    99 	if( MdsUtils::GetExt( aHD.Uri(), extPtr ) )
       
   100 		{
       
   101 		RPointerArray<CHarvesterPluginInfo> supportedPlugins;
       
   102 		CleanupClosePushL( supportedPlugins );
       
   103 		GetSupportedPluginsL( supportedPlugins, extPtr );
       
   104 		
       
   105 		const TInt sCount = supportedPlugins.Count();
       
   106 		if( sCount == 1 )
       
   107 			{
       
   108 			CHarvesterPluginInfo* info = supportedPlugins[0];
       
   109 			if( info->iObjectTypes.Count() == 1 )
       
   110 				{
       
   111 				aObjectDef.Copy( *(info->iObjectTypes[0]) );
       
   112 				aHD.SetHarvesterPluginInfo( info );
       
   113 				CleanupStack::PopAndDestroy( &supportedPlugins );
       
   114 				return;
       
   115 				}
       
   116 			}
       
   117 		for( TInt i = sCount - 1; i >=0; i-- )
       
   118 			{
       
   119 			CHarvesterPluginInfo* info = supportedPlugins[i];
       
   120 			if ( !(info->iPlugin) )
       
   121 				{
       
   122 				info->iPlugin = CHarvesterPlugin::NewL( info->iPluginUid );
       
   123 				info->iPlugin->SetQueue( info->iQueue );
       
   124 				info->iPlugin->SetHarvesterPluginFactory( *this );  
       
   125 				info->iPlugin->SetBlacklist( *iBlacklist );
       
   126 				}
       
   127 			info->iPlugin->GetObjectType( aHD.Uri(), aObjectDef );
       
   128 			if( aObjectDef.Length() > 0 )
       
   129 				{
       
   130 				aHD.SetHarvesterPluginInfo( info );
       
   131 				break;
       
   132 				}
       
   133 			}
       
   134 		CleanupStack::PopAndDestroy( &supportedPlugins );
       
   135 		}
       
   136 	else
       
   137 		{
       
   138 		aObjectDef.Zero();
       
   139 		}
       
   140 	}
    99 	}
   141 	
   100 	
   142 // ---------------------------------------------------------------------------
   101 // ---------------------------------------------------------------------------
   143 // GetMimeType
   102 // GetMimeType
   144 // ---------------------------------------------------------------------------
   103 // ---------------------------------------------------------------------------
   207 	   		hpi->iPlugin->SetBlacklist( *iBlacklist );
   166 	   		hpi->iPlugin->SetBlacklist( *iBlacklist );
   208 	   		}
   167 	   		}
   209 			
   168 			
   210 		if( aHD->ObjectType() == EFastHarvest || aHD->Origin() == MdeConstants::Object::ECamera )
   169 		if( aHD->ObjectType() == EFastHarvest || aHD->Origin() == MdeConstants::Object::ECamera )
   211 		   	{
   170 		   	{
   212 		   	hpi->iQueue.Insert( aHD, 0 );
   171 		   	hpi->iQueue.InsertL( aHD, 0 );
       
   172 		   	
   213 		   	if( !hpi->iPlugin->IsActive() )
   173 		   	if( !hpi->iPlugin->IsActive() )
   214 		   	    {
   174 		   	    {
   215 	            hpi->iPlugin->SetPriority( KHarvesterPriorityHarvestingPlugin + 1 );
   175 	            hpi->iPlugin->SetPriority( KHarvesterPriorityHarvestingPlugin + 1 );
   216 		   	    }
   176 		   	    }
   217 		    }
   177 		    }
   326         CleanupStack::Pop( str );
   286         CleanupStack::Pop( str );
   327         }
   287         }
   328     
   288     
   329     pluginInfo->iPluginUid = aPluginUid;
   289     pluginInfo->iPluginUid = aPluginUid;
   330     
   290     
   331 #ifdef MDS_HARVESTERPLUGINS_ON_BOOT
       
   332     pluginInfo->iPlugin = CHarvesterPlugin::NewL( pluginInfo->iPluginUid );
   291     pluginInfo->iPlugin = CHarvesterPlugin::NewL( pluginInfo->iPluginUid );
   333     pluginInfo->iPlugin->SetQueue( pluginInfo->iQueue );
   292     pluginInfo->iPlugin->SetQueue( pluginInfo->iQueue );
   334     pluginInfo->iPlugin->SetHarvesterPluginFactory( *this );
   293     pluginInfo->iPlugin->SetHarvesterPluginFactory( *this );
   335 #endif
       
   336     
   294     
   337     iHarvesterPluginInfoArray.AppendL( pluginInfo );
   295     iHarvesterPluginInfoArray.AppendL( pluginInfo );
   338     CleanupStack::Pop( pluginInfo );
   296     CleanupStack::Pop( pluginInfo );
   339     }
   297     }
   340 
   298 
   489             iHarvesterPluginInfoArray[i]->iPlugin->StartHarvest();
   447             iHarvesterPluginInfoArray[i]->iPlugin->StartHarvest();
   490             }
   448             }
   491         }
   449         }
   492     }
   450     }
   493 
   451 
       
   452 EXPORT_C void CHarvesterPluginFactory::GetObjectDefL( CHarvesterData* aHD, TDes& aObjectDef )
       
   453     {
       
   454     TPtrC extPtr;
       
   455     if( MdsUtils::GetExt( aHD->Uri(), extPtr ) )
       
   456         {
       
   457         RPointerArray<CHarvesterPluginInfo> supportedPlugins;
       
   458         CleanupClosePushL( supportedPlugins );
       
   459         GetSupportedPluginsL( supportedPlugins, extPtr );
       
   460         
       
   461         const TInt sCount = supportedPlugins.Count();
       
   462         if( sCount == 1 )
       
   463             {
       
   464             CHarvesterPluginInfo* info = supportedPlugins[0];
       
   465             if( info->iObjectTypes.Count() == 1 )
       
   466                 {
       
   467                 aObjectDef.Copy( *(info->iObjectTypes[0]) );
       
   468                 aHD->SetHarvesterPluginInfo( info );
       
   469                 CleanupStack::PopAndDestroy( &supportedPlugins );
       
   470                 return;
       
   471                 }
       
   472             }
       
   473         for( TInt i = sCount - 1; i >=0; i-- )
       
   474             {
       
   475             CHarvesterPluginInfo* info = supportedPlugins[i];
       
   476             if ( !(info->iPlugin) )
       
   477                 {
       
   478                 info->iPlugin = CHarvesterPlugin::NewL( info->iPluginUid );
       
   479                 info->iPlugin->SetQueue( info->iQueue );
       
   480                 info->iPlugin->SetHarvesterPluginFactory( *this );  
       
   481                 info->iPlugin->SetBlacklist( *iBlacklist );
       
   482                 }
       
   483             info->iPlugin->GetObjectType( aHD->Uri(), aObjectDef );
       
   484             if( aHD && aObjectDef.Length() > 0 )
       
   485                 {
       
   486                 aHD->SetHarvesterPluginInfo( info );
       
   487                 break;
       
   488                 }
       
   489             else if( !aHD )
       
   490                 {
       
   491                 break;
       
   492                 }
       
   493             }
       
   494         CleanupStack::PopAndDestroy( &supportedPlugins );
       
   495         }
       
   496     else
       
   497         {
       
   498         aObjectDef.Zero();
       
   499         }
       
   500     }
       
   501 
       
   502