calendarui/customisationmanager/src/calencustomisationmanager.cpp
branchRCL_3
changeset 28 96907930389d
parent 20 9c5b1510919f
child 29 12af337248b1
equal deleted inserted replaced
27:aba12c885d83 28:96907930389d
   142     if(iSetting)
   142     if(iSetting)
   143         {
   143         {
   144         iSetting->Release();
   144         iSetting->Release();
   145         }
   145         }
   146     iHiddenViews.Reset();
   146     iHiddenViews.Reset();
   147     iDefferedUnloadPluginList.Reset();
       
   148 
   147 
   149     TRACE_EXIT_POINT;
   148     TRACE_EXIT_POINT;
   150     }
   149     }
   151 
   150 
   152 // ----------------------------------------------------------------------------
   151 // ----------------------------------------------------------------------------
   427             // Mark the plugin as being disabled
   426             // Mark the plugin as being disabled
   428             pluginInfo->Disable( ETrue );
   427             pluginInfo->Disable( ETrue );
   429              
   428              
   430             // Remove the plugin from the active plugin list
   429             // Remove the plugin from the active plugin list
   431             TInt position = iActivePlugins.Find( aPluginUid );
   430             TInt position = iActivePlugins.Find( aPluginUid );
   432             ASSERT( position != KErrNotFound );
   431             if(position == KErrNotFound ) // plugin has already been removed
       
   432                 { 
       
   433                 return ;
       
   434                 }
   433             
   435             
   434             iActivePlugins.Remove( position );
   436             iActivePlugins.Remove( position );
   435              
   437              
   436             // Does this plugin hide any views
   438             // Does this plugin hide any views
   437             RArray<TInt> removedViews;
   439             RArray<TInt> removedViews;
   499         {
   501         {
   500         TInt position = iPlugins.Find( aPlugins[index], CPluginInfo::Identifier );
   502         TInt position = iPlugins.Find( aPlugins[index], CPluginInfo::Identifier );
   501         if ( position != KErrNotFound ) 
   503         if ( position != KErrNotFound ) 
   502 	        {
   504 	        {
   503             TUid pluginUid = iPlugins[ position]->Uid();
   505             TUid pluginUid = iPlugins[ position]->Uid();
   504             if(!(iRomBasedPlugins.Find(pluginUid) != KErrNotFound))
   506             if(!iPluginInfo[position]->RomBased())           
   505                 {
   507                 {
   506                     if((iInfoBarProviderUid != iPlugins[position]->Uid())
   508                     if((iInfoBarProviderUid != iPlugins[position]->Uid())
   507                         && (iPreviewPaneProviderUid != iPlugins[ position]->Uid()))
   509                         && (iPreviewPaneProviderUid != iPlugins[ position]->Uid()))
   508                         {
   510                         {
   509                         CPluginInfo* removedPlugin = iPlugins[ position ];                   
   511                         CPluginInfo* removedPlugin = iPlugins[ position ];                   
   549         iActivePlugins.AppendL( aPluginUid );
   551         iActivePlugins.AppendL( aPluginUid );
   550     
   552     
   551         // Issue notification of plugin been added
   553         // Issue notification of plugin been added
   552         iPluginsEnabledDisabled = ETrue;
   554         iPluginsEnabledDisabled = ETrue;
   553         iServices.IssueNotificationL( ECalenNotifyPluginEnabledDisabled );
   555         iServices.IssueNotificationL( ECalenNotifyPluginEnabledDisabled );
       
   556         }
       
   557 		else
       
   558     	{
       
   559 		// Ensure plugin is enabled
       
   560 		if(iPlugins[index]->IsDisabled())
       
   561 			{
       
   562 			iPlugins[index]->Disable( EFalse );
       
   563 			iServices.IssueNotificationL( ECalenNotifyPluginEnabledDisabled );
       
   564 			}
   554         }
   565         }
   555     
   566     
   556     TRACE_EXIT_POINT;
   567     TRACE_EXIT_POINT;
   557     }
   568     }
   558 	
   569 	
   737 // Examines the properties of the plugin list and
   748 // Examines the properties of the plugin list and
   738 // loads those that need to loaded on start-up
   749 // loads those that need to loaded on start-up
   739 // (other items were commented in a header).
   750 // (other items were commented in a header).
   740 // ----------------------------------------------------------------------------
   751 // ----------------------------------------------------------------------------
   741 //
   752 //
   742 void CCalenCustomisationManager::DoImmediatePluginLoadingL(TBool aLoadViewbasedPulgins)
   753 void CCalenCustomisationManager::DoImmediatePluginLoadingL()
   743     {
   754     {
   744     TRACE_ENTRY_POINT;
   755     TRACE_ENTRY_POINT;
   745 
   756 
   746     
   757     
   747     for(TInt i = 0 ; i < iPlugins.Count() ; i++)
   758     for(TInt i = 0 ; i < iPlugins.Count() ; i++)
   757     TInt pluginCount = iPluginInfo.Count();
   768     TInt pluginCount = iPluginInfo.Count();
   758 
   769 
   759     for ( TInt index( 0 ); index < pluginCount; ++index )
   770     for ( TInt index( 0 ); index < pluginCount; ++index )
   760         {
   771         {
   761         TUid pluginUid = iPluginInfo[index]->ImplementationUid();
   772         TUid pluginUid = iPluginInfo[index]->ImplementationUid();
   762         TBool loadPlugins(EFalse);
       
   763         
   773         
   764         if(aLoadViewbasedPulgins)
   774         if ( iActivePlugins.Find( pluginUid ) != KErrNotFound )        
   765             {
       
   766             if ( (iActivePlugins.Find( pluginUid ) != KErrNotFound) && 
       
   767                  !(iRomBasedPlugins.Find( pluginUid ) != KErrNotFound) )
       
   768                 {
       
   769                 loadPlugins = ETrue;
       
   770                 }                
       
   771             }
       
   772         else if((iActivePlugins.Find( pluginUid ) != KErrNotFound))
       
   773             {
       
   774             loadPlugins = ETrue;
       
   775             }       
       
   776         
   775         
   777         if (loadPlugins)
       
   778             {
   776             {
   779             TRAPD( error, LoadPluginL( pluginUid ) );
   777             TRAPD( error, LoadPluginL( pluginUid ) );
   780             if ( error )
   778             if ( error )
   781                 {
   779                 {
   782                 // report a problem loading the plugin
   780                 // report a problem loading the plugin
  1289     for ( TInt index = 0; index < count; ++index )
  1287     for ( TInt index = 0; index < count; ++index )
  1290         {
  1288         {
  1291         TRAPD( error,
  1289         TRAPD( error,
  1292             for (; index < count; ++index )
  1290             for (; index < count; ++index )
  1293                 {
  1291                 {
       
  1292                 if ( !iPlugins[index]->IsDisabled() )
       
  1293                     {
  1294                 iPlugins[index]->Plugin().CustomiseMenuPaneL( aResourceId,
  1294                 iPlugins[index]->Plugin().CustomiseMenuPaneL( aResourceId,
  1295                                                              aMenuPane );
  1295                                                              aMenuPane );
  1296                                                              
  1296                                                              
  1297                 // The commands added should be checked to see that
  1297                 // The commands added should be checked to see that
  1298                 // they match the expected command range for the plugin
  1298                 // they match the expected command range for the plugin
       
  1299                     }
  1299                 }
  1300                 }
  1300              );
  1301              );
  1301          
  1302          
  1302         if ( error )
  1303         if ( error )
  1303             {
  1304             {
  1428 //           
  1429 //           
  1429 void CCalenCustomisationManager::AddPluginL( CCalenCustomisation* aPlugin,
  1430 void CCalenCustomisationManager::AddPluginL( CCalenCustomisation* aPlugin,
  1430                                              TUid aUid ) 
  1431                                              TUid aUid ) 
  1431     {
  1432     {
  1432     TRACE_ENTRY_POINT;
  1433     TRACE_ENTRY_POINT;
  1433 
  1434     TInt index = iPlugins.Find( aUid, CPluginInfo::Identifier );
       
  1435     if ( index == KErrNotFound )
       
  1436         {
  1434     CPluginInfo* newPlugin = new ( ELeave ) CPluginInfo( aPlugin, aUid);
  1437     CPluginInfo* newPlugin = new ( ELeave ) CPluginInfo( aPlugin, aUid);
  1435     CleanupStack::PushL( newPlugin );
  1438     CleanupStack::PushL( newPlugin );
  1436     iPlugins.AppendL( newPlugin );
  1439     iPlugins.AppendL( newPlugin );
  1437     CleanupStack::Pop( newPlugin );
  1440     CleanupStack::Pop( newPlugin );
       
  1441         }
  1438 
  1442 
  1439     TRACE_EXIT_POINT;
  1443     TRACE_EXIT_POINT;
  1440     }
  1444     }
  1441 
  1445 
  1442 // ----------------------------------------------------------------------------
  1446 // ----------------------------------------------------------------------------
  1492 EXPORT_C void CCalenCustomisationManager::DoPluginLoadingL()
  1496 EXPORT_C void CCalenCustomisationManager::DoPluginLoadingL()
  1493     {
  1497     {
  1494     TRACE_ENTRY_POINT;
  1498     TRACE_ENTRY_POINT;
  1495     // Reset and destroy the contents of the owned arrays    
  1499     // Reset and destroy the contents of the owned arrays    
  1496     //iPlugins.ResetAndDestroy();
  1500     //iPlugins.ResetAndDestroy();
  1497 
       
  1498     iPluginInfo.ResetAndDestroy();
       
  1499 
       
  1500     iActivePlugins.Reset();
       
  1501 
       
  1502     iHiddenViews.Reset();
  1501     iHiddenViews.Reset();
  1503     iDefferedUnloadPluginList.Reset();
  1502     iDefferedUnloadPluginList.Reset();
  1504     // create active plugin list
  1503     // create active plugin list
  1505     CreateActivePluginListL();
  1504     CreateActivePluginListL();
  1506     
  1505     
  1507     DoImmediatePluginLoadingL(ETrue);
  1506     DoImmediatePluginLoadingL();
  1508     iSetting->LoadL();
  1507     iSetting->LoadL();
  1509     iSetting->UpdatePluginListL(*this);
  1508     iSetting->UpdatePluginListL(*this);
  1510     
  1509     
  1511     TRACE_EXIT_POINT;
  1510     TRACE_EXIT_POINT;
  1512     }
  1511     }
  1522     
  1521     
  1523     TInt pluginCount = iPluginInfo.Count();
  1522     TInt pluginCount = iPluginInfo.Count();
  1524     for(TInt index = 0;index<pluginCount;index++)
  1523     for(TInt index = 0;index<pluginCount;index++)
  1525         {
  1524         {
  1526         TUid pluginUid = iPluginInfo[index]->ImplementationUid();
  1525         TUid pluginUid = iPluginInfo[index]->ImplementationUid();
  1527         if(iActivePlugins.Find(pluginUid)!=KErrNotFound)
  1526         if ((iActivePlugins.Find(pluginUid) != KErrNotFound)
       
  1527                 && !(iRomBasedPlugins.Find(pluginUid) != KErrNotFound))
  1528             {
  1528             {
  1529             DisablePluginOnFakeExitL(pluginUid);
  1529             DisablePluginOnFakeExitL(pluginUid);
  1530             }
  1530             }
  1531         }
  1531         }
  1532     
  1532