phoneuis/vmbx/src/VmAppUi.cpp
branchRCL_3
changeset 25 5266b1f337bd
equal deleted inserted replaced
24:41a7f70b3818 25:5266b1f337bd
       
     1 /*
       
     2 * Copyright (c) 2002-2009 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:  This module contains the implementation of CVmAppUi
       
    15 *                class member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "VoiceMailboxAppPrivateCRKeys.h"
       
    22 #include "voicemailboxdomaincrkeys.h"
       
    23 #include "VmAppUi.h"
       
    24 
       
    25 #include "VmApp.h"
       
    26 
       
    27 #include "VmContainer.h"
       
    28 
       
    29 #include <e32property.h>
       
    30 #include <PSVariables.h>
       
    31 #include "VmQueryLauncher.h"
       
    32 #include <vm.rsg>
       
    33 
       
    34 #include "vm.hrh"
       
    35 
       
    36 #include <eiklabel.h>
       
    37 #include <aknlists.h>
       
    38 #include <aknnotedialog.h>
       
    39 #include <eikmenup.h>
       
    40 #include <AknGlobalNote.h>
       
    41 #include <AknQueryDialog.h>
       
    42 #include <AknQueryValuePhone.h>
       
    43 #include <avkon.mbg>
       
    44 
       
    45 #include <AiwCommon.hrh>    //KAiwCmdCall
       
    46 #include <AiwServiceHandler.h>      //For Application InterWorking
       
    47 #include <csxhelp/smsvo.hlp.hrh>  // for help context
       
    48 #include <hlplch.h>  // for HlpLauncher
       
    49 #include <featmgr.h>  // Feature Manager
       
    50 
       
    51 #include <aknnotewrappers.h>
       
    52 #include <StringLoader.h>
       
    53 
       
    54 #ifdef __BT_SAP
       
    55 #include <BTSapDomainPSKeys.h>
       
    56 #endif
       
    57 #include <centralrepository.h>
       
    58 
       
    59 #include "VmDetailsDialog.h"
       
    60 #include <AknNotify.h>
       
    61 #include <AknNotifyStd.h>
       
    62 #include "VMBLogger.h"
       
    63 #include <gsfwviewuids.h> // For General Settings application UID
       
    64 
       
    65 const TInt KVmHelpArraySize = 1;
       
    66 // ============================ MEMBER FUNCTIONS ===============================
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CVmAppUi::ConstructL
       
    70 // Symbian 2nd phase constructor can leave.
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 void CVmAppUi::ConstructL()
       
    74     {
       
    75     BaseConstructL( 
       
    76     EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible );
       
    77     FeatureManager::InitializeLibL();
       
    78     iFeatureManagerInitialized = ETrue;
       
    79     iAppUiState = EIdle;
       
    80 
       
    81 #ifdef __BT_SAP
       
    82     if ( FeatureManager::FeatureSupported( KFeatureIdBtSap ) )
       
    83         {
       
    84         TInt sapState( 0 );
       
    85         TInt error = RProperty::Get( KPSUidBluetoothSapConnectionState,
       
    86                                      KBTSapConnectionState,
       
    87                                      sapState );
       
    88         if (  error == KErrNone )
       
    89             {
       
    90             if ( sapState == EBTSapConnected )
       
    91                 {
       
    92                 HBufC* informationNoteTxt = StringLoader::LoadLC(
       
    93                                                        R_OFFLINE_NOT_POSSIBLE_SAP );
       
    94                 TPtrC note = informationNoteTxt->Des();
       
    95                 CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
       
    96                 globalNote->SetGraphic( EMbmAvkonQgn_note_info,
       
    97                                                       EMbmAvkonQgn_note_info_mask );
       
    98                 globalNote->ShowNoteL( EAknGlobalErrorNote, note );
       
    99                 CleanupStack::PopAndDestroy( globalNote );
       
   100                 Exit();
       
   101                 }
       
   102             }
       
   103         }
       
   104 #endif //__BT_SAP
       
   105 
       
   106     iFromGS = IsStartedFromGSL();
       
   107 
       
   108     iAppContainer = new (ELeave) CVmContainer();
       
   109 
       
   110     iServiceHandler = CAiwServiceHandler::NewL();
       
   111     iAppContainer->ConstructL( ClientRect(), iServiceHandler );
       
   112     AddToStackL( iAppContainer );
       
   113     iServiceHandler->AttachMenuL( R_VM_MENU, R_VMBX_APP_INTEREST );
       
   114 
       
   115     CEikMenuPane* temp =
       
   116                 (CEikonEnv::Static())->AppUiFactory()->MenuBar()->MenuPane();
       
   117 
       
   118     _LIT(KNull, "");
       
   119     AddMenuItemL( temp, KNull, EVmCmdAiwPlaceholder );
       
   120 
       
   121     iServiceHandler->InitializeMenuPaneL( *temp, R_VM_MENU, EVmCmdAiwCmdLast,
       
   122                                          iServiceHandler->InParamListL() );
       
   123 
       
   124     // fetch some localised texts from resources
       
   125     iTextCallVoiceMail = iEikonEnv->AllocReadResourceL( R_MENU_CALL_VOICEMAIL );
       
   126 
       
   127     iTextDefineNumber = iEikonEnv->AllocReadResourceL( R_MENU_DEFINE_NUMBER );
       
   128     iTextChangeNumber = iEikonEnv->AllocReadResourceL( R_MENU_CHANGE_NUMBER );
       
   129     iTextClearIcon = StringLoader::LoadL( R_CLEAR_ICON );
       
   130 
       
   131     if ( FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ) )
       
   132         {
       
   133         iTextCallVideoMail = iEikonEnv->AllocReadResourceL(
       
   134             R_MENU_CALL_VIDEOMAIL );
       
   135         iTextDefineVideoNumber = iEikonEnv->AllocReadResourceL(
       
   136             R_MENU_DEFINE_VIDEO_NUMBER );
       
   137         }
       
   138 
       
   139     if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
   140         {
       
   141         iTextCallIntVoiceMail =
       
   142                       iEikonEnv->AllocReadResourceL( R_MENU_CALL_INT_MAILBOX );
       
   143         }
       
   144 
       
   145     if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
       
   146         {
       
   147         iTextShowDetails = StringLoader::LoadL( R_OPEN_DETAILS );
       
   148         }
       
   149 
       
   150     if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   151         {
       
   152         iTextHelp = iEikonEnv->AllocReadResourceL( R_MENU_HELP );
       
   153         }
       
   154 
       
   155     iTextExit = iEikonEnv->AllocReadResourceL( R_MENU_EXIT );
       
   156 
       
   157     if ( !IsIpVoiceMailboxServices() && 
       
   158         ( ( !iAppContainer->Number().Length() &&
       
   159         !iAppContainer->VideoNumber().Length() ) || 
       
   160         ( !iAppContainer->Number().Length() && 
       
   161         !iAppContainer->IsVideoSupported() ) ) )
       
   162         {
       
   163         // If the vmbx number is not defined, query it as soon as
       
   164         // the app has been fully constructed.
       
   165         iQueryLauncher = CVmQueryLauncher::NewL( *iAppContainer, *this );
       
   166         iAppUiState = ELauncherQueryingNumber;
       
   167         }
       
   168 
       
   169     DrawCbaButtonsL();
       
   170     }
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // CVmAppUi::~CVmAppUi
       
   174 // Destructor
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 CVmAppUi::~CVmAppUi()
       
   178     {
       
   179     if ( iServiceHandler )
       
   180         {
       
   181         delete iServiceHandler;
       
   182         }
       
   183 
       
   184     if ( iQueryLauncher )
       
   185         {
       
   186         iQueryLauncher->Cancel();
       
   187         delete iQueryLauncher;
       
   188         }
       
   189 
       
   190     if ( iAppContainer )
       
   191         {
       
   192         RemoveFromStack( iAppContainer );
       
   193         delete iAppContainer;
       
   194         }
       
   195     delete iTextCallVoiceMail;
       
   196     delete iTextDefineNumber;
       
   197     delete iTextDefineVideoNumber;
       
   198     delete iTextChangeNumber;
       
   199     delete iTextShowDetails;
       
   200     delete iTextClearIcon;
       
   201     delete iTextCallVideoMail;
       
   202     delete iTextCallIntVoiceMail;
       
   203 
       
   204     delete iTextHelp;
       
   205     delete iTextExit;
       
   206 
       
   207     if ( iFeatureManagerInitialized )
       
   208         {
       
   209         FeatureManager::UnInitializeLib();
       
   210         }
       
   211     }
       
   212 
       
   213 // ------------------------------------------------------------------------------
       
   214 // CVmAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
       
   215 //  This function is called by the UIKON framework just before it displays
       
   216 //  a menu pane. Menu items are created.
       
   217 // ------------------------------------------------------------------------------
       
   218 void CVmAppUi::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   219     {
       
   220     VMBLOGSTRING( "VMBX: CVmAppUi::DynInitMenuPaneL: =>" );
       
   221 
       
   222     iServiceHandler->InitializeMenuPaneL( *aMenuPane,
       
   223                                             aResourceId,
       
   224                                             EVmCmdAiwCmdLast,
       
   225                                             iServiceHandler->InParamListL() );
       
   226 
       
   227     if ( aResourceId == R_VM_MENU )
       
   228         {
       
   229         aMenuPane->SetItemDimmed( KVmCmdAiwVoiceCall, ETrue );
       
   230 
       
   231         if ( FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ) )
       
   232             {
       
   233             aMenuPane->SetItemDimmed( KVmCmdAiwVideoCall, ETrue );
       
   234             }
       
   235 
       
   236         if ( iAppContainer->IsVoIPProfilesFound() )
       
   237             {
       
   238             // Internet call command id is same as video call command id
       
   239             // when video call is not supported. There is no video call
       
   240             // option in menu when video call is not supported.
       
   241             TInt intCallMenuPosition =
       
   242                 FeatureManager::FeatureSupported(
       
   243                 KFeatureIdCsVideoTelephony ) ?
       
   244                 KVmCmdAiwVoipCall :
       
   245                 KVmCmdAiwVideoCall;
       
   246 
       
   247             aMenuPane->SetItemDimmed( intCallMenuPosition,ETrue );
       
   248             }
       
   249 
       
   250         TInt currentItem = iAppContainer->CurrentItem();
       
   251         VMBLOGSTRING2( "VMBX: CVmAppUi::DynInitMenuPaneL:currentItem=%d",
       
   252                 currentItem );
       
   253         switch ( currentItem )
       
   254             {
       
   255             case EVmbxVoiceMailboxNumberInd:
       
   256                 {
       
   257                 if ( iAppContainer->Number().Length() )
       
   258                     {
       
   259                     AddMenuItemL( aMenuPane, *iTextCallVoiceMail,
       
   260                                   EvmCmdCallVoiceMail );
       
   261                     
       
   262                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   263                         {
       
   264                         AddMenuItemL( aMenuPane, *iTextChangeNumber,
       
   265                                       EvmCmdChangeNumber );
       
   266                         }
       
   267                     }
       
   268                 else 
       
   269                     {
       
   270                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   271                         {
       
   272                         AddMenuItemL( aMenuPane, *iTextDefineNumber, 
       
   273                                       EvmCmdChangeNumber );
       
   274                         }
       
   275                     }
       
   276                 break;
       
   277                 }
       
   278                 
       
   279             case EVmbxVideoMailboxNumberInd:
       
   280                 {                    
       
   281                 if ( iAppContainer->IsVideoSupported() )
       
   282                     {
       
   283                     if ( iAppContainer->VideoNumber().Length() )
       
   284                         {
       
   285                         AddMenuItemL( aMenuPane, *iTextCallVideoMail,
       
   286                                       EvmCmdCallVideoMail );
       
   287                         if ( iAppContainer->AllowedToChangeTheNumber() )
       
   288                             {
       
   289                             AddMenuItemL( aMenuPane, *iTextChangeNumber,
       
   290                                           EvmCmdChangeVideoNumber );
       
   291                             }
       
   292                         }
       
   293                     else
       
   294                         {
       
   295                         if ( iAppContainer->AllowedToChangeTheNumber() )
       
   296                             {
       
   297                             AddMenuItemL( aMenuPane, *iTextDefineVideoNumber,
       
   298                                           EvmCmdChangeVideoNumber );
       
   299                             }
       
   300                         }
       
   301                     }
       
   302                 break;
       
   303                 }
       
   304                     
       
   305             case EVmbxIntCallVoiceMailboxNumberInd:
       
   306                 {
       
   307                 if ( iAppContainer->IsIpVoiceMailboxServices() )
       
   308                     {
       
   309                     AddMenuItemL( aMenuPane, *iTextCallIntVoiceMail,
       
   310                                   EvmCmdCallIntVoiceMail );
       
   311                     }
       
   312                 break;
       
   313                 }
       
   314                 
       
   315             // CDMA specific:
       
   316 
       
   317             case EVmbxVoiceMessageAmountInd:
       
   318                 {
       
   319                 if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
       
   320                     {
       
   321                     if ( iAppContainer->Number().Length() )
       
   322                         {
       
   323                         AddMenuItemL( aMenuPane, *iTextCallVoiceMail,
       
   324                                       EvmCmdCallVoiceMail );
       
   325                         }
       
   326                     }
       
   327                 break;
       
   328                 }
       
   329             
       
   330             case EVmbxDetailsOfLastMessageInd:
       
   331                 {
       
   332                 if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
       
   333                     {
       
   334                     AddMenuItemL( aMenuPane, *iTextShowDetails,
       
   335                                   EvmCmdShowLastMessageDetails );
       
   336                     }
       
   337                 break;
       
   338                 }
       
   339 
       
   340 
       
   341             default:
       
   342                 {
       
   343                 break;
       
   344                 }
       
   345             }
       
   346 
       
   347         if ( iAppContainer->IsClearIcon() )
       
   348             {
       
   349             AddMenuItemL( aMenuPane, *iTextClearIcon, EvmCmdClearIcon );
       
   350             }
       
   351 
       
   352         // Check if help feature is available
       
   353         if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   354             {
       
   355             AddMenuItemL( aMenuPane, *iTextHelp, EAknCmdHelp );
       
   356             }
       
   357 
       
   358         AddMenuItemL( aMenuPane, *iTextExit, EAknCmdExit );
       
   359         }
       
   360 
       
   361     VMBLOGSTRING( "VMBX: CVmAppUi::DynInitMenuPaneL: <=" );
       
   362     }
       
   363 
       
   364 // -----------------------------------------------------------------------------
       
   365 // CVmAppUi::AddMenuItemL
       
   366 // Adds an item in menu
       
   367 // -----------------------------------------------------------------------------
       
   368 //
       
   369 void CVmAppUi::AddMenuItemL( CEikMenuPane* aMenuPane,
       
   370                                                  const TDesC& aText,
       
   371                                                              TInt aCommandId )
       
   372     {
       
   373     VMBLOGSTRING( "VMBX: CVmAppUi::AddMenuItemL=>" ); 
       
   374     CEikMenuPaneItem::SData data;
       
   375     data.iCascadeId = 0;
       
   376     data.iFlags = 0;
       
   377     data.iCommandId = aCommandId;
       
   378     data.iText = aText;
       
   379     aMenuPane->AddMenuItemL( data );
       
   380     if ( aText.Length() 
       
   381          && ( EAknCmdExit != aCommandId ) 
       
   382          && ( EAknCmdHelp != aCommandId ) )
       
   383         {
       
   384         SetItemSpecificL( aMenuPane, aCommandId );
       
   385         }
       
   386     VMBLOGSTRING2( "VMBX: CVmAppUi::AddMenuItemL:aCommandId=%d",aCommandId );
       
   387     VMBLOGSTRING( "VMBX: CVmAppUi::AddMenuItemL<=" ); 
       
   388     }
       
   389 
       
   390 // -----------------------------------------------------------------------------
       
   391 // CVmAppUi::HandleCommandL
       
   392 // Handles menu commands and softkey-exit
       
   393 // -----------------------------------------------------------------------------
       
   394 //
       
   395 void CVmAppUi::HandleCommandL( TInt aCommand )
       
   396     {
       
   397     VMBLOGSTRING( "VMBX: CVmAppUi::HandleCommandL: =>" );
       
   398     switch ( aCommand )
       
   399         {
       
   400         case EEikCmdExit:
       
   401         case EAknSoftkeyExit:
       
   402         case EAknSoftkeyBack:
       
   403             {
       
   404             Exit();
       
   405             break;
       
   406             }
       
   407         case EVmCbaMskDefVoMbx:
       
   408         case EvmCmdChangeNumber:
       
   409             {
       
   410             if ( !iAppContainer->AllowedToChangeTheNumber() )
       
   411                 {
       
   412                 User::Leave( KErrNotSupported );
       
   413                 }
       
   414             if ( ELauncherQueryingNumber != iAppUiState )
       
   415                 {
       
   416                 iAppContainer->QueryNumberL( EVmbxChangeNumberQuery );
       
   417                 DrawCbaButtonsL();
       
   418                 }
       
   419             break;
       
   420             }
       
   421 
       
   422         case EVmCbaMskCallVoipMbx:
       
   423         case EvmCmdCallIntVoiceMail:
       
   424            {
       
   425             if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
   426                 {
       
   427                 iAppContainer->CallIntVoiceMailBoxL();
       
   428                 }
       
   429 
       
   430             break;
       
   431             }
       
   432 
       
   433         case EAknCmdHelp:
       
   434             {
       
   435             if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   436                 {
       
   437                 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
       
   438                                                             AppHelpContextL() );
       
   439                 }
       
   440             break;
       
   441             }
       
   442 
       
   443         case EVmCbaMskCallVoMbx:
       
   444         case EvmCmdCallVoiceMail:
       
   445             {
       
   446             iAppContainer->CallVoiceMailBoxL();
       
   447             break;
       
   448             }
       
   449 
       
   450         case EvmCmdShowLastMessageDetails:
       
   451             {
       
   452             CVmDetailsDialog* dlg = CVmDetailsDialog::NewL();
       
   453             dlg->ExecuteLD( R_VMBX_DETAIL_DIALOG );
       
   454             break;
       
   455             }
       
   456 
       
   457         case EvmCmdClearIcon:
       
   458             {
       
   459             // Reset counter to 0 in SD
       
   460             iAppContainer->ResetVoicemailMessageCounterL();
       
   461 
       
   462             // Show confirmation note:
       
   463             HBufC* noteText = StringLoader::LoadLC( R_VOICEMAIL_CLEARED );
       
   464 
       
   465             CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote();
       
   466             note->ExecuteLD( *noteText );
       
   467 
       
   468             CleanupStack::PopAndDestroy( noteText );
       
   469             break;
       
   470             }
       
   471 
       
   472         case EVmCbaMskDefViMbx:
       
   473         case EvmCmdChangeVideoNumber:
       
   474             {
       
   475             if ( ELauncherQueryingNumber != iAppUiState )
       
   476                 {
       
   477                 iAppContainer->QueryVideoNumberL( EVmbxChangeNumberQuery );
       
   478                 DrawCbaButtonsL();
       
   479                 }
       
   480             break;
       
   481             }
       
   482 
       
   483         case EVmCbaMskCallViMbx:
       
   484         case EvmCmdCallVideoMail:
       
   485             {
       
   486             iAppContainer->CallVideoMailBoxL();
       
   487             break;
       
   488             }
       
   489         default:
       
   490             break;
       
   491         }
       
   492     VMBLOGSTRING( "VMBX: CVmAppUi::HandleCommandL: <=" );
       
   493     }
       
   494 
       
   495 // -----------------------------------------------------------------------------
       
   496 // CVmAppUi::HelpContextL
       
   497 // Returns the help context
       
   498 // -----------------------------------------------------------------------------
       
   499 //
       
   500 CArrayFix<TCoeHelpContext>* CVmAppUi::HelpContextL() const
       
   501     {
       
   502     CArrayFixFlat<TCoeHelpContext>* array =
       
   503                    new( ELeave ) CArrayFixFlat<TCoeHelpContext>( KVmHelpArraySize );
       
   504 
       
   505     // Cannot leave because the buffer for the appended item is allocated
       
   506     // in the constructor.
       
   507     array->AppendL( TCoeHelpContext( KUidvm, KSMSVO_HLP_MAIN_VIEW ) );
       
   508 
       
   509     return array;
       
   510     }
       
   511 
       
   512 // -----------------------------------------------------------------------------
       
   513 // CVmAppUi::DrawCbaButtonsL
       
   514 // Loads the appropriate CBA buttons for MSK.
       
   515 // -----------------------------------------------------------------------------
       
   516 //
       
   517 void CVmAppUi::DrawCbaButtonsL()
       
   518     {
       
   519     VMBLOGSTRING( "VMBX: CVmAppUi::DrawCbaButtonsL: =>" );
       
   520 
       
   521     CEikButtonGroupContainer* cba = Cba();
       
   522     TInt currentItem = iAppContainer->CurrentItem();
       
   523     TInt resourceId = 0;
       
   524 
       
   525     switch ( currentItem )
       
   526         {
       
   527         case EVmbxVoiceMailboxNumberInd:
       
   528             {
       
   529             if ( !iAppContainer->Number().Length())
       
   530                 {
       
   531                 if ( iFromGS )
       
   532                     {
       
   533                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   534                         {
       
   535                         resourceId = R_VMBX_GS_CBA_DEFINE_VO_NUMBER;
       
   536                         }
       
   537                     else
       
   538                         {
       
   539                         resourceId = R_VMBX_GS_CBA_NOTALLOW_DEFINE_VO_NUMBER;
       
   540                         }
       
   541                     }
       
   542                 else
       
   543                     {
       
   544                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   545                         {
       
   546                         resourceId = R_VMBX_CBA_DEFINE_VO_NUMBER;
       
   547                         }
       
   548                     else
       
   549                         {
       
   550                         resourceId = R_VMBX_CBA_NOTALLOW_DEFINE_VO_NUMBER;
       
   551                         }
       
   552                     }
       
   553                 }
       
   554             else
       
   555                 {
       
   556                 if(iFromGS)
       
   557                     {
       
   558                     resourceId = R_VMBX_GS_CBA_CALL_VO_MAILBOX;
       
   559                     }
       
   560                 else
       
   561                     {
       
   562                     resourceId = R_VMBX_CBA_CALL_VO_MAILBOX;
       
   563                     }
       
   564                 }
       
   565             break;
       
   566             }
       
   567         case EVmbxVideoMailboxNumberInd:
       
   568             {
       
   569             if ( !iAppContainer->VideoNumber().Length() )
       
   570                 {
       
   571                 if ( iFromGS )
       
   572                     {
       
   573                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   574                         {
       
   575                         resourceId = R_VMBX_GS_CBA_DEFINE_VI_NUMBER;
       
   576                         }
       
   577                     else
       
   578                         {
       
   579                         resourceId = R_VMBX_GS_CBA_NOTALLOW_DEFINE_VI_NUMBER;
       
   580                         }
       
   581                     }
       
   582                 else
       
   583                     {
       
   584                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   585                         {
       
   586                         resourceId = R_VMBX_CBA_DEFINE_VI_NUMBER;
       
   587                         }
       
   588                     else
       
   589                         {
       
   590                         resourceId = R_VMBX_CBA_NOTALLOW_DEFINE_VI_NUMBER;
       
   591                         }
       
   592                     }
       
   593                 }
       
   594             else
       
   595                 {
       
   596                 if ( iFromGS )
       
   597                     {
       
   598                     resourceId = R_VMBX_GS_CBA_CALL_VI_MAILBOX;
       
   599                     }
       
   600                 else
       
   601                     {
       
   602                     resourceId = R_VMBX_CBA_CALL_VI_MAILBOX;
       
   603                     }
       
   604                 }
       
   605             break;
       
   606             }
       
   607         case EVmbxIntCallVoiceMailboxNumberInd:
       
   608             {
       
   609             if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
   610                 {
       
   611                 if ( iFromGS )
       
   612                     {
       
   613                     resourceId = R_VMBX_GS_CALL_VOIP_MAILBOX;
       
   614                     }
       
   615                 else
       
   616                     {
       
   617                     resourceId = R_VMBX_CBA_CALL_VOIP_MAILBOX;
       
   618                     }
       
   619                 }
       
   620             break;
       
   621             }
       
   622        default:
       
   623             break;
       
   624         }
       
   625 
       
   626     cba->SetCommandSetL( resourceId );
       
   627     cba->DrawDeferred();
       
   628     VMBLOGSTRING( "VMBX: CVmAppUi::DrawCbaButtonsL: <=" );
       
   629     }
       
   630 
       
   631 // -----------------------------------------------------------------------------
       
   632 // CVmAppUi::HandleForegroundEventL
       
   633 // Handles changes in keyboard focus when an application switches to or from
       
   634 // the foreground.
       
   635 // -----------------------------------------------------------------------------
       
   636 //
       
   637 void CVmAppUi::HandleForegroundEventL( TBool aForeground )
       
   638     {
       
   639     if ( aForeground ) // back to foreground
       
   640         {
       
   641         if ( iAppContainer->IsServiceUpdated() )
       
   642             {
       
   643             iAppContainer->UpdateListboxL();
       
   644             }
       
   645 
       
   646         // get numbers
       
   647         iAppContainer->UpdateVmbxNumberL();
       
   648         // change state so that FocusChanged will update ListBox fields
       
   649         iAppContainer->UpdateData( ETrue );
       
   650         }
       
   651     CAknAppUi::HandleForegroundEventL( aForeground );
       
   652     }
       
   653 
       
   654 // -----------------------------------------------------------------------------
       
   655 // CVmAppUi::IsStartedFromGSL
       
   656 // Defines whether voice mail application is started from general
       
   657 // settings or not.
       
   658 // -----------------------------------------------------------------------------
       
   659 //
       
   660 TBool CVmAppUi::IsStartedFromGSL()
       
   661     {
       
   662     TBool result = EFalse;
       
   663     RWsSession ws;
       
   664     User::LeaveIfError( ws.Connect() );
       
   665     CleanupClosePushL( ws );
       
   666 
       
   667     // Find the task with uid
       
   668     TApaTaskList taskList( ws );
       
   669     TApaTask task = taskList.FindApp( KUidGS );
       
   670 
       
   671     if ( task.Exists() )
       
   672         {
       
   673         // read window group id of general settings
       
   674         TInt gsTaskId = task.WgId();
       
   675 
       
   676         // Find task from position 1 (background)
       
   677         TApaTask bgTask = taskList.FindByPos(1);
       
   678 
       
   679         // Read window group id of background task
       
   680         TInt bgTaskId = bgTask.WgId();
       
   681 
       
   682         if( gsTaskId == bgTaskId )
       
   683         	{
       
   684         	// General settings is straight below voice mail application
       
   685         	// => application is started from general settings
       
   686         	result = ETrue;
       
   687         	}
       
   688         else
       
   689         	{
       
   690         	result = EFalse;
       
   691         	}
       
   692         }
       
   693     else
       
   694     	{
       
   695     	// General settings task does not exist
       
   696     	result = EFalse;
       
   697     	}
       
   698     CleanupStack::PopAndDestroy( ); // ws
       
   699 
       
   700     return result;
       
   701     }
       
   702 
       
   703 // -----------------------------------------------------------------------------
       
   704 // CVmAppUi::NumberQueryComplete
       
   705 //
       
   706 //
       
   707 // -----------------------------------------------------------------------------
       
   708 void CVmAppUi::NumberQueryComplete()
       
   709     {
       
   710     iAppUiState = EIdle;
       
   711     }
       
   712 
       
   713 // -----------------------------------------------------------------------------
       
   714 // CVmAppUi::GetAppUiState
       
   715 //
       
   716 //
       
   717 // -----------------------------------------------------------------------------
       
   718 TVmbxAppUiState CVmAppUi::GetAppUiState()
       
   719     {
       
   720     return iAppUiState;
       
   721     }
       
   722 
       
   723 // -----------------------------------------------------------------------------
       
   724 // CVmAppUi::IsIpVoiceMailboxServices
       
   725 //
       
   726 //
       
   727 // -----------------------------------------------------------------------------   
       
   728 TBool CVmAppUi::IsIpVoiceMailboxServices()
       
   729     {
       
   730     return iAppContainer->IsIpVoiceMailboxServices();
       
   731     }
       
   732 
       
   733 // -----------------------------------------------------------------------------
       
   734 // CVmAppUi::SetItemSpecific
       
   735 //
       
   736 //
       
   737 // -----------------------------------------------------------------------------
       
   738 void CVmAppUi::SetItemSpecificL( CEikMenuPane* aMenuPane, TInt aCommandId )
       
   739     {
       
   740     VMBLOGSTRING2( "VMBX: CVmAppUi::SetItemSpecificL:aCommandId=%d =>",
       
   741     aCommandId );
       
   742     if ( aMenuPane )
       
   743         {
       
   744         aMenuPane->SetItemSpecific( aCommandId, ETrue );
       
   745         }
       
   746     else
       
   747         {
       
   748         User::Leave( KErrArgument );
       
   749         }
       
   750     VMBLOGSTRING( "VMBX: CVmAppUi::SetItemSpecificL: <=" );
       
   751     }
       
   752 
       
   753 // End of File