233 TRACE_ENTRY_POINT; |
180 TRACE_ENTRY_POINT; |
234 |
181 |
235 iPluginInfo.ResetAndDestroy(); |
182 iPluginInfo.ResetAndDestroy(); |
236 iActivePlugins.Reset(); |
183 iActivePlugins.Reset(); |
237 iRomBasedPlugins.Reset(); |
184 iRomBasedPlugins.Reset(); |
238 |
185 |
239 //Added resolver for corolla release |
186 //Added resolver for corolla release |
240 // Set resolver params |
187 // Set resolver params |
241 /*TLanguage lang = User::Language(); |
188 TLanguage lang = User::Language(); |
242 TBuf8<40> langStr; |
189 TBuf8<40> langStr; |
243 langStr.Format( _L8("language(%d)"), lang ); |
190 langStr.Format( _L8("language(%d)"), lang ); |
244 |
191 |
245 TEComResolverParams resolverParams; |
192 TEComResolverParams resolverParams; |
246 resolverParams.SetDataType( langStr ); |
193 resolverParams.SetDataType( langStr ); |
247 resolverParams.SetGenericMatch( ETrue );*/ |
194 resolverParams.SetGenericMatch( ETrue ); |
248 |
195 |
249 REComSession::ListImplementationsL( KCalenCustomisationInterfaceUid,/* resolverParams,*/ iPluginInfo ); |
196 // REComSession::ListImplementationsL( KCalenCustomisationInterfaceUid, resolverParams, iPluginInfo ); |
250 |
197 REComSession::ListImplementationsL( KCalenCustomisationInterfaceUid, iPluginInfo ); |
251 LoadPluginsBasedOnVariantL(); |
|
252 |
|
253 TInt pluginCount = iPluginInfo.Count(); |
198 TInt pluginCount = iPluginInfo.Count(); |
254 |
199 |
255 for ( TInt pluginIndex(0); pluginIndex < pluginCount; ++pluginIndex ) |
200 for ( TInt pluginIndex(0); pluginIndex < pluginCount; ++pluginIndex ) |
256 { |
201 { |
257 TUid pluginUid = iPluginInfo[pluginIndex]->ImplementationUid(); |
202 TUid pluginUid = iPluginInfo[pluginIndex]->ImplementationUid(); |
258 |
203 |
259 // Find the plugin in the list of known plugins |
|
260 TInt position = iPluginSettingsStatus.Find( pluginUid, PluginAvailabilityFinder ); |
|
261 if ( ( position == KErrNotFound ) || ( iPluginSettingsStatus[position].iEnabled ) ) |
|
262 { |
|
263 // If the plugin can not be found or if it is enabled |
204 // If the plugin can not be found or if it is enabled |
264 // add it to the list of active plugins |
205 // add it to the list of active plugins |
265 iActivePlugins.AppendL( pluginUid ); |
206 iActivePlugins.AppendL( pluginUid ); |
266 |
207 |
267 // If the plugin is rom-based, store its uid |
208 // If the plugin is rom-based, store its uid |
268 if ( iPluginInfo[pluginIndex]->RomBased() ) |
209 if ( iPluginInfo[pluginIndex]->RomBased() ) |
269 { |
210 { |
270 iRomBasedPlugins.AppendL( pluginUid ); |
211 iRomBasedPlugins.AppendL( pluginUid ); |
271 } |
212 } |
272 } |
|
273 } |
|
274 |
|
275 TRACE_EXIT_POINT; |
|
276 } |
|
277 |
|
278 // ---------------------------------------------------------------------------- |
|
279 // CCalenCustomisationManager::GetCustomViewsL |
|
280 // GetCustomViews returns custom views info in an array for a given |
|
281 // plugin. |
|
282 // NOTE: The contents of the array are owned by the caller - caller |
|
283 // must guarantee to call ResetAndDestroy on the array in all cases. |
|
284 // ---------------------------------------------------------------------------- |
|
285 // |
|
286 EXPORT_C void CCalenCustomisationManager::GetCustomViewsL( TUid aPluginUid, |
|
287 RPointerArray<CCalenView>& aViews ) |
|
288 { |
|
289 TRACE_ENTRY_POINT; |
|
290 |
|
291 CCalenCustomisation* plugin = FindPluginL( aPluginUid ); |
|
292 User::LeaveIfNull( plugin ); |
|
293 |
|
294 TRAPD( error, plugin->GetCustomViewsL( aViews )); |
|
295 if ( error ) |
|
296 { |
|
297 // Report a problem with plugin. |
|
298 } |
|
299 |
|
300 TInt numViews = aViews.Count(); |
|
301 for ( TInt index( 0 ); index < numViews; ++index ) |
|
302 { |
|
303 CCalenView* customView = aViews[index]; |
|
304 |
|
305 // Add to view info array |
|
306 const TUid viewId = customView->Id(); |
|
307 |
|
308 // Check for duplicate view ids. |
|
309 TInt position = iViewInfoArray.Find( viewId , |
|
310 CCalenViewInfo::ViewInfoIdentifier ); |
|
311 |
|
312 if ( position == KErrNotFound ) |
|
313 { |
|
314 const TDesC& menuName = customView->LocalisedViewNameL( CCalenView::EMenuName ); |
|
315 const TDesC& settingsName = customView->LocalisedViewNameL( CCalenView::ESettingsName ); |
|
316 const CCalenView::TCyclePosition cyclePos = customView->CyclePosition(); |
|
317 |
|
318 CCalenViewInfo* viewInfo = CCalenViewInfo::NewL( viewId, |
|
319 aPluginUid, |
|
320 menuName, |
|
321 settingsName, |
|
322 cyclePos ); |
|
323 |
|
324 // Check if the view has already been hidden. |
|
325 TBool hidden = ( iHiddenViews.Find( viewId.iUid ) != KErrNotFound ); |
|
326 viewInfo->Hide( hidden ); |
|
327 |
|
328 ViewInfoArray().InsertInOrderAllowRepeatsL( viewInfo, iSortOrder ); |
|
329 } |
|
330 else |
|
331 { |
|
332 // A plugin with the same id already exists. ( It could be a replacement |
|
333 // view provided by a rom plugin, as currently preventing rom plugins from |
|
334 // being disabled if required is not implemented, it needs to be handled) |
|
335 delete customView; |
|
336 aViews.Remove( index ); |
|
337 index--; |
|
338 numViews--; |
|
339 |
213 |
340 // Report a problem with plugin. |
214 } |
341 } |
|
342 } |
|
343 RArray<TInt> hiddenViews; |
|
344 CleanupClosePushL( hiddenViews ); |
|
345 plugin->RemoveViewsFromCycle( hiddenViews ); |
|
346 TInt hiddenViewCount = hiddenViews.Count(); |
|
347 if ( hiddenViewCount ) |
|
348 { |
|
349 // Get the default view form the settings to check if it is going to be hidden |
|
350 // by the installed plugin |
|
351 TUid defaultView = iSetting->DefaultView(); |
|
352 for ( TInt index(0); index < hiddenViewCount; ++index ) |
|
353 { |
|
354 TInt hiddenViewId = hiddenViews[index]; |
|
355 // iHiddenViews.InsertInOrderAllowRepeatsL( hiddenViewId ); |
|
356 |
|
357 // If this view is already on the view cycle list it needs |
|
358 // to be hidden. |
|
359 TUid hiddenViewUid = TUid::Uid( hiddenViewId ); |
|
360 |
|
361 // If the current default view is hidden, then set the newly |
|
362 // installed plugin view as default view |
|
363 if(defaultView == hiddenViewUid) |
|
364 { |
|
365 TInt position = iViewInfoArray.Find( aPluginUid, |
|
366 CCalenViewInfo::ViewPluginIdentifier ); |
|
367 if(position != -1) |
|
368 { |
|
369 for(TInt i = position; i < iViewInfoArray.Count(); i++) |
|
370 { |
|
371 if((iViewInfoArray[i]->PluginUid() == aPluginUid) && |
|
372 (iViewInfoArray[i]->CyclePosition() != CCalenView::ENoCyclePosition)) |
|
373 { |
|
374 iSetting->SetDefaultView(iViewInfoArray[i]->ViewUid()); |
|
375 break; |
|
376 } |
|
377 } |
|
378 } |
|
379 } |
|
380 } |
|
381 } |
|
382 CleanupStack::PopAndDestroy(); // removedViews |
|
383 |
215 |
384 TRACE_EXIT_POINT; |
216 TRACE_EXIT_POINT; |
385 } |
217 } |
386 |
218 |
387 // ---------------------------------------------------------------------------- |
219 // ---------------------------------------------------------------------------- |
388 // CCalenCustomisationManager::SetPluginAvailabilityL |
220 // CCalenCustomisationManager::SetPluginAvailabilityL |
389 // Enables or disables the given plugin. |
221 // Enables or disables the given plugin. |
390 // ---------------------------------------------------------------------------- |
222 // ---------------------------------------------------------------------------- |
391 // |
223 // |
392 EXPORT_C void CCalenCustomisationManager::SetPluginAvailabilityL( TUid aPluginUid, |
224 void CCalenCustomisationManager::SetPluginAvailabilityL( TUid aPluginUid, |
393 TBool aEnabled ) |
225 TBool aEnabled ) |
394 { |
226 { |
395 TRACE_ENTRY_POINT; |
227 TRACE_ENTRY_POINT; |
396 |
228 |
397 if ( aEnabled ) |
229 if ( aEnabled ) |
791 |
453 |
792 // the plugin array takes ownership of the plugin |
454 // the plugin array takes ownership of the plugin |
793 AddPluginL( plugin, aPluginUid ); |
455 AddPluginL( plugin, aPluginUid ); |
794 CleanupStack::Pop( plugin ); |
456 CleanupStack::Pop( plugin ); |
795 |
457 |
796 |
458 |
797 RArray<TInt> hiddenViews; |
459 TRACE_EXIT_POINT; |
798 CleanupClosePushL( hiddenViews ); |
460 } |
799 plugin->RemoveViewsFromCycle( hiddenViews ); |
461 |
800 TInt hiddenViewCount = hiddenViews.Count(); |
462 |
801 if ( hiddenViewCount ) |
463 |
802 { |
|
803 // Get the default view form the settings to check if it is going to be hidden |
|
804 // by the installed plugin |
|
805 TUid defaultView = iSetting->DefaultView(); |
|
806 for ( TInt index(0); index < hiddenViewCount; ++index ) |
|
807 { |
|
808 TInt hiddenViewId = hiddenViews[index]; |
|
809 iHiddenViews.InsertInOrderAllowRepeatsL( hiddenViewId ); |
|
810 |
|
811 // If this view is already on the view cycle list it needs |
|
812 // to be hidden. |
|
813 TUid hiddenViewUid = TUid::Uid( hiddenViewId ); |
|
814 |
|
815 // If the current default view is hidden, then set the newly |
|
816 // installed plugin view as default view |
|
817 if(defaultView == hiddenViewUid) |
|
818 iSetting->SetDefaultView(aPluginUid); |
|
819 |
|
820 TInt position = iViewInfoArray.Find( hiddenViewUid, |
|
821 CCalenViewInfo::ViewInfoIdentifier ); |
|
822 |
|
823 if ( position != KErrNotFound ) |
|
824 { |
|
825 CCalenViewInfo* viewInfo = iViewInfoArray[position]; |
|
826 viewInfo->Hide( ETrue ); |
|
827 |
|
828 // By hiding the view, the cycleposition order may be changed |
|
829 // so the view info array needs to be resorted. |
|
830 iViewInfoArray.Sort( iSortOrder ); |
|
831 } |
|
832 } |
|
833 } |
|
834 CleanupStack::PopAndDestroy(); // removedViews |
|
835 |
|
836 TRACE_EXIT_POINT; |
|
837 } |
|
838 |
|
839 // ---------------------------------------------------------------------------- |
|
840 // CCalenCustomisationManager::OfferMenuPaneL |
|
841 // Offers a menupane for customisation by plugins |
|
842 // and the controller. |
|
843 // (other items were commented in a header). |
|
844 // ---------------------------------------------------------------------------- |
|
845 // |
|
846 EXPORT_C void CCalenCustomisationManager::OfferMenuPaneL( TInt aResourceId, |
|
847 CEikMenuPane* aMenuPane ) |
|
848 { |
|
849 TRACE_ENTRY_POINT; |
|
850 |
|
851 // Offer the menu to registered plugins |
|
852 OfferMenuPaneToPluginsL( aResourceId, aMenuPane ); |
|
853 |
|
854 // If the menupane is a main menu, a check needs to be made that the |
|
855 // exit and switch view commands exist |
|
856 |
|
857 // Replace the send menu if it exists |
|
858 TInt position( 0 ); |
|
859 if ( aMenuPane->MenuItemExists( ECalenSend, position) ) |
|
860 { |
|
861 // Delete the existing send menu option |
|
862 aMenuPane->DeleteMenuItem(ECalenSend); |
|
863 |
|
864 // Insert the calensend menu item |
|
865 iGlobalData->CalenSendL().DisplaySendMenuItemL( *aMenuPane, position ); |
|
866 } |
|
867 |
|
868 // If the menu has a view switch menu item, it is up to the |
|
869 // customisation manager to decide if the menu should be |
|
870 // cascading or a selection list box. |
|
871 if ( aMenuPane->MenuItemExists( ECalenSwitchView, position) ) |
|
872 { |
|
873 CEikMenuPaneItem::SData& switchItem = aMenuPane->ItemData( ECalenSwitchView ); |
|
874 if ( iActivePlugins.Count() == 0 ) |
|
875 { |
|
876 // Create a cascading menu |
|
877 switchItem.iCascadeId = R_CALENDAR_CHANGE_VIEW_MENUPANE; |
|
878 } |
|
879 else |
|
880 { |
|
881 switchItem.iCascadeId = 0; |
|
882 } |
|
883 } |
|
884 |
|
885 TRACE_EXIT_POINT; |
|
886 } |
|
887 |
|
888 // ---------------------------------------------------------------------------- |
|
889 // CCalenCustomisationManager::CheckHiddenViewL( |
|
890 // A check needs to be made to see if any other plugins hide the same view. |
|
891 // ---------------------------------------------------------------------------- |
|
892 // |
|
893 void CCalenCustomisationManager::CheckHiddenViewL( TUid aViewUid, TUid aPluginUid ) |
|
894 { |
|
895 TRACE_ENTRY_POINT; |
|
896 |
|
897 // Find the viewId in the hidden view list, and remove it |
|
898 TInt viewId = aViewUid.iUid; |
|
899 TInt position = iHiddenViews.Find( viewId ); |
|
900 if ( position != KErrNotFound ) |
|
901 { |
|
902 iHiddenViews.Remove( position ); |
|
903 |
|
904 // Try to find the view again, in case it is hidden by another view |
|
905 position = iHiddenViews.Find( viewId ); |
|
906 if ( position == KErrNotFound ) |
|
907 { |
|
908 // If it can't be found in the hidden view list, |
|
909 // it can be unhidden. |
|
910 TInt viewInfoPos = iViewInfoArray.Find( aViewUid , |
|
911 CCalenViewInfo::ViewInfoIdentifier ); |
|
912 |
|
913 if ( viewInfoPos != KErrNotFound ) |
|
914 { |
|
915 // Unhide the view |
|
916 CCalenViewInfo* viewInfo = iViewInfoArray[viewInfoPos]; |
|
917 viewInfo->Hide( EFalse ); |
|
918 |
|
919 // Set hidden view as default view if the currently disabled plugin |
|
920 // is the default view |
|
921 TInt position = iViewInfoArray.Find( aPluginUid, |
|
922 CCalenViewInfo::ViewPluginIdentifier ); |
|
923 if(position != -1) |
|
924 { |
|
925 for(TInt i = position; i < iViewInfoArray.Count(); i++) |
|
926 { |
|
927 if((iViewInfoArray[i]->PluginUid() == aPluginUid) && |
|
928 iViewInfoArray[i]->ViewUid() == iSetting->DefaultView()) |
|
929 { |
|
930 iSetting->SetDefaultView(aViewUid); |
|
931 break; |
|
932 } |
|
933 } |
|
934 } |
|
935 |
|
936 // By unhiding the view, the cycleposition order may be changed |
|
937 // so the view info array needs to be resorted. |
|
938 iViewInfoArray.Sort( iSortOrder ); |
|
939 } |
|
940 } |
|
941 } |
|
942 TRACE_EXIT_POINT; |
|
943 } |
|
944 |
|
945 // ---------------------------------------------------------------------------- |
|
946 // CCalenCustomisationManager::GetReplacePluginViewIdL |
|
947 // Returns the view ID of the plugin that hides a particular view |
|
948 // ---------------------------------------------------------------------------- |
|
949 // |
|
950 EXPORT_C TUid CCalenCustomisationManager::GetReplacePluginViewIdL( TUid aHiddenViewId ) |
|
951 { |
|
952 TRACE_ENTRY_POINT; |
|
953 |
|
954 RArray<TInt> removedViews; |
|
955 CCalenCustomisation* plugin = NULL; |
|
956 TInt i = 0; |
|
957 for( ;i < iActivePlugins.Count(); i++) |
|
958 { |
|
959 plugin = FindPluginL(iActivePlugins[i]); |
|
960 plugin->RemoveViewsFromCycle(removedViews); |
|
961 if(removedViews.Count()) |
|
962 { |
|
963 TInt position = removedViews.Find(aHiddenViewId.iUid); |
|
964 if(position != KErrNotFound) |
|
965 break; |
|
966 else |
|
967 continue; |
|
968 } |
|
969 else |
|
970 { |
|
971 continue; |
|
972 } |
|
973 } |
|
974 removedViews.Reset(); |
|
975 |
|
976 // Get all the views provided by the plugin |
|
977 //plugin->GetCustomViewsL() |
|
978 TInt position = iViewInfoArray.Find( iActivePlugins[i], |
|
979 CCalenViewInfo::ViewPluginIdentifier ); |
|
980 while((position < iViewInfoArray.Count()) && ((iViewInfoArray[position]->CyclePosition() == CCalenView::ENoCyclePosition) || |
|
981 (iActivePlugins[i] != (iViewInfoArray[position]->PluginUid())))) |
|
982 { |
|
983 // go to the next view position |
|
984 position++; |
|
985 } |
|
986 TRACE_EXIT_POINT; |
|
987 |
|
988 return (iViewInfoArray[position]->ViewUid()); |
|
989 } |
|
990 |
|
991 // ---------------------------------------------------------------------------- |
|
992 // CCalenCustomisationManager::GetReplacePluginViewIdL |
|
993 // Returns the hidden views list |
|
994 // ---------------------------------------------------------------------------- |
|
995 // |
|
996 EXPORT_C void CCalenCustomisationManager::GetHiddenViewIdL( TUid aPluginUid, RArray<TInt>& aHiddenViews ) |
|
997 { |
|
998 TRACE_ENTRY_POINT; |
|
999 |
|
1000 // Get the plugin instance |
|
1001 CCalenCustomisation* plugin = FindPluginL(aPluginUid); |
|
1002 |
|
1003 plugin->RemoveViewsFromCycle(aHiddenViews); |
|
1004 |
|
1005 TRACE_EXIT_POINT; |
|
1006 } |
|
1007 |
|
1008 // ---------------------------------------------------------------------------- |
|
1009 // CCalenCustomisationManager::CustomPreviewPaneL |
|
1010 // Returns the preview pane |
|
1011 // (other items were commented in a header). |
|
1012 // ---------------------------------------------------------------------------- |
|
1013 EXPORT_C MCalenPreview* CCalenCustomisationManager::CustomPreviewPaneL( TRect& aRect ) |
|
1014 { |
|
1015 MCalenPreview* previewPane = NULL; |
|
1016 |
|
1017 |
|
1018 // Loop though all the command handlers, within two interlinked |
|
1019 // for loops. If PreviewPaneL leaves for one plugin, a plugin |
|
1020 // error message will be displayed and the loop will continue with |
|
1021 // the next command handler. If none of the plugins leave, there will |
|
1022 // be only one TRAP used. |
|
1023 TInt count = iPlugins.Count(); |
|
1024 for ( TInt index = 0; index < count && !previewPane; ++index ) |
|
1025 { |
|
1026 TRAPD( error, |
|
1027 { |
|
1028 // Loop though until an infobar is found |
|
1029 for (; index < count && !previewPane; ++index ) |
|
1030 { |
|
1031 if ( !iPlugins[index]->IsDisabled() ) |
|
1032 { |
|
1033 previewPane = iPlugins[index]->Plugin().CustomPreviewPaneL( aRect ); |
|
1034 } |
|
1035 } |
|
1036 } |
|
1037 ); |
|
1038 if ( error ) |
|
1039 { |
|
1040 // Report a problem with plugin. |
|
1041 } |
|
1042 } |
|
1043 |
|
1044 TRACE_EXIT_POINT; |
|
1045 return previewPane; |
|
1046 } |
|
1047 // ---------------------------------------------------------------------------- |
|
1048 // CCalenCustomisationManager::PreviewPane |
|
1049 // Returns the preview pane |
|
1050 // (other items were commented in a header). |
|
1051 // ---------------------------------------------------------------------------- |
|
1052 EXPORT_C CCoeControl* CCalenCustomisationManager::PreviewPane( TRect& aRect ) |
|
1053 { |
|
1054 TRACE_ENTRY_POINT; |
|
1055 |
|
1056 iInfoBarProviderUid = TUid::Uid(0);; |
|
1057 iPreviewPaneProviderUid = TUid::Uid(0); |
|
1058 |
|
1059 CCoeControl* previewPane = NULL; |
|
1060 |
|
1061 // Loop though all the command handlers, within two interlinked |
|
1062 // for loops. If PreviewPaneL leaves for one plugin, a plugin |
|
1063 // error message will be displayed and the loop will continue with |
|
1064 // the next command handler. If none of the plugins leave, there will |
|
1065 // be only one TRAP used. |
|
1066 TInt count = iPlugins.Count(); |
|
1067 for ( TInt index = 0; index < count && !previewPane; ++index ) |
|
1068 { |
|
1069 TRAPD( error, |
|
1070 // Loop though until an infobar is found |
|
1071 for (; index < count && !previewPane; ++index ) |
|
1072 { |
|
1073 |
|
1074 if ( !iPlugins[index]->IsDisabled() ) |
|
1075 { |
|
1076 previewPane = iPlugins[index]->Plugin().PreviewPaneL( aRect ); |
|
1077 if(previewPane) |
|
1078 { |
|
1079 iPreviewPaneProviderUid = iPlugins[index]->Uid(); |
|
1080 } |
|
1081 } |
|
1082 |
|
1083 } |
|
1084 ); |
|
1085 |
|
1086 if ( error ) |
|
1087 { |
|
1088 // Report a problem with plugin. |
|
1089 } |
|
1090 } |
|
1091 |
|
1092 TRACE_EXIT_POINT; |
|
1093 return previewPane; |
|
1094 } |
|
1095 |
464 |
1096 // ---------------------------------------------------------------------------- |
465 // ---------------------------------------------------------------------------- |
1097 // CCalenCustomisationManager::Infobar |
466 // CCalenCustomisationManager::Infobar |
1098 // Returns the infobar. |
467 // Returns the infobar. |
1099 // (other items were commented in a header). |
468 // (other items were commented in a header). |
1100 // ---------------------------------------------------------------------------- |
469 // ---------------------------------------------------------------------------- |
1101 EXPORT_C CCoeControl* CCalenCustomisationManager::Infobar(const TRect& aRect ) |
470 HbWidget* CCalenCustomisationManager::Infobar( ) |
1102 { |
471 { |
1103 TRACE_ENTRY_POINT; |
472 TRACE_ENTRY_POINT; |
1104 |
473 |
1105 iInfoBarProviderUid = TUid::Uid(0); |
474 iInfoBarProviderUid = TUid::Uid(0); |
1106 iPreviewPaneProviderUid = TUid::Uid(0); |
475 |
1107 |
476 HbWidget* infoBar =NULL; |
1108 CCoeControl* infoBar = NULL; |
|
1109 // Loop though all the command handlers, within two interlinked |
477 // Loop though all the command handlers, within two interlinked |
1110 // for loops. If GetInfoBarL leaves for one plugin, a plugin |
478 // for loops. If GetInfoBarL leaves for one plugin, a plugin |
1111 // error message will be displayed and the loop will continue with |
479 // error message will be displayed and the loop will continue with |
1112 // the next command handler. If none of the plugins leave, there will |
480 // the next command handler. If none of the plugins leave, there will |
1113 // be only one TRAP used. |
481 // be only one TRAP used. |
1114 TInt count = iPlugins.Count(); |
482 TInt count = iPlugins.Count(); |
|
483 /*if(count > 0) |
|
484 { |
|
485 infoBar = iPlugins[0]->Plugin().InfobarL(); |
|
486 iInfoBarProviderUid = iPlugins[0]->Uid(); |
|
487 }*/ |
|
488 |
1115 for ( TInt index = 0; index < count && !infoBar; ++index ) |
489 for ( TInt index = 0; index < count && !infoBar; ++index ) |
1116 { |
490 { |
1117 TRAPD( error, |
491 TRAPD( error, |
1118 // Loop though until an infobar is found |
492 // Loop though until an infobar is found |
1119 for (; index < count && !infoBar; ++index ) |
493 for (; index < count && !infoBar; ++index ) |
1120 { |
494 { |
1121 if ( !iPlugins[index]->IsDisabled() ) |
495 //if ( !iPlugins[index]->IsDisabled() ) |
1122 { |
496 { |
1123 infoBar = iPlugins[index]->Plugin().InfobarL( aRect ); |
497 infoBar = iPlugins[index]->Plugin().InfobarL(); |
1124 iInfoBarProviderUid = iPlugins[index]->Uid(); |
498 iInfoBarProviderUid = iPlugins[index]->Uid(); |
1125 } |
499 } |
1126 } |
500 } |
1127 ); |
501 ); |
1128 |
502 if(error) |
1129 if ( error ) |
503 { |
1130 { |
504 // Need to handle the error case |
1131 // Report a problem with plugin. |
505 } |
1132 } |
|
1133 } |
506 } |
1134 |
507 |
1135 TRACE_EXIT_POINT; |
508 TRACE_EXIT_POINT; |
1136 return infoBar; |
509 return infoBar; |
1137 } |
510 } |
1138 |
511 |
1139 // ---------------------------------------------------------------------------- |
512 // ---------------------------------------------------------------------------- |
1140 // CCalenCustomisationManager::Infobar |
513 // CCalenCustomisationManager::InfobarTextL |
1141 // Returns the infobar. |
514 // @returns info bar text |
1142 // (other items were commented in a header). |
515 // (other items were commented in a header). |
1143 // ---------------------------------------------------------------------------- |
516 // ---------------------------------------------------------------------------- |
1144 EXPORT_C const TDesC& CCalenCustomisationManager::Infobar() |
517 // |
1145 { |
518 QString* CCalenCustomisationManager::InfobarTextL() |
1146 TRACE_ENTRY_POINT; |
519 { |
1147 |
520 TRACE_ENTRY_POINT; |
1148 iInfoBarProviderUid = TUid::Uid(0); |
521 |
1149 iPreviewPaneProviderUid = TUid::Uid(0); |
522 iInfoBarProviderUid = TUid::Uid(0); |
1150 |
523 |
1151 iInfoBarStr.Set(KNullDesC); |
524 QString* infoBarText =NULL; |
1152 // Loop though all the command handlers, within two interlinked |
525 // Loop though all the command handlers, within two interlinked |
1153 // for loops. If GetInfoBarL leaves for one plugin, a plugin |
526 // for loops. If GetInfoBarL leaves for one plugin, a plugin |
1154 // error message will be displayed and the loop will continue with |
527 // error message will be displayed and the loop will continue with |
1155 // the next command handler. If none of the plugins leave, there will |
528 // the next command handler. If none of the plugins leave, there will |
1156 // be only one TRAP used. |
529 // be only one TRAP used. |
1157 TBool infoBarFound = EFalse; |
530 TInt count = iPlugins.Count(); |
1158 TInt count = iPlugins.Count(); |
531 /*if(count > 0) |
1159 for ( TInt index = 0; index < count && !infoBarFound; ++index ) |
532 { |
1160 { |
533 infoBar = iPlugins[0]->Plugin().InfobarL(); |
1161 TRAPD( error, |
534 iInfoBarProviderUid = iPlugins[0]->Uid(); |
1162 // Loop though until an infobar is found |
535 }*/ |
1163 for (; index < count && !infoBarFound; ++index ) |
536 |
1164 { |
537 for ( TInt index = 0; index < count && !infoBarText; ++index ) |
1165 if ( !iPlugins[index]->IsDisabled() ) |
538 { |
1166 { |
539 TRAPD( error, |
1167 iInfoBarStr.Set( iPlugins[index]->Plugin().InfobarL() ); |
540 // Loop though until an infobar is found |
1168 if(iInfoBarStr.Length()) |
541 for (; index < count && !infoBarText; ++index ) |
1169 { |
542 { |
1170 infoBarFound = ETrue; |
543 //if ( !iPlugins[index]->IsDisabled() ) |
1171 } |
544 { |
1172 iInfoBarProviderUid = iPlugins[index]->Uid(); |
545 infoBarText = iPlugins[index]->Plugin().InfobarTextL(); |
1173 } |
546 iInfoBarProviderUid = iPlugins[index]->Uid(); |
1174 } |
547 } |
1175 ); |
548 } |
1176 |
549 ); |
1177 if ( error ) |
550 if(error) |
1178 { |
551 { |
1179 // Report a problem with plugin. |
552 // Need to handle the error case |
1180 } |
553 } |
1181 } |
554 |
1182 |
555 } |
1183 TRACE_EXIT_POINT; |
556 |
1184 return iInfoBarStr; |
557 TRACE_EXIT_POINT; |
1185 } |
558 return infoBarText; |
1186 |
559 } |
1187 // ---------------------------------------------------------------------------- |
560 |
1188 // CCalenCustomisationManager::HiddenView |
561 // ---------------------------------------------------------------------------- |
1189 // Return ETrue if a view has been hidden by a plugin |
562 // CCalenCustomisationManager::FindPluginL |
1190 // (other items were commented in a header). |
563 // Finds a plugin and returns a plugin with a given uid, returns NULL |
1191 // ---------------------------------------------------------------------------- |
564 // if the uid can not be found. |
1192 // |
565 // (other items were commented in a header). |
1193 EXPORT_C TBool CCalenCustomisationManager::HiddenView( TUid aHiddenView) const |
566 // ---------------------------------------------------------------------------- |
1194 { |
567 // |
1195 TRACE_ENTRY_POINT; |
568 CCalenCustomisation* CCalenCustomisationManager::FindPluginL( TUid aUid ) |
1196 TRACE_EXIT_POINT; |
569 { |
1197 return ( iHiddenViews.Find( aHiddenView.iUid ) != KErrNotFound ); |
570 TRACE_ENTRY_POINT; |
1198 } |
571 |
1199 |
572 TInt index = iPlugins.Find( aUid, CPluginInfo::Identifier ); |
1200 |
573 |
1201 // ---------------------------------------------------------------------------- |
574 CCalenCustomisation* plugin = NULL; |
1202 // CCalenCustomisationManager::RomBased( |
575 if ( index != KErrNotFound ) |
1203 // Return ETrue if a view has been provided by a rom-based plugin |
576 { |
|
577 plugin = &( iPlugins[index]->Plugin() ); |
|
578 } |
|
579 |
|
580 TRACE_EXIT_POINT; |
|
581 return plugin; |
|
582 } |
|
583 |
|
584 // ---------------------------------------------------------------------------- |
|
585 // CCalenCustomisationManager::CPluginInfo::CPluginInfo( |
|
586 // C++ constructor |
|
587 // (other items were commented in a header). |
|
588 // ---------------------------------------------------------------------------- |
|
589 // |
|
590 CCalenCustomisationManager::CPluginInfo::CPluginInfo( |
|
591 CCalenCustomisation* aPlugin, |
|
592 TUid aUid ) |
|
593 : iPlugin( aPlugin ), |
|
594 iUid( aUid ) |
|
595 { |
|
596 TRACE_ENTRY_POINT; |
|
597 TRACE_EXIT_POINT; |
|
598 } |
|
599 |
|
600 // ---------------------------------------------------------------------------- |
|
601 // CCalenCustomisationManager::CPluginInfo::~CPluginInfo( |
|
602 // C++ destructor |
|
603 // (other items were commented in a header). |
|
604 // ---------------------------------------------------------------------------- |
|
605 // |
|
606 CCalenCustomisationManager::CPluginInfo::~CPluginInfo() |
|
607 { |
|
608 TRACE_ENTRY_POINT; |
|
609 |
|
610 delete iPlugin; |
|
611 |
|
612 TRACE_EXIT_POINT; |
|
613 } |
|
614 |
|
615 // ---------------------------------------------------------------------------- |
|
616 // CCalenCustomisationManager::CPluginInfo::Plugin |
|
617 // returns a reference to the plugin |
|
618 // (other items were commented in a header). |
|
619 // ---------------------------------------------------------------------------- |
|
620 // |
|
621 CCalenCustomisation& CCalenCustomisationManager::CPluginInfo::Plugin() |
|
622 { |
|
623 TRACE_ENTRY_POINT; |
|
624 TRACE_EXIT_POINT; |
|
625 |
|
626 return *iPlugin; |
|
627 } |
|
628 |
|
629 // ---------------------------------------------------------------------------- |
|
630 // CCalenCustomisationManager::CPluginInfo::Uid |
|
631 // returns the plugin uid |
|
632 // (other items were commented in a header). |
|
633 // ---------------------------------------------------------------------------- |
|
634 // |
|
635 TUid CCalenCustomisationManager::CPluginInfo::Uid() const |
|
636 { |
|
637 TRACE_ENTRY_POINT; |
|
638 TRACE_EXIT_POINT; |
|
639 |
|
640 return iUid; |
|
641 } |
|
642 |
|
643 // ---------------------------------------------------------------------------- |
|
644 // CCalenCustomisationManager::CPluginInfo::Disable |
|
645 // Marks the plugin as being disabled |
1204 // (other items were commented in a header). |
646 // (other items were commented in a header). |
1205 // ---------------------------------------------------------------------------- |
647 // ---------------------------------------------------------------------------- |
1206 // |
648 // |
1207 EXPORT_C TBool CCalenCustomisationManager::IsViewRomBased( TUid aViewUid ) const |
649 void CCalenCustomisationManager::CPluginInfo::Disable( TBool aDisable) |
1208 { |
650 { |
1209 TRACE_ENTRY_POINT; |
651 TRACE_ENTRY_POINT; |
1210 |
652 |
1211 TBool isRomBased = EFalse; |
653 iDisabled = aDisable; |
1212 |
654 |
1213 TInt viewInfoPos = iViewInfoArray.Find( aViewUid , |
655 TRACE_EXIT_POINT; |
1214 CCalenViewInfo::ViewInfoIdentifier ); |
656 } |
1215 if ( viewInfoPos != KErrNotFound ) |
657 |
1216 { |
658 // ---------------------------------------------------------------------------- |
1217 TUid plugUid = iViewInfoArray[viewInfoPos]->PluginUid(); |
659 // CCalenCustomisationManager::CPluginInfo::IsDisabled |
1218 TInt position = iRomBasedPlugins.Find( plugUid ); |
660 // Returns if the plugin has been marked as being disabled |
1219 if ( position != KErrNotFound ) |
661 // (other items were commented in a header). |
1220 { |
662 // ---------------------------------------------------------------------------- |
1221 isRomBased = ETrue; |
663 // |
1222 } |
664 TBool CCalenCustomisationManager::CPluginInfo::IsDisabled() |
1223 } |
665 { |
1224 |
666 TRACE_ENTRY_POINT; |
1225 TRACE_EXIT_POINT; |
667 |
1226 return isRomBased; |
668 return iDisabled; |
1227 } |
669 |
1228 |
670 TRACE_EXIT_POINT; |
1229 // ---------------------------------------------------------------------------- |
671 } |
1230 // CCalenCustomisationManager::CanBeEnabledDisabled( |
672 |
1231 // Return ETrue if plugins can be enabled/disabled from settings |
673 |
1232 // (other items were commented in a header). |
674 |
1233 // ---------------------------------------------------------------------------- |
675 // ---------------------------------------------------------------------------- |
1234 // |
676 // CCalenCustomisationManager::AddPluginL |
1235 EXPORT_C TBool CCalenCustomisationManager::CanBeEnabledDisabledL(TUid aPluginUid) |
677 // Adds a plugin to the array of plugins |
1236 { |
678 // (other items were commented in a header). |
1237 TRACE_ENTRY_POINT; |
679 // ---------------------------------------------------------------------------- |
1238 TBool enabledDisabled = EFalse; |
680 // |
1239 |
681 void CCalenCustomisationManager::AddPluginL( CCalenCustomisation* aPlugin, |
1240 CCalenCustomisation* plugin = FindPluginL(aPluginUid); |
682 TUid aUid ) |
1241 if(plugin) |
683 { |
1242 { |
684 TRACE_ENTRY_POINT; |
1243 enabledDisabled = plugin->CanBeEnabledDisabled(); |
685 |
1244 } |
686 CPluginInfo* newPlugin = new ( ELeave ) CPluginInfo( aPlugin, aUid); |
1245 |
687 CleanupStack::PushL( newPlugin ); |
1246 TRACE_EXIT_POINT; |
688 iPlugins.AppendL( newPlugin ); |
1247 return enabledDisabled; |
689 CleanupStack::Pop( newPlugin ); |
1248 } |
690 |
1249 |
691 TRACE_EXIT_POINT; |
1250 // ---------------------------------------------------------------------------- |
692 } |
1251 // CCalenCustomisationManager::OfferMenuPaneL |
693 |
1252 // Offers a menupane to all interested plugins |
694 // ---------------------------------------------------------------------------- |
1253 // (other items were commented in a header). |
695 // CCalenCustomisationManager::CPluginInfo::Identifier( |
1254 // ---------------------------------------------------------------------------- |
696 // Matches an uid and a plugin uid. Used by FindPluginL to |
1255 // |
697 // find a plugin with a given uid. |
1256 void CCalenCustomisationManager::OfferMenuPaneToPluginsL( TInt aResourceId, |
698 // (other items were commented in a header). |
1257 CEikMenuPane* aMenuPane ) |
699 // ---------------------------------------------------------------------------- |
|
700 // |
|
701 TBool CCalenCustomisationManager::CPluginInfo::Identifier( const TUid* aUid, |
|
702 const CPluginInfo& aArray ) |
|
703 { |
|
704 TRACE_ENTRY_POINT; |
|
705 TRACE_EXIT_POINT; |
|
706 |
|
707 return ( *aUid == aArray.Uid() ); |
|
708 } |
|
709 |
|
710 |
|
711 |
|
712 // ---------------------------------------------------------------------------- |
|
713 // CCalenCustomisationManager::Identifier( |
|
714 // Matches an uid and a plugin uid. Used by when finding the disabled plugins |
|
715 // (other items were commented in a header). |
|
716 // ---------------------------------------------------------------------------- |
|
717 // |
|
718 TBool CCalenCustomisationManager::PluginAvailabilityFinder( const TUid* aUid, |
|
719 const TCalenPluginAvailability& aArrayItem ) |
|
720 { |
|
721 TRACE_ENTRY_POINT; |
|
722 TRACE_EXIT_POINT; |
|
723 |
|
724 return ( *aUid == aArrayItem.iUid); |
|
725 } |
|
726 |
|
727 // ---------------------------------------------------------------------------- |
|
728 // CCalenCustomisationManager::OfferMenu |
|
729 // Offers a menupane for customisation by plugins |
|
730 // and the controller. |
|
731 // (other items were commented in a header). |
|
732 // ---------------------------------------------------------------------------- |
|
733 // |
|
734 void CCalenCustomisationManager::OfferMenu(HbMenu* aHbMenu ) |
1258 { |
735 { |
1259 TRACE_ENTRY_POINT; |
736 TRACE_ENTRY_POINT; |
1260 |
737 |
1261 // Get the number of command handlers |
738 // Get the number of command handlers |
1262 // TInt count = iCommandHandlers.Count(); |
739 // TInt count = iCommandHandlers.Count(); |
1263 const TInt count = iPlugins.Count(); |
740 const TInt count = iPlugins.Count(); |
1264 |
741 |
1265 // Loop though all the command handlers, within two interlinked |
742 // Loop though all the command handlers, within two interlinked |
1266 // for loops. If customiseMenuPane leaves for one plugin, a plugin |
743 // for loops. If customiseMenuPane leaves for one plugin, a plugin |
1267 // error message will be displayed and the loop will continue with |
744 // error message will be displayed and the loop will continue with |
1287 } |
763 } |
1288 |
764 |
1289 TRACE_EXIT_POINT; |
765 TRACE_EXIT_POINT; |
1290 } |
766 } |
1291 |
767 |
1292 // ---------------------------------------------------------------------------- |
|
1293 // CCalenCustomisationManager::FindPluginL |
|
1294 // Finds a plugin and returns a plugin with a given uid, returns NULL |
|
1295 // if the uid can not be found. |
|
1296 // (other items were commented in a header). |
|
1297 // ---------------------------------------------------------------------------- |
|
1298 // |
|
1299 CCalenCustomisation* CCalenCustomisationManager::FindPluginL( TUid aUid ) |
|
1300 { |
|
1301 TRACE_ENTRY_POINT; |
|
1302 |
|
1303 TInt index = iPlugins.Find( aUid, CPluginInfo::Identifier ); |
|
1304 |
|
1305 CCalenCustomisation* plugin = NULL; |
|
1306 if ( index != KErrNotFound ) |
|
1307 { |
|
1308 plugin = &( iPlugins[index]->Plugin() ); |
|
1309 } |
|
1310 |
|
1311 TRACE_EXIT_POINT; |
|
1312 return plugin; |
|
1313 } |
|
1314 |
|
1315 // ---------------------------------------------------------------------------- |
|
1316 // CCalenCustomisationManager::CPluginInfo::CPluginInfo( |
|
1317 // C++ constructor |
|
1318 // (other items were commented in a header). |
|
1319 // ---------------------------------------------------------------------------- |
|
1320 // |
|
1321 CCalenCustomisationManager::CPluginInfo::CPluginInfo( |
|
1322 CCalenCustomisation* aPlugin, |
|
1323 TUid aUid ) |
|
1324 : iPlugin( aPlugin ), |
|
1325 iUid( aUid ) |
|
1326 { |
|
1327 TRACE_ENTRY_POINT; |
|
1328 TRACE_EXIT_POINT; |
|
1329 } |
|
1330 |
|
1331 // ---------------------------------------------------------------------------- |
|
1332 // CCalenCustomisationManager::CPluginInfo::~CPluginInfo( |
|
1333 // C++ destructor |
|
1334 // (other items were commented in a header). |
|
1335 // ---------------------------------------------------------------------------- |
|
1336 // |
|
1337 CCalenCustomisationManager::CPluginInfo::~CPluginInfo() |
|
1338 { |
|
1339 TRACE_ENTRY_POINT; |
|
1340 |
|
1341 delete iPlugin; |
|
1342 |
|
1343 TRACE_EXIT_POINT; |
|
1344 } |
|
1345 |
|
1346 // ---------------------------------------------------------------------------- |
|
1347 // CCalenCustomisationManager::CPluginInfo::Plugin |
|
1348 // returns a reference to the plugin |
|
1349 // (other items were commented in a header). |
|
1350 // ---------------------------------------------------------------------------- |
|
1351 // |
|
1352 CCalenCustomisation& CCalenCustomisationManager::CPluginInfo::Plugin() |
|
1353 { |
|
1354 TRACE_ENTRY_POINT; |
|
1355 TRACE_EXIT_POINT; |
|
1356 |
|
1357 return *iPlugin; |
|
1358 } |
|
1359 |
|
1360 // ---------------------------------------------------------------------------- |
|
1361 // CCalenCustomisationManager::CPluginInfo::Uid |
|
1362 // returns the plugin uid |
|
1363 // (other items were commented in a header). |
|
1364 // ---------------------------------------------------------------------------- |
|
1365 // |
|
1366 TUid CCalenCustomisationManager::CPluginInfo::Uid() const |
|
1367 { |
|
1368 TRACE_ENTRY_POINT; |
|
1369 TRACE_EXIT_POINT; |
|
1370 |
|
1371 return iUid; |
|
1372 } |
|
1373 |
|
1374 // ---------------------------------------------------------------------------- |
|
1375 // CCalenCustomisationManager::CPluginInfo::Disable |
|
1376 // Marks the plugin as being disabled |
|
1377 // (other items were commented in a header). |
|
1378 // ---------------------------------------------------------------------------- |
|
1379 // |
|
1380 void CCalenCustomisationManager::CPluginInfo::Disable( TBool aDisable) |
|
1381 { |
|
1382 TRACE_ENTRY_POINT; |
|
1383 |
|
1384 iDisabled = aDisable; |
|
1385 |
|
1386 TRACE_EXIT_POINT; |
|
1387 } |
|
1388 |
|
1389 // ---------------------------------------------------------------------------- |
|
1390 // CCalenCustomisationManager::CPluginInfo::IsDisabled |
|
1391 // Returns if the plugin has been marked as being disabled |
|
1392 // (other items were commented in a header). |
|
1393 // ---------------------------------------------------------------------------- |
|
1394 // |
|
1395 TBool CCalenCustomisationManager::CPluginInfo::IsDisabled() |
|
1396 { |
|
1397 TRACE_ENTRY_POINT; |
|
1398 |
|
1399 return iDisabled; |
|
1400 |
|
1401 TRACE_EXIT_POINT; |
|
1402 } |
|
1403 |
|
1404 // ---------------------------------------------------------------------------- |
|
1405 // CCalenCustomisationManager::AddPluginL |
|
1406 // Adds a plugin to the array of plugins |
|
1407 // (other items were commented in a header). |
|
1408 // ---------------------------------------------------------------------------- |
|
1409 // |
|
1410 void CCalenCustomisationManager::AddPluginL( CCalenCustomisation* aPlugin, |
|
1411 TUid aUid ) |
|
1412 { |
|
1413 TRACE_ENTRY_POINT; |
|
1414 |
|
1415 CPluginInfo* newPlugin = new ( ELeave ) CPluginInfo( aPlugin, aUid); |
|
1416 CleanupStack::PushL( newPlugin ); |
|
1417 iPlugins.AppendL( newPlugin ); |
|
1418 CleanupStack::Pop( newPlugin ); |
|
1419 |
|
1420 TRACE_EXIT_POINT; |
|
1421 } |
|
1422 |
|
1423 // ---------------------------------------------------------------------------- |
|
1424 // CCalenCustomisationManager::CPluginInfo::Identifier( |
|
1425 // Matches an uid and a plugin uid. Used by FindPluginL to |
|
1426 // find a plugin with a given uid. |
|
1427 // (other items were commented in a header). |
|
1428 // ---------------------------------------------------------------------------- |
|
1429 // |
|
1430 TBool CCalenCustomisationManager::CPluginInfo::Identifier( const TUid* aUid, |
|
1431 const CPluginInfo& aArray ) |
|
1432 { |
|
1433 TRACE_ENTRY_POINT; |
|
1434 TRACE_EXIT_POINT; |
|
1435 |
|
1436 return ( *aUid == aArray.Uid() ); |
|
1437 } |
|
1438 |
|
1439 // ---------------------------------------------------------------------------- |
|
1440 // CCalenCustomisationManager::ViewInfoArray |
|
1441 // returns a reference to the view info array. |
|
1442 // (other items were commented in a header). |
|
1443 // ---------------------------------------------------------------------------- |
|
1444 // |
|
1445 RPointerArray<CCalenViewInfo>& CCalenCustomisationManager::ViewInfoArray() |
|
1446 { |
|
1447 TRACE_ENTRY_POINT; |
|
1448 |
|
1449 TRACE_EXIT_POINT; |
|
1450 return iViewInfoArray; |
|
1451 } |
|
1452 |
|
1453 // ---------------------------------------------------------------------------- |
|
1454 // CCalenCustomisationManager::PluginAvailabilityFinder |
|
1455 // Matches an uid and a plugin uid. Used by when finding the disabled plugins |
|
1456 // (other items were commented in a header). |
|
1457 // ---------------------------------------------------------------------------- |
|
1458 // |
|
1459 TBool CCalenCustomisationManager::PluginAvailabilityFinder( const TUid* aUid, |
|
1460 const TCalenPluginAvailability& aArrayItem ) |
|
1461 { |
|
1462 TRACE_ENTRY_POINT; |
|
1463 TRACE_EXIT_POINT; |
|
1464 |
|
1465 return ( *aUid == aArrayItem.iUid); |
|
1466 } |
|
1467 |
|
1468 // ---------------------------------------------------------------------------- |
|
1469 // CCalenCustomisationManager::DoPluginLoadingL |
|
1470 // Load all plugins |
|
1471 // ---------------------------------------------------------------------------- |
|
1472 // |
|
1473 EXPORT_C void CCalenCustomisationManager::DoPluginLoadingL() |
|
1474 { |
|
1475 TRACE_ENTRY_POINT; |
|
1476 // Reset and destroy the contents of the owned arrays |
|
1477 iPlugins.ResetAndDestroy(); |
|
1478 |
|
1479 iPluginInfo.ResetAndDestroy(); |
|
1480 |
|
1481 iActivePlugins.Reset(); |
|
1482 |
|
1483 iHiddenViews.Reset(); |
|
1484 iDefferedUnloadPluginList.Reset(); |
|
1485 // create active plugin list |
|
1486 CreateActivePluginListL(); |
|
1487 |
|
1488 DoImmediatePluginLoadingL(); |
|
1489 iSetting->LoadL(); |
|
1490 iSetting->UpdatePluginListL(*this); |
|
1491 |
|
1492 TRACE_EXIT_POINT; |
|
1493 } |
|
1494 |
|
1495 // ---------------------------------------------------------------------------- |
|
1496 // CCalenCustomisationManager::DisableAllPluginsL |
|
1497 // Disable all plugins |
|
1498 // ---------------------------------------------------------------------------- |
|
1499 // |
|
1500 EXPORT_C void CCalenCustomisationManager::DisableAllPluginsL() |
|
1501 { |
|
1502 TRACE_ENTRY_POINT; |
|
1503 |
|
1504 TInt pluginCount = iPluginInfo.Count(); |
|
1505 for(TInt index = 0;index<pluginCount;index++) |
|
1506 { |
|
1507 TUid pluginUid = iPluginInfo[index]->ImplementationUid(); |
|
1508 if(iActivePlugins.Find(pluginUid)!=KErrNotFound) |
|
1509 { |
|
1510 DisablePluginOnFakeExitL(pluginUid); |
|
1511 } |
|
1512 } |
|
1513 |
|
1514 TRACE_EXIT_POINT; |
|
1515 } |
|
1516 |
|
1517 // ---------------------------------------------------------------------------- |
|
1518 // CCalenCustomisationManager::DisablePluginOnFakeExitL |
|
1519 // Disable plugin on fake exit |
|
1520 // ---------------------------------------------------------------------------- |
|
1521 // |
|
1522 void CCalenCustomisationManager::DisablePluginOnFakeExitL(TUid aPluginUid) |
|
1523 { |
|
1524 TRACE_ENTRY_POINT; |
|
1525 |
|
1526 TInt index = iPlugins.Find( aPluginUid, CPluginInfo::Identifier ); |
|
1527 if ( index != KErrNotFound ) |
|
1528 { |
|
1529 CPluginInfo* pluginInfo = iPlugins[index]; |
|
1530 |
|
1531 // Remove the plugin from the active plugin list |
|
1532 TInt position = iActivePlugins.Find( aPluginUid ); |
|
1533 ASSERT( position != KErrNotFound ); |
|
1534 |
|
1535 if(iActivePlugins.Count()) |
|
1536 { |
|
1537 iActivePlugins.Remove( position ); |
|
1538 } |
|
1539 |
|
1540 // Does this plugin hide any views |
|
1541 RArray<TInt> removedViews; |
|
1542 CleanupClosePushL( removedViews ); |
|
1543 CCalenCustomisation& plugin = pluginInfo->Plugin(); |
|
1544 plugin.RemoveViewsFromCycle( removedViews ); |
|
1545 TInt hiddenViewsCount = removedViews.Count(); |
|
1546 if ( hiddenViewsCount ) |
|
1547 { |
|
1548 // Need to recalculate which views have been hidden, as |
|
1549 // more than one plugin might have hidden the same view. |
|
1550 for ( TInt index( 0 ); index < hiddenViewsCount; ++index ) |
|
1551 { |
|
1552 TUid viewUid = TUid::Uid( removedViews[index] ); |
|
1553 CheckHiddenViewL( viewUid, aPluginUid ); |
|
1554 } |
|
1555 } |
|
1556 |
|
1557 // If the plugin does not offer any views, or the current |
|
1558 // info or preview bar it can be deleted immediately, |
|
1559 // otherwise the customisation needs to wait until it |
|
1560 // is told it is safe to do so. |
|
1561 |
|
1562 // Does this plugin does not offer any views and the plugin |
|
1563 // doesn't offer the current infobar or preview pane |
|
1564 // bar it can be deleted immediately |
|
1565 TInt offerViews = iViewInfoArray.Find( aPluginUid, |
|
1566 CCalenViewInfo::ViewPluginIdentifier ); |
|
1567 |
|
1568 if ( offerViews == KErrNotFound && |
|
1569 iInfoBarProviderUid != aPluginUid |
|
1570 && iPreviewPaneProviderUid != aPluginUid ) |
|
1571 { |
|
1572 RArray<TUid> pluginArray; |
|
1573 CleanupClosePushL( pluginArray ); |
|
1574 pluginArray.AppendL( aPluginUid ); |
|
1575 UnloadPluginsL( pluginArray ); |
|
1576 CleanupStack::PopAndDestroy(); // pluginArray |
|
1577 } |
|
1578 |
|
1579 // Issue notification of plugin been disabled |
|
1580 iPluginsEnabledDisabled = ETrue; |
|
1581 iServices.IssueNotificationL( ECalenNotifyPluginEnabledDisabled ); |
|
1582 CleanupStack::PopAndDestroy(); // removedViews |
|
1583 } |
|
1584 TRACE_EXIT_POINT; |
|
1585 } |
|
1586 |
|
1587 // End of File |
768 // End of File |
1588 |
|