defaultapplicationsettings/server/src/das_srvmime_dlg.cpp
branchRCL_3
changeset 35 5f281e37a2f5
parent 0 254040eb3b7d
equal deleted inserted replaced
34:90fe62538f66 35:5f281e37a2f5
       
     1 /*
       
     2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of the Services & MIME view class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // System includes
       
    21 #include <e32base.h>
       
    22 #include <AknIconArray.h> 
       
    23 #include <gulicon.h>
       
    24 #include <AknsUtils.h>
       
    25 #include <avkon.mbg>
       
    26 
       
    27 #include <featmgr.h>
       
    28 #include <hlplch.h>
       
    29 
       
    30 #include <aknlists.h>
       
    31 #include <barsread.h>
       
    32 #include <e32def.h>
       
    33 #include <eikclbd.h>
       
    34 #include <eikmenub.h>
       
    35 
       
    36 #include <defaultappserver.rsg>
       
    37 #include <StringLoader.h>
       
    38 #include <uikon.hrh>
       
    39 #include <aknPopup.h>
       
    40 #include <akntitle.h>
       
    41 #include <aknsfld.h>
       
    42 #include <featmgr.h>
       
    43 
       
    44 #include <aknsettingitemlist.h> 
       
    45 
       
    46 #include "das_srvmime_dlg.h"
       
    47 #include "das_servmimeapps.h"
       
    48 #include "das_appui.h"
       
    49 #include "das_app.h"
       
    50 #include "das.hrh"
       
    51 #include "das.hlp.hrh"
       
    52 
       
    53 
       
    54 // ======== MEMBER FUNCTIONS ========
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // Symbian 2-phased constructor
       
    58 // ---------------------------------------------------------------------------
       
    59 //    
       
    60 CDefaultAppSrvMimeDlg* CDefaultAppSrvMimeDlg::NewL(CDefaultAppAppUi* aAppUi)
       
    61     {
       
    62     //we first need to create a CDefaultAppServMimeApps instance
       
    63     TInt *selected;
       
    64     if(aAppUi->iReloadDlgAdvanced)
       
    65     {
       
    66     	//some settings for the advanced view
       
    67     	selected=&(aAppUi->iSelectedItemAdvanced);
       
    68     }
       
    69     else
       
    70     {
       
    71         //some settings for the simple view
       
    72     	selected=&(aAppUi->iSelectedItemSimple);
       
    73     };
       
    74     
       
    75     //create the dialog instance (ownership of servMimeApps is passed to the dialog
       
    76     CDefaultAppSrvMimeDlg *dialog=new(ELeave)CDefaultAppSrvMimeDlg(aAppUi, selected);
       
    77     CleanupStack::PushL(dialog);
       
    78     dialog->ConstructL(R_DAS_MENUBAR); 
       
    79     CleanupStack::Pop(dialog);
       
    80     return dialog;
       
    81     }
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // C++ Constructor
       
    85 // ---------------------------------------------------------------------------
       
    86 //    
       
    87 CDefaultAppSrvMimeDlg::CDefaultAppSrvMimeDlg(CDefaultAppAppUi* aAppUi, TInt *aSelected) : 
       
    88     CAknSelectionListDialog(*aSelected, &aAppUi->iServMimeApps->iList, NULL), 
       
    89     iDefaultAppUi(aAppUi), iSelected(aSelected), iOkToExit(EFalse)
       
    90     {
       
    91     //no implementation necessary
       
    92     }
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 // Destructor
       
    96 // ---------------------------------------------------------------------------
       
    97 //    
       
    98 CDefaultAppSrvMimeDlg::~CDefaultAppSrvMimeDlg()
       
    99     {
       
   100     if ( iDefaultAppUi )
       
   101         {
       
   102         iDefaultAppUi->SetDialogExist( EFalse );
       
   103         }
       
   104     
       
   105     if ( iPopupList )
       
   106         {
       
   107         iPopupList->CancelPopup();
       
   108         iPopupList = NULL;
       
   109         }
       
   110     }
       
   111 
       
   112 
       
   113 // ---------------------------------------------------------------------------
       
   114 // From class From CAknSelectionListDialog
       
   115 // This function is called when buttons/softkeys are pressed, to check if the dlg should exit.
       
   116 // We make the checkings and return the result.
       
   117 // ---------------------------------------------------------------------------
       
   118 //   
       
   119 TBool CDefaultAppSrvMimeDlg::OkToExitL(TInt aButtonId)
       
   120     {
       
   121     CAknSelectionListDialog::OkToExitL(aButtonId);
       
   122     if ( aButtonId == EAknSoftkeyOptions && iPopupList )
       
   123     	{
       
   124     	iPopupList->CancelPopup();
       
   125     	iPopupList = NULL;
       
   126     	}
       
   127     if(aButtonId == EAknSoftkeyBack || aButtonId == EAknCmdOpen || aButtonId == EAknSoftkeyOk)
       
   128         {
       
   129         ProcessCommandL(aButtonId);
       
   130         };
       
   131     if(aButtonId==EAknCmdEnd || aButtonId==EAknSoftkeyCancel)
       
   132     	{
       
   133     	iOkToExit=ETrue;
       
   134     	iDefaultAppUi->iReloadDlg=EFalse;
       
   135     	}
       
   136     return iOkToExit;
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // From class From CAknSelectionListDialog
       
   141 // This function is called when a command is issued by the user.
       
   142 // ---------------------------------------------------------------------------
       
   143 //
       
   144 void CDefaultAppSrvMimeDlg::ProcessCommandL(TInt aCommand)
       
   145     {
       
   146     CAknSelectionListDialog::ProcessCommandL(aCommand); //this hides the menu and takes care of find
       
   147     iEnterKeyPressed=EFalse; 
       
   148     
       
   149     
       
   150     *iSelected = ListBox()->CurrentItemIndex();
       
   151     if (FindBox() && *iSelected != -1)
       
   152 	    *iSelected = STATIC_CAST(CAknFilteredTextListBoxModel*,ListBox()->Model())->Filter()->FilteredItemIndex(*iSelected);
       
   153     // ATTENTION: If *iSelected is -1 it means that the list is empty!
       
   154 
       
   155     
       
   156     switch(aCommand)
       
   157         {
       
   158     case EDasCmdAdvanced:
       
   159         //SwitchViewL();
       
   160         
       
   161         //make the dialog reload        
       
   162         iDefaultAppUi->iReloadDlgAdvanced=ETrue;
       
   163         iOkToExit=ETrue;
       
   164         //force our exit
       
   165         TryExitL(0);
       
   166         
       
   167         break;
       
   168     case EAknCmdHelp:
       
   169         HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), iDefaultAppUi->AppHelpContextL());
       
   170         break;
       
   171     case EDasCmdResetAll:
       
   172     case EDasCmdResetSelected:
       
   173         if(aCommand==EDasCmdResetSelected)
       
   174         {
       
   175         	if(*iSelected!=-1)
       
   176         	    iDefaultAppUi->iServMimeApps->RestoreFactorySettingsL(*iSelected);
       
   177         }   
       
   178         else
       
   179             iDefaultAppUi->iServMimeApps->RestoreFactorySettingsL(-1);
       
   180             
       
   181         //common code:
       
   182         //reload the dialog
       
   183         if(!iDefaultAppUi->iServMimeApps->iSimplifiedView)
       
   184             iDefaultAppUi->iReloadDlgAdvanced=ETrue;
       
   185         iOkToExit=ETrue;
       
   186         //delete the iServMimeApps so that it will be reloaded next time
       
   187         delete iDefaultAppUi->iServMimeApps;
       
   188         iDefaultAppUi->iServMimeApps=NULL;
       
   189         //force our exit
       
   190         TryExitL(0);
       
   191         break;
       
   192     case EAknCmdExit:
       
   193         //exit the server
       
   194         iOkToExit=ETrue;
       
   195         iDefaultAppUi->iReloadDlg=EFalse;
       
   196         //force our exit
       
   197         TryExitL(0);
       
   198         break;
       
   199     case EAknSoftkeyBack:
       
   200         //we have 2 cases here: 
       
   201         //if we are in the advanced view, we switch back to the simple view.
       
   202         //if we are in the simple view, then we exit the server
       
   203         if(iDefaultAppUi->iServMimeApps->iAppUid == KUidGS && !iDefaultAppUi->iServMimeApps->iSimplifiedView)
       
   204             {
       
   205             //switch back to simple view
       
   206             //make the dialog reload
       
   207             iDefaultAppUi->iReloadDlgAdvanced=EFalse;
       
   208             iOkToExit=ETrue;
       
   209             // no need to force our exit, we are comming from a TryExitL() 
       
   210             }
       
   211         else
       
   212             {
       
   213             //exit the server
       
   214             iOkToExit=ETrue;
       
   215             iDefaultAppUi->iReloadDlg=EFalse;
       
   216             //tell AppUi that the exit is due a "Back" command
       
   217             iDefaultAppUi->iExitBack=ETrue;
       
   218             }
       
   219         break;
       
   220     case EAknCmdOpen:
       
   221     case EAknSoftkeyOk:
       
   222         //we have the index of the selected item in *iSelected
       
   223         OpenMenuForSelectedServiceAndMimeL(*iSelected);
       
   224         break;    
       
   225         }
       
   226     }
       
   227 
       
   228 // ---------------------------------------------------------------------------
       
   229 // From class From CAknSelectionListDialog
       
   230 // Called during the construction of the dialog. We build the list of elements here.
       
   231 // ---------------------------------------------------------------------------
       
   232 //    
       
   233 void CDefaultAppSrvMimeDlg::PreLayoutDynInitL()
       
   234     {
       
   235     CAknSelectionListDialog::PreLayoutDynInitL();
       
   236     
       
   237     CEikSettingsListBox* listbox=(CEikSettingsListBox*)ListBox();
       
   238     // Ownership retained by us
       
   239     listbox->CreateScrollBarFrameL( ETrue );
       
   240     listbox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto );
       
   241     listbox->UpdateScrollBarsL();   
       
   242 
       
   243     //enable marquee
       
   244     EnableMarqueeL();   
       
   245         
       
   246     //restore the selected item    
       
   247     if(*iSelected >= 0)
       
   248         {
       
   249         listbox->SetCurrentItemIndex(*iSelected);
       
   250         };
       
   251         
       
   252     //change the title
       
   253     CEikStatusPane *statusPane=iDefaultAppUi->StatusPane();
       
   254     if(statusPane && statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidTitle)).IsPresent())
       
   255         {
       
   256         CAknTitlePane *titlePane=(CAknTitlePane*)(statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
       
   257         HBufC* titleString;
       
   258         //load the correct title string
       
   259         if(iDefaultAppUi->iReloadDlgAdvanced)
       
   260             {
       
   261                 if(iDefaultAppUi->iClientUid == KUidGS)
       
   262                     //User activated advanced view in Control Panel
       
   263                     titleString=StringLoader::LoadLC(R_DA_TITLE_ADVANCED);
       
   264                 else //Client is some application other than Control Panel; load app specific view.
       
   265                     titleString=StringLoader::LoadLC(R_DA_TITLE_APP);
       
   266             }
       
   267         else //Simple view in Control Panel
       
   268             titleString=StringLoader::LoadLC(R_DA_TITLE_MAIN);
       
   269         titlePane->SetTextL(*titleString);
       
   270         CleanupStack::PopAndDestroy(titleString);
       
   271         };
       
   272     
       
   273     ListBox()->AddItemChangeObserverL( this );
       
   274     }
       
   275     
       
   276 // ---------------------------------------------------------------------------
       
   277 // From class CAknDialog.
       
   278 // Called when the menu is initialized.
       
   279 // ---------------------------------------------------------------------------
       
   280 //
       
   281 void CDefaultAppSrvMimeDlg::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
       
   282     {
       
   283     if (aResourceId != R_DAS_MENU) return;
       
   284     __ASSERT_ALWAYS(iDefaultAppUi->iServMimeApps,User::Leave(KErrGeneral));
       
   285     
       
   286     // for !iSimplifiedView dim the EDasCmdAdvanced
       
   287     if(!iDefaultAppUi->iServMimeApps->iSimplifiedView)
       
   288         aMenuPane->SetItemDimmed(EDasCmdAdvanced, ETrue);    
       
   289     
       
   290     // if the Client is not observing when we are exiting, then dim the Exit
       
   291     if(iDefaultAppUi->iServMimeApps->iFlagNoObserver)
       
   292         aMenuPane->SetItemDimmed(EAknCmdExit, ETrue);
       
   293     
       
   294     // Help should be displayed only if the feature is supported
       
   295     // according to Feature Manager
       
   296     if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
       
   297         {
       
   298         aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue);
       
   299         }
       
   300 		//if the findbox already exists, dim the find menu item.
       
   301     if ( FindBox()->IsVisible() )
       
   302         {
       
   303         aMenuPane->SetItemDimmed(EAknCmdFindPopupActivated, ETrue);
       
   304         }
       
   305     
       
   306     CTextListBoxModel* modelSm = ( ( CEikSettingsListBox* )ListBox() )->Model();  // not taking ownership
       
   307     TInt itemCount = modelSm->NumberOfItems();
       
   308 		//if the listbox is empty, dim the change menu item.
       
   309     if (itemCount == 0)
       
   310         {
       
   311         aMenuPane->SetItemDimmed(EAknCmdOpen, ETrue);
       
   312         }
       
   313     
       
   314     }
       
   315     
       
   316 // ---------------------------------------------------------------------------
       
   317 // From class CCoeControl.
       
   318 // Called to get the help context.
       
   319 // ---------------------------------------------------------------------------
       
   320 //
       
   321 void CDefaultAppSrvMimeDlg::GetHelpContext(TCoeHelpContext& aContext) const
       
   322     {
       
   323     aContext.iMajor = KUidDefaultAppServer;
       
   324     
       
   325     //check if we have proper values
       
   326     if(!iDefaultAppUi->iServMimeApps)
       
   327         aContext.iContext = KDA_HLP_MAIN;
       
   328     else
       
   329         {
       
   330         //check for GS client
       
   331         if (iDefaultAppUi->iServMimeApps->iAppUid == KUidGS)
       
   332             {
       
   333             //the client is GS. Check for simplified or advanced view
       
   334             if (iDefaultAppUi->iServMimeApps->iSimplifiedView)
       
   335                 aContext.iContext = KDA_HLP_MAIN;
       
   336             else
       
   337                 aContext.iContext = KDA_HLP_ADVANCED;
       
   338             }
       
   339         else
       
   340             {
       
   341             //this is not GS client
       
   342             aContext.iContext = KDA_HLP_APPLICATION;
       
   343             };
       
   344         };
       
   345     }
       
   346 
       
   347 // ---------------------------------------------------------------------------
       
   348 // From class CCoeControl.
       
   349 // Called to get the help context.
       
   350 // ---------------------------------------------------------------------------
       
   351 //    
       
   352 void CDefaultAppSrvMimeDlg::SizeChanged()
       
   353     {
       
   354     CAknSelectionListDialog::SizeChanged(); 
       
   355     }
       
   356    
       
   357     
       
   358 // ---------------------------------------------------------------------------
       
   359 // Enables marquee for the list elements.
       
   360 // ---------------------------------------------------------------------------
       
   361 //  
       
   362 void CDefaultAppSrvMimeDlg::EnableMarqueeL()
       
   363     {
       
   364     CFormattedCellListBoxData *tmp=((CEikSettingsListBox*)(ListBox()))->ItemDrawer()->FormattedCellData();
       
   365     
       
   366     tmp->SetMarqueeParams(KMaxTInt, 6, 2000000, 10000); // Magic: loop forever
       
   367     tmp->EnableMarqueeL(ETrue);
       
   368     }
       
   369 
       
   370 
       
   371 // ---------------------------------------------------------------------------
       
   372 // Loads icons from a file and sets them in the drawer for iSavedGamesList
       
   373 // ---------------------------------------------------------------------------
       
   374 //  
       
   375 CArrayPtr<CGulIcon>* CDefaultAppSrvMimeDlg::GetPopupListIconsL() const
       
   376     {
       
   377     // CGulIcon class packages two bitmaps: icon image and its mask
       
   378     // CAknIconArray inherits from CArrayPtrFlat
       
   379     CArrayPtr<CGulIcon>* iconList = new (ELeave) 
       
   380                                  CAknIconArray(2);
       
   381     CleanupStack::PushL(iconList);
       
   382     
       
   383     TFileName iconFile( AknIconUtils::AvkonIconFileName() );
       
   384     MAknsSkinInstance* skinInstance;
       
   385     CFbsBitmap* newIconBmp = NULL;
       
   386     CFbsBitmap* newIconBmpMask = NULL;
       
   387     CGulIcon* newIcon = NULL;
       
   388     
       
   389     skinInstance = AknsUtils::SkinInstance();
       
   390               
       
   391     //creating blank icon
       
   392     AknsUtils::CreateIconLC(skinInstance,KAknsIIDQgnPropEmpty,
       
   393                            newIconBmp,newIconBmpMask,iconFile,
       
   394                            EMbmAvkonQgn_prop_empty,
       
   395                            EMbmAvkonQgn_prop_empty_mask);
       
   396     
       
   397     newIcon = CGulIcon::NewL(newIconBmp,newIconBmpMask);
       
   398     
       
   399     CleanupStack::Pop(2);//newIconBmp & newIconBmpMask
       
   400     CleanupStack::PushL(newIcon);
       
   401     iconList->AppendL(newIcon);
       
   402     
       
   403     CleanupStack::Pop(newIcon);     
       
   404               
       
   405     //creating TICK mark icon
       
   406     AknsUtils::CreateIconLC(skinInstance,KAknsIIDQgnPropSubCurrent,
       
   407                            newIconBmp,newIconBmpMask,iconFile,
       
   408                            EMbmAvkonQgn_prop_sub_current,
       
   409                            EMbmAvkonQgn_prop_sub_current_mask);
       
   410     
       
   411     newIcon = CGulIcon::NewL(newIconBmp,newIconBmpMask);
       
   412     
       
   413     CleanupStack::Pop(2);//newIconBmp & newIconBmpMask
       
   414     CleanupStack::PushL(newIcon);
       
   415     iconList->AppendL(newIcon);
       
   416 
       
   417     CleanupStack::Pop(newIcon);
       
   418     
       
   419     CleanupStack::Pop(iconList);
       
   420 
       
   421     newIconBmp = NULL;
       
   422     newIconBmpMask = NULL;
       
   423     newIcon = NULL;
       
   424 
       
   425     return iconList;
       
   426     }
       
   427         
       
   428     
       
   429 // ---------------------------------------------------------------------------
       
   430 // Pops-up a menu list with the Applications for the selected Service & MIME item
       
   431 // ---------------------------------------------------------------------------
       
   432 //  
       
   433 void CDefaultAppSrvMimeDlg::OpenMenuForSelectedServiceAndMimeL(TInt aSelectedIndex)
       
   434     {
       
   435     if(!iDefaultAppUi->iServMimeApps)User::Leave(KErrNotFound);
       
   436     if(aSelectedIndex<0)return; //there is no selected item (list is empty)
       
   437     
       
   438     CAknSingleGraphicPopupMenuStyleListBox *selectedServiceAndMime = new (ELeave) CAknSingleGraphicPopupMenuStyleListBox;
       
   439     CleanupStack::PushL(selectedServiceAndMime);
       
   440     
       
   441     if ( iPopupList != NULL )
       
   442     	{
       
   443         iPopupList->CancelPopup();
       
   444         iPopupList = NULL;
       
   445     	}
       
   446     
       
   447     iPopupList = CAknPopupList::NewL(selectedServiceAndMime, R_AVKON_SOFTKEYS_OK_CANCEL);
       
   448     selectedServiceAndMime->ConstructL(iPopupList,EAknListBoxMenuList);
       
   449     selectedServiceAndMime->CreateScrollBarFrameL (ETrue);
       
   450     selectedServiceAndMime->ScrollBarFrame()->SetScrollBarVisibilityL( 
       
   451             CEikScrollBarFrame::EOff, 
       
   452             CEikScrollBarFrame::EAuto );
       
   453 
       
   454     //construct icons
       
   455     CArrayPtr<CGulIcon>* icons=GetPopupListIconsL();
       
   456     selectedServiceAndMime->ItemDrawer()->ColumnData()->SetIconArray(icons); // passing ownership of icons
       
   457     
       
   458     
       
   459     //populate the applications list
       
   460     CTextListBoxModel* modelApps = selectedServiceAndMime->Model();  // not taking ownership
       
   461     modelApps->SetOwnershipType (ELbmOwnsItemArray);
       
   462     CDesCArray* applications = STATIC_CAST(CDesCArray*, modelApps->ItemTextArray());
       
   463     HBufC* listTitle=NULL;
       
   464     iDefaultAppUi->iServMimeApps->GetApplicationsListL(aSelectedIndex, *applications, listTitle);
       
   465     
       
   466     
       
   467     //set the title of the list
       
   468     CleanupStack::PushL(listTitle);
       
   469     iPopupList->SetTitleL(*listTitle);
       
   470     CleanupStack::PopAndDestroy(listTitle);
       
   471     //
       
   472     TInt popupOk = iPopupList->ExecuteLD();
       
   473     iPopupList = NULL;
       
   474     
       
   475     if(popupOk)
       
   476         {
       
   477         TInt selected = selectedServiceAndMime->CurrentItemIndex();
       
   478         
       
   479         //update the default in the array & list
       
   480         //get the list array first
       
   481         CTextListBoxModel* modelSm = ((CEikSettingsListBox*)ListBox())->Model();  // not taking ownership
       
   482         //modelSm->SetOwnershipType (ELbmOwnsItemArray);
       
   483         CDesCArray* servicesAndMimesArray = STATIC_CAST(CDesCArray*, modelSm->ItemTextArray());
       
   484         //do the update
       
   485         iDefaultAppUi->iServMimeApps->UpdateDefaultL(aSelectedIndex,selected,servicesAndMimesArray);
       
   486         //redraw the list
       
   487         DrawNow();
       
   488         }
       
   489     CleanupStack::PopAndDestroy(selectedServiceAndMime);
       
   490     }
       
   491 
       
   492 // ---------------------------------------------------------------------------
       
   493 // OfferKeyEventL from ccoecontrol
       
   494 // ---------------------------------------------------------------------------
       
   495 // 
       
   496 TKeyResponse CDefaultAppSrvMimeDlg::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType)
       
   497     {
       
   498     if ( aKeyEvent.iCode == EKeyBackspace )
       
   499         {
       
   500         if ( FindBox()->TextLength() >0 )
       
   501             {
       
   502             return FindBox()->OfferKeyEventL( aKeyEvent, aType );
       
   503             }
       
   504         }
       
   505     return CAknSelectionListDialog::OfferKeyEventL( aKeyEvent ,aType );
       
   506     }
       
   507 
       
   508 // -----------------------------------------------------------------------------
       
   509 // CDefaultAppSrvMimeDlg::ListBoxItemsChanged (from MListBoxItemChangeObserver)
       
   510 // 
       
   511 // -----------------------------------------------------------------------------
       
   512 //
       
   513 void CDefaultAppSrvMimeDlg::ListBoxItemsChanged( CEikListBox* aListBox )
       
   514     {
       
   515     if ( aListBox )
       
   516         {
       
   517         CEikButtonGroupContainer& cba = ButtonGroupContainer();
       
   518         CTextListBoxModel* modelSm = ((CEikSettingsListBox*)aListBox)->Model();  // not taking ownership
       
   519         TInt itemCount = modelSm->NumberOfItems();
       
   520         if (itemCount == 0)
       
   521             {
       
   522             cba.MakeCommandVisible(EAknCmdOpen, EFalse);
       
   523             }
       
   524         else
       
   525             {
       
   526             cba.MakeCommandVisible(EAknCmdOpen, ETrue);
       
   527             }
       
   528         }
       
   529     }
       
   530