phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp
branchRCL_3
changeset 12 4ae315f230bc
parent 8 5586b4d2ec3e
child 13 a6539d1e8e43
equal deleted inserted replaced
11:2828b4d142c0 12:4ae315f230bc
   258 void CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL(
   258 void CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL(
   259     CEikMenuPane* aMenuPane )
   259     CEikMenuPane* aMenuPane )
   260     {
   260     {
   261     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL()"));
   261     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL()"));
   262     
   262     
   263     // Used for checking whether some maps have been installed or not.
       
   264     RPointerArray<CMnProvider> providers;
       
   265     CleanupClosePushL( providers );
       
   266     MnProviderFinder::FindProvidersL( providers, CMnProvider::EServiceMapView );
       
   267     
       
   268     if ( !iPlugin.Container().CommMethodsAvailable() )
   263     if ( !iPlugin.Container().CommMethodsAvailable() )
   269         {// no comm methods available
   264         {// no comm methods available
   270         aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectCmd );
   265         aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectCmd );
   271         // ECCAppCommLauncherDefaultsCmd is deleted in the SimContactDynInitMenuPaneL() method
   266         // ECCAppCommLauncherDefaultsCmd is deleted in the SimContactDynInitMenuPaneL() method
   272         if (iContactStore != ECmsContactStoreSim)
   267         if (iContactStore != ECmsContactStoreSim)
   273             {
   268             {
   274             aMenuPane->DeleteMenuItem( ECCAppCommLauncherDefaultsCmd );
   269             aMenuPane->DeleteMenuItem( ECCAppCommLauncherDefaultsCmd );
   275             }
   270             }
   276         }
   271         }
   277     // If the count equals to 0, it means:
   272     else
   278     // No map is installed and there must be no adress item displayed in launcher view. 
       
   279     else if ( providers.Count() > 0 )
       
   280     	{
   273     	{
   281         CCCAppCommLauncherContactHandler& contactHandler = iPlugin.ContactHandler();
   274         CCCAppCommLauncherContactHandler& contactHandler = iPlugin.ContactHandler();
   282         
   275         
   283         // Get the number how many addresses are defined.
   276         // Get the number how many addresses are defined.
   284         TInt addressAmount = 
   277         const TInt addressAmount = 
   285              contactHandler.AddressAmount( VPbkFieldTypeSelectorFactory::EFindOnMapSelector);
   278              contactHandler.AddressAmount( VPbkFieldTypeSelectorFactory::EFindOnMapSelector);
   286         
   279         
   287         // If the amount of address is not 0 and the amount of listbox in launcher view is 1.
   280         // If the amount of address is not 0 and the amount of listbox in launcher view is 1.
   288         // That means only address is defined in the contact.
   281         // That means only address is defined in the contact.
   289         if ( ( addressAmount > 0 ) 
   282         if ( ( addressAmount > 0 ) 
   290         	   && ( iPlugin.Container().GetListBoxItemAmount() == 1 ) )
   283         	   && ( iPlugin.Container().GetListBoxItemAmount() == 1 ) )
   291         	{
   284         	{
   292         	aMenuPane->DeleteMenuItem( ECCAppCommLauncherDefaultsCmd );
   285         	aMenuPane->DeleteMenuItem( ECCAppCommLauncherDefaultsCmd );
   293         	}
   286         	}
   294     	}
   287     	}
   295 
       
   296     providers.ResetAndDestroy();
       
   297     CleanupStack::PopAndDestroy( &providers );
       
   298     
   288     
   299     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL()"));
   289     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL()"));
   300     }
   290     }
   301 
   291 
   302 // ---------------------------------------------------------------------------
   292 // ---------------------------------------------------------------------------