44 CCalenCustomisationManager* CCalenCustomisationManager::NewL( |
49 CCalenCustomisationManager* CCalenCustomisationManager::NewL( |
45 MCalenServicesFactory& aFactory, |
50 MCalenServicesFactory& aFactory, |
46 MCalenServices& aServices |
51 MCalenServices& aServices |
47 ) |
52 ) |
48 { |
53 { |
49 TRACE_ENTRY_POINT; |
54 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_NEWL_ENTRY ); |
50 |
|
51 CCalenCustomisationManager* self = new( ELeave ) CCalenCustomisationManager( |
55 CCalenCustomisationManager* self = new( ELeave ) CCalenCustomisationManager( |
52 aFactory, |
56 aFactory, |
53 aServices ); |
57 aServices ); |
54 CleanupStack::PushL( self ); |
58 CleanupStack::PushL( self ); |
55 self->ConstructL(); |
59 self->ConstructL(); |
56 CleanupStack::Pop( self ); |
60 CleanupStack::Pop( self ); |
57 |
61 |
58 TRACE_EXIT_POINT; |
62 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_NEWL_EXIT ); |
59 return self; |
63 return self; |
60 } |
64 } |
61 |
65 |
62 // ---------------------------------------------------------------------------- |
66 // ---------------------------------------------------------------------------- |
63 // CCalenCustomisationManager::CCalenCustomisationManager |
67 // CCalenCustomisationManager::CCalenCustomisationManager |
68 CCalenCustomisationManager::CCalenCustomisationManager( MCalenServicesFactory& aFactory, |
72 CCalenCustomisationManager::CCalenCustomisationManager( MCalenServicesFactory& aFactory, |
69 MCalenServices& aServices ) |
73 MCalenServices& aServices ) |
70 : iServicesFactory( aFactory ), |
74 : iServicesFactory( aFactory ), |
71 iServices( aServices ) |
75 iServices( aServices ) |
72 { |
76 { |
73 TRACE_ENTRY_POINT; |
77 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_CCALENCUSTOMISATIONMANAGER_ENTRY ); |
74 TRACE_EXIT_POINT; |
78 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_CCALENCUSTOMISATIONMANAGER_EXIT ); |
75 } |
79 } |
76 |
80 |
77 // ---------------------------------------------------------------------------- |
81 // ---------------------------------------------------------------------------- |
78 // CCalenCustomisationManager::ConstructL |
82 // CCalenCustomisationManager::ConstructL |
79 // Second stage constructor |
83 // Second stage constructor |
80 // (other items were commented in a header). |
84 // (other items were commented in a header). |
81 // ---------------------------------------------------------------------------- |
85 // ---------------------------------------------------------------------------- |
82 // |
86 // |
83 void CCalenCustomisationManager::ConstructL() |
87 void CCalenCustomisationManager::ConstructL() |
84 { |
88 { |
85 TRACE_ENTRY_POINT; |
89 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_CONSTRUCTL_ENTRY ); |
86 |
90 |
87 CreateActivePluginListL(); |
91 CreateActivePluginListL(); |
88 |
92 |
89 // Load any enabled plugins |
93 // Load any enabled plugins |
90 DoImmediatePluginLoadingL(); |
94 DoImmediatePluginLoadingL(); |
91 |
95 |
92 TRACE_EXIT_POINT; |
96 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_CONSTRUCTL_EXIT ); |
93 } |
97 } |
94 |
98 |
95 // ---------------------------------------------------------------------------- |
99 // ---------------------------------------------------------------------------- |
96 // CCalenCustomisationManager::~CCalenCustomisationManager |
100 // CCalenCustomisationManager::~CCalenCustomisationManager |
97 // Destructor |
101 // Destructor |
98 // (other items were commented in a header). |
102 // (other items were commented in a header). |
99 // ---------------------------------------------------------------------------- |
103 // ---------------------------------------------------------------------------- |
100 // |
104 // |
101 CCalenCustomisationManager::~CCalenCustomisationManager() |
105 CCalenCustomisationManager::~CCalenCustomisationManager() |
102 { |
106 { |
103 TRACE_ENTRY_POINT; |
107 OstTraceFunctionEntry0( DUP1_CCALENCUSTOMISATIONMANAGER_CCALENCUSTOMISATIONMANAGER_ENTRY ); |
104 |
108 |
105 // Reset and destroy the contents of the owned arrays, |
109 // Reset and destroy the contents of the owned arrays, |
106 // this will delete the plugins. |
110 // this will delete the plugins. |
107 iPlugins.ResetAndDestroy(); |
111 iPlugins.ResetAndDestroy(); |
108 |
112 |
114 // Close the ECOM interface |
118 // Close the ECOM interface |
115 REComSession::FinalClose(); |
119 REComSession::FinalClose(); |
116 |
120 |
117 iDefferedUnloadPluginList.Reset(); |
121 iDefferedUnloadPluginList.Reset(); |
118 |
122 |
119 TRACE_EXIT_POINT; |
123 OstTraceFunctionExit0( DUP1_CCALENCUSTOMISATIONMANAGER_CCALENCUSTOMISATIONMANAGER_EXIT ); |
120 } |
124 } |
121 // ---------------------------------------------------------------------------- |
125 // ---------------------------------------------------------------------------- |
122 // CCalenCustomisationManager::GetCommandHandlerL |
126 // CCalenCustomisationManager::GetCommandHandlerL |
123 // Get a command handler for a specific command. Ownership remains with the |
127 // Get a command handler for a specific command. Ownership remains with the |
124 // plugin |
128 // plugin |
125 // ---------------------------------------------------------------------------- |
129 // ---------------------------------------------------------------------------- |
126 MCalenCommandHandler* CCalenCustomisationManager::GetCommandHandlerL( TInt aCommand ) |
130 MCalenCommandHandler* CCalenCustomisationManager::GetCommandHandlerL( TInt aCommand ) |
127 { |
131 { |
128 TRACE_ENTRY_POINT; |
132 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_GETCOMMANDHANDLERL_ENTRY ); |
129 |
133 |
130 MCalenCommandHandler* handler( NULL ); |
134 MCalenCommandHandler* handler( NULL ); |
131 |
135 |
132 // Loop though all the enabled plugins asking for a command handler |
136 // Loop though all the enabled plugins asking for a command handler |
133 // to handle this command with. Returns NULL if no plugin wants to |
137 // to handle this command with. Returns NULL if no plugin wants to |
164 // Returns a reference to an array of active plugins uids |
168 // Returns a reference to an array of active plugins uids |
165 // ---------------------------------------------------------------------------- |
169 // ---------------------------------------------------------------------------- |
166 // |
170 // |
167 const RArray<TUid>& CCalenCustomisationManager::ActivePlugins() const |
171 const RArray<TUid>& CCalenCustomisationManager::ActivePlugins() const |
168 { |
172 { |
169 TRACE_ENTRY_POINT; |
173 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_ACTIVEPLUGINS_ENTRY ); |
170 TRACE_EXIT_POINT; |
174 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_ACTIVEPLUGINS_EXIT ); |
171 |
|
172 return iActivePlugins; |
175 return iActivePlugins; |
173 } |
176 } |
174 |
177 |
175 // ---------------------------------------------------------------------------- |
178 // ---------------------------------------------------------------------------- |
176 // CCalenCustomisationManager::CreateActivePluginListL |
179 // CCalenCustomisationManager::CreateActivePluginListL |
177 // Generates the list of active plugins |
180 // Generates the list of active plugins |
178 // ---------------------------------------------------------------------------- |
181 // ---------------------------------------------------------------------------- |
179 // |
182 // |
180 void CCalenCustomisationManager::CreateActivePluginListL() |
183 void CCalenCustomisationManager::CreateActivePluginListL() |
181 { |
184 { |
182 TRACE_ENTRY_POINT; |
185 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_CREATEACTIVEPLUGINLISTL_ENTRY ); |
183 |
|
184 iPluginInfo.ResetAndDestroy(); |
186 iPluginInfo.ResetAndDestroy(); |
185 iActivePlugins.Reset(); |
187 iActivePlugins.Reset(); |
186 iRomBasedPlugins.Reset(); |
188 iRomBasedPlugins.Reset(); |
187 |
189 |
188 REComSession::ListImplementationsL( KCalenCustomisationInterfaceUid, iPluginInfo ); |
190 REComSession::ListImplementationsL( KCalenCustomisationInterfaceUid, iPluginInfo ); |
259 delete impl; |
262 delete impl; |
260 } |
263 } |
261 } |
264 } |
262 } |
265 } |
263 needsToBeRemoved.Close(); |
266 needsToBeRemoved.Close(); |
|
267 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_LOADPLUGINSBASEDONVARIANTL_EXIT ); |
264 } |
268 } |
265 |
269 |
266 // ---------------------------------------------------------------------------- |
270 // ---------------------------------------------------------------------------- |
267 // CCalenCustomisationManager::PluginInfoFinder( |
271 // CCalenCustomisationManager::PluginInfoFinder( |
268 // Matches an uid in pluginInfo. |
272 // Matches an uid in pluginInfo. |
269 // ---------------------------------------------------------------------------- |
273 // ---------------------------------------------------------------------------- |
270 // |
274 // |
271 TBool CCalenCustomisationManager::PluginInfoFinder( const TUid* aUid, |
275 TBool CCalenCustomisationManager::PluginInfoFinder( const TUid* aUid, |
272 const CImplementationInformation& aArrayItem ) |
276 const CImplementationInformation& aArrayItem ) |
273 { |
277 { |
|
278 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_PLUGININFOFINDER_ENTRY ); |
274 return (*aUid == aArrayItem.ImplementationUid() ); |
279 return (*aUid == aArrayItem.ImplementationUid() ); |
275 } |
280 } |
276 |
281 |
277 // ---------------------------------------------------------------------------- |
282 // ---------------------------------------------------------------------------- |
278 // CCalenCustomisationManager::SetPluginAvailabilityL |
283 // CCalenCustomisationManager::SetPluginAvailabilityL |
280 // ---------------------------------------------------------------------------- |
285 // ---------------------------------------------------------------------------- |
281 // |
286 // |
282 void CCalenCustomisationManager::SetPluginAvailabilityL( TUid aPluginUid, |
287 void CCalenCustomisationManager::SetPluginAvailabilityL( TUid aPluginUid, |
283 TBool aEnabled ) |
288 TBool aEnabled ) |
284 { |
289 { |
285 TRACE_ENTRY_POINT; |
290 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_SETPLUGINAVAILABILITYL_ENTRY ); |
286 |
|
287 if ( aEnabled ) |
291 if ( aEnabled ) |
288 { |
292 { |
289 EnablePluginL( aPluginUid ); |
293 EnablePluginL( aPluginUid ); |
290 } |
294 } |
291 else |
295 else |
292 { |
296 { |
293 DisablePluginL( aPluginUid ); |
297 DisablePluginL( aPluginUid ); |
294 } |
298 } |
295 |
299 |
296 TRACE_EXIT_POINT; |
300 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_SETPLUGINAVAILABILITYL_EXIT ); |
297 } |
301 } |
298 |
302 |
299 // ---------------------------------------------------------------------------- |
303 // ---------------------------------------------------------------------------- |
300 // CCalenCustomisationManager::DisablePluginL |
304 // CCalenCustomisationManager::DisablePluginL |
301 // Disables the given plugin. |
305 // Disables the given plugin. |
302 // ---------------------------------------------------------------------------- |
306 // ---------------------------------------------------------------------------- |
303 // |
307 // |
304 void CCalenCustomisationManager::DisablePluginL( TUid aPluginUid ) |
308 void CCalenCustomisationManager::DisablePluginL( TUid aPluginUid ) |
305 { |
309 { |
306 TRACE_ENTRY_POINT; |
310 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_DISABLEPLUGINL_ENTRY ); |
307 |
|
308 // Find the plugins |
311 // Find the plugins |
309 TInt index = iPlugins.Find( aPluginUid, CPluginInfo::Identifier ); |
312 TInt index = iPlugins.Find( aPluginUid, CPluginInfo::Identifier ); |
310 if ( index != KErrNotFound ) |
313 if ( index != KErrNotFound ) |
311 { |
314 { |
312 CPluginInfo* pluginInfo = iPlugins[index]; |
315 CPluginInfo* pluginInfo = iPlugins[index]; |
341 // is called when it is safe to unload the plugin. |
344 // is called when it is safe to unload the plugin. |
342 // ---------------------------------------------------------------------------- |
345 // ---------------------------------------------------------------------------- |
343 // |
346 // |
344 void CCalenCustomisationManager::UnloadPluginsL( const RArray<TUid>& aPlugins ) |
347 void CCalenCustomisationManager::UnloadPluginsL( const RArray<TUid>& aPlugins ) |
345 { |
348 { |
346 TRACE_ENTRY_POINT; |
349 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_UNLOADPLUGINSL_ENTRY ); |
347 // Check plugin isn't already enabled |
350 // Check plugin isn't already enabled |
348 TInt count = aPlugins.Count(); |
351 TInt count = aPlugins.Count(); |
349 for (TInt index = 0; index < count; ++index ) |
352 for (TInt index = 0; index < count; ++index ) |
350 { |
353 { |
351 TInt position = iPlugins.Find( aPlugins[index], CPluginInfo::Identifier ); |
354 TInt position = iPlugins.Find( aPlugins[index], CPluginInfo::Identifier ); |
362 iPlugins[position]->Disable(ETrue); |
365 iPlugins[position]->Disable(ETrue); |
363 iDefferedUnloadPluginList.AppendL(iPlugins[position]->Uid()); |
366 iDefferedUnloadPluginList.AppendL(iPlugins[position]->Uid()); |
364 } |
367 } |
365 } |
368 } |
366 } |
369 } |
367 TRACE_EXIT_POINT; |
370 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_UNLOADPLUGINSL_EXIT ); |
368 } |
371 } |
369 |
372 |
370 // ---------------------------------------------------------------------------- |
373 // ---------------------------------------------------------------------------- |
371 // CCalenCustomisationManager::EnablePluginL |
374 // CCalenCustomisationManager::EnablePluginL |
372 // Enables the given plugin. Returns KErrNotFound if |
375 // Enables the given plugin. Returns KErrNotFound if |
373 // the plugin can't be found, KErrNone otherwise. |
376 // the plugin can't be found, KErrNone otherwise. |
374 // ---------------------------------------------------------------------------- |
377 // ---------------------------------------------------------------------------- |
375 // |
378 // |
376 void CCalenCustomisationManager::EnablePluginL( TUid aPluginUid ) |
379 void CCalenCustomisationManager::EnablePluginL( TUid aPluginUid ) |
377 { |
380 { |
378 TRACE_ENTRY_POINT; |
381 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_ENABLEPLUGINL_ENTRY ); |
379 |
|
380 // Check plugin isn't already enabled |
382 // Check plugin isn't already enabled |
381 TInt index = iPlugins.Find( aPluginUid, CPluginInfo::Identifier); |
383 TInt index = iPlugins.Find( aPluginUid, CPluginInfo::Identifier); |
382 |
384 |
383 if ( index == KErrNotFound ) |
385 if ( index == KErrNotFound ) |
384 { |
386 { |
395 // Issue notification of plugin been added |
397 // Issue notification of plugin been added |
396 iPluginsEnabledDisabled = ETrue; |
398 iPluginsEnabledDisabled = ETrue; |
397 iServices.IssueNotificationL( ECalenNotifyPluginEnabledDisabled ); |
399 iServices.IssueNotificationL( ECalenNotifyPluginEnabledDisabled ); |
398 } |
400 } |
399 |
401 |
400 TRACE_EXIT_POINT; |
402 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_ENABLEPLUGINL_EXIT ); |
401 } |
403 } |
402 |
404 |
403 // ---------------------------------------------------------------------------- |
405 // ---------------------------------------------------------------------------- |
404 // CCalenCustomisationManager::HandleNotificationL |
406 // CCalenCustomisationManager::HandleNotificationL |
405 // From MCalenNotificationHandler. Handles notifications. |
407 // From MCalenNotificationHandler. Handles notifications. |
406 // (other items were commented in a header). |
408 // (other items were commented in a header). |
407 // ---------------------------------------------------------------------------- |
409 // ---------------------------------------------------------------------------- |
408 // |
410 // |
409 void CCalenCustomisationManager::HandleNotification(const TCalenNotification aNotification ) |
411 void CCalenCustomisationManager::HandleNotification(const TCalenNotification aNotification ) |
410 { |
412 { |
411 TRACE_ENTRY_POINT; |
413 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_HANDLENOTIFICATION_ENTRY ); |
412 |
|
413 PIM_TRAPD_HANDLE( HandleNotificationL(aNotification) ); |
414 PIM_TRAPD_HANDLE( HandleNotificationL(aNotification) ); |
414 |
415 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_HANDLENOTIFICATION_EXIT ); |
415 TRACE_EXIT_POINT; |
|
416 } |
416 } |
417 |
417 |
418 // ---------------------------------------------------------------------------- |
418 // ---------------------------------------------------------------------------- |
419 // CCalenCustomisationManager::HandleNotificationL |
419 // CCalenCustomisationManager::HandleNotificationL |
420 // Handles notifications that the list of available plugins had been changed, |
420 // Handles notifications that the list of available plugins had been changed, |
425 // (other items were commented in a header). |
425 // (other items were commented in a header). |
426 // ---------------------------------------------------------------------------- |
426 // ---------------------------------------------------------------------------- |
427 // |
427 // |
428 void CCalenCustomisationManager::HandleNotificationL(TCalenNotification aNotification) |
428 void CCalenCustomisationManager::HandleNotificationL(TCalenNotification aNotification) |
429 { |
429 { |
430 TRACE_ENTRY_POINT; |
430 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_HANDLENOTIFICATIONL_ENTRY ); |
431 switch( aNotification ) |
431 switch( aNotification ) |
432 { |
432 { |
433 case ECalenNotifySystemLanguageChanged: |
433 case ECalenNotifySystemLanguageChanged: |
434 { |
434 { |
435 CreateActivePluginListL(); |
435 CreateActivePluginListL(); |
436 DoImmediatePluginLoadingL(); |
436 DoImmediatePluginLoadingL(); |
437 } |
437 } |
438 break; |
438 break; |
439 } |
439 } |
440 TRACE_EXIT_POINT; |
440 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_HANDLENOTIFICATIONL_EXIT ); |
441 } |
441 } |
442 |
442 |
443 |
443 |
444 // ---------------------------------------------------------------------------- |
444 // ---------------------------------------------------------------------------- |
445 // CCalenCustomisationManager::PluginInfoArray |
445 // CCalenCustomisationManager::PluginInfoArray |
492 |
490 |
493 } |
491 } |
494 } |
492 } |
495 } |
493 } |
496 |
494 |
497 TRACE_EXIT_POINT; |
495 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_DOIMMEDIATEPLUGINLOADINGL_EXIT ); |
498 } |
496 } |
499 |
497 |
500 // ---------------------------------------------------------------------------- |
498 // ---------------------------------------------------------------------------- |
501 // CCalenCustomisationManager::LoadPluginL |
499 // CCalenCustomisationManager::LoadPluginL |
502 // Loads a plugin |
500 // Loads a plugin |
503 // (other items were commented in a header). |
501 // (other items were commented in a header). |
504 // ---------------------------------------------------------------------------- |
502 // ---------------------------------------------------------------------------- |
505 // |
503 // |
506 void CCalenCustomisationManager::LoadPluginL( TUid aPluginUid ) |
504 void CCalenCustomisationManager::LoadPluginL( TUid aPluginUid ) |
507 { |
505 { |
508 TRACE_ENTRY_POINT; |
506 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_LOADPLUGINL_ENTRY ); |
509 |
|
510 // Get a new services object from global data |
507 // Get a new services object from global data |
511 MCalenServices* services = iServicesFactory.NewServicesL(); |
508 MCalenServices* services = iServicesFactory.NewServicesL(); |
512 CleanupStack::PushL( services ); |
509 CleanupStack::PushL( services ); |
513 // Creates the plugin and transfers ownership of the services |
510 // Creates the plugin and transfers ownership of the services |
514 // object to the plugin. |
511 // object to the plugin. |
535 // Returns the infobar. |
532 // Returns the infobar. |
536 // (other items were commented in a header). |
533 // (other items were commented in a header). |
537 // ---------------------------------------------------------------------------- |
534 // ---------------------------------------------------------------------------- |
538 HbWidget* CCalenCustomisationManager::Infobar( ) |
535 HbWidget* CCalenCustomisationManager::Infobar( ) |
539 { |
536 { |
540 TRACE_ENTRY_POINT; |
537 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_INFOBAR_ENTRY ); |
541 |
|
542 iInfoBarProviderUid = TUid::Uid(0); |
538 iInfoBarProviderUid = TUid::Uid(0); |
543 |
539 |
544 HbWidget* infoBar =NULL; |
540 HbWidget* infoBar =NULL; |
545 // Loop though all the command handlers, within two interlinked |
541 // Loop though all the command handlers, within two interlinked |
546 // for loops. If GetInfoBarL leaves for one plugin, a plugin |
542 // for loops. If GetInfoBarL leaves for one plugin, a plugin |
571 { |
567 { |
572 // Need to handle the error case |
568 // Need to handle the error case |
573 } |
569 } |
574 } |
570 } |
575 |
571 |
576 TRACE_EXIT_POINT; |
572 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_INFOBAR_EXIT ); |
577 return infoBar; |
573 return infoBar; |
578 } |
574 } |
579 |
575 |
580 // ---------------------------------------------------------------------------- |
576 // ---------------------------------------------------------------------------- |
581 // CCalenCustomisationManager::InfobarTextL |
577 // CCalenCustomisationManager::InfobarTextL |
582 // @returns info bar text |
578 // @returns info bar text |
583 // (other items were commented in a header). |
579 // (other items were commented in a header). |
584 // ---------------------------------------------------------------------------- |
580 // ---------------------------------------------------------------------------- |
585 // |
581 // |
586 QString* CCalenCustomisationManager::InfobarTextL() |
582 QString* CCalenCustomisationManager::InfobarTextL() |
587 { |
583 { |
588 TRACE_ENTRY_POINT; |
584 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_INFOBARTEXTL_ENTRY ); |
589 |
585 iInfoBarProviderUid = TUid::Uid(0); |
590 iInfoBarProviderUid = TUid::Uid(0); |
586 |
591 |
587 QString* infoBarText =NULL; |
592 QString* infoBarText =NULL; |
588 // Loop though all the command handlers, within two interlinked |
593 // Loop though all the command handlers, within two interlinked |
589 // for loops. If GetInfoBarL leaves for one plugin, a plugin |
594 // for loops. If GetInfoBarL leaves for one plugin, a plugin |
590 // error message will be displayed and the loop will continue with |
595 // error message will be displayed and the loop will continue with |
591 // the next command handler. If none of the plugins leave, there will |
596 // the next command handler. If none of the plugins leave, there will |
592 // be only one TRAP used. |
597 // be only one TRAP used. |
593 TInt count = iPlugins.Count(); |
598 TInt count = iPlugins.Count(); |
594 /*if(count > 0) |
599 /*if(count > 0) |
595 { |
600 { |
596 infoBar = iPlugins[0]->Plugin().InfobarL(); |
601 infoBar = iPlugins[0]->Plugin().InfobarL(); |
597 iInfoBarProviderUid = iPlugins[0]->Uid(); |
602 iInfoBarProviderUid = iPlugins[0]->Uid(); |
598 }*/ |
603 }*/ |
599 |
604 |
600 for ( TInt index = 0; index < count && !infoBarText; ++index ) |
605 for ( TInt index = 0; index < count && !infoBarText; ++index ) |
601 { |
606 { |
602 TRAPD( error, |
607 TRAPD( error, |
603 // Loop though until an infobar is found |
608 // Loop though until an infobar is found |
604 for (; index < count && !infoBarText; ++index ) |
609 for (; index < count && !infoBarText; ++index ) |
605 { |
610 { |
606 //if ( !iPlugins[index]->IsDisabled() ) |
611 //if ( !iPlugins[index]->IsDisabled() ) |
607 { |
612 { |
608 infoBarText = iPlugins[index]->Plugin().InfobarTextL(); |
613 infoBarText = iPlugins[index]->Plugin().InfobarTextL(); |
609 iInfoBarProviderUid = iPlugins[index]->Uid(); |
614 iInfoBarProviderUid = iPlugins[index]->Uid(); |
610 } |
615 } |
611 } |
616 } |
612 ); |
617 ); |
613 if(error) |
618 if(error) |
614 { |
619 { |
615 // Need to handle the error case |
620 // Need to handle the error case |
616 } |
621 } |
617 |
622 |
618 } |
623 } |
619 |
624 |
620 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_INFOBARTEXTL_EXIT ); |
625 TRACE_EXIT_POINT; |
621 return infoBarText; |
626 return infoBarText; |
622 } |
627 } |
|
628 |
623 |
629 // ---------------------------------------------------------------------------- |
624 // ---------------------------------------------------------------------------- |
630 // CCalenCustomisationManager::FindPluginL |
625 // CCalenCustomisationManager::FindPluginL |
631 // Finds a plugin and returns a plugin with a given uid, returns NULL |
626 // Finds a plugin and returns a plugin with a given uid, returns NULL |
632 // if the uid can not be found. |
627 // if the uid can not be found. |
633 // (other items were commented in a header). |
628 // (other items were commented in a header). |
634 // ---------------------------------------------------------------------------- |
629 // ---------------------------------------------------------------------------- |
635 // |
630 // |
636 CCalenCustomisation* CCalenCustomisationManager::FindPluginL( TUid aUid ) |
631 CCalenCustomisation* CCalenCustomisationManager::FindPluginL( TUid aUid ) |
637 { |
632 { |
638 TRACE_ENTRY_POINT; |
633 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_FINDPLUGINL_ENTRY ); |
639 |
|
640 TInt index = iPlugins.Find( aUid, CPluginInfo::Identifier ); |
634 TInt index = iPlugins.Find( aUid, CPluginInfo::Identifier ); |
641 |
635 |
642 CCalenCustomisation* plugin = NULL; |
636 CCalenCustomisation* plugin = NULL; |
643 if ( index != KErrNotFound ) |
637 if ( index != KErrNotFound ) |
644 { |
638 { |
645 plugin = &( iPlugins[index]->Plugin() ); |
639 plugin = &( iPlugins[index]->Plugin() ); |
646 } |
640 } |
647 |
641 |
648 TRACE_EXIT_POINT; |
642 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_FINDPLUGINL_EXIT ); |
649 return plugin; |
643 return plugin; |
650 } |
644 } |
651 |
645 |
652 // ---------------------------------------------------------------------------- |
646 // ---------------------------------------------------------------------------- |
653 // CCalenCustomisationManager::CPluginInfo::CPluginInfo( |
647 // CCalenCustomisationManager::CPluginInfo::CPluginInfo( |
659 CCalenCustomisation* aPlugin, |
653 CCalenCustomisation* aPlugin, |
660 TUid aUid ) |
654 TUid aUid ) |
661 : iPlugin( aPlugin ), |
655 : iPlugin( aPlugin ), |
662 iUid( aUid ) |
656 iUid( aUid ) |
663 { |
657 { |
664 TRACE_ENTRY_POINT; |
658 OstTraceFunctionEntry0( CPLUGININFO_CPLUGININFO_ENTRY ); |
665 TRACE_EXIT_POINT; |
659 OstTraceFunctionExit0( CPLUGININFO_CPLUGININFO_EXIT ); |
666 } |
660 } |
667 |
661 |
668 // ---------------------------------------------------------------------------- |
662 // ---------------------------------------------------------------------------- |
669 // CCalenCustomisationManager::CPluginInfo::~CPluginInfo( |
663 // CCalenCustomisationManager::CPluginInfo::~CPluginInfo( |
670 // C++ destructor |
664 // C++ destructor |
671 // (other items were commented in a header). |
665 // (other items were commented in a header). |
672 // ---------------------------------------------------------------------------- |
666 // ---------------------------------------------------------------------------- |
673 // |
667 // |
674 CCalenCustomisationManager::CPluginInfo::~CPluginInfo() |
668 CCalenCustomisationManager::CPluginInfo::~CPluginInfo() |
675 { |
669 { |
676 TRACE_ENTRY_POINT; |
670 OstTraceFunctionEntry0( DUP1_CPLUGININFO_CPLUGININFO_ENTRY ); |
677 |
|
678 delete iPlugin; |
671 delete iPlugin; |
679 |
672 |
680 TRACE_EXIT_POINT; |
673 OstTraceFunctionExit0( DUP1_CPLUGININFO_CPLUGININFO_EXIT ); |
681 } |
674 } |
682 |
675 |
683 // ---------------------------------------------------------------------------- |
676 // ---------------------------------------------------------------------------- |
684 // CCalenCustomisationManager::CPluginInfo::Plugin |
677 // CCalenCustomisationManager::CPluginInfo::Plugin |
685 // returns a reference to the plugin |
678 // returns a reference to the plugin |
686 // (other items were commented in a header). |
679 // (other items were commented in a header). |
687 // ---------------------------------------------------------------------------- |
680 // ---------------------------------------------------------------------------- |
688 // |
681 // |
689 CCalenCustomisation& CCalenCustomisationManager::CPluginInfo::Plugin() |
682 CCalenCustomisation& CCalenCustomisationManager::CPluginInfo::Plugin() |
690 { |
683 { |
691 TRACE_ENTRY_POINT; |
684 OstTraceFunctionEntry0( CPLUGININFO_PLUGIN_ENTRY ); |
692 TRACE_EXIT_POINT; |
685 |
693 |
686 OstTraceFunctionExit0( CPLUGININFO_PLUGIN_EXIT ); |
694 return *iPlugin; |
687 return *iPlugin; |
695 } |
688 } |
696 |
689 |
697 // ---------------------------------------------------------------------------- |
690 // ---------------------------------------------------------------------------- |
698 // CCalenCustomisationManager::CPluginInfo::Uid |
691 // CCalenCustomisationManager::CPluginInfo::Uid |
714 // (other items were commented in a header). |
706 // (other items were commented in a header). |
715 // ---------------------------------------------------------------------------- |
707 // ---------------------------------------------------------------------------- |
716 // |
708 // |
717 void CCalenCustomisationManager::CPluginInfo::Disable( TBool aDisable) |
709 void CCalenCustomisationManager::CPluginInfo::Disable( TBool aDisable) |
718 { |
710 { |
719 TRACE_ENTRY_POINT; |
711 OstTraceFunctionEntry0( CPLUGININFO_DISABLE_ENTRY ); |
720 |
|
721 iDisabled = aDisable; |
712 iDisabled = aDisable; |
722 |
713 |
723 TRACE_EXIT_POINT; |
714 OstTraceFunctionExit0( CPLUGININFO_DISABLE_EXIT ); |
724 } |
715 } |
725 |
716 |
726 // ---------------------------------------------------------------------------- |
717 // ---------------------------------------------------------------------------- |
727 // CCalenCustomisationManager::CPluginInfo::IsDisabled |
718 // CCalenCustomisationManager::CPluginInfo::IsDisabled |
728 // Returns if the plugin has been marked as being disabled |
719 // Returns if the plugin has been marked as being disabled |
729 // (other items were commented in a header). |
720 // (other items were commented in a header). |
730 // ---------------------------------------------------------------------------- |
721 // ---------------------------------------------------------------------------- |
731 // |
722 // |
732 TBool CCalenCustomisationManager::CPluginInfo::IsDisabled() |
723 TBool CCalenCustomisationManager::CPluginInfo::IsDisabled() |
733 { |
724 { |
734 TRACE_ENTRY_POINT; |
725 OstTraceFunctionEntry0( CPLUGININFO_ISDISABLED_ENTRY ); |
735 |
726 OstTraceFunctionExit0( CPLUGININFO_ISDISABLED_EXIT ); |
736 return iDisabled; |
727 return iDisabled; |
737 |
|
738 TRACE_EXIT_POINT; |
|
739 } |
728 } |
740 |
729 |
741 |
730 |
742 |
731 |
743 // ---------------------------------------------------------------------------- |
732 // ---------------------------------------------------------------------------- |
747 // ---------------------------------------------------------------------------- |
736 // ---------------------------------------------------------------------------- |
748 // |
737 // |
749 void CCalenCustomisationManager::AddPluginL( CCalenCustomisation* aPlugin, |
738 void CCalenCustomisationManager::AddPluginL( CCalenCustomisation* aPlugin, |
750 TUid aUid ) |
739 TUid aUid ) |
751 { |
740 { |
752 TRACE_ENTRY_POINT; |
741 OstTraceFunctionEntry0( CCALENCUSTOMISATIONMANAGER_ADDPLUGINL_ENTRY ); |
753 |
|
754 CPluginInfo* newPlugin = new ( ELeave ) CPluginInfo( aPlugin, aUid); |
742 CPluginInfo* newPlugin = new ( ELeave ) CPluginInfo( aPlugin, aUid); |
755 CleanupStack::PushL( newPlugin ); |
743 CleanupStack::PushL( newPlugin ); |
756 iPlugins.AppendL( newPlugin ); |
744 iPlugins.AppendL( newPlugin ); |
757 CleanupStack::Pop( newPlugin ); |
745 CleanupStack::Pop( newPlugin ); |
758 |
746 OstTraceFunctionExit0( CCALENCUSTOMISATIONMANAGER_ADDPLUGINL_EXIT ); |
759 TRACE_EXIT_POINT; |
|
760 } |
747 } |
761 |
748 |
762 // ---------------------------------------------------------------------------- |
749 // ---------------------------------------------------------------------------- |
763 // CCalenCustomisationManager::CPluginInfo::Identifier( |
750 // CCalenCustomisationManager::CPluginInfo::Identifier( |
764 // Matches an uid and a plugin uid. Used by FindPluginL to |
751 // Matches an uid and a plugin uid. Used by FindPluginL to |