phoneuis/vmbx/src/VmContainer.cpp
changeset 0 5f000ab63145
child 25 91c2fb4b78df
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: Container for Voice mailbox application.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <aknlists.h>
       
    20 #include <AknDef.h>
       
    21 #include <AknsUtils.h>
       
    22 #include <AknsConstants.h>
       
    23 #include <AknsUtils.h>
       
    24 #include <AknsBasicBackgroundControlContext.h>
       
    25 #include <badesca.h>
       
    26 #include <aknkeys.h>
       
    27 #include <gulicon.h>
       
    28 #include <featmgr.h>
       
    29 #include <StringLoader.h>
       
    30 #include <data_caging_path_literals.hrh>
       
    31 
       
    32 #include <PbkFields.hrh>
       
    33 #include <PhCltUtils.h>
       
    34 #include <AiwServiceHandler.h> //For Application InterWorking
       
    35 #include <NumberGrouping.h>
       
    36 #include <NumberGroupingCRKeys.h>
       
    37 #include <settingsinternalcrkeys.h>
       
    38 #include <NetworkHandlingDomainPSKeys.h>
       
    39 #include <centralrepository.h>
       
    40 #include <AiwDialDataTypes.h>
       
    41 #include <aiwdialdataext.h>
       
    42 
       
    43 #include <spsettings.h>
       
    44 #include <vmnumber.h>
       
    45 #include <vm.rsg>
       
    46 #include <vm.mbg>
       
    47 #include "vm.hrh"
       
    48 
       
    49 #include "VoiceMailboxAppPrivateCRKeys.h"
       
    50 #include "voicemailboxdomaincrkeys.h"
       
    51 #include "VMBLogger.h"
       
    52 #include "VmContainer.h"
       
    53 #include "VmApp.h"
       
    54 #include "VmAppUi.h"
       
    55 
       
    56 // CONSTANTS
       
    57 
       
    58 _LIT( KVmNoIconPrefix, "0\t");       // no icon
       
    59 _LIT( KVmSimIconPrefix, "1\t");      // CS icon, number is stored in sim
       
    60 _LIT( KVmwCSIconPrefix, "2\t");      // CS icon, number is stored in phone memory
       
    61 _LIT( KVmwVideoIconPrefix, "3\t");   // default icon to Video
       
    62 _LIT( KVmwVoIPIconPrefix,  "4\t");   // default icon to VoIP
       
    63 
       
    64 _LIT( KVmSuffix, "\t");
       
    65 //for the mbm file
       
    66 _LIT( KVmMbmDrive, "Z:");
       
    67 _LIT( KVmLibMbmFile, "vm.mbm");
       
    68 
       
    69 const TInt KVmClearIcon = 0x02;
       
    70 const TInt KVmMailboxNumber = 0x04;
       
    71 const TInt KVmMessageDetails = 0x08;
       
    72 const TInt KVmPrefixLength = 3;
       
    73 const TInt KVmIconArraySize = 2;
       
    74 const TInt KFormattedCharLength = 3;
       
    75 
       
    76 // ================= MEMBER FUNCTIONS ==========================================
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CVmContainer::CVmContainer
       
    80 // C++ default constructor can NOT contain any code, that
       
    81 // might leave.
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 
       
    85 CVmContainer::CVmContainer()
       
    86     : iArray( 2 ),
       
    87       iVmUiOpts( 0 )
       
    88     {
       
    89     }
       
    90 
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CVmContainer::ConstructL
       
    94 // Symbian 2nd phase constructor can leave.
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 /*****************************************************
       
    98 *      Series 60 Customer / ETel
       
    99 *      Series 60  ETel API
       
   100 *****************************************************/
       
   101 void CVmContainer::ConstructL( const TRect& aRect,
       
   102                                            CAiwServiceHandler* aServiceHandler )
       
   103     {
       
   104     VMBLOGSTRING( "VMBX: CVmContainer::ConstructL: =>" );
       
   105     CreateWindowL();
       
   106     SetBlank();
       
   107 
       
   108     iServiceProviderSettings = CSPSettings::NewL();
       
   109 
       
   110     //Create repository and notify handlers.
       
   111     iSession = CRepository::NewL( KCRUidVoiceMailbox );
       
   112     iNotifyHandler1 = CCenRepNotifyHandler::NewL( *this, *iSession,
       
   113                           CCenRepNotifyHandler::EIntKey, KVmMessageCounter );
       
   114     iNotifyHandler2 = CCenRepNotifyHandler::NewL( *this, *iSession,
       
   115                           CCenRepNotifyHandler::EIntKey, KVmSummaryInfoIsSet );
       
   116     iNotifyHandler3 = CCenRepNotifyHandler::NewL( *this, *iSession,
       
   117                           CCenRepNotifyHandler::EIntKey, KVideoMbxSupport );
       
   118     iNotifyHandler1->StartListeningL();
       
   119     iNotifyHandler2->StartListeningL();
       
   120     iNotifyHandler3->StartListeningL();
       
   121 
       
   122     FeatureManager::InitializeLibL();
       
   123     iFeatureManagerInitialized = ETrue;
       
   124 
       
   125     TInt result( KErrNone );
       
   126     if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
       
   127         {
       
   128         result = iSession->Get( KVmUIOpts, iVmUiOpts );
       
   129 
       
   130         if ( result != KErrNone )
       
   131             {
       
   132             if ( result == KErrNotFound )
       
   133                 {
       
   134                 iVmUiOpts = 0;
       
   135                 }
       
   136             else
       
   137                 {
       
   138                 VMBLOGSTRING2( "VMBX: CVmContainer::ConstructL: CenRep error: %d", result );
       
   139                 User::Leave( result );
       
   140                 }
       
   141             }
       
   142         }
       
   143 
       
   144     result = iSession->Get( KVideoMbxSupport, iIsVideoSupported );
       
   145     if ( result != KErrNone )
       
   146         {
       
   147         iIsVideoSupported = EFalse;
       
   148         }
       
   149 
       
   150     // connect to phoneclient
       
   151     iServiceHandler  = aServiceHandler;
       
   152 
       
   153     // open vmbx number interface
       
   154     User::LeaveIfError( iVmbxNumber.Open() );
       
   155 
       
   156     // get the vmbx number of the active ALS line
       
   157     TInt ret( iVmbxNumber.GetVmbxNumber( iNumber ) );
       
   158 
       
   159     if ( ret != KErrNone && ret != KErrNotFound )
       
   160         {
       
   161         User::Leave( ret );
       
   162         }
       
   163 
       
   164     if ( IsVideoSupported() )
       
   165         {
       
   166         // get the video mailbox number of the active ALS line
       
   167         ret = iVmbxNumber.GetVideoMbxNumber( iVideoNumber );
       
   168         if ( ret != KErrNone && ret != KErrNotFound )
       
   169              {
       
   170              User::Leave( ret );
       
   171              }
       
   172         }
       
   173 
       
   174     TInt pngErr( KErrNone );
       
   175     TInt pngSupported( 0 );
       
   176     CRepository* repository = CRepository::NewL( KCRUidNumberGrouping );
       
   177     pngErr = repository->Get( KNumberGrouping, pngSupported );
       
   178     delete repository;
       
   179 
       
   180     if ( KErrNone == pngErr && pngSupported != 0 )
       
   181         {
       
   182         iNumberGrouping = CPNGNumberGrouping::NewL( KVmbxMaxNumberLength );
       
   183         }
       
   184 
       
   185     // construct the listbox object
       
   186     iListBox = new (ELeave) CAknDoubleGraphicStyleListBox;
       
   187     iListBox->SetContainerWindowL( *this );
       
   188 
       
   189     if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
   190         {
       
   191         iListBox->ConstructL( this, EAknListBoxMultiselectionList );
       
   192         }
       
   193     else
       
   194         {
       
   195         iListBox->ConstructL( this, EAknListBoxSelectionList );
       
   196         }
       
   197 
       
   198     // load the two localised strings for the listbox
       
   199     if (  FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
       
   200         {
       
   201         iLine1 = StringLoader::LoadL( R_MAILBOX_NUMBER );
       
   202         }
       
   203     else
       
   204         {
       
   205         iLine1 = iEikonEnv->AllocReadResourceL( R_CALL_VOICEMAIL );
       
   206         }
       
   207     iLine2 = iEikonEnv->AllocReadResourceL( R_NUMBER_PANE_EMPTY );
       
   208 
       
   209     if ( FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ) )
       
   210         {
       
   211         iVideoLine1 = iEikonEnv->AllocReadResourceL( R_CALL_VIDEOMAIL );
       
   212         iVideoLine2 = iEikonEnv->AllocReadResourceL( R_NUMBER_PANE_EMPTY );
       
   213         }
       
   214 
       
   215     if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
   216         {
       
   217         iLine3 = iEikonEnv->AllocReadResourceL( R_INT_CALL_VOICEMAIL );
       
   218         iLine4 = iEikonEnv->AllocReadResourceL( R_ADDRESS_PANE_EMPTY );
       
   219         }
       
   220 
       
   221     FillIndArray();
       
   222 
       
   223     // Set the text in the listbox
       
   224     // First create space for the items
       
   225     for ( TInt i = 0; i < iIndArray.Count(); i++ )
       
   226         {
       
   227         iArray.AppendL( KNullDesC );
       
   228         }
       
   229 
       
   230     //construct the list icon array, empty icon and sim icon
       
   231     ConstructIconsForListboxL();
       
   232     //set the icon array to the list box
       
   233     iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( iListIcons );
       
   234     iListBox->SetListBoxObserver( this );
       
   235 
       
   236     // New voice messages
       
   237     UpdateNewVoiceMessagesInListBoxL();
       
   238 
       
   239     // Voice mailbox number
       
   240     UpdateVmbxNumberInListBoxL();
       
   241 
       
   242     // Details
       
   243     UpdateLastMessageDetailsInListBoxL();
       
   244 
       
   245     iListBox->Model()->SetItemTextArray( &iArray );
       
   246     iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   247     iListBox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue );
       
   248     iListBox->CreateScrollBarFrameL( ETrue );
       
   249     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
       
   250                         CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
       
   251 
       
   252     TRect rect( 0, 0, 0, 0 );
       
   253     // Temporary rect is passed. Correct rect is set in SizeChanged.
       
   254     iSkinContext = CAknsBasicBackgroundControlContext::NewL(
       
   255         KAknsIIDQsnBgAreaMainCalc, rect, EFalse );
       
   256 
       
   257     SetRect( aRect );
       
   258     ActivateL();
       
   259     DrawNow();
       
   260 
       
   261     // request notify on ALS line changes
       
   262     iVmbxNumber.NotifyAlsLineChangeL( this );
       
   263 
       
   264     // request notify on vmbx number changes
       
   265     iVmbxNumber.NotifyVmbxNumberChangeL( this, ETrue );
       
   266 
       
   267     // request notify on Service changes
       
   268     iVmbxNumber.NotifyServiceChange( this );
       
   269 
       
   270     UpdateData( EFalse );
       
   271     iIsCallOngoing = EFalse;
       
   272 
       
   273     VMBLOGSTRING( "VMBX: CVmContainer::ConstructL: <=" );
       
   274     }
       
   275 
       
   276 
       
   277 // -----------------------------------------------------------------------------
       
   278 // CVmContainer::~CVmContainer
       
   279 // Destructor
       
   280 // -----------------------------------------------------------------------------
       
   281 //
       
   282 CVmContainer::~CVmContainer()
       
   283     {
       
   284     VMBLOGSTRING( "VMBX: CVmContainer::~CVmContainer: =>" );
       
   285 
       
   286     delete iServiceProviderSettings;
       
   287     
       
   288     delete iListBox;
       
   289 
       
   290     iArray.Reset();
       
   291     
       
   292     delete iLine1;
       
   293     delete iLine2;
       
   294     delete iVideoLine1;
       
   295     delete iVideoLine2;
       
   296     delete iLine3;
       
   297     delete iLine4;
       
   298     
       
   299    
       
   300     iVmbxNumber.NotifyServiceChangeCancel();
       
   301 
       
   302     iVmbxNumber.Close();
       
   303     if ( iNotifyHandler1 )
       
   304         {
       
   305         iNotifyHandler1->StopListening();
       
   306         delete iNotifyHandler1;
       
   307         }
       
   308 
       
   309     if ( iNotifyHandler2 )
       
   310         {
       
   311         iNotifyHandler2->StopListening();
       
   312         delete iNotifyHandler2;
       
   313         }
       
   314     
       
   315     if ( iNotifyHandler3 )
       
   316         {
       
   317         iNotifyHandler3->StopListening();
       
   318         delete iNotifyHandler3;
       
   319         }
       
   320 
       
   321     delete iSession;
       
   322     delete iNumberGrouping;
       
   323 
       
   324     iIndArray.Close();
       
   325 
       
   326     if ( iFeatureManagerInitialized )
       
   327         {
       
   328         FeatureManager::UnInitializeLib();
       
   329         }
       
   330 
       
   331     delete iSkinContext;
       
   332 
       
   333     VMBLOGSTRING( "VMBX: CVmContainer::~CVmContainer: <=" );
       
   334     }
       
   335 
       
   336 // -----------------------------------------------------------------------------
       
   337 // CVmContainer::SizeChanged
       
   338 // Called by framework when the view size is changed
       
   339 // -----------------------------------------------------------------------------
       
   340 //
       
   341 void CVmContainer::SizeChanged()
       
   342     {
       
   343     if ( iSkinContext )
       
   344         {
       
   345         iSkinContext->SetRect( TRect( TPoint( 0, 0 ), Rect().Size() ) );
       
   346         }
       
   347     AknLayoutUtils::LayoutControl( iListBox, Rect(),
       
   348                                         AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) );
       
   349 
       
   350     }
       
   351 
       
   352 // -----------------------------------------------------------------------------
       
   353 // CVmContainer::CountComponentControls
       
   354 // Gets a count of the component controls
       
   355 // -----------------------------------------------------------------------------
       
   356 //
       
   357 TInt CVmContainer::CountComponentControls() const
       
   358     {
       
   359     if( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
   360         {
       
   361         return 2; // the listbox is the only control
       
   362         }
       
   363     else
       
   364         {
       
   365         return 1; // the listbox is the only control
       
   366         }
       
   367     }
       
   368 
       
   369 // -----------------------------------------------------------------------------
       
   370 // CVmContainer::ComponentControl
       
   371 // Gets an indexed component of a compound control
       
   372 // -----------------------------------------------------------------------------
       
   373 //
       
   374 CCoeControl* CVmContainer::ComponentControl( TInt /*aIndex*/ ) const
       
   375     {
       
   376     return iListBox;
       
   377     }
       
   378 
       
   379 // -----------------------------------------------------------------------------
       
   380 // CVmContainer::AllowedToChangeTheNumber
       
   381 // Check wether is possible to edit the voice mailbox number.
       
   382 // -----------------------------------------------------------------------------
       
   383 //
       
   384 TBool CVmContainer::AllowedToChangeTheNumber()
       
   385     {
       
   386     VMBLOGSTRING( "VMBX: CVmContainer::AllowedToChangeTheNumber: =>" );
       
   387     VMBLOGSTRING( "VMBX: CVmContainer::AllowedToChangeTheNumber: <=" );
       
   388     return iVmbxNumber.AllowedToChangeTheNumber();
       
   389     }
       
   390 
       
   391 
       
   392 // -----------------------------------------------------------------------------
       
   393 // CVmContainer::OfferKeyEventL
       
   394 // Handles key events
       
   395 // -----------------------------------------------------------------------------
       
   396 //
       
   397 TKeyResponse CVmContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   398                                                              TEventCode aType )
       
   399     {
       
   400     VMBLOGSTRING( "VMBX: CVmContainer::OfferKeyEventL: =>" );
       
   401     // For CDMA:
       
   402     if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
       
   403         {
       
   404         if ( aType == EEventKey )
       
   405             {
       
   406             TInt currentItem = CurrentItem();
       
   407             if ( currentItem != KErrNotFound )
       
   408                 {
       
   409                 if ( aKeyEvent.iCode == EKeyPhoneSend )
       
   410                     {
       
   411                     if ( currentItem == EVmbxVoiceMessageAmountInd
       
   412                                  || currentItem == EVmbxVoiceMailboxNumberInd )
       
   413                         {
       
   414                         CallVoiceMailBoxL();
       
   415                         VMBLOGSTRING( "VMBX: CVmContainer::OfferKeyEventL: Send key" );
       
   416                         return EKeyWasConsumed;
       
   417                         }
       
   418                     }
       
   419 
       
   420                 if ( aKeyEvent.iCode == EKeyOK )
       
   421                     {
       
   422                     if ( currentItem == EVmbxVoiceMessageAmountInd )
       
   423                         {
       
   424                         CallVoiceMailBoxL();
       
   425                         VMBLOGSTRING( "VMBX: CVmContainer::OfferKeyEventL: OK key" );
       
   426                         return EKeyWasConsumed;
       
   427                         }
       
   428                     else if ( currentItem == EVmbxVoiceMailboxNumberInd )
       
   429                         {
       
   430                         if ( AllowedToChangeTheNumber() )
       
   431                             {
       
   432                             iAvkonAppUi->HandleCommandL( EvmCmdChangeNumber );
       
   433                             }
       
   434                         else
       
   435                             {
       
   436                             CallVoiceMailBoxL();
       
   437                             }
       
   438                         VMBLOGSTRING( "VMBX: CVmContainer::OfferKeyEventL: OK key" );
       
   439                         return EKeyWasConsumed;
       
   440                         }
       
   441                     else if ( currentItem == EVmbxIntCallVoiceMailboxNumberInd &&
       
   442                               FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
   443                         {
       
   444                         VMBLOGSTRING( "VMBX: CVmContainer::OfferKeyEventL: OK key" );
       
   445                         return EKeyWasConsumed;
       
   446                         }
       
   447                     else if ( currentItem == EVmbxDetailsOfLastMessageInd )
       
   448                         {
       
   449                         iAvkonAppUi->HandleCommandL( EvmCmdShowLastMessageDetails );
       
   450                         VMBLOGSTRING( "VMBX: CVmContainer::OfferKeyEventL: OK key" );
       
   451                         return EKeyWasConsumed;
       
   452                         }
       
   453                     }
       
   454                 }
       
   455             }
       
   456 
       
   457         return iListBox->OfferKeyEventL( aKeyEvent, aType );
       
   458         }
       
   459 
       
   460     // General variant:
       
   461     if ( aType == EEventKey )
       
   462         {
       
   463         TInt currentItem = CurrentItem();
       
   464         // pressing selection/SEND/enter key initiates a voice call
       
   465         if ( ( aKeyEvent.iCode == EKeyOK
       
   466                || aKeyEvent.iCode == EKeyPhoneSend
       
   467                || aKeyEvent.iCode == EKeyEnter )
       
   468             && ( currentItem == EVmbxVoiceMessageAmountInd
       
   469                  || currentItem == EVmbxVoiceMailboxNumberInd ) )
       
   470             {
       
   471             CallVoiceMailBoxL();
       
   472             }
       
   473         else if ( ( aKeyEvent.iCode == EKeyOK
       
   474                     || aKeyEvent.iCode == EKeyPhoneSend
       
   475                     || aKeyEvent.iCode == EKeyEnter )
       
   476                 && ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip )
       
   477                 && currentItem != EVmbxVoiceMessageAmountInd
       
   478                 && currentItem != EVmbxVoiceMailboxNumberInd
       
   479                 && currentItem != EVmbxVideoMailboxNumberInd) )
       
   480             {
       
   481             CallIntVoiceMailBoxL();
       
   482             }
       
   483 
       
   484         else if ( IsVideoSupported()
       
   485                   && ( aKeyEvent.iCode == EKeyOK
       
   486                       || aKeyEvent.iCode == EKeyPhoneSend
       
   487                       || aKeyEvent.iCode == EKeyEnter )
       
   488                   && currentItem == EVmbxVideoMailboxNumberInd )
       
   489             {
       
   490             CallVideoMailBoxL();
       
   491             }
       
   492 
       
   493         if ( ( aKeyEvent.iCode == EKeyUpArrow || aKeyEvent.iCode == EKeyDownArrow ) &&
       
   494              ( IsVideoSupported() ||
       
   495                FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) )
       
   496             {
       
   497             TKeyResponse response( iListBox->OfferKeyEventL( aKeyEvent,
       
   498                                                                     aType ) );
       
   499             iListBox->SetCurrentItemIndex( iListBox->CurrentItemIndex() );
       
   500             ( static_cast <CVmAppUi*>iAvkonAppUi ) ->DrawCbaButtonsL();
       
   501             VMBLOGSTRING2( "VMBX: CVmContainer::OfferKeyEventL: \
       
   502             response = %I", response );
       
   503             return response;
       
   504             }
       
   505         }
       
   506     VMBLOGSTRING( "VMBX: CVmContainer::OfferKeyEventL: <=" );
       
   507     return EKeyWasConsumed;
       
   508     }
       
   509 
       
   510 // -----------------------------------------------------------------------------
       
   511 // CVmContainer::HandleListBoxEventL
       
   512 // Handles listbox clicks.
       
   513 // -----------------------------------------------------------------------------
       
   514 //
       
   515 void CVmContainer::HandleListBoxEventL(
       
   516     CEikListBox* /*aListBox*/,
       
   517     TListBoxEvent aEventType)
       
   518     {
       
   519     VMBLOGSTRING( "VMBX: HandleListBoxEventL: =>" );
       
   520     VMBLOGSTRING2( "VMBX: HandleListBoxEventL: aEventType=%d", aEventType );
       
   521     switch ( aEventType )
       
   522         {
       
   523         case EEventItemSingleClicked:
       
   524             {
       
   525             // at begining,if Querying number, 
       
   526             // the key envent should not be response
       
   527             if( ELauncherQueryingNumber != 
       
   528                     ( static_cast <CVmAppUi*>iAvkonAppUi )->GetAppUiState() )
       
   529                 {
       
   530                 TKeyEvent aKeyEvent;
       
   531                 aKeyEvent.iCode = EKeyOK;
       
   532                 VMBLOGSTRING( "VMBX: HandleListBoxEventL: OfferKeyEventL" );
       
   533                 OfferKeyEventL( aKeyEvent, EEventKey );
       
   534                 }
       
   535             VMBLOGSTRING( "VMBX: HandleListBoxEventL: EEventItemSingleClicked" );
       
   536             break;
       
   537             }
       
   538         default:
       
   539             VMBLOGSTRING( "VMBX: HandleListBoxEventL: default" );
       
   540             break;
       
   541         }
       
   542 
       
   543     VMBLOGSTRING( "VMBX: HandleListBoxEventL: <=" );
       
   544     }
       
   545 
       
   546 // -----------------------------------------------------------------------------
       
   547 // CVmContainer::HandleResourceChange
       
   548 // Notifier for changing orientation
       
   549 // (other items were commented in a header).
       
   550 // -----------------------------------------------------------------------------
       
   551 //
       
   552 void CVmContainer::HandleResourceChange( TInt aType )
       
   553     {
       
   554     VMBLOGSTRING( "VMBX: HandleResourceChange: =>" );
       
   555     TRect mainPaneRect ;
       
   556     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   557         {
       
   558         VMBLOGSTRING( "VMBX: HandleResourceChange: DynamicLayout" );
       
   559         iListBox->HandleResourceChange( aType );
       
   560         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
       
   561                                                                  mainPaneRect );
       
   562         TRAP_IGNORE( CEikonEnv::Static()->AppUiFactory()->StatusPane()->
       
   563                             SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ) );
       
   564         SetRect( mainPaneRect );
       
   565         DrawNow();
       
   566         }
       
   567     CCoeControl::HandleResourceChange( aType );
       
   568     VMBLOGSTRING( "VMBX: HandleResourceChange: <=" );
       
   569     }
       
   570 
       
   571 // -----------------------------------------------------------------------------
       
   572 // CVmContainer::Draw
       
   573 // Redraw the window owned by this container
       
   574 // -----------------------------------------------------------------------------
       
   575 //
       
   576 void CVmContainer::Draw( const TRect& aRect ) const
       
   577     {
       
   578     VMBLOGSTRING( "VMBX: Draw: =>" );
       
   579     CWindowGc& gc = SystemGc();
       
   580     gc.Clear( aRect );
       
   581 
       
   582     // Drawing skin
       
   583     if ( iSkinContext )
       
   584         {
       
   585         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   586         AknsDrawUtils::Background( skin, iSkinContext, this, gc, aRect );
       
   587         }
       
   588     VMBLOGSTRING( "VMBX: Draw: <=" );
       
   589     }
       
   590 // -----------------------------------------------------------------------------
       
   591 // CVmContainer::QueryNumberL
       
   592 // Queries for a new voice mailbox number. If the query
       
   593 // is approved, the listbox is updated.
       
   594 // -----------------------------------------------------------------------------
       
   595 //
       
   596 void CVmContainer::QueryNumberL( TVmbxQueryType aQueryType )
       
   597     {
       
   598     VMBLOGSTRING( "VMBX: CVmContainer::QueryNumberL: =>" );
       
   599     TBool ret( EFalse );
       
   600     TRAPD( queryErr, 
       
   601         ret = iVmbxNumber.QueryNumberL( aQueryType, iNumber, ETrue ) );
       
   602 
       
   603     if ( KErrNone == queryErr )
       
   604         {
       
   605         if ( ret )
       
   606             {
       
   607             // if the query was approved, update vmbx number
       
   608             UpdateVmbxNumberInListBoxL();
       
   609             (static_cast <CVmAppUi*>iAvkonAppUi) ->DrawCbaButtonsL();
       
   610             iListBox->DrawNow();
       
   611             VMBLOGSTRING( "VMBX: CVmContainer::QueryNumberL: \
       
   612             update vmbx number listbox" );
       
   613             }
       
   614         }
       
   615     else
       
   616         {
       
   617         VMBLOGSTRING2( "VMBX: CVmContainer::QueryNumberL: \
       
   618         queryErr = %d", queryErr );
       
   619         
       
   620         if ( KErrAccessDenied == queryErr )
       
   621             {
       
   622             VMBLOGSTRING( "VMBX: CVmContainer::QueryNumberL: \
       
   623             not allow to change number" );
       
   624             }
       
   625         else
       
   626             {
       
   627             User::Leave( queryErr );
       
   628             }
       
   629         }
       
   630     VMBLOGSTRING( "VMBX: CVmContainer::QueryNumberL: <=" );
       
   631     }
       
   632 
       
   633 // -----------------------------------------------------------------------------
       
   634 // CVmContainer::UpdateNewVoiceMessagesInListBoxL
       
   635 // Updates the new voice message to the listbox
       
   636 // -----------------------------------------------------------------------------
       
   637 //
       
   638 void CVmContainer::UpdateNewVoiceMessagesInListBoxL()
       
   639     {
       
   640     VMBLOGSTRING( "VMBX: CVmContainer::UpdateNewVoiceMessagesInListBoxL: =>" );
       
   641     if ( !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
       
   642         {
       
   643         VMBLOGSTRING( "VMBX: CVmContainer::UpdateNewVoiceMessagesInListBoxL:\
       
   644         Cdma not supported" );
       
   645         return;
       
   646         }
       
   647 
       
   648     // First line
       
   649     HBufC* firstLineText = StringLoader::LoadLC( R_VOICE_MESSAGES );
       
   650 
       
   651     // Second line
       
   652     HBufC* secondLineText = NULL;
       
   653     TInt voiceMessageAmout = 0;
       
   654 
       
   655     TInt err = iSession->Get( KVmMessageCounter, voiceMessageAmout );
       
   656     if ( err != KErrNotFound )
       
   657         {
       
   658         VMBLOGSTRING2( "VMBX: CVmContainer::UpdateNewVoiceMessagesInListBoxL:\
       
   659         CenRep error: %d", err );
       
   660         User::LeaveIfError( err );
       
   661         }
       
   662 
       
   663     if ( voiceMessageAmout == 0 )
       
   664         {
       
   665         secondLineText = StringLoader::LoadLC( R_NO_NEW );
       
   666         }
       
   667     else if ( voiceMessageAmout == 1 )
       
   668         {
       
   669         secondLineText = StringLoader::LoadLC( R_NEW_MESSAGES );
       
   670         }
       
   671     else
       
   672         {
       
   673         secondLineText = StringLoader::LoadLC( R_N_NEW, voiceMessageAmout );
       
   674         }
       
   675 
       
   676     // Create combination:
       
   677     HBufC* comboText = HBufC::NewLC( firstLineText->Length() +
       
   678                                     secondLineText->Length() +
       
   679                                     KFormattedCharLength ); // 3 special chars
       
   680 
       
   681     TPtr comboPtr = comboText->Des();
       
   682     comboPtr.Append( KVmNoIconPrefix );
       
   683     comboPtr.Append( *firstLineText );
       
   684     comboPtr.Append( KVmSuffix );
       
   685     comboPtr.Append( *secondLineText );
       
   686 
       
   687     TInt ind = iIndArray.Find( EVmbxVoiceMessageAmountInd );
       
   688     if ( ind != KErrNotFound )
       
   689         {
       
   690         iArray.Delete( ind );
       
   691         iArray.InsertL( ind, comboPtr );
       
   692         }
       
   693 
       
   694     CleanupStack::PopAndDestroy( comboText );
       
   695     CleanupStack::PopAndDestroy( secondLineText );
       
   696     CleanupStack::PopAndDestroy( firstLineText );
       
   697     VMBLOGSTRING( "VMBX: CVmContainer::UpdateNewVoiceMessagesInListBoxL: <=" );
       
   698     }
       
   699 
       
   700 // -----------------------------------------------------------------------------
       
   701 // CVmContainer::UpdateVmbxNumberInListBoxL
       
   702 // Updates the vmbx number in the listbox shown on the app screen.
       
   703 // -----------------------------------------------------------------------------
       
   704 //
       
   705 void CVmContainer::UpdateVmbxNumberInListBoxL()
       
   706     {
       
   707     VMBLOGSTRING( "VMBX: CVmContainer::UpdateVmbxNumberInListBoxL: =>" );
       
   708     if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) &&
       
   709         !( iVmUiOpts & KVmMailboxNumber ) )
       
   710         {
       
   711         VMBLOGSTRING( "VMBX: CVmContainer::UpdateNewVoiceMessagesInListBoxL: \
       
   712         Cdma supported or/and no vmbxnumber support" );
       
   713         return;
       
   714         }
       
   715 
       
   716     // allocate buffer for icon, title, vmxb number and suffix
       
   717     HBufC* buf = HBufC::NewLC( KVmNoIconPrefix().Length() +
       
   718                                iLine1->Length() +
       
   719                                KVmSuffix().Length() +
       
   720                                KVmbxMaxNumberLength );
       
   721         
       
   722     TPtr bufPtr = buf->Des();
       
   723 
       
   724     // listbox formatting
       
   725     if ( iVmbxNumber.IsSimMemory() && iNumber.Length() )
       
   726         {
       
   727         VMBLOGSTRING( "UpdateNewVoiceMessagesInListBoxL::Show SIM icon" );
       
   728         bufPtr.Append( KVmSimIconPrefix );
       
   729         }
       
   730     else
       
   731         {
       
   732         VMBLOGSTRING( "UpdateNewVoiceMessagesInListBoxL::Show CS icon, number stored to phone" );
       
   733         bufPtr.Append( KVmwCSIconPrefix );
       
   734         }
       
   735 
       
   736     bufPtr.Append( *iLine1 );  // "Voice Mailbox"-text (localised)
       
   737     bufPtr.Append( KVmSuffix );
       
   738 
       
   739     if ( !iNumber.Length() )
       
   740         {
       
   741         bufPtr.Append( *iLine2 );       // "No number"-text (localised)
       
   742         }
       
   743     else
       
   744         {
       
   745         // Convert the phone number to accommodate the current locale
       
   746         TBuf<KVmbxMaxNumberLength> locNumber;
       
   747 
       
   748         if ( iNumberGrouping )
       
   749             {
       
   750             iNumberGrouping->Set( iNumber );
       
   751             locNumber.Copy( iNumberGrouping->FormattedNumber() );
       
   752             }
       
   753         else
       
   754             {
       
   755             locNumber.Copy( iNumber );
       
   756             }
       
   757 
       
   758         AknTextUtils::LanguageSpecificNumberConversion( locNumber );
       
   759 
       
   760         bufPtr.Append( locNumber );
       
   761         }
       
   762 
       
   763     TInt ind = iIndArray.Find( EVmbxVoiceMailboxNumberInd );
       
   764     if ( ind  != KErrNotFound )
       
   765         {
       
   766         iArray.Delete( ind );
       
   767         iArray.InsertL( ind, bufPtr );
       
   768         }
       
   769     CleanupStack::PopAndDestroy( buf );
       
   770 
       
   771     // ========================================================================
       
   772     // Video Mailbox specific part starts from here
       
   773     // ========================================================================
       
   774 
       
   775     if ( IsVideoSupported() )
       
   776         {
       
   777         TInt videoline2MaxLength( iVideoLine2->Length() );
       
   778 
       
   779         if ( KVmbxMaxNumberLength > videoline2MaxLength )
       
   780             {
       
   781             videoline2MaxLength = KVmbxMaxNumberLength;
       
   782             }
       
   783 
       
   784         // allocate buffer for 2 listbox lines and 3 formatter chars
       
   785         HBufC* videoBuf = HBufC::NewLC( iVideoLine1->Length() +
       
   786                                             videoline2MaxLength +
       
   787                                             KVmNoIconPrefix().Length() +
       
   788                                             KVmSuffix().Length() );
       
   789 
       
   790         TPtr videoBufPtr = videoBuf->Des();
       
   791 
       
   792         // listbox formatting
       
   793         videoBufPtr.Append( KVmwVideoIconPrefix );
       
   794         videoBufPtr.Append( *iVideoLine1 );  // "Video Mailbox"-text (localised)
       
   795         videoBufPtr.Append( KVmSuffix );
       
   796 
       
   797         if ( !iVideoNumber.Length() )
       
   798             {
       
   799             videoBufPtr.Append( *iVideoLine2 );  // "No number"-text (localised)
       
   800             }
       
   801         else
       
   802             {
       
   803             // Convert the phone number to accommodate the current locale
       
   804             TBuf<KVmbxMaxNumberLength> videoLocNumber;
       
   805 
       
   806             if ( iNumberGrouping )
       
   807                 {
       
   808                 iNumberGrouping->Set( iVideoNumber );
       
   809                 videoLocNumber.Copy( iNumberGrouping->FormattedNumber() );
       
   810                 }
       
   811             else
       
   812                 {
       
   813                 videoLocNumber.Copy( iVideoNumber );
       
   814                 }
       
   815 
       
   816             AknTextUtils::LanguageSpecificNumberConversion( videoLocNumber );
       
   817 
       
   818             videoBufPtr.Append( videoLocNumber );
       
   819             }
       
   820 
       
   821         TInt videoInd = iIndArray.Find( EVmbxVideoMailboxNumberInd );
       
   822         if ( videoInd != KErrNotFound )
       
   823             {
       
   824             iArray.Delete( videoInd );
       
   825             iArray.InsertL( videoInd, videoBufPtr );
       
   826             }
       
   827         CleanupStack::PopAndDestroy( videoBuf );
       
   828         }
       
   829     
       
   830     // ========================================================================
       
   831     // IP Mailbox specific part starts from here
       
   832     // ========================================================================
       
   833     
       
   834     if ( IsIpVoiceMailboxServices() )
       
   835         {
       
   836         // Get all Service Ids
       
   837         RArray<TUint> profileIds;
       
   838         CleanupClosePushL( profileIds );
       
   839         iVmbxNumber.GetServiceIds( profileIds );
       
   840 
       
   841         TBuf<KVmbxMaxAddressLength> vmbxAddress;
       
   842 
       
   843         for ( TInt i( 0 ); i < profileIds.Count(); i++ )
       
   844             {
       
   845             // Get mailbox name
       
   846             TVmbxServiceInfo serviceInfo;
       
   847             serviceInfo.iServiceId = profileIds[ i ];
       
   848             iVmbxNumber.GetServiceInfo( serviceInfo );
       
   849             HBufC* name = HBufC::NewLC( serviceInfo.iName.Length() );
       
   850             name->Des().Copy( serviceInfo.iName );
       
   851 
       
   852             HBufC* mailbox = StringLoader::LoadLC(
       
   853                 R_VOIP_LIST_MAILBOX_NAME, name->Des( ) );
       
   854 
       
   855             HBufC* buf2 = HBufC::NewLC( mailbox->Length()
       
   856                                         + KVmbxMaxNumberLength
       
   857                                         + KVmNoIconPrefix().Length()
       
   858                                         + KVmSuffix().Length() * 3 );
       
   859             TPtr bufPtr2 = buf2->Des();
       
   860 
       
   861             // Brand icon here, if brand icon is not available
       
   862             // use default VoIP icon
       
   863             TInt iconId( KErrNotFound );
       
   864             TRAPD( error, AddBrandIconL( profileIds[ i ], iconId ) );
       
   865 
       
   866             if ( KErrNone == error && KErrNotFound != iconId )
       
   867                 {
       
   868                 bufPtr2.AppendNum( iconId );
       
   869                 bufPtr2.Append( KVmSuffix );
       
   870                 }
       
   871             else
       
   872                 {
       
   873                 bufPtr2.Append( KVmwVoIPIconPrefix );
       
   874                 }
       
   875 
       
   876             // Add Mailbox text
       
   877             bufPtr2.Append( mailbox->Des() );
       
   878             bufPtr2.Append( KVmSuffix );
       
   879 
       
   880             // Write address
       
   881             vmbxAddress.Copy( serviceInfo.iAddress );
       
   882 
       
   883             if ( !vmbxAddress.Length() )
       
   884                 {
       
   885                 bufPtr2.Append( *iLine4 );  // "No number"-text (localised)
       
   886                 }
       
   887             else
       
   888                 {
       
   889                 bufPtr2.Append( vmbxAddress );
       
   890                 }
       
   891 
       
   892             // this corrects SIM icon to the right place
       
   893             bufPtr2.Append( KVmSuffix );
       
   894 
       
   895             ind = iIndArray.Find( EVmbxIntCallVoiceMailboxNumberInd );
       
   896             if ( KErrNotFound != ind )
       
   897                 {
       
   898                 VMBLOGSTRING2( "VMBX: CVmContainer::UpdateVmbxNumberInListBoxL: %S", buf2 );
       
   899                 iArray.Delete( ind + i );
       
   900                 iArray.InsertL( ind + i, bufPtr2 );
       
   901                 }
       
   902 
       
   903             CleanupStack::PopAndDestroy( buf2 );
       
   904             CleanupStack::PopAndDestroy( mailbox );
       
   905             CleanupStack::PopAndDestroy( name );
       
   906             }
       
   907         CleanupStack::PopAndDestroy( &profileIds );
       
   908         }
       
   909     VMBLOGSTRING( "VMBX: CVmContainer::UpdateVmbxNumberInListBoxL: <=" );
       
   910     }
       
   911 
       
   912 // -----------------------------------------------------------------------------
       
   913 // CVmContainer::UpdateLastMessageDetailsInListBoxL
       
   914 // Updates the last message details to the listbox
       
   915 // -----------------------------------------------------------------------------
       
   916 //
       
   917 void CVmContainer::UpdateLastMessageDetailsInListBoxL()
       
   918     {
       
   919     VMBLOGSTRING( "VMBX: CVmContainer::UpdateLastMessageDetailsInListBoxL: =>" );
       
   920     if ( !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ||
       
   921          !( iVmUiOpts & KVmMessageDetails ) )
       
   922         {
       
   923         VMBLOGSTRING( "VMBX: CVmContainer::UpdateNewVoiceMessagesInListBoxL: \
       
   924          Cdma supported or/and no vmbxdetails support" );
       
   925         return;
       
   926         }
       
   927 
       
   928     // Determine the position of this item in the list (if any)
       
   929     TInt ind = iIndArray.Find( EVmbxDetailsOfLastMessageInd );
       
   930 
       
   931     // if the last message is not set, hide the item:
       
   932     // 0 = not set
       
   933     // 1 = set.
       
   934     TInt messageSet = 0;
       
   935 
       
   936     iSession->Get( KVmSummaryInfoIsSet, messageSet ); // ignore error
       
   937 
       
   938     if ( messageSet == 0 )
       
   939         {
       
   940         if ( ind != KErrNotFound )
       
   941             {
       
   942             // remove the item from the list
       
   943             iIndArray.Remove( ind );
       
   944             iArray.Delete( ind );
       
   945             }
       
   946         return;
       
   947         }
       
   948 
       
   949     HBufC* resourceText = StringLoader::LoadLC( R_DETAILS_OF_LAST );
       
   950 
       
   951     // Three special chars
       
   952     HBufC* detailsText = HBufC::NewLC( KVmPrefixLength +
       
   953                                                     resourceText->Length() );
       
   954     TPtr detailsPtr = detailsText->Des();
       
   955     detailsPtr.Append( KVmNoIconPrefix );
       
   956     detailsPtr.Append( *resourceText );
       
   957     detailsPtr.Append( KVmSuffix );
       
   958     detailsPtr.Append( KNullDesC ); // the second line is empty
       
   959 
       
   960     if ( ind == KErrNotFound )
       
   961         {
       
   962         // Add the item back to the list
       
   963         iIndArray.Append( EVmbxDetailsOfLastMessageInd );
       
   964         iArray.AppendL( detailsPtr );
       
   965         }
       
   966 
       
   967     CleanupStack::PopAndDestroy( detailsText );
       
   968     CleanupStack::PopAndDestroy( resourceText );
       
   969     VMBLOGSTRING( "VMBX: CVmContainer::\
       
   970     UpdateLastMessageDetailsInListBoxL: <=" );
       
   971     }
       
   972 
       
   973 // -----------------------------------------------------------------------------
       
   974 // CVmContainer::CallVoiceMailBoxL
       
   975 // Calls the vmbx number using PhoneClient.
       
   976 // -----------------------------------------------------------------------------
       
   977 //
       
   978 /*****************************************************
       
   979 *      Series 60 Customer / ETel
       
   980 *      Series 60  ETel API
       
   981 *****************************************************/
       
   982 void CVmContainer::CallVoiceMailBoxL()
       
   983     {
       
   984     VMBLOGSTRING( "VMBX: CVmContainer::CallVoiceMailBoxL: =>" );
       
   985 
       
   986     if ( !iIsCallOngoing )
       
   987         {
       
   988         AiwCallRequestL( KVmCmdAiwVoiceCall, CAiwDialData::EAIWVoice );
       
   989         }
       
   990 
       
   991     VMBLOGSTRING( "VMBX: CVmContainer::CallVoiceMailBoxL: <=" );
       
   992     }
       
   993 
       
   994 
       
   995 // -----------------------------------------------------------------------------
       
   996 // CVmContainer::CallVoiceMailBoxL
       
   997 // Calls the vmbx number using PhoneClient.
       
   998 // -----------------------------------------------------------------------------
       
   999 //
       
  1000 /*****************************************************
       
  1001 *      Series 60 Customer / ETel
       
  1002 *      Series 60  ETel API
       
  1003 *****************************************************/
       
  1004 void CVmContainer::CallIntVoiceMailBoxL()
       
  1005     {
       
  1006     VMBLOGSTRING( "VMBX: CVmContainer::CallVoiceMailBoxL: =>" );
       
  1007 
       
  1008     if ( !iIsCallOngoing )
       
  1009         {
       
  1010         AiwCallRequestL( KVmCmdAiwVoipCall, CAiwDialData::EAIWVoiP );
       
  1011         }
       
  1012 
       
  1013     VMBLOGSTRING( "VMBX: CVmContainer::CallVoiceMailBoxL: <=" );
       
  1014     }
       
  1015 
       
  1016 
       
  1017 // -----------------------------------------------------------------------------
       
  1018 // CVmContainer::HandleNotifyL
       
  1019 // When user has completed an action to a vmbx number
       
  1020 // -----------------------------------------------------------------------------
       
  1021 //
       
  1022 void CVmContainer::HandleNotifyL( TInt /*aLine*/, const TDesC& aValue )
       
  1023     {
       
  1024     VMBLOGSTRING( "VMBX: CVmContainer::HandleNotifyL: =>" );
       
  1025     iNumber.Copy( aValue );
       
  1026     UpdateVmbxNumberInListBoxL();
       
  1027     (static_cast <CVmAppUi*>iAvkonAppUi) ->DrawCbaButtonsL();
       
  1028     iListBox->DrawNow();
       
  1029     VMBLOGSTRING( "VMBX: CVmContainer::HandleNotifyL: <=" );
       
  1030     }
       
  1031 
       
  1032 // -----------------------------------------------------------------------------
       
  1033 // CVmContainer::HandleAlsChangeL
       
  1034 // ALS line changed
       
  1035 // -----------------------------------------------------------------------------
       
  1036 //
       
  1037 void CVmContainer::HandleAlsChangeL( TVmbxAlsLine /*aLine*/ )
       
  1038     {
       
  1039     VMBLOGSTRING( "VMBX: CVmContainer::HandleAlsChangeL: =>" );
       
  1040     VMBLOGSTRING( "VMBX: CVmContainer::HandleAlsChangeL: <=" );
       
  1041     }
       
  1042 
       
  1043 // -----------------------------------------------------------------------------
       
  1044 // CVmContainer::UpdateVmbxNumberL
       
  1045 // Gets the vmbx number from SIM/SharedData and updates it in the display.
       
  1046 // -----------------------------------------------------------------------------
       
  1047 //
       
  1048 void CVmContainer::UpdateVmbxNumberL()
       
  1049     {
       
  1050     VMBLOGSTRING( "VMBX: CVmContainer::UpdateVmbxNumberL: =>" );
       
  1051     TInt ret ( iVmbxNumber.GetVmbxNumber( iNumber ) );
       
  1052 
       
  1053     if ( ret == KErrNotFound )
       
  1054         {
       
  1055         iNumber.Zero();
       
  1056         }
       
  1057     else if ( ret != KErrNone )
       
  1058         {
       
  1059         User::LeaveIfError( ret );
       
  1060         }
       
  1061 
       
  1062     UpdateVmbxNumberInListBoxL();
       
  1063     iListBox->DrawNow();
       
  1064     (static_cast <CVmAppUi*>iAvkonAppUi) ->DrawCbaButtonsL();
       
  1065     VMBLOGSTRING( "VMBX: CVmContainer::UpdateVmbxNumberL: <=" );
       
  1066     }
       
  1067 
       
  1068 // -----------------------------------------------------------------------------
       
  1069 // CVmContainer::HandleNotifyInt
       
  1070 // Integer value keys has pressed
       
  1071 // -----------------------------------------------------------------------------
       
  1072 //
       
  1073 void CVmContainer::HandleNotifyInt( TUint32 aKey, TInt aValue )
       
  1074     {
       
  1075     VMBLOGSTRING( "VMBX: CVmContainer::HandleNotifyInt: =>" );
       
  1076     if ( aKey == KVmMessageCounter)
       
  1077         {
       
  1078         TRAPD( err1, UpdateNewVoiceMessagesInListBoxL() );
       
  1079         if ( err1 != KErrNone )
       
  1080             {
       
  1081             _LIT(KVmbxPanicType1,"UpdateNewVoiceMessagesInListBoxL");
       
  1082             User::Panic( KVmbxPanicType1, err1 );
       
  1083             }
       
  1084         iListBox->DrawNow();
       
  1085         }
       
  1086     else if ( aKey == KVmSummaryInfoIsSet )
       
  1087         {
       
  1088         TInt currentItem = CurrentItem();
       
  1089         if ( currentItem == EVmbxDetailsOfLastMessageInd )
       
  1090             {
       
  1091             TInt newInd = iIndArray.Find( EVmbxVoiceMailboxNumberInd );
       
  1092             if ( newInd != KErrNotFound )
       
  1093                 {
       
  1094                 iListBox->SetCurrentItemIndex( newInd );
       
  1095                 }
       
  1096             }
       
  1097         TRAPD( err2, UpdateLastMessageDetailsInListBoxL() );
       
  1098         if ( err2 != KErrNone )
       
  1099             {
       
  1100             _LIT(KVmbxPanicType2,"UpdateLastMessageDetailsInListBoxL");
       
  1101             User::Panic( KVmbxPanicType2, err2 );
       
  1102             }
       
  1103         TRAPD( err3, iListBox->HandleItemAdditionL() );
       
  1104         if ( err3 != KErrNone )
       
  1105             {
       
  1106             _LIT(KVmbxPanicType3,"iListBox->HandleItemAdditionL");
       
  1107             User::Panic( KVmbxPanicType3, err3 );
       
  1108             }
       
  1109         }
       
  1110     else if ( aKey == KVideoMbxSupport )
       
  1111         {
       
  1112         iIsVideoSupported = aValue;
       
  1113         UpdateData( ETrue );
       
  1114         TRAP_IGNORE( UpdateListboxL() );
       
  1115         }
       
  1116     VMBLOGSTRING( "VMBX: CVmContainer::HandleNotifyInt: <=" );
       
  1117     }
       
  1118 
       
  1119 // -----------------------------------------------------------------------------
       
  1120 // CVmContainer::ResetVoicemailMessageCounterL
       
  1121 // Resets to zero the voicemail message counter in SD
       
  1122 // -----------------------------------------------------------------------------
       
  1123 //
       
  1124 void CVmContainer::ResetVoicemailMessageCounterL()
       
  1125     {
       
  1126     VMBLOGSTRING( "VMBX: CVmContainer::ResetVoicemailMessageCounterL: =>" );
       
  1127 
       
  1128     TInt err = iSession->Set( KVmMessageCounter, 0 );
       
  1129     if ( err != KErrNotFound )
       
  1130         {
       
  1131         VMBLOGSTRING2( "VMBX: CVmContainer::ResetVoicemailMessageCounterL: \
       
  1132         CenRep error: %d", err );
       
  1133         User::LeaveIfError( err );
       
  1134         }
       
  1135 
       
  1136     UpdateNewVoiceMessagesInListBoxL();
       
  1137     iListBox->DrawNow();
       
  1138     VMBLOGSTRING( "VMBX: CVmContainer::ResetVoicemailMessageCounterL: <=" );
       
  1139     }
       
  1140 
       
  1141 // -----------------------------------------------------------------------------
       
  1142 // CVmContainer::IsClearIcon
       
  1143 // Checks if clear icon is set
       
  1144 // -----------------------------------------------------------------------------
       
  1145 //
       
  1146 TBool CVmContainer::IsClearIcon()
       
  1147     {
       
  1148     VMBLOGSTRING( "VMBX: CVmContainer::IsClearIcon: =>" );
       
  1149     VMBLOGSTRING( "VMBX: CVmContainer::IsClearIcon: <=" );
       
  1150     return iVmUiOpts & KVmClearIcon;
       
  1151     }
       
  1152 
       
  1153 // -----------------------------------------------------------------------------
       
  1154 // CVmContainer::FillIndArray
       
  1155 // Fill array with indications
       
  1156 // -----------------------------------------------------------------------------
       
  1157 //
       
  1158 void CVmContainer::FillIndArray()
       
  1159     {
       
  1160     VMBLOGSTRING( "VMBX: CVmContainer::FillIndArray: =>" );
       
  1161     if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
       
  1162         {
       
  1163         //NewVoiceMessages
       
  1164         iIndArray.Append( EVmbxVoiceMessageAmountInd );
       
  1165 
       
  1166         if ( iVmUiOpts & KVmMailboxNumber )
       
  1167             {
       
  1168             //VmbxNumber
       
  1169             iIndArray.Append( EVmbxVoiceMailboxNumberInd );
       
  1170             }
       
  1171 
       
  1172          // Details (EVmbxDetailsOfLastMessageInd) are added dynamically in
       
  1173          // UpdateLastMessageDetailsInListBoxL, always to the end of the list
       
  1174          }
       
  1175     else
       
  1176         {
       
  1177         //VmbxNumber
       
  1178         iIndArray.Append( EVmbxVoiceMailboxNumberInd );
       
  1179         }
       
  1180 
       
  1181     if ( IsVideoSupported() )
       
  1182         {
       
  1183         iIndArray.Append( EVmbxVideoMailboxNumberInd );
       
  1184         }
       
  1185 
       
  1186     if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
  1187         {
       
  1188         RArray<TUint> profileIds;
       
  1189         iVmbxNumber.GetServiceIds( profileIds );
       
  1190 
       
  1191         for ( TInt i( 0 ); i < profileIds.Count(); i++ )
       
  1192             {
       
  1193             VMBLOGSTRING( "VMBX: CVmContainer::FillIndArray \
       
  1194                            Appending Voip mailbox service" );
       
  1195             iIndArray.Append( EVmbxIntCallVoiceMailboxNumberInd );
       
  1196             }
       
  1197 
       
  1198         profileIds.Close();
       
  1199         }
       
  1200     VMBLOGSTRING( "VMBX: CVmContainer::FillIndArray: <=" );
       
  1201     }
       
  1202 
       
  1203 // -----------------------------------------------------------------------------
       
  1204 // CVmContainer::CurrentItem
       
  1205 // Gets index  of the current item in listbox
       
  1206 // -----------------------------------------------------------------------------
       
  1207 //
       
  1208 TInt CVmContainer::CurrentItem()
       
  1209     {
       
  1210     VMBLOGSTRING( "VMBX: CVmContainer::CurrentItem: =>" );
       
  1211     if ( iListBox->CurrentItemIndex() >= iIndArray.Count() )
       
  1212         {
       
  1213         VMBLOGSTRING( "VMBX: CVmContainer::CurrentItem: \
       
  1214         listbox iten not found" );
       
  1215         return KErrNotFound;
       
  1216         }
       
  1217     TInt listBoxCurrentIndex = iListBox->CurrentItemIndex();
       
  1218     VMBLOGSTRING2( "VMBX: CVmContainer::CurrentItem: listBoxCurrentIndex=%d",
       
  1219     listBoxCurrentIndex );
       
  1220     TInt currentItemIndex = iIndArray[ listBoxCurrentIndex ];
       
  1221     VMBLOGSTRING2( "VMBX: CVmContainer::CurrentItem: currentItemIndex=%d <=",
       
  1222     currentItemIndex );
       
  1223     return currentItemIndex;
       
  1224     }
       
  1225 
       
  1226 // -----------------------------------------------------------------------------
       
  1227 // CVmContainer::AskTypeL
       
  1228 // Ask Vmbx type.
       
  1229 // -----------------------------------------------------------------------------
       
  1230 //
       
  1231 TInt CVmContainer::AskTypeL()
       
  1232     {
       
  1233     VMBLOGSTRING( "VMBX: CVmContainer::AskTypeL: =>" );
       
  1234     TInt type( EVmbx );
       
  1235     
       
  1236     if ( IsVideoSupported() )
       
  1237         {
       
  1238         type = iVmbxNumber.SelectTypeL( EVmbxDefine );
       
  1239         }
       
  1240     
       
  1241     VMBLOGSTRING( "VMBX: CVmContainer::AskTypeL: <=" );
       
  1242     return type;
       
  1243     }
       
  1244 
       
  1245 // -----------------------------------------------------------------------------
       
  1246 // CVmContainer::IsVoIPProfilesFound
       
  1247 // Check if VoIP profiles is found.
       
  1248 // -----------------------------------------------------------------------------
       
  1249 //
       
  1250 TBool CVmContainer::IsVoIPProfilesFound()
       
  1251     {
       
  1252     VMBLOGSTRING( "VMBX: CVmContainer::IsVoIPProfilesFound" );
       
  1253 
       
  1254     return iVmbxNumber.IsVoIPProfilesFound();
       
  1255    }
       
  1256 
       
  1257 // -----------------------------------------------------------------------------
       
  1258 // CVmContainer::QueryVideoNumberL
       
  1259 // Queries for a new video mailbox number. If the query
       
  1260 // is approved, the listbox is updated.
       
  1261 // -----------------------------------------------------------------------------
       
  1262 //
       
  1263 void CVmContainer::QueryVideoNumberL( TVmbxQueryType aQueryType )
       
  1264     {
       
  1265     if ( IsVideoSupported() )
       
  1266         {
       
  1267         TBool ret( EFalse );
       
  1268         TRAPD( queryErr, 
       
  1269             ret = iVmbxNumber.QueryVideoMbxNumberL( aQueryType, iVideoNumber ) );
       
  1270 
       
  1271         if ( KErrNone == queryErr )
       
  1272             {
       
  1273             if ( ret )
       
  1274                 {
       
  1275                 // if the query was approved, update vmbx number
       
  1276                 UpdateVmbxNumberInListBoxL();
       
  1277                 (static_cast <CVmAppUi*>iAvkonAppUi) ->DrawCbaButtonsL();
       
  1278                 iListBox->DrawNow();
       
  1279                 }
       
  1280             }
       
  1281          else
       
  1282             {
       
  1283             VMBLOGSTRING2( "VMBX: CVmContainer::QueryVideoMbxNumberL: \
       
  1284             queryErr = %d", queryErr );
       
  1285             
       
  1286             if ( KErrAccessDenied == queryErr )
       
  1287                 {
       
  1288                 VMBLOGSTRING( "VMBX: CVmContainer::QueryVideoMbxNumberL: \
       
  1289                 not allow to change number" );
       
  1290                 }
       
  1291             else
       
  1292                 {
       
  1293                 User::Leave( queryErr );
       
  1294                 }
       
  1295             }
       
  1296         }
       
  1297     }
       
  1298 
       
  1299 // -----------------------------------------------------------------------------
       
  1300 // CVmContainer::FocusChanged
       
  1301 // Indicate the requirements for control redrawing.
       
  1302 // -----------------------------------------------------------------------------
       
  1303 //
       
  1304 void CVmContainer::FocusChanged( TDrawNow /*aDrawNow*/ )
       
  1305     {
       
  1306     VMBLOGSTRING( "VMBX: CVmContainer::FocusChanged: =>" );
       
  1307     TInt ret1( KErrNone );
       
  1308     TInt ret2( KErrNone );
       
  1309 
       
  1310     // Wwhen returned from other application to vmbx.
       
  1311     // Not necessary to update every time when focus changed.
       
  1312     if ( iUpdateData )
       
  1313         {
       
  1314         // get numbers, possible changed from Idle or General settings
       
  1315         ret1 = iVmbxNumber.GetVmbxNumber( iNumber );
       
  1316         if ( IsVideoSupported() )
       
  1317             {
       
  1318             ret2 = iVmbxNumber.GetVideoMbxNumber( iVideoNumber );
       
  1319             }
       
  1320         }
       
  1321     if ( iListBox )
       
  1322         {
       
  1323         if ( iUpdateData )
       
  1324             {
       
  1325             if ( ( ret1 == KErrNone || ret1 == KErrNotFound) &&
       
  1326                  ( ret2 == KErrNone || ret2 == KErrNotFound) )
       
  1327                 {
       
  1328                 TRAP_IGNORE( UpdateVmbxNumberInListBoxL() );
       
  1329                 TRAP_IGNORE(
       
  1330                     ( static_cast <CVmAppUi*>iAvkonAppUi ) ->DrawCbaButtonsL() );
       
  1331                 }
       
  1332             UpdateData( EFalse );
       
  1333             }
       
  1334         iListBox->SetFocus( IsFocused() );
       
  1335         }
       
  1336     iIsCallOngoing = EFalse;
       
  1337     VMBLOGSTRING( "VMBX: CVmContainer::FocusChanged: <=" );
       
  1338     }
       
  1339 
       
  1340 // -----------------------------------------------------------------------------
       
  1341 // CVmContainer::ConstructIconsForListboxL
       
  1342 // Constructs the icons that are needed to indicate where the vmbx number
       
  1343 // is stored
       
  1344 // -----------------------------------------------------------------------------
       
  1345 //
       
  1346 void CVmContainer::ConstructIconsForListboxL()
       
  1347     {
       
  1348     VMBLOGSTRING( "VMBX: CVmContainer::ConstructIconsForListboxL: =>" );
       
  1349     iListIcons = new (ELeave) CAknIconArray( KVmIconArraySize );
       
  1350 
       
  1351     CFbsBitmap* bitmap;
       
  1352     CFbsBitmap* mask;
       
  1353 
       
  1354     //Get the mbm file path
       
  1355     TFileName mbmfile( KVmMbmDrive );
       
  1356     mbmfile.Append( KDC_APP_BITMAP_DIR );
       
  1357     mbmfile.Append( KVmLibMbmFile );
       
  1358 
       
  1359     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  1360 
       
  1361     //empty bitmap
       
  1362     AknsUtils::CreateIconL( skin, KAknsIIDQgnPropEmpty, bitmap,mask, mbmfile,
       
  1363             EMbmVmQgn_prop_empty, EMbmVmQgn_prop_empty_mask );
       
  1364 
       
  1365     CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
       
  1366     iListIcons->AppendL( icon );
       
  1367 
       
  1368     bitmap = NULL;
       
  1369     mask = NULL;
       
  1370 
       
  1371     //sim icon
       
  1372     AknIconUtils::CreateIconL( bitmap, mask, mbmfile,
       
  1373                                 EMbmVmQgn_prop_nrtyp_sim_contact,
       
  1374                                 EMbmVmQgn_prop_nrtyp_sim_contact_mask );
       
  1375 
       
  1376     CGulIcon* icon1 = CGulIcon::NewL( bitmap, mask );
       
  1377     iListIcons->AppendL( icon1 );
       
  1378     // Add default icons(CS, Video and VoIP) to the icon list
       
  1379     iVmbxNumber.ConstructDefaultIconsL( iListIcons );
       
  1380     VMBLOGSTRING2( "VMBX: CVmContainer::ConstructIconsForListboxL: count: %d", iListIcons->Count() );
       
  1381 
       
  1382     CTextListBoxModel* model = iListBox->Model();
       
  1383     CDesCArray* items = static_cast<CDesCArray*>( model->ItemTextArray() );
       
  1384     items->Reset();
       
  1385 
       
  1386     // Update listbox according new values..
       
  1387     iListBox->SetCurrentItemIndex( 0 );
       
  1388     iListBox->HandleItemAdditionL();
       
  1389     VMBLOGSTRING( "VMBX: CVmContainer::ConstructIconsForListboxL: <=" );
       
  1390     }
       
  1391 
       
  1392 // -----------------------------------------------------------------------------
       
  1393 // CVmContainer::CallVideoMailBoxL
       
  1394 // Calls the vmbx number using PhoneClient
       
  1395 // -----------------------------------------------------------------------------
       
  1396 //
       
  1397 void CVmContainer::CallVideoMailBoxL()
       
  1398     {
       
  1399     VMBLOGSTRING( "VMBX: CVmContainer::CallVideoMailBoxL: =>" );
       
  1400 
       
  1401     if ( !iIsCallOngoing )
       
  1402         {
       
  1403         AiwCallRequestL( KVmCmdAiwVideoCall, CAiwDialData::EAIWForcedVideo );
       
  1404         }
       
  1405 
       
  1406     VMBLOGSTRING( "VMBX: CVmContainer::CallVideoMailBoxL: <=" );
       
  1407     }
       
  1408 
       
  1409 // -----------------------------------------------------------------------------
       
  1410 // CVmContainer::AiwCallRequestL()
       
  1411 // Makes a call request to AiwProvider.
       
  1412 // -----------------------------------------------------------------------------
       
  1413 //
       
  1414 void CVmContainer::AiwCallRequestL( TInt aCommand, 
       
  1415                                     CAiwDialData::TCallType aCallType )
       
  1416     {
       
  1417     VMBLOGSTRING( "VMBX: CVmContainer::AiwCallRequestL: =>" );
       
  1418     TBuf<KVmbxMaxNumberLength> number;
       
  1419 
       
  1420     if ( aCallType == CAiwDialData::EAIWVoice )
       
  1421         {
       
  1422         VMBLOGSTRING( "VMBX: CVmContainer::AiwCallRequestL: Type: VoiceCall" );
       
  1423         number.Copy( iNumber );
       
  1424 
       
  1425         if ( !iNumber.Length() )
       
  1426             {
       
  1427             QueryNumberL( EVmbxNotDefinedQuery );
       
  1428             VMBLOGSTRING( "VMBX: CVmContainer::AiwCallRequestL: \
       
  1429                 No VoiceCall number: <=" );
       
  1430             return;
       
  1431             }
       
  1432         VMBLOGSTRING( "VMBX: CVmContainer::AiwCallRequestL: \
       
  1433             VoiceCall number copied" );
       
  1434         number.Copy( iNumber );
       
  1435         }
       
  1436 
       
  1437     if ( aCallType == CAiwDialData::EAIWForcedVideo )
       
  1438         {
       
  1439         if ( !iVideoNumber.Length() )
       
  1440             {
       
  1441             QueryVideoNumberL( EVmbxNotDefinedQuery );
       
  1442             VMBLOGSTRING( "VMBX: CVmContainer::AiwCallRequestL: \
       
  1443                 No VideoCall number: <=" );
       
  1444             return;
       
  1445             }
       
  1446         VMBLOGSTRING( "VMBX: CVmContainer::AiwCallRequestL: \
       
  1447             VideoCall number copied" );
       
  1448         number.Copy( iVideoNumber );
       
  1449         }
       
  1450 
       
  1451     TVmbxServiceInfo serviceInfo;
       
  1452     
       
  1453     if ( aCallType == CAiwDialData::EAIWVoiP)
       
  1454         {
       
  1455         VMBLOGSTRING( "VMBX: CVmContainer::AiwCallRequestL: Type: VoipCall" );
       
  1456 
       
  1457         serviceInfo.iServiceId = ServiceId();
       
  1458 
       
  1459         TInt error( iVmbxNumber.GetServiceInfo( serviceInfo ) );
       
  1460 
       
  1461         if ( KErrNone == error )
       
  1462             {
       
  1463             number.Copy( serviceInfo.iAddress );
       
  1464             }
       
  1465 
       
  1466         VMBLOGSTRING2( "VMBX: AiwCallRequestL: VoIP address error: %d", error );
       
  1467         VMBLOGSTRING2( "VMBX: AiwCallRequestL: VoIP address: %S", &number );
       
  1468         VMBLOGSTRING2( "VMBX: AiwCallRequestL: VoIP serviceId: %d", serviceInfo.iServiceId );
       
  1469         }
       
  1470 
       
  1471     // Create a dial data object and push it into the cleanup stack.
       
  1472     CAiwDialDataExt* dialData = CAiwDialDataExt::NewLC();
       
  1473     
       
  1474     VMBLOGSTRING( "VMBX: CVmContainer::AiwCallRequestL: \
       
  1475         AIW dialData object created" );
       
  1476 
       
  1477     // Set up dial data parameters.
       
  1478     dialData->SetPhoneNumberL( number );
       
  1479     dialData->SetCallType( aCallType );
       
  1480     dialData->SetServiceId( serviceInfo.iServiceId );
       
  1481 
       
  1482     // Set up CAiwGenericParamList object.
       
  1483     CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
       
  1484     dialData->FillInParamListL( paramList );
       
  1485 
       
  1486     // Execute AIW menu service command.
       
  1487     iIsCallOngoing = ETrue;
       
  1488     VMBLOGSTRING( "VMBX: CVmContainer::AiwCallRequestL: Execute AIW menu \
       
  1489         service command" );
       
  1490     iServiceHandler->ExecuteMenuCmdL( aCommand,
       
  1491                                       paramList,
       
  1492                                       iServiceHandler->OutParamListL(),
       
  1493                                       0,
       
  1494                                       NULL );
       
  1495 
       
  1496     // Dial data is no longer needed and can be deleted.
       
  1497     CleanupStack::PopAndDestroy( dialData );
       
  1498     VMBLOGSTRING( "VMBX: CVmContainer::AiwCallRequestL: <=" );
       
  1499     }
       
  1500 
       
  1501 
       
  1502 // -----------------------------------------------------------------------------
       
  1503 // CVmContainer::Number
       
  1504 // Query for a voice mailbox number.
       
  1505 // -----------------------------------------------------------------------------
       
  1506 //
       
  1507 const TDesC& CVmContainer::Number() const
       
  1508     {
       
  1509     return iNumber;
       
  1510     }
       
  1511 
       
  1512 // -----------------------------------------------------------------------------
       
  1513 // CVmContainer::VideoNumber
       
  1514 // Query for a video mailbox number.
       
  1515 // -----------------------------------------------------------------------------
       
  1516 //
       
  1517 const TDesC& CVmContainer::VideoNumber() const
       
  1518     {
       
  1519     return iVideoNumber;
       
  1520     }
       
  1521 
       
  1522 // -----------------------------------------------------------------------------
       
  1523 // CVmContainer::UpdateData
       
  1524 // LisBox will be updated with data possibly changed in other application
       
  1525 // -----------------------------------------------------------------------------
       
  1526 //
       
  1527 void CVmContainer::UpdateData( TBool aState )
       
  1528     {
       
  1529     iUpdateData = aState;
       
  1530     }
       
  1531 
       
  1532 // -----------------------------------------------------------------------------
       
  1533 // CVmContainer::ServiceId
       
  1534 //
       
  1535 // -----------------------------------------------------------------------------
       
  1536 //
       
  1537 TUint CVmContainer::ServiceId()
       
  1538     {
       
  1539     TUint serviceId( 0 );
       
  1540     TInt decrease( 0 );
       
  1541 
       
  1542     RArray<TUint> profileIds;
       
  1543     iVmbxNumber.GetServiceIds( profileIds );
       
  1544 
       
  1545     // Count how many items we have to decrease
       
  1546     for ( TInt i( 0 ); i < iIndArray.Count(); i++ )
       
  1547         {
       
  1548         if ( EVmbxIntCallVoiceMailboxNumberInd != iIndArray[ i ] )
       
  1549             {
       
  1550             decrease++;
       
  1551             }
       
  1552         }
       
  1553 
       
  1554     serviceId = profileIds[ iListBox->CurrentItemIndex() - decrease ];
       
  1555     profileIds.Close();
       
  1556 
       
  1557     VMBLOGSTRING2( "VMBX: CVmContainer::ServiceId() return %d", serviceId );    
       
  1558     return serviceId;
       
  1559     }
       
  1560 
       
  1561 
       
  1562 // -----------------------------------------------------------------------------
       
  1563 // CVmContainer::HandleServiceNotifyL
       
  1564 // VoIP profile has changed
       
  1565 // -----------------------------------------------------------------------------
       
  1566 //
       
  1567 void CVmContainer::HandleServiceNotifyL()
       
  1568     {
       
  1569     VMBLOGSTRING( "VMBX: CVmContainer::HandleServiceNotifyL: =>" );
       
  1570 
       
  1571     iServiceUpdated = ETrue;
       
  1572 
       
  1573     VMBLOGSTRING( "VMBX: CVmContainer::HandleServiceNotifyL: <=" );
       
  1574     }
       
  1575 
       
  1576 // -----------------------------------------------------------------------------
       
  1577 // CVmContainer::AddBrandIconL
       
  1578 //
       
  1579 // -----------------------------------------------------------------------------
       
  1580 //
       
  1581 void CVmContainer::AddBrandIconL( TUint aServiceId, TInt& aIconId )
       
  1582     {
       
  1583     // Set branding icon to context pane if available.
       
  1584     TBuf8<KVmSettingsUiBrandingIdLength> brandId( KNullDesC8 );
       
  1585 
       
  1586     iVmbxNumber.BrandIdL( aServiceId, brandId );
       
  1587 
       
  1588     CFbsBitmap* brandedBitmap = NULL;
       
  1589     CFbsBitmap* brandedBitmapMask = NULL;
       
  1590 
       
  1591     // Get branded bitmap
       
  1592     TRAPD( err, iVmbxNumber.GetBrandedIconL(
       
  1593         brandId, brandedBitmap, brandedBitmapMask ) );
       
  1594 
       
  1595     VMBLOGSTRING2( "VMBX: CVmContainer::AddBrandIconL: error: %d", err );
       
  1596 
       
  1597     if ( KErrNone == err )
       
  1598         {
       
  1599         // The count of list icons(before adding branding icon to the list)
       
  1600         // must be the branded icon list id
       
  1601         aIconId = iListIcons->Count();
       
  1602         // Create new icon and add it to the icon list
       
  1603         iListIcons->AppendL(
       
  1604             CGulIcon::NewL( brandedBitmap, brandedBitmapMask ) );
       
  1605         }
       
  1606     else
       
  1607         {
       
  1608         delete brandedBitmap;
       
  1609         delete brandedBitmapMask;
       
  1610         }
       
  1611     }
       
  1612 
       
  1613 // -----------------------------------------------------------------------------
       
  1614 // CVmContainer::UpdateListboxL
       
  1615 //
       
  1616 // -----------------------------------------------------------------------------
       
  1617 //
       
  1618 void CVmContainer::UpdateListboxL()
       
  1619     {
       
  1620     VMBLOGSTRING( "VMBX: CVmContainer::UpdateListboxL: =>" );
       
  1621 
       
  1622     iIndArray.Reset();
       
  1623     iArray.Reset();
       
  1624 
       
  1625     FillIndArray();
       
  1626 
       
  1627     // Set the text in the listbox
       
  1628     // First create space for the items
       
  1629     for ( TInt i = 0; i < iIndArray.Count(); i++ )
       
  1630         {
       
  1631         iArray.AppendL( KNullDesC );
       
  1632         }
       
  1633 
       
  1634     // New voice messages
       
  1635     UpdateNewVoiceMessagesInListBoxL();
       
  1636 
       
  1637     // Voice mailbox number
       
  1638     UpdateVmbxNumberInListBoxL();
       
  1639 
       
  1640     // Details
       
  1641     UpdateLastMessageDetailsInListBoxL();
       
  1642 
       
  1643     KErrNotFound == iListBox->CurrentItemIndex() ?
       
  1644         iListBox->SetCurrentItemIndex( 0 ) :
       
  1645             iListBox->SetCurrentItemIndex( iListBox->CurrentItemIndex() );
       
  1646 
       
  1647     ( static_cast <CVmAppUi*>iAvkonAppUi )->DrawCbaButtonsL();
       
  1648 
       
  1649     // Update listbox according new values..
       
  1650     iListBox->HandleItemAdditionL();
       
  1651     iListBox->DrawNow();
       
  1652 
       
  1653     // Reset updating value
       
  1654     iServiceUpdated = EFalse;
       
  1655 
       
  1656     VMBLOGSTRING( "VMBX: CVmContainer::UpdateListboxL: <=" );
       
  1657     }
       
  1658 
       
  1659 // -----------------------------------------------------------------------------
       
  1660 // CVmContainer::IsServiceUpdated
       
  1661 //
       
  1662 // -----------------------------------------------------------------------------
       
  1663 //
       
  1664 TBool CVmContainer::IsServiceUpdated() const
       
  1665     {
       
  1666     return iServiceUpdated;
       
  1667     }
       
  1668 
       
  1669 TBool CVmContainer::IsIpVoiceMailboxServices()
       
  1670     {
       
  1671     return iVmbxNumber.IsIpVoiceMailboxServices();
       
  1672     }
       
  1673 
       
  1674 TBool CVmContainer::IsVideoSupported()
       
  1675     {
       
  1676     if ( iIsVideoSupported &&
       
  1677          FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ) )
       
  1678         {
       
  1679         return ETrue;
       
  1680         }
       
  1681     else
       
  1682         {
       
  1683         return EFalse;
       
  1684         }
       
  1685     }
       
  1686 
       
  1687 // End of File
       
  1688