phoneuis/vmbx/src/VmAppUi.cpp
changeset 0 5f000ab63145
child 44 3c221667e687
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     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 ( !iAppContainer->IsVideoSupported() )
       
   158         {
       
   159         // If the vmbx number is not defined, query it as soon as
       
   160         // the app has been fully constructed.
       
   161         if ( !iAppContainer->Number().Length() &&
       
   162              !IsIpVoiceMailboxServices() )
       
   163             {
       
   164             // Query cs vmbx number since ip vmbx address cannot be asked
       
   165             iAppContainer->QueryNumberL( EVmbxNotDefinedQuery );
       
   166             }
       
   167         }
       
   168     else
       
   169         {
       
   170         if ( !iAppContainer->Number().Length() &&
       
   171              !iAppContainer->VideoNumber().Length() &&
       
   172              !IsIpVoiceMailboxServices() )
       
   173             {
       
   174             iQueryLauncher = CVmQueryLauncher::NewL( *iAppContainer, *this );
       
   175             iAppUiState = ELauncherQueryingNumber;
       
   176             }
       
   177         }
       
   178 
       
   179     DrawCbaButtonsL();
       
   180     }
       
   181 
       
   182 // -----------------------------------------------------------------------------
       
   183 // CVmAppUi::~CVmAppUi
       
   184 // Destructor
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 CVmAppUi::~CVmAppUi()
       
   188     {
       
   189     if ( iServiceHandler )
       
   190         {
       
   191         delete iServiceHandler;
       
   192         }
       
   193 
       
   194     if ( iQueryLauncher )
       
   195         {
       
   196         iQueryLauncher->Cancel();
       
   197         delete iQueryLauncher;
       
   198         }
       
   199 
       
   200     if ( iAppContainer )
       
   201         {
       
   202         RemoveFromStack( iAppContainer );
       
   203         delete iAppContainer;
       
   204         }
       
   205     delete iTextCallVoiceMail;
       
   206     delete iTextDefineNumber;
       
   207     delete iTextDefineVideoNumber;
       
   208     delete iTextChangeNumber;
       
   209     delete iTextShowDetails;
       
   210     delete iTextClearIcon;
       
   211     delete iTextCallVideoMail;
       
   212     delete iTextCallIntVoiceMail;
       
   213 
       
   214     delete iTextHelp;
       
   215     delete iTextExit;
       
   216 
       
   217     if ( iFeatureManagerInitialized )
       
   218         {
       
   219         FeatureManager::UnInitializeLib();
       
   220         }
       
   221     }
       
   222 
       
   223 // ------------------------------------------------------------------------------
       
   224 // CVmAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
       
   225 //  This function is called by the UIKON framework just before it displays
       
   226 //  a menu pane. Menu items are created.
       
   227 // ------------------------------------------------------------------------------
       
   228 void CVmAppUi::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   229     {
       
   230     VMBLOGSTRING( "VMBX: CVmAppUi::DynInitMenuPaneL: =>" );
       
   231 
       
   232     iServiceHandler->InitializeMenuPaneL( *aMenuPane,
       
   233                                             aResourceId,
       
   234                                             EVmCmdAiwCmdLast,
       
   235                                             iServiceHandler->InParamListL() );
       
   236 
       
   237     if ( aResourceId == R_VM_MENU )
       
   238         {
       
   239         aMenuPane->SetItemDimmed( KVmCmdAiwVoiceCall, ETrue );
       
   240 
       
   241         if ( FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ) )
       
   242             {
       
   243             aMenuPane->SetItemDimmed( KVmCmdAiwVideoCall, ETrue );
       
   244             }
       
   245 
       
   246         if ( iAppContainer->IsVoIPProfilesFound() )
       
   247             {
       
   248             // Internet call command id is same as video call command id
       
   249             // when video call is not supported. There is no video call
       
   250             // option in menu when video call is not supported.
       
   251             TInt intCallMenuPosition =
       
   252                 FeatureManager::FeatureSupported(
       
   253                 KFeatureIdCsVideoTelephony ) ?
       
   254                 KVmCmdAiwVoipCall :
       
   255                 KVmCmdAiwVideoCall;
       
   256 
       
   257             aMenuPane->SetItemDimmed( intCallMenuPosition,ETrue );
       
   258             }
       
   259 
       
   260         TInt currentItem = iAppContainer->CurrentItem();
       
   261         VMBLOGSTRING2( "VMBX: CVmAppUi::DynInitMenuPaneL:currentItem=%d",
       
   262                 currentItem );
       
   263         switch ( currentItem )
       
   264             {
       
   265             case EVmbxVoiceMailboxNumberInd:
       
   266                 {
       
   267                 if ( iAppContainer->Number().Length() )
       
   268                     {
       
   269                     AddMenuItemL( aMenuPane, *iTextCallVoiceMail,
       
   270                                   EvmCmdCallVoiceMail );
       
   271                     
       
   272                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   273                         {
       
   274                         AddMenuItemL( aMenuPane, *iTextChangeNumber,
       
   275                                       EvmCmdChangeNumber );
       
   276                         }
       
   277                     }
       
   278                 else 
       
   279                     {
       
   280                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   281                         {
       
   282                         AddMenuItemL( aMenuPane, *iTextDefineNumber, 
       
   283                                       EvmCmdChangeNumber );
       
   284                         }
       
   285                     }
       
   286                 break;
       
   287                 }
       
   288                 
       
   289             case EVmbxVideoMailboxNumberInd:
       
   290                 {                    
       
   291                 if ( iAppContainer->IsVideoSupported() )
       
   292                     {
       
   293                     if ( iAppContainer->VideoNumber().Length() )
       
   294                         {
       
   295                         AddMenuItemL( aMenuPane, *iTextCallVideoMail,
       
   296                                       EvmCmdCallVideoMail );
       
   297                         if ( iAppContainer->AllowedToChangeTheNumber() )
       
   298                             {
       
   299                             AddMenuItemL( aMenuPane, *iTextChangeNumber,
       
   300                                           EvmCmdChangeVideoNumber );
       
   301                             }
       
   302                         }
       
   303                     else
       
   304                         {
       
   305                         if ( iAppContainer->AllowedToChangeTheNumber() )
       
   306                             {
       
   307                             AddMenuItemL( aMenuPane, *iTextDefineVideoNumber,
       
   308                                           EvmCmdChangeVideoNumber );
       
   309                             }
       
   310                         }
       
   311                     }
       
   312                 break;
       
   313                 }
       
   314                     
       
   315             case EVmbxIntCallVoiceMailboxNumberInd:
       
   316                 {
       
   317                 if ( iAppContainer->IsIpVoiceMailboxServices() )
       
   318                     {
       
   319                     AddMenuItemL( aMenuPane, *iTextCallIntVoiceMail,
       
   320                                   EvmCmdCallIntVoiceMail );
       
   321                     }
       
   322                 break;
       
   323                 }
       
   324                 
       
   325             // CDMA specific:
       
   326 
       
   327             case EVmbxVoiceMessageAmountInd:
       
   328                 {
       
   329                 if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
       
   330                     {
       
   331                     if ( iAppContainer->Number().Length() )
       
   332                         {
       
   333                         AddMenuItemL( aMenuPane, *iTextCallVoiceMail,
       
   334                                       EvmCmdCallVoiceMail );
       
   335                         }
       
   336                     }
       
   337                 break;
       
   338                 }
       
   339             
       
   340             case EVmbxDetailsOfLastMessageInd:
       
   341                 {
       
   342                 if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
       
   343                     {
       
   344                     AddMenuItemL( aMenuPane, *iTextShowDetails,
       
   345                                   EvmCmdShowLastMessageDetails );
       
   346                     }
       
   347                 break;
       
   348                 }
       
   349 
       
   350 
       
   351             default:
       
   352                 {
       
   353                 break;
       
   354                 }
       
   355             }
       
   356 
       
   357         if ( iAppContainer->IsClearIcon() )
       
   358             {
       
   359             AddMenuItemL( aMenuPane, *iTextClearIcon, EvmCmdClearIcon );
       
   360             }
       
   361 
       
   362         // Check if help feature is available
       
   363         if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   364             {
       
   365             AddMenuItemL( aMenuPane, *iTextHelp, EAknCmdHelp );
       
   366             }
       
   367 
       
   368         AddMenuItemL( aMenuPane, *iTextExit, EAknCmdExit );
       
   369         }
       
   370 
       
   371     VMBLOGSTRING( "VMBX: CVmAppUi::DynInitMenuPaneL: <=" );
       
   372     }
       
   373 
       
   374 // -----------------------------------------------------------------------------
       
   375 // CVmAppUi::AddMenuItemL
       
   376 // Adds an item in menu
       
   377 // -----------------------------------------------------------------------------
       
   378 //
       
   379 void CVmAppUi::AddMenuItemL( CEikMenuPane* aMenuPane,
       
   380                                                  const TDesC& aText,
       
   381                                                              TInt aCommandId )
       
   382     {
       
   383     VMBLOGSTRING( "VMBX: CVmAppUi::AddMenuItemL=>" ); 
       
   384     CEikMenuPaneItem::SData data;
       
   385     data.iCascadeId = 0;
       
   386     data.iFlags = 0;
       
   387     data.iCommandId = aCommandId;
       
   388     data.iText = aText;
       
   389     aMenuPane->AddMenuItemL( data );
       
   390     if ( aText.Length() 
       
   391          && ( EAknCmdExit != aCommandId ) 
       
   392          && ( EAknCmdHelp != aCommandId ) )
       
   393         {
       
   394         SetItemSpecificL( aMenuPane, aCommandId );
       
   395         }
       
   396     VMBLOGSTRING2( "VMBX: CVmAppUi::AddMenuItemL:aCommandId=%d",aCommandId );
       
   397     VMBLOGSTRING( "VMBX: CVmAppUi::AddMenuItemL<=" ); 
       
   398     }
       
   399 
       
   400 // -----------------------------------------------------------------------------
       
   401 // CVmAppUi::HandleCommandL
       
   402 // Handles menu commands and softkey-exit
       
   403 // -----------------------------------------------------------------------------
       
   404 //
       
   405 void CVmAppUi::HandleCommandL( TInt aCommand )
       
   406     {
       
   407     VMBLOGSTRING( "VMBX: CVmAppUi::HandleCommandL: =>" );
       
   408     switch ( aCommand )
       
   409         {
       
   410         case EEikCmdExit:
       
   411         case EAknSoftkeyExit:
       
   412         case EAknSoftkeyBack:
       
   413             {
       
   414             Exit();
       
   415             break;
       
   416             }
       
   417         case EVmCbaMskDefVoMbx:
       
   418         case EvmCmdChangeNumber:
       
   419             {
       
   420             if ( !iAppContainer->AllowedToChangeTheNumber() )
       
   421                 {
       
   422                 User::Leave( KErrNotSupported );
       
   423                 }
       
   424             if ( ELauncherQueryingNumber != iAppUiState )
       
   425                 {
       
   426                 iAppContainer->QueryNumberL( EVmbxChangeNumberQuery );
       
   427                 DrawCbaButtonsL();
       
   428                 }
       
   429             break;
       
   430             }
       
   431 
       
   432         case EVmCbaMskCallVoipMbx:
       
   433         case EvmCmdCallIntVoiceMail:
       
   434            {
       
   435             if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
   436                 {
       
   437                 iAppContainer->CallIntVoiceMailBoxL();
       
   438                 }
       
   439 
       
   440             break;
       
   441             }
       
   442 
       
   443         case EAknCmdHelp:
       
   444             {
       
   445             if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   446                 {
       
   447                 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
       
   448                                                             AppHelpContextL() );
       
   449                 }
       
   450             break;
       
   451             }
       
   452 
       
   453         case EVmCbaMskCallVoMbx:
       
   454         case EvmCmdCallVoiceMail:
       
   455             {
       
   456             iAppContainer->CallVoiceMailBoxL();
       
   457             break;
       
   458             }
       
   459 
       
   460         case EvmCmdShowLastMessageDetails:
       
   461             {
       
   462             CVmDetailsDialog* dlg = CVmDetailsDialog::NewL();
       
   463             dlg->ExecuteLD( R_VMBX_DETAIL_DIALOG );
       
   464             break;
       
   465             }
       
   466 
       
   467         case EvmCmdClearIcon:
       
   468             {
       
   469             // Reset counter to 0 in SD
       
   470             iAppContainer->ResetVoicemailMessageCounterL();
       
   471 
       
   472             // Show confirmation note:
       
   473             HBufC* noteText = StringLoader::LoadLC( R_VOICEMAIL_CLEARED );
       
   474 
       
   475             CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote();
       
   476             note->ExecuteLD( *noteText );
       
   477 
       
   478             CleanupStack::PopAndDestroy( noteText );
       
   479             break;
       
   480             }
       
   481 
       
   482         case EVmCbaMskDefViMbx:
       
   483         case EvmCmdChangeVideoNumber:
       
   484             {
       
   485             if ( ELauncherQueryingNumber != iAppUiState )
       
   486                 {
       
   487                 iAppContainer->QueryVideoNumberL( EVmbxChangeNumberQuery );
       
   488                 DrawCbaButtonsL();
       
   489                 }
       
   490             break;
       
   491             }
       
   492 
       
   493         case EVmCbaMskCallViMbx:
       
   494         case EvmCmdCallVideoMail:
       
   495             {
       
   496             iAppContainer->CallVideoMailBoxL();
       
   497             break;
       
   498             }
       
   499         default:
       
   500             break;
       
   501         }
       
   502     VMBLOGSTRING( "VMBX: CVmAppUi::HandleCommandL: <=" );
       
   503     }
       
   504 
       
   505 // -----------------------------------------------------------------------------
       
   506 // CVmAppUi::HelpContextL
       
   507 // Returns the help context
       
   508 // -----------------------------------------------------------------------------
       
   509 //
       
   510 CArrayFix<TCoeHelpContext>* CVmAppUi::HelpContextL() const
       
   511     {
       
   512     CArrayFixFlat<TCoeHelpContext>* array =
       
   513                    new( ELeave ) CArrayFixFlat<TCoeHelpContext>( KVmHelpArraySize );
       
   514 
       
   515     // Cannot leave because the buffer for the appended item is allocated
       
   516     // in the constructor.
       
   517     array->AppendL( TCoeHelpContext( KUidvm, KSMSVO_HLP_MAIN_VIEW ) );
       
   518 
       
   519     return array;
       
   520     }
       
   521 
       
   522 // -----------------------------------------------------------------------------
       
   523 // CVmAppUi::DrawCbaButtonsL
       
   524 // Loads the appropriate CBA buttons for MSK.
       
   525 // -----------------------------------------------------------------------------
       
   526 //
       
   527 void CVmAppUi::DrawCbaButtonsL()
       
   528     {
       
   529     VMBLOGSTRING( "VMBX: CVmAppUi::DrawCbaButtonsL: =>" );
       
   530 
       
   531     CEikButtonGroupContainer* cba = Cba();
       
   532     TInt currentItem = iAppContainer->CurrentItem();
       
   533     TInt resourceId = 0;
       
   534 
       
   535     switch ( currentItem )
       
   536         {
       
   537         case EVmbxVoiceMailboxNumberInd:
       
   538             {
       
   539             if ( !iAppContainer->Number().Length())
       
   540                 {
       
   541                 if ( iFromGS )
       
   542                     {
       
   543                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   544                         {
       
   545                         resourceId = R_VMBX_GS_CBA_DEFINE_VO_NUMBER;
       
   546                         }
       
   547                     else
       
   548                         {
       
   549                         resourceId = R_VMBX_GS_CBA_NOTALLOW_DEFINE_VO_NUMBER;
       
   550                         }
       
   551                     }
       
   552                 else
       
   553                     {
       
   554                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   555                         {
       
   556                         resourceId = R_VMBX_CBA_DEFINE_VO_NUMBER;
       
   557                         }
       
   558                     else
       
   559                         {
       
   560                         resourceId = R_VMBX_CBA_NOTALLOW_DEFINE_VO_NUMBER;
       
   561                         }
       
   562                     }
       
   563                 }
       
   564             else
       
   565                 {
       
   566                 if(iFromGS)
       
   567                     {
       
   568                     resourceId = R_VMBX_GS_CBA_CALL_VO_MAILBOX;
       
   569                     }
       
   570                 else
       
   571                     {
       
   572                     resourceId = R_VMBX_CBA_CALL_VO_MAILBOX;
       
   573                     }
       
   574                 }
       
   575             break;
       
   576             }
       
   577         case EVmbxVideoMailboxNumberInd:
       
   578             {
       
   579             if ( !iAppContainer->VideoNumber().Length() )
       
   580                 {
       
   581                 if ( iFromGS )
       
   582                     {
       
   583                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   584                         {
       
   585                         resourceId = R_VMBX_GS_CBA_DEFINE_VI_NUMBER;
       
   586                         }
       
   587                     else
       
   588                         {
       
   589                         resourceId = R_VMBX_GS_CBA_NOTALLOW_DEFINE_VI_NUMBER;
       
   590                         }
       
   591                     }
       
   592                 else
       
   593                     {
       
   594                     if ( iAppContainer->AllowedToChangeTheNumber() )
       
   595                         {
       
   596                         resourceId = R_VMBX_CBA_DEFINE_VI_NUMBER;
       
   597                         }
       
   598                     else
       
   599                         {
       
   600                         resourceId = R_VMBX_CBA_NOTALLOW_DEFINE_VI_NUMBER;
       
   601                         }
       
   602                     }
       
   603                 }
       
   604             else
       
   605                 {
       
   606                 if ( iFromGS )
       
   607                     {
       
   608                     resourceId = R_VMBX_GS_CBA_CALL_VI_MAILBOX;
       
   609                     }
       
   610                 else
       
   611                     {
       
   612                     resourceId = R_VMBX_CBA_CALL_VI_MAILBOX;
       
   613                     }
       
   614                 }
       
   615             break;
       
   616             }
       
   617         case EVmbxIntCallVoiceMailboxNumberInd:
       
   618             {
       
   619             if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
   620                 {
       
   621                 if ( iFromGS )
       
   622                     {
       
   623                     resourceId = R_VMBX_GS_CALL_VOIP_MAILBOX;
       
   624                     }
       
   625                 else
       
   626                     {
       
   627                     resourceId = R_VMBX_CBA_CALL_VOIP_MAILBOX;
       
   628                     }
       
   629                 }
       
   630             break;
       
   631             }
       
   632        default:
       
   633             break;
       
   634         }
       
   635 
       
   636     cba->SetCommandSetL( resourceId );
       
   637     cba->DrawDeferred();
       
   638     VMBLOGSTRING( "VMBX: CVmAppUi::DrawCbaButtonsL: <=" );
       
   639     }
       
   640 
       
   641 // -----------------------------------------------------------------------------
       
   642 // CVmAppUi::HandleForegroundEventL
       
   643 // Handles changes in keyboard focus when an application switches to or from
       
   644 // the foreground.
       
   645 // -----------------------------------------------------------------------------
       
   646 //
       
   647 void CVmAppUi::HandleForegroundEventL( TBool aForeground )
       
   648     {
       
   649     if ( aForeground ) // back to foreground
       
   650         {
       
   651         if ( iAppContainer->IsServiceUpdated() )
       
   652             {
       
   653             iAppContainer->UpdateListboxL();
       
   654             }
       
   655 
       
   656         // get numbers
       
   657         iAppContainer->UpdateVmbxNumberL();
       
   658         // change state so that FocusChanged will update ListBox fields
       
   659         iAppContainer->UpdateData( ETrue );
       
   660         }
       
   661     CAknAppUi::HandleForegroundEventL( aForeground );
       
   662     }
       
   663 
       
   664 // -----------------------------------------------------------------------------
       
   665 // CVmAppUi::IsStartedFromGSL
       
   666 // Defines whether voice mail application is started from general
       
   667 // settings or not.
       
   668 // -----------------------------------------------------------------------------
       
   669 //
       
   670 TBool CVmAppUi::IsStartedFromGSL()
       
   671     {
       
   672     TBool result = EFalse;
       
   673     RWsSession ws;
       
   674     User::LeaveIfError( ws.Connect() );
       
   675     CleanupClosePushL( ws );
       
   676 
       
   677     // Find the task with uid
       
   678     TApaTaskList taskList( ws );
       
   679     TApaTask task = taskList.FindApp( KUidGS );
       
   680 
       
   681     if ( task.Exists() )
       
   682         {
       
   683         // read window group id of general settings
       
   684         TInt gsTaskId = task.WgId();
       
   685 
       
   686         // Find task from position 1 (background)
       
   687         TApaTask bgTask = taskList.FindByPos(1);
       
   688 
       
   689         // Read window group id of background task
       
   690         TInt bgTaskId = bgTask.WgId();
       
   691 
       
   692         if( gsTaskId == bgTaskId )
       
   693         	{
       
   694         	// General settings is straight below voice mail application
       
   695         	// => application is started from general settings
       
   696         	result = ETrue;
       
   697         	}
       
   698         else
       
   699         	{
       
   700         	result = EFalse;
       
   701         	}
       
   702         }
       
   703     else
       
   704     	{
       
   705     	// General settings task does not exist
       
   706     	result = EFalse;
       
   707     	}
       
   708     CleanupStack::PopAndDestroy( ); // ws
       
   709 
       
   710     return result;
       
   711     }
       
   712 
       
   713 // -----------------------------------------------------------------------------
       
   714 // CVmAppUi::NumberQueryComplete
       
   715 //
       
   716 //
       
   717 // -----------------------------------------------------------------------------
       
   718 void CVmAppUi::NumberQueryComplete()
       
   719     {
       
   720     iAppUiState = EIdle;
       
   721     }
       
   722 
       
   723 // -----------------------------------------------------------------------------
       
   724 // CVmAppUi::GetAppUiState
       
   725 //
       
   726 //
       
   727 // -----------------------------------------------------------------------------
       
   728 TVmbxAppUiState CVmAppUi::GetAppUiState()
       
   729     {
       
   730     return iAppUiState;
       
   731     }
       
   732 
       
   733 // -----------------------------------------------------------------------------
       
   734 // CVmAppUi::IsIpVoiceMailboxServices
       
   735 //
       
   736 //
       
   737 // -----------------------------------------------------------------------------   
       
   738 TBool CVmAppUi::IsIpVoiceMailboxServices()
       
   739     {
       
   740     return iAppContainer->IsIpVoiceMailboxServices();
       
   741     }
       
   742 
       
   743 // -----------------------------------------------------------------------------
       
   744 // CVmAppUi::SetItemSpecific
       
   745 //
       
   746 //
       
   747 // -----------------------------------------------------------------------------
       
   748 void CVmAppUi::SetItemSpecificL( CEikMenuPane* aMenuPane, TInt aCommandId )
       
   749     {
       
   750     VMBLOGSTRING2( "VMBX: CVmAppUi::SetItemSpecificL:aCommandId=%d =>",
       
   751     aCommandId );
       
   752     if ( aMenuPane )
       
   753         {
       
   754         aMenuPane->SetItemSpecific( aCommandId, ETrue );
       
   755         }
       
   756     else
       
   757         {
       
   758         User::Leave( KErrArgument );
       
   759         }
       
   760     VMBLOGSTRING( "VMBX: CVmAppUi::SetItemSpecificL: <=" );
       
   761     }
       
   762 
       
   763 // End of File