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 // --------------------------------------------------------------------------- |
327 CleanupStack::Pop( str ); |
286 CleanupStack::Pop( str ); |
328 } |
287 } |
329 |
288 |
330 pluginInfo->iPluginUid = aPluginUid; |
289 pluginInfo->iPluginUid = aPluginUid; |
331 |
290 |
332 #ifdef MDS_HARVESTERPLUGINS_ON_BOOT |
|
333 pluginInfo->iPlugin = CHarvesterPlugin::NewL( pluginInfo->iPluginUid ); |
291 pluginInfo->iPlugin = CHarvesterPlugin::NewL( pluginInfo->iPluginUid ); |
334 pluginInfo->iPlugin->SetQueue( pluginInfo->iQueue ); |
292 pluginInfo->iPlugin->SetQueue( pluginInfo->iQueue ); |
335 pluginInfo->iPlugin->SetHarvesterPluginFactory( *this ); |
293 pluginInfo->iPlugin->SetHarvesterPluginFactory( *this ); |
336 #endif |
|
337 |
294 |
338 iHarvesterPluginInfoArray.AppendL( pluginInfo ); |
295 iHarvesterPluginInfoArray.AppendL( pluginInfo ); |
339 CleanupStack::Pop( pluginInfo ); |
296 CleanupStack::Pop( pluginInfo ); |
340 } |
297 } |
341 |
298 |
490 iHarvesterPluginInfoArray[i]->iPlugin->StartHarvest(); |
447 iHarvesterPluginInfoArray[i]->iPlugin->StartHarvest(); |
491 } |
448 } |
492 } |
449 } |
493 } |
450 } |
494 |
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 |