pkiutilities/CertmanUi/SRC/CertmanuiviewPersonal.cpp
changeset 0 164170e6151a
child 5 3b17fc5c9564
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2003-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:   Implementation of class CCertManUIViewPersonal
       
    15 *                Updates Options list depending of the number of
       
    16 *                marked and unmarked certificates in the listbox.
       
    17 *                Handles softkey and Option list commands.
       
    18 *                Handles certificate deletion including confirmation and
       
    19 *                read-only notes.
       
    20 *                Shows certificate details view with appropriate
       
    21 *                warning notes if certificate is corrupted/expired/not valid.
       
    22 *
       
    23 */
       
    24 
       
    25 
       
    26 // INCLUDE FILES
       
    27 
       
    28 #include <aknmessagequerydialog.h>
       
    29 #include <aknnotewrappers.h>            // for warning & information notes
       
    30 #include <certmanui.rsg>
       
    31 #include <ErrorUI.h>
       
    32 #include "CertmanuiCertificateHelper.h"
       
    33 #include "CertmanuiKeeper.h"
       
    34 #include "CertmanuicontainerPersonal.h"
       
    35 #include "CertmanuiSyncWrapper.h"
       
    36 #include "Certmanui.hrh"
       
    37 #include "CertmanuiCommon.h"
       
    38 #include "CertManUILogger.h"
       
    39 
       
    40 #include    <hlplch.h>                  // For HlpLauncher
       
    41 #include    <featmgr.h>                 // For FeatureManager
       
    42 
       
    43 
       
    44 // ================= MEMBER FUNCTIONS =======================
       
    45 
       
    46 // ---------------------------------------------------------
       
    47 // CCertManUIViewPersonal::CCertManUIViewPersonal(CCertManUIKeeper& aKeeper)
       
    48 // : iKeeper(aKeeper), iCrMgr(iKeeper.CertManager())
       
    49 // Constructor
       
    50 // ---------------------------------------------------------
       
    51 //
       
    52 CCertManUIViewPersonal::CCertManUIViewPersonal( CCertManUIKeeper& aKeeper )
       
    53 : iKeeper( aKeeper )
       
    54     {
       
    55     CERTMANUILOGGER_WRITE_TIMESTAMP( "CCertManUIViewPersonal::CCertManUIViewPersonal" );
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // CCertManUIViewPersonal::~CCertManUIViewPersonal()
       
    60 // Destructor
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 CCertManUIViewPersonal::~CCertManUIViewPersonal()
       
    64     {
       
    65     CERTMANUILOGGER_ENTERFN( "CCertManUIViewPersonal::~CCertManUIViewPersonal" );
       
    66 
       
    67     if ( iContainerPersonal )
       
    68         {
       
    69         AppUi()->RemoveFromViewStack( *this, iContainerPersonal );
       
    70         delete iContainerPersonal;
       
    71         }
       
    72 
       
    73     CERTMANUILOGGER_LEAVEFN( "CCertManUIViewPersonal::~CCertManUIViewPersonal" );
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------
       
    77 // CCertManUIViewPersonal* CCertManUIViewPersonal::NewL(const TRect& /*aRect*/,
       
    78 //                                CCertManUIKeeper& aKeeper)
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 CCertManUIViewPersonal* CCertManUIViewPersonal::NewL( const TRect& /*aRect*/,
       
    82                                 CCertManUIKeeper& aKeeper )
       
    83     {
       
    84     CCertManUIViewPersonal* self = new ( ELeave ) CCertManUIViewPersonal( aKeeper );
       
    85     CleanupStack::PushL( self );
       
    86     self->ConstructL();
       
    87     CleanupStack::Pop();
       
    88     return self;
       
    89     }
       
    90 
       
    91 // ---------------------------------------------------------
       
    92 // CCertManUIViewPersonal* CCertManUIViewPersonal::NewLC(const TRect& /*aRect*/,
       
    93 //                                 CCertManUIKeeper& aKeeper)
       
    94 // ---------------------------------------------------------
       
    95 //
       
    96 CCertManUIViewPersonal* CCertManUIViewPersonal::NewLC( const TRect& /*aRect*/,
       
    97                                  CCertManUIKeeper& aKeeper )
       
    98     {
       
    99     CCertManUIViewPersonal* self = new ( ELeave ) CCertManUIViewPersonal( aKeeper );
       
   100     CleanupStack::PushL( self );
       
   101     self->ConstructL();
       
   102     return self;
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------
       
   106 // CCertManUIViewPersonal::ConstructL()
       
   107 // EPOC two-phased constructor
       
   108 // ---------------------------------------------------------
       
   109 //
       
   110 void CCertManUIViewPersonal::ConstructL()
       
   111     {
       
   112     CERTMANUILOGGER_ENTERFN( "CCertManUIViewPersonal::ConstructL" );
       
   113 
       
   114     BaseConstructL( R_CERTMANUI_VIEW_MAIN_PERSONAL );
       
   115 
       
   116     CERTMANUILOGGER_LEAVEFN( "CCertManUIViewPersonal::ConstructL" );
       
   117     }
       
   118 
       
   119 // ---------------------------------------------------------
       
   120 // CCertManUIViewPersonal::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
       
   121 // Updates Options list with correct items depending on
       
   122 // whether the listbox is empty or if it has any marked items
       
   123 // ---------------------------------------------------------
       
   124 //
       
   125 void CCertManUIViewPersonal::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
       
   126     {
       
   127     CERTMANUILOGGER_ENTERFN( "CCertManUIViewPersonal::DynInitMenuPaneL" );
       
   128 
       
   129     if (( iKeeper.iWrapper->IsActive() ) ||
       
   130         ( iContainerPersonal->iListBox->CurrentItemIndex() >= iKeeper.iUserLabelEntries.Count() ))
       
   131         {
       
   132         return;
       
   133         }
       
   134 
       
   135     const CListBoxView::CSelectionIndexArray* selections =
       
   136             iContainerPersonal->iListBox->SelectionIndexes();
       
   137     const TInt markedCount = selections->Count();
       
   138     const TInt currentItemIndex = iContainerPersonal->iListBox->CurrentItemIndex();
       
   139 
       
   140     switch ( aResourceId )
       
   141         {
       
   142         case R_CERTMANUI_VIEW_MENU_PERSONAL:
       
   143             {
       
   144             if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   145                 {
       
   146                 aMenuPane->DeleteMenuItem( EAknCmdHelp );
       
   147                 }
       
   148 
       
   149             // the certificate list is empty, all except Exit are dimmed
       
   150             if ( currentItemIndex == -1 )
       
   151                 {
       
   152                 aMenuPane->SetItemDimmed( ECertManUICmdAppViewDtls, ETrue );
       
   153                 aMenuPane->SetItemDimmed( ECertManUICmdAppDelete, ETrue );
       
   154                 aMenuPane->SetItemDimmed( ECertManUICmdMoveToDevice, ETrue );
       
   155                 aMenuPane->SetItemDimmed( ECertManUICmdMarkUnmark, ETrue );
       
   156                 }
       
   157             else
       
   158                 {
       
   159                 if ( markedCount == 1 )
       
   160                     {
       
   161                     aMenuPane->SetItemDimmed( ECertManUICmdAppViewDtls, ETrue );
       
   162                     }
       
   163 
       
   164                 if ( markedCount > 1 )
       
   165                     {
       
   166                     aMenuPane->SetItemDimmed( ECertManUICmdAppViewDtls, ETrue );
       
   167                     aMenuPane->SetItemDimmed( ECertManUICmdMoveToDevice, ETrue );
       
   168                     }
       
   169 
       
   170                 if ( !iKeeper.iCertificateHelper->IsOneMarkedCertificateDeletable(
       
   171                         iContainerPersonal->iListBox, KCertTypePersonal ) )
       
   172                     {
       
   173                     aMenuPane->SetItemDimmed( ECertManUICmdAppDelete, ETrue );
       
   174                     aMenuPane->SetItemDimmed( ECertManUICmdMoveToDevice, ETrue );
       
   175                     }
       
   176                 }
       
   177             break;
       
   178             }
       
   179 
       
   180         case R_CERTMANUI_MENUPANE_OPTIONS_MARKED:
       
   181             {
       
   182             if ( markedCount > 1 )
       
   183                 {
       
   184                 aMenuPane->SetItemDimmed( ECertManUICmdMoveToDevice, ETrue );
       
   185                 }
       
   186 
       
   187             if ( !iKeeper.iCertificateHelper->IsOneMarkedCertificateDeletable(
       
   188                     iContainerPersonal->iListBox, KCertTypePersonal ) )
       
   189                 {
       
   190                 aMenuPane->SetItemDimmed( ECertManUICmdAppDelete, ETrue );
       
   191                 }
       
   192 
       
   193             // not available for personal certificates
       
   194             aMenuPane->SetItemDimmed( ECertManUICmdMoveToPersonal, ETrue );
       
   195             }
       
   196             // FALLTHROUGH
       
   197 
       
   198         case R_CERTMANUI_MENU_PANE_MARK_UNMARK:
       
   199             {
       
   200             TInt index = 0;
       
   201             TKeyArrayFix key( 0, ECmpTInt );
       
   202             if ( selections->Find( currentItemIndex, key, index ) )
       
   203                 {   // focus is on unmarked item
       
   204                 aMenuPane->SetItemDimmed( ECertManUICmdUnmark, ETrue );
       
   205                 }
       
   206             else
       
   207                 {   // focus is on marked item
       
   208                 aMenuPane->SetItemDimmed( ECertManUICmdMark, ETrue );
       
   209                 }
       
   210 
       
   211             // if all items are marked, dim "mark all" option
       
   212             if ( markedCount == iContainerPersonal->iListBox->Model()->NumberOfItems() )
       
   213                 {
       
   214                 aMenuPane->SetItemDimmed( ECertManUICmdMarkAll, ETrue );
       
   215                 }
       
   216 
       
   217             // if no items are marked, dim "unmark all" option
       
   218             if ( markedCount == 0 )
       
   219                 {
       
   220                 aMenuPane->SetItemDimmed( ECertManUICmdUnmarkAll, ETrue );
       
   221                 }
       
   222             break;
       
   223             }
       
   224 
       
   225         default:
       
   226             break;
       
   227         }
       
   228 
       
   229   CERTMANUILOGGER_LEAVEFN( "CCertManUIViewPersonal::DynInitMenuPaneL" );
       
   230   }
       
   231 
       
   232 // ---------------------------------------------------------
       
   233 // CCertManUIViewPersonal::Id() const
       
   234 // Returns Personal view id
       
   235 // ---------------------------------------------------------
       
   236 //
       
   237 TUid CCertManUIViewPersonal::Id() const
       
   238     {
       
   239     return KCertManUIViewPersonalId;
       
   240     }
       
   241 
       
   242 // ---------------------------------------------------------
       
   243 // CCertManUIViewPersonal::HandleCommandL(TInt aCommand)
       
   244 // Handles Softkey and Options list commands
       
   245 // ---------------------------------------------------------
       
   246 //
       
   247 void CCertManUIViewPersonal::HandleCommandL(TInt aCommand)
       
   248     {
       
   249     CERTMANUILOGGER_ENTERFN( "CCertManUIViewPersonal::HandleCommandL" );
       
   250 
       
   251     if (( iKeeper.iWrapper->IsActive() ) ||
       
   252         ( iContainerPersonal->iListBox->CurrentItemIndex() >= iKeeper.iUserLabelEntries.Count() ))
       
   253         {
       
   254         return;
       
   255         }
       
   256 
       
   257     switch ( aCommand )
       
   258         {
       
   259         case EAknSoftkeyBack:
       
   260             {
       
   261             // Activate main view
       
   262             AppUi()->ActivateLocalViewL( KCertManUIViewMainId );
       
   263             break;
       
   264             }
       
   265         // put the view specific menu commands here
       
   266         case EAknCmdExit:
       
   267             {
       
   268             ((CAknViewAppUi*)iAvkonAppUi)->HandleCommandL( EAknCmdExit );
       
   269             break;
       
   270             }
       
   271         case ECertManUICmdAppViewDtls:
       
   272             {
       
   273             iKeeper.iCertificateHelper->MessageQueryViewDetailsL(
       
   274                 iContainerPersonal->iListBox->CurrentItemIndex(), KCertTypePersonal, iEikonEnv );
       
   275             break;
       
   276             }
       
   277         case ECertManUICmdAppDelete:
       
   278             {
       
   279             if ( iKeeper.iCertificateHelper->ConfirmationQueryDeleteCertL( KCertTypePersonal,
       
   280                                                       iContainerPersonal->iListBox ))
       
   281                 {
       
   282                 // goes here if at least one certificate is deleted
       
   283                 iCurrentPosition = iContainerPersonal->iListBox->CurrentItemIndex();
       
   284                 iTopItem = iContainerPersonal->iListBox->TopItemIndex();
       
   285 
       
   286                 iContainerPersonal->DrawListBoxL(iCurrentPosition, iTopItem );
       
   287                 TRAPD( error, iKeeper.RefreshUserCertEntriesL() );
       
   288                 if ( error != KErrNone )
       
   289                     {
       
   290                     if ( error == KErrCorrupt )
       
   291                         {
       
   292                         iKeeper.ShowErrorNoteL( error );
       
   293                         User::Exit( KErrNone );
       
   294                         }
       
   295                     else
       
   296                         {
       
   297                         // have to call straight away the Exit
       
   298                         // showing any error notes would corrupt the display
       
   299                         User::Exit( error );
       
   300                         }
       
   301                     }
       
   302                 UpdateMenuBar();
       
   303                 }
       
   304             break;
       
   305             }
       
   306        case ECertManUICmdMoveToDevice:
       
   307             {
       
   308             HBufC* prompt = StringLoader::LoadLC(
       
   309                         R_QTN_CM_CONF_MOVE_TO_DEVICE );
       
   310             TInt selection = iKeeper.iCertificateHelper->DisplayConfirmationLD(prompt);
       
   311             if ( selection )
       
   312                 {                
       
   313                 TInt focusPosition = 0;
       
   314                 
       
   315                 const CArrayFix<TInt>* array = iContainerPersonal->iListBox->SelectionIndexes();
       
   316                 
       
   317                 if ( array->Count() == 1 )
       
   318                     {
       
   319                     // item is marked
       
   320                     focusPosition = array->At( 0 );
       
   321                     }
       
   322                 else
       
   323                     {
       
   324                     // There is no marked item. Select higlighted item 
       
   325                     focusPosition = iContainerPersonal->iListBox->CurrentItemIndex();
       
   326                     }
       
   327                                                 
       
   328                 CCTCertInfo* entry = iKeeper.iUserLabelEntries[ focusPosition ]->iUserEntry;
       
   329 
       
   330                 // Move key first
       
   331                 TCTKeyAttributeFilter keyFilter;
       
   332                 keyFilter.iKeyId = entry->SubjectKeyId();
       
   333                 keyFilter.iPolicyFilter =  TCTKeyAttributeFilter::EAllKeys;
       
   334 
       
   335                 TRAPD( error, iKeeper.iCertificateHelper->MoveKeyL( keyFilter,
       
   336                                 KCMFileKeyStoreTokenUid, KCMDeviceKeyStoreTokenUid ));
       
   337 
       
   338                 if ( error == KErrNone )
       
   339                     {
       
   340                     // Move certificate
       
   341                     iKeeper.iCertificateHelper->MoveCertL( *entry, focusPosition, iContainerPersonal->iListBox,
       
   342                                     KCMFileCertStoreTokenUid, KCMDeviceCertStoreTokenUid );
       
   343 
       
   344                     TRAP( error, iKeeper.RefreshUserCertEntriesL() );
       
   345                     if ( error != KErrNone )
       
   346                         {
       
   347                         if ( error == KErrCorrupt )
       
   348                             {
       
   349                             iKeeper.ShowErrorNoteL( error );
       
   350                             User::Exit( KErrNone );
       
   351                             }
       
   352                         else
       
   353                             {
       
   354                             // have to call straight away the Exit
       
   355                             // showing any error notes would corrupt the display
       
   356                             User::Exit( error );
       
   357                             }
       
   358                         }
       
   359 
       
   360                     MDesCArray* itemList = iContainerPersonal->iListBox->Model()->ItemTextArray();
       
   361                     CDesCArray* itemArray = ( CDesCArray* )itemList;
       
   362                     if (( itemArray != NULL ) && ( itemArray->Count() == 0 ))
       
   363                         {
       
   364                         iCurrentPosition = 0;
       
   365                         iTopItem = 0;
       
   366                         iContainerPersonal->UpdateListBoxL( iCurrentPosition, iTopItem );
       
   367                         }
       
   368                      else
       
   369                         {
       
   370                         iCurrentPosition = iContainerPersonal->iListBox->CurrentItemIndex();
       
   371                         iTopItem = iContainerPersonal->iListBox->TopItemIndex();
       
   372                         }
       
   373 
       
   374                     iContainerPersonal->DrawListBoxL(iCurrentPosition, iTopItem );
       
   375 
       
   376                     UpdateMenuBar();
       
   377                     }
       
   378                 }
       
   379             break;
       
   380             }
       
   381         case ECertManUICmdMark:
       
   382         case ECertManUICmdUnmark:
       
   383         case ECertManUICmdMarkAll:
       
   384         case ECertManUICmdUnmarkAll:
       
   385             {
       
   386             // Gets pointer of current listbox.
       
   387             CEikListBox* listbox = iContainerPersonal->iListBox;
       
   388             if ( listbox )
       
   389                 {
       
   390                 AknSelectionService::HandleMarkableListProcessCommandL(
       
   391                     aCommand, listbox );
       
   392                 iKeeper.iCertificateHelper->HandleMarkableListCommandL( aCommand,
       
   393                                                 iContainerPersonal->iListBox  );
       
   394 
       
   395                 UpdateMenuBar();
       
   396                 }
       
   397             break;
       
   398             }
       
   399 
       
   400         case EAknCmdHelp:
       
   401             {
       
   402             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   403                 {
       
   404                 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), AppUi()->AppHelpContextL() );
       
   405                 }
       
   406             break;
       
   407             }
       
   408 
       
   409         default:
       
   410             {
       
   411             AppUi()->HandleCommandL( aCommand );
       
   412             break;
       
   413             }
       
   414         }
       
   415 
       
   416     CERTMANUILOGGER_LEAVEFN( "CCertManUIViewPersonal::HandleCommandL" );
       
   417     }
       
   418 
       
   419 // ---------------------------------------------------------
       
   420 // CCertManUIViewPersonal::HandleClientRectChange()
       
   421 // ---------------------------------------------------------
       
   422 //
       
   423 void CCertManUIViewPersonal::HandleClientRectChange()
       
   424     {
       
   425     if ( iContainerPersonal )
       
   426         {
       
   427         iContainerPersonal->SetRect( ClientRect() );
       
   428         }
       
   429     }
       
   430 
       
   431 // ---------------------------------------------------------
       
   432 // CCertManUIViewPersonal::DoActivateL(const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/)
       
   433 // Updates the view when opening it
       
   434 // ---------------------------------------------------------
       
   435 //
       
   436 void CCertManUIViewPersonal::DoActivateL(const TVwsViewId& aPrevViewId, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/)
       
   437     {
       
   438     CERTMANUILOGGER_ENTERFN( "CCertManUIViewPersonal::DoActivateL" );
       
   439 
       
   440     iKeeper.StartWaitDialogL( ECertmanUiWaitDialog );
       
   441     CleanupCloseWaitDialogPushL( iKeeper );
       
   442 
       
   443     TRAPD ( error, iKeeper.RefreshUserCertEntriesL() );
       
   444     if ( error != KErrNone )
       
   445         {
       
   446         if ( error == KErrCorrupt )
       
   447             {
       
   448             iKeeper.ShowErrorNoteL( error );
       
   449             User::Exit( KErrNone );
       
   450             }
       
   451         else
       
   452             {
       
   453             // have to call straight away the Exit
       
   454             // showing any error notes would corrupt the display
       
   455             User::Exit( error );
       
   456             }
       
   457         }
       
   458 
       
   459     // If this view is being activated from main view,
       
   460     // current position is 0. The declaration of KCertManUIViewMainId is
       
   461     // located in certmanuiviewid.h which is not public header --> constant
       
   462     // is being used.
       
   463     if( aPrevViewId.iViewUid == KCertManUIViewMainId )
       
   464         {
       
   465         iCurrentPosition = 0;
       
   466         }
       
   467 
       
   468     if ( iContainerPersonal )
       
   469         {
       
   470         ((CAknViewAppUi*)iAvkonAppUi)->RemoveFromViewStack( *this, iContainerPersonal );
       
   471         delete iContainerPersonal;
       
   472         iContainerPersonal = NULL;
       
   473         }
       
   474     iContainerPersonal = new ( ELeave ) CCertManUIContainerPersonal( *this, iKeeper );
       
   475     iContainerPersonal->SetMopParent(this);
       
   476     iContainerPersonal->ConstructL( ClientRect(), iCurrentPosition, iTopItem );
       
   477 
       
   478     iKeeper.ActivateTitleL( KViewTitleCertManUIPersonal );
       
   479 
       
   480     iContainerPersonal->DrawListBoxL( iCurrentPosition, iTopItem );
       
   481     ((CAknViewAppUi*)iAvkonAppUi)->AddToStackL( *this, iContainerPersonal );
       
   482 
       
   483     UpdateMenuBar();
       
   484 
       
   485     CleanupStack::PopAndDestroy();    // closes wait dialog
       
   486 
       
   487     CERTMANUILOGGER_LEAVEFN( "CCertManUIViewPersonal::DoActivateL" );
       
   488     }
       
   489 
       
   490 // ---------------------------------------------------------
       
   491 // CCertManUIViewPersonal::DoDeactivate()
       
   492 // Saves focus position when closing view
       
   493 // ---------------------------------------------------------
       
   494 //
       
   495 void CCertManUIViewPersonal::DoDeactivate()
       
   496     {
       
   497     CERTMANUILOGGER_ENTERFN( "CCertManUIViewPersonal::DoDeactivate" );
       
   498 
       
   499     iCurrentPosition = iContainerPersonal->iListBox->CurrentItemIndex();
       
   500     iTopItem = iContainerPersonal->iListBox->TopItemIndex();
       
   501     if ( iContainerPersonal )
       
   502         {
       
   503         ((CAknViewAppUi*)iAvkonAppUi)->RemoveFromViewStack(*this, iContainerPersonal);
       
   504         delete iContainerPersonal;
       
   505         iContainerPersonal = NULL;
       
   506         }
       
   507 
       
   508     CERTMANUILOGGER_LEAVEFN( "CCertManUIViewPersonal::DoDeactivate" );
       
   509     }
       
   510 
       
   511 // ---------------------------------------------------------
       
   512 // CCertManUIViewPersonal::Container()
       
   513 // Returns iContainerPersonal to be used in CertManUIContainerPersonal
       
   514 // ---------------------------------------------------------
       
   515 //
       
   516 CCoeControl* CCertManUIViewPersonal::Container()
       
   517     {
       
   518     return iContainerPersonal;
       
   519     }
       
   520 
       
   521 // ---------------------------------------------------------
       
   522 // CCertManUIViewPersonal::UpdateMenuBar()
       
   523 // Updates the menu bar
       
   524 // ---------------------------------------------------------
       
   525 //
       
   526 void CCertManUIViewPersonal::UpdateMenuBar()
       
   527     {
       
   528     CEikButtonGroupContainer*  cba = Cba();
       
   529 
       
   530     if ( cba == NULL )
       
   531         {
       
   532         return;
       
   533         }
       
   534 
       
   535     if ( iKeeper.iUserLabelEntries.Count() == 0 )
       
   536         {
       
   537         // No certificate. Don't show MSK
       
   538         UpdateCba( R_CERTMANUI_OPTIONS_OPEN_BACK );
       
   539         cba->MakeCommandVisible( ECertManUICmdAppViewDtls, EFalse );
       
   540         }
       
   541     else
       
   542         {
       
   543         if ( iContainerPersonal->iListBox->SelectionIndexes()->Count() > 0 )
       
   544             {
       
   545             MenuBar()->SetContextMenuTitleResourceId( R_CERTMANUI_MENUBAR_OPTIONS_MARKED );
       
   546             UpdateCba( R_CERTMANUI_OPTIONS_CONTEXT_BACK );
       
   547             }
       
   548         else
       
   549             {
       
   550             MenuBar()->SetMenuTitleResourceId( R_CERTMANUI_MENUBAR_VIEW_PERSONAL );
       
   551             UpdateCba( R_CERTMANUI_OPTIONS_OPEN_BACK );
       
   552             }
       
   553          cba->MakeCommandVisible( ECertManUICmdAppViewDtls, ETrue );
       
   554          }
       
   555     }
       
   556 
       
   557 // ---------------------------------------------------------
       
   558 // CCertManUIViewPersonal::UpdateCba( TInt aCbaResourceId )
       
   559 // Updates cba
       
   560 // ---------------------------------------------------------
       
   561 //
       
   562 void CCertManUIViewPersonal::UpdateCba( TInt aCbaResourceId )
       
   563     {
       
   564     CEikButtonGroupContainer*  cba = Cba();
       
   565 
       
   566     if ( cba )
       
   567         {
       
   568         cba->SetCommandSetL( aCbaResourceId );
       
   569         cba->DrawNow();
       
   570         }
       
   571     }
       
   572 
       
   573 // End of File
       
   574