wlansecuritysettings/wlaneapsettingsui/EapTls/ConfigUi/src/EapTlsUiView.cpp
changeset 0 c8830336c852
child 2 1c7bc153c08e
equal deleted inserted replaced
-1:000000000000 0:c8830336c852
       
     1 /*
       
     2 * Copyright (c) 2001-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 the License "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 EAP TLS UI settings dialog
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <eikdialg.h>
       
    22 #include <AknDialog.h>
       
    23 #include <aknlists.h>
       
    24 #include "EapTlsUiView.h"
       
    25 #include "EapTlsUi.hrh"
       
    26 #include <EapTlsUi.rsg>
       
    27 #include <akntextsettingpage.h>
       
    28 #include <aknsettingitemlist.h>
       
    29 #include "EapTlsUiSettingArray.h"
       
    30 #include <aknnavi.h>
       
    31 #include <akntabgrp.h>
       
    32 #include <aknnavide.h>
       
    33 #include <aknnotewrappers.h> // TEMPORARY, for info message...
       
    34 #include <aknradiobuttonsettingpage.h>
       
    35 #include <EapTlsPeapUiConnection.h>
       
    36 #include <EapTlsPeapUiDataConnection.h>
       
    37 #include <EapTlsPeapUiCipherSuites.h>
       
    38 #include <EapTlsPeapUiEapTypes.h>
       
    39 #include <EapTlsPeapUiCertificates.h>
       
    40 #include <AknIconArray.h>
       
    41 #include <AknsUtils.h>
       
    42 
       
    43 #include <FeatMgr.h>
       
    44 #include <hlplch.h>
       
    45 #include <csxhelp/cp.hlp.hrh>
       
    46 
       
    47 
       
    48 // CONSTANTS
       
    49 // UID of general settings app, in which help texts are included
       
    50 const TUid KHelpUidPlugin = { 0x100058EC };
       
    51 
       
    52 static const TInt KSuiteArrayGranularity = 4;
       
    53 static const TInt KCertificateArrayGranularity = 5;
       
    54 static const TInt KMaxLengthOfSuiteName = 255;
       
    55 
       
    56 _LIT( KNameSeparator, " " );
       
    57 _LIT( KEmptyString, "" );
       
    58 
       
    59 /* This is the maximum length of a certificate's full name, includes
       
    60 label, primary and secondary names */
       
    61 const TUint32 KMaxFullCertLabelLength = KMaxCertLabelLength + 2 * 
       
    62                                     KMaxNameLength + 1; // 1 is for separator.
       
    63 
       
    64 // MODULE DATA STRUCTURES
       
    65 enum TPageIds
       
    66     {
       
    67     ESettingsPage = 0,
       
    68     ECipherSuitePage
       
    69     };
       
    70 
       
    71 enum TSettingIds
       
    72     {
       
    73     EUserCertificateItem = 0,
       
    74     ECaCertificateItem,
       
    75     EUsernameInUseItem,
       
    76     EUsernameItem,
       
    77     ERealmInUseItem,
       
    78     ERealmItem
       
    79     };
       
    80 
       
    81 
       
    82 // ============================ MEMBER FUNCTIONS ===============================
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CEapTlsUiDialog::CEapTlsUiDialog
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 CEapTlsUiDialog::CEapTlsUiDialog( CEapTlsPeapUiConnection* aConnection, 
       
    89 								  TInt& aButtonId ) 
       
    90 : CAknDialog(),
       
    91   iConnection( aConnection ),
       
    92   iDataConnection( 0 ), 
       
    93   iCipherSuites( 0 ), 
       
    94   iCertificates( 0 ),
       
    95   iUserCertificateListBox( 0 ), 
       
    96   iCaCertificateListBox( 0 ), 
       
    97   iCipherSuiteListBox( 0 ), 
       
    98   iSettingArray( 0 ), 
       
    99   iSettingListBox( 0 ), 
       
   100   iCipherSuitesViewArray( 0 ), 
       
   101   iPreviousText( 0 ), 
       
   102   iButtonId( &aButtonId ),
       
   103   iIsUIConstructionCompleted( EFalse )
       
   104     {
       
   105     }
       
   106 
       
   107 
       
   108 // ---------------------------------------------------------
       
   109 // CEapTlsUiDialog::ConstructAndRunLD
       
   110 // ---------------------------------------------------------
       
   111 //
       
   112 TInt CEapTlsUiDialog::ConstructAndRunLD( TInt aResourceId )
       
   113     {
       
   114     CleanupStack::PushL( this );
       
   115 
       
   116     iSettingArray = CEapTlsSettingItemArray::NewL();
       
   117 
       
   118     User::LeaveIfError( iConnection->Connect() );
       
   119     
       
   120     // Basic data
       
   121     iDataConnection = iConnection->GetDataConnection();
       
   122     if ( iDataConnection == 0 )
       
   123         {
       
   124         User::Leave( KErrNoMemory );
       
   125         }
       
   126     User::LeaveIfError( iDataConnection->Open() );
       
   127     User::LeaveIfError( iDataConnection->GetData( &iUiData ) );
       
   128     
       
   129     // Cipher suites
       
   130     iCipherSuites = iConnection->GetCipherSuiteConnection();
       
   131     if ( iCipherSuites == 0 )
       
   132         {
       
   133         User::Leave( KErrNoMemory );
       
   134         }
       
   135     User::LeaveIfError( iCipherSuites->Open() );
       
   136     User::LeaveIfError( iCipherSuites->GetCipherSuites( &iUiCipherSuites ) );
       
   137 
       
   138     iCipherSuitesViewArray = new( ELeave ) CDesCArrayFlat( 
       
   139                                                     KSuiteArrayGranularity );
       
   140 
       
   141     FeatureManager::InitializeLibL();
       
   142     
       
   143     ConstructL( R_TLS_MENUBAR );
       
   144     
       
   145     // ExecuteLD will PushL( this ), so we have to Pop it...
       
   146     CleanupStack::Pop( this ); // this
       
   147     
       
   148     return CAknDialog::ExecuteLD( aResourceId );
       
   149     }
       
   150     
       
   151 
       
   152 // -----------------------------------------------------------------------------
       
   153 // CEapTlsUiDialog::OfferKeyEventL
       
   154 // -----------------------------------------------------------------------------
       
   155 //
       
   156 TKeyResponse CEapTlsUiDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   157                                                     TEventCode aType )
       
   158     {
       
   159     TKeyResponse result( EKeyWasNotConsumed );
       
   160     
       
   161     TInt pageId = ActivePageId();
       
   162     if ( aType == EEventKey && pageId == KEAPTLSCIPHERPAGE )
       
   163         {
       
   164         TInt indexBefore = iCipherSuiteListBox->CurrentItemIndex();
       
   165         
       
   166         // Handle Enter key here, since it doesn't seem to convert into
       
   167         // the proper command id via the normal route
       
   168         // (maybe some Avkon support for Enter key is still missing in
       
   169         // S60 3.2 2008_wk22)
       
   170         if ( aKeyEvent.iCode == EKeyEnter )
       
   171             {
       
   172             if ( ( *iUiCipherSuites )[indexBefore].iIsEnabled )
       
   173                 {
       
   174                 OkToExitL( ETlsUiCmdDisable );
       
   175                 }
       
   176             else
       
   177                 {
       
   178                 OkToExitL( ETlsUiCmdEnable );
       
   179                 }
       
   180                 
       
   181             result = EKeyWasConsumed;
       
   182             }
       
   183         else
       
   184             {        
       
   185             result = CAknDialog::OfferKeyEventL( aKeyEvent, aType );
       
   186             }
       
   187             
       
   188         TInt indexAfter = iCipherSuiteListBox->CurrentItemIndex();
       
   189 
       
   190         if ( indexBefore != indexAfter )
       
   191             {
       
   192             CEikButtonGroupContainer& cba = ButtonGroupContainer();
       
   193             if( ( *iUiCipherSuites )[ indexAfter ].iIsEnabled )
       
   194                 {
       
   195                 cba.SetCommandSetL( R_TLS_UI_SOFTKEYS_OPTIONS_BACK_DISABLE );
       
   196                 }
       
   197             else
       
   198                 {
       
   199                 cba.SetCommandSetL( R_TLS_UI_SOFTKEYS_OPTIONS_BACK_ENABLE );
       
   200                 }
       
   201             
       
   202             cba.DrawDeferred();
       
   203             }
       
   204         }
       
   205     else
       
   206         {
       
   207         result = CAknDialog::OfferKeyEventL( aKeyEvent, aType );
       
   208         }
       
   209 
       
   210     return result;
       
   211     }
       
   212     
       
   213 
       
   214 // -----------------------------------------------------------------------------
       
   215 // CEapTlsUiDialog::~CEapTlsUiDialog
       
   216 // -----------------------------------------------------------------------------
       
   217 //
       
   218 CEapTlsUiDialog::~CEapTlsUiDialog()
       
   219     {
       
   220     if ( iSettingArray )
       
   221         {
       
   222         iSettingArray->Array()->ResetAndDestroy();
       
   223         }
       
   224 
       
   225     delete iSettingArray;
       
   226     iSettingListBox = 0;
       
   227 
       
   228     iDataConnection->Close();
       
   229     delete iDataConnection;
       
   230 
       
   231     iCipherSuites->Close();
       
   232     delete iCipherSuites;
       
   233     
       
   234     iCertificates->Close();
       
   235     delete iCertificates;
       
   236     
       
   237     iConnection->Close();
       
   238         
       
   239     iCipherSuitesViewArray->Reset();
       
   240     delete iCipherSuitesViewArray;
       
   241     
       
   242     delete iPreviousText;
       
   243     
       
   244     FeatureManager::UnInitializeLib();
       
   245     }
       
   246 
       
   247 
       
   248 // ---------------------------------------------------------
       
   249 // CEapTlsUiDialog::HandleListBoxEventL
       
   250 // ---------------------------------------------------------
       
   251 //
       
   252 void CEapTlsUiDialog::HandleListBoxEventL( CEikListBox* aListBox,
       
   253                                            TListBoxEvent aEventType )
       
   254     {
       
   255     switch ( aEventType )
       
   256         {
       
   257         case EEventEnterKeyPressed:
       
   258         case EEventItemSingleClicked:
       
   259             {
       
   260             if ( aListBox == iSettingListBox )
       
   261                 {
       
   262                 OkToExitL( ETlsUiCmdChange );                 
       
   263                 }
       
   264                 
       
   265             else if ( aListBox == iCipherSuiteListBox )
       
   266                 {
       
   267                 TInt index = iCipherSuiteListBox->CurrentItemIndex();
       
   268                 if( iUiCipherSuites->At( index ).iIsEnabled )
       
   269                     {
       
   270                     OkToExitL( ETlsUiCmdDisable );
       
   271                     }
       
   272                 else
       
   273                     {
       
   274                     OkToExitL( ETlsUiCmdEnable );
       
   275                     }                 
       
   276                 }
       
   277                 
       
   278             else
       
   279                 {
       
   280                 // Do nothing; we should never end up here
       
   281                 }
       
   282         
       
   283             break;
       
   284             }
       
   285 
       
   286         case EEventItemActioned:
       
   287         case EEventEditingStarted:
       
   288         case EEventEditingStopped:
       
   289         case EEventPenDownOnItem:
       
   290         case EEventItemDraggingActioned:
       
   291             {
       
   292             break;
       
   293             }
       
   294 
       
   295         default:
       
   296             {
       
   297             break;
       
   298             };
       
   299         };
       
   300     }    
       
   301 
       
   302 
       
   303 // -----------------------------------------------------------------------------
       
   304 // CEapTlsUiDialog::PreLayoutDynInitL
       
   305 // -----------------------------------------------------------------------------
       
   306 //
       
   307 void CEapTlsUiDialog::PreLayoutDynInitL()
       
   308     {
       
   309     // Change title
       
   310     ChangeTitleL( ETrue );
       
   311     
       
   312     iSettingListBox = static_cast<CAknSettingStyleListBox*>( 
       
   313                                     ControlOrNull( ETlsSettingsListbox ) );
       
   314     iSettingListBox->SetComponentsToInheritVisibility( ETrue );
       
   315 
       
   316     iCipherSuiteListBox = static_cast<CAknSingleGraphicStyleListBox*>( 
       
   317                             ControlOrNull( ETlsSettingsCipherSuiteListbox ) );
       
   318     iCipherSuiteListBox->SetComponentsToInheritVisibility( ETrue );
       
   319         
       
   320       // Certificates
       
   321     iCertificates = iConnection->GetCertificateConnection( this );
       
   322     User::LeaveIfError( iCertificates->Open() );
       
   323     iCertificates->GetCertificates( &iUiUserCertificates, &iUiCACertificates );
       
   324     }
       
   325 
       
   326 
       
   327 // -----------------------------------------------------------------------------
       
   328 // CEapTlsUiDialog::CompleteReadCertificates
       
   329 // -----------------------------------------------------------------------------
       
   330 //
       
   331 void CEapTlsUiDialog::CompleteReadCertificates( const TInt aResult )
       
   332     {
       
   333     if ( aResult == KErrNone ) // Certifiocates are received from core
       
   334         {
       
   335         TRAPD( err, CompleteUiConstructionL() );
       
   336         if ( err != KErrNone)
       
   337             {
       
   338             TRAP_IGNORE( TryExitL( KErrCancel ) );
       
   339             }
       
   340         }
       
   341     else
       
   342         {
       
   343         TRAP_IGNORE( TryExitL( KErrCancel ) );
       
   344         }
       
   345     }
       
   346 
       
   347 
       
   348 // -----------------------------------------------------------------------------
       
   349 // CEapTlsUiDialog::CompleteUiConstructionL
       
   350 // -----------------------------------------------------------------------------
       
   351 //
       
   352 void CEapTlsUiDialog::CompleteUiConstructionL()
       
   353     {
       
   354     // Initialize setting page 
       
   355     iSettingListBox = static_cast<CAknSettingStyleListBox*>( 
       
   356                                         ControlOrNull( ETlsSettingsListbox ) );
       
   357     iSettingListBox->SetMopParent( this );
       
   358     iSettingListBox->CreateScrollBarFrameL( ETrue );
       
   359     iSettingListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
       
   360                                                 CEikScrollBarFrame::EOff,
       
   361                                                 CEikScrollBarFrame::EAuto );
       
   362     iSettingListBox->SetListBoxObserver( this );                                                
       
   363     DrawSettingsListL();
       
   364 
       
   365     // Initialize cipher suites page
       
   366     iCipherSuiteListBox = static_cast<CAknSingleGraphicStyleListBox*>( 
       
   367                             ControlOrNull( ETlsSettingsCipherSuiteListbox ) );
       
   368     iCipherSuiteListBox->CreateScrollBarFrameL( ETrue );
       
   369     iCipherSuiteListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
       
   370                                                 CEikScrollBarFrame::EOff,
       
   371                                                 CEikScrollBarFrame::EAuto );
       
   372     iCipherSuiteListBox->UpdateScrollBarsL();
       
   373     
       
   374     iCipherSuiteListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   375     iCipherSuiteListBox->SetListBoxObserver( this );    
       
   376 
       
   377     //Following deletes internal array created from resources. 
       
   378     // To prevent memory leak.
       
   379     MDesCArray* internalArray = iCipherSuiteListBox->Model()->ItemTextArray();
       
   380     delete internalArray;
       
   381     
       
   382     SetIconsL();
       
   383     DrawCipherSuitesL();
       
   384     
       
   385     iIsUIConstructionCompleted = ETrue;
       
   386     }
       
   387     
       
   388 
       
   389 // -----------------------------------------------------------------------------
       
   390 // CEapTlsUiDialog::PostLayoutDynInitL
       
   391 // -----------------------------------------------------------------------------
       
   392 //
       
   393 void CEapTlsUiDialog::PostLayoutDynInitL()
       
   394     {
       
   395     TUid naviPaneUid;
       
   396     naviPaneUid.iUid = EEikStatusPaneUidNavi;
       
   397 
       
   398     CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
       
   399     CEikStatusPaneBase::TPaneCapabilities subPane = 
       
   400                                 statusPane->PaneCapabilities( naviPaneUid );
       
   401     if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   402         {
       
   403         CAknNavigationControlContainer* naviPane = 
       
   404                                 static_cast<CAknNavigationControlContainer*>(
       
   405                                         statusPane->ControlL( naviPaneUid ) );
       
   406         CAknNavigationDecorator* naviDecorator = naviPane->ResourceDecorator();
       
   407         if ( naviDecorator )
       
   408             {
       
   409             CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( 
       
   410                                         naviDecorator->DecoratedControl() );
       
   411             tabGroup->SetActiveTabById( 0 ); 
       
   412             tabGroup->SetTabFixedWidthL( KTabWidthWithOneTab );
       
   413             }
       
   414         }
       
   415     }
       
   416 
       
   417 
       
   418 // -----------------------------------------------------------------------------
       
   419 // CEapTlsUiDialog::ChangeTitleL
       
   420 // -----------------------------------------------------------------------------
       
   421 //
       
   422 void CEapTlsUiDialog::ChangeTitleL( TBool aIsStarted )
       
   423     {
       
   424     TUid titlePaneUid;
       
   425     titlePaneUid.iUid = EEikStatusPaneUidTitle;
       
   426 
       
   427     CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
       
   428     CEikStatusPaneBase::TPaneCapabilities subPane = 
       
   429                                 statusPane->PaneCapabilities( titlePaneUid );
       
   430     
       
   431     if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   432         {
       
   433         CAknTitlePane* titlePane = static_cast<CAknTitlePane*>( 
       
   434                                         statusPane->ControlL( titlePaneUid ) );
       
   435         if ( aIsStarted )
       
   436             {
       
   437             // Store previous application title text
       
   438             const TDesC* prevText = titlePane->Text();    
       
   439             iPreviousText = HBufC::NewL( prevText->Length() );
       
   440             iPreviousText->Des().Append( *prevText );   
       
   441             
       
   442             TDesC* titleText = iEikonEnv->AllocReadResourceLC( 
       
   443                                                         R_TLS_SETTINGS_TITLE );
       
   444             titlePane->SetTextL( *titleText );
       
   445             CleanupStack::PopAndDestroy( titleText ); 
       
   446             }
       
   447         else
       
   448             {
       
   449             // Set calling application title text back
       
   450             titlePane->SetTextL( *iPreviousText );    
       
   451             }    
       
   452         }
       
   453     }
       
   454 
       
   455 
       
   456 // -----------------------------------------------------------------------------
       
   457 // CEapTlsUiDialog::OkToExitL
       
   458 // -----------------------------------------------------------------------------
       
   459 //
       
   460 TBool CEapTlsUiDialog::OkToExitL( TInt aButtonId )
       
   461     {
       
   462     TBool ret( EFalse );
       
   463     switch ( aButtonId )
       
   464         {
       
   465         case EEikBidOk:
       
   466             {
       
   467             if( iIsUIConstructionCompleted )
       
   468                 {
       
   469                 TPageIds index = static_cast<TPageIds>( ActivePageIndex() );
       
   470                 if ( index == ESettingsPage )
       
   471                     {
       
   472                     ShowSettingPageL( EFalse );
       
   473                     }
       
   474                 }
       
   475             else
       
   476                 {
       
   477                 #if defined(_DEBUG) || defined(DEBUG)
       
   478 				RDebug::Print(_L("CEapTlsUiDialog::OkToExitL - UI not ready - Ignoring key press.\n") );
       
   479 				#endif
       
   480                 }
       
   481             break;
       
   482             }
       
   483 
       
   484         case EAknSoftkeyOptions:
       
   485             {
       
   486             DisplayMenuL();
       
   487             break;
       
   488             }
       
   489 
       
   490         case EAknSoftkeyBack:
       
   491         case EAknCmdExit:
       
   492             {
       
   493             if( iIsUIConstructionCompleted )
       
   494                 {
       
   495                 iDataConnection->Update();
       
   496                 ChangeTitleL( EFalse );
       
   497                 ret = ETrue;
       
   498                 }
       
   499             break;
       
   500             }
       
   501             
       
   502         case ETlsUiCmdChange:
       
   503             {
       
   504             TPageIds index = static_cast<TPageIds>( ActivePageIndex() );
       
   505             if ( index == ESettingsPage )
       
   506                 {
       
   507                 if( iIsUIConstructionCompleted )
       
   508     				{
       
   509         			ShowSettingPageL( EFalse );
       
   510     				}
       
   511     			else
       
   512     			    {
       
   513     				#if defined(_DEBUG) || defined(DEBUG)
       
   514     				RDebug::Print(_L("CEapPeapUiDialog::ProcessCommandL - UI not ready - Ignoring key press.\n") );
       
   515     				#endif
       
   516     			    }
       
   517                 }
       
   518             break;
       
   519             }
       
   520         case ETlsUiCmdEnable:
       
   521         case ETlsUiCmdDisable:
       
   522             {
       
   523             ProcessCommandL( aButtonId );
       
   524             ret = EFalse;
       
   525             break;
       
   526             }
       
   527 
       
   528         default:
       
   529             {
       
   530             break;
       
   531             }
       
   532         }
       
   533 
       
   534     if ( ret )
       
   535         {
       
   536         *iButtonId = aButtonId;
       
   537         }
       
   538 
       
   539     return ret;
       
   540     }
       
   541 
       
   542 
       
   543 // -----------------------------------------------------------------------------
       
   544 // CEapTlsUiDialog::DrawSettingsListL
       
   545 // -----------------------------------------------------------------------------
       
   546 //
       
   547 void CEapTlsUiDialog::DrawSettingsListL()
       
   548     {  
       
   549     iSettingArray->Array()->ResetAndDestroy();
       
   550     TInt ordinal = 0;
       
   551 
       
   552     TInt activeUserCertificate = CheckActiveUserCertificate();
       
   553     TBuf<KMaxFullCertLabelLength> aActiveuserCertificateName = KEmptyString();
       
   554     if ( activeUserCertificate != KErrNotFound )
       
   555         {
       
   556 		TBuf<KMaxFullCertLabelLength> text;
       
   557 		GetFullCertLabel( 
       
   558                 iUiUserCertificates->At( activeUserCertificate ).iCertEntry,
       
   559                 text );
       
   560 		aActiveuserCertificateName.Copy( text );		
       
   561         }
       
   562     else
       
   563         {
       
   564         TDesC* notDefinedText = iEikonEnv->AllocReadResourceLC( 
       
   565                                                         R_TLS_NOT_DEFINED );
       
   566         aActiveuserCertificateName.Copy( *notDefinedText );
       
   567         CleanupStack::PopAndDestroy( notDefinedText );
       
   568         }
       
   569 
       
   570     iSettingArray->AddTextItemL( aActiveuserCertificateName,
       
   571                                  ETlsSettingsUserCert,
       
   572                                  R_TLS_USER_CERT_SETTING,
       
   573                                  R_TLS_USERNAME_PAGE,
       
   574                                  NULL,
       
   575                                  ordinal++ );
       
   576 
       
   577     TInt activeCaCertificate = CheckActiveCaCertificate();
       
   578     TBuf<KMaxFullCertLabelLength> aActiveCaCertificateName = KEmptyString();
       
   579     if ( activeCaCertificate != KErrNotFound )
       
   580         {
       
   581 		TBuf<KMaxFullCertLabelLength> text;
       
   582 		GetFullCertLabel(
       
   583                     iUiCACertificates->At( activeCaCertificate ).iCertEntry, 
       
   584                     text );
       
   585 		aActiveCaCertificateName.Copy( text );				
       
   586         }
       
   587     else
       
   588         {
       
   589         TDesC* notDefinedText = iEikonEnv->AllocReadResourceLC( 
       
   590                                                         R_TLS_NOT_DEFINED );
       
   591         aActiveCaCertificateName.Copy( *notDefinedText );
       
   592         CleanupStack::PopAndDestroy( notDefinedText );                
       
   593         }
       
   594 
       
   595     iSettingArray->AddTextItemL( aActiveCaCertificateName,
       
   596                                  ETlsSettingsCaCert,
       
   597                                  R_TLS_CA_CERT_SETTING,
       
   598                                  R_TLS_USERNAME_PAGE,
       
   599                                  NULL,
       
   600                                  ordinal++ );
       
   601 
       
   602     iSettingArray->AddBinarySettingItemL( R_TLS_DISPLAY_AUTOUSECONF_PAGE,
       
   603                                           R_TLS_USERNAME_INUSESTRING, 
       
   604                                           R_TLS_USERNAME_AUTOUSECONF_TEXTS,
       
   605                                           ordinal++,
       
   606                                           *iUiData->GetUseManualUsername() );
       
   607                                 
       
   608     iSettingArray->AddTextItemL( iUiData->GetManualUsername(),
       
   609                                  ETlsTabSheetSettingsUsername,
       
   610                                  R_TLS_USERNAME_STRING,
       
   611                                  R_TLS_USERNAME_PAGE,
       
   612                                  NULL,
       
   613                                  ordinal++ );
       
   614 
       
   615     iSettingArray->AddBinarySettingItemL( R_TLS_DISPLAY_AUTOUSECONF_PAGE, 
       
   616                                           R_TLS_REALM_INUSESTRING, 
       
   617                                           R_TLS_REALM_AUTOUSECONF_TEXTS,
       
   618                                           ordinal++,
       
   619                                           *iUiData->GetUseManualRealm() );    
       
   620 
       
   621     iSettingArray->AddTextItemL( iUiData->GetManualRealm(),
       
   622                                  ETlsTabSheetSettingsRealm,
       
   623                                  R_TLS_REALM_STRING,
       
   624                                  R_TLS_REALM_PAGE,
       
   625                                  NULL,
       
   626                                  ordinal++ );
       
   627 
       
   628     iSettingArray->AddBinarySettingItemL( R_TLS_DISPLAY_AUTOUSECONF_PAGE,
       
   629                                           R_TLS_TLS_PRIVACY_STRING, 
       
   630                                           R_TLS_TLS_PRIVACY_AUTOUSECONF_TEXTS,
       
   631                                           ordinal++,
       
   632                                           *iUiData->GetTlsPrivacy() );
       
   633         
       
   634     iSettingListBox->Model()->SetItemTextArray( iSettingArray->Array() );
       
   635     iSettingListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   636     iSettingArray->Array()->RecalculateVisibleIndicesL();
       
   637     iSettingListBox->HandleItemAdditionL();
       
   638     iSettingListBox->UpdateScrollBarsL();
       
   639     }
       
   640 
       
   641 
       
   642 // -----------------------------------------------------------------------------
       
   643 // CEapTlsUiDialog::DynInitMenuPaneL
       
   644 // -----------------------------------------------------------------------------
       
   645 //
       
   646 void CEapTlsUiDialog::DynInitMenuPaneL( TInt aResourceId, 
       
   647                                         CEikMenuPane* aMenuPane )
       
   648     {
       
   649     CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   650 
       
   651     if ( aMenuPane && aResourceId == R_TLS_MENU_PANE )
       
   652         {
       
   653         if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   654             {
       
   655             aMenuPane->DeleteMenuItem( EAknCmdHelp );
       
   656             }
       
   657 
       
   658         TPageIds index = static_cast<TPageIds>( ActivePageIndex() );
       
   659         if ( index == ESettingsPage )
       
   660             {
       
   661             aMenuPane->SetItemDimmed( ETlsUiCmdEnable,  ETrue );
       
   662             aMenuPane->SetItemDimmed( ETlsUiCmdDisable, ETrue );
       
   663             }
       
   664         else if ( index == ECipherSuitePage )
       
   665             {
       
   666             aMenuPane->SetItemDimmed( ETlsUiCmdChange, ETrue );
       
   667 
       
   668             if ( iCipherSuitesViewArray->Count() > 0 )
       
   669                 {
       
   670                 TInt currIndex = iCipherSuiteListBox->CurrentItemIndex();
       
   671                 TBool enabled = iUiCipherSuites->At( currIndex ).iIsEnabled;
       
   672 
       
   673                 // Hide either "Enable" or "Disable", as appropriate.
       
   674                 aMenuPane->SetItemDimmed( ETlsUiCmdEnable,  enabled );
       
   675                 aMenuPane->SetItemDimmed( ETlsUiCmdDisable, !enabled );
       
   676                 }
       
   677             else
       
   678                 {
       
   679                 aMenuPane->SetItemDimmed( ETlsUiCmdEnable,  ETrue );
       
   680                 aMenuPane->SetItemDimmed( ETlsUiCmdDisable, ETrue );
       
   681                 }
       
   682             }
       
   683         }
       
   684     }
       
   685 
       
   686 
       
   687 // -----------------------------------------------------------------------------
       
   688 // CEapTlsUiDialog::ProcessCommandL
       
   689 // -----------------------------------------------------------------------------
       
   690 //
       
   691 void CEapTlsUiDialog::ProcessCommandL( TInt aCommand )
       
   692     {
       
   693     if ( MenuShowing() )
       
   694         {
       
   695         HideMenu();
       
   696         }
       
   697 
       
   698     TPageIds pageIndex = static_cast<TPageIds>( ActivePageIndex() );
       
   699     switch( aCommand )
       
   700         {
       
   701         case EAknCmdExit:
       
   702             {
       
   703             TryExitL( aCommand );
       
   704             break;
       
   705             }
       
   706 
       
   707         case EAknCmdHelp:
       
   708             {
       
   709             HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
       
   710                                     iEikonEnv->EikAppUi()->AppHelpContextL() );
       
   711             break;
       
   712             }
       
   713 
       
   714         case ETlsUiCmdChange:
       
   715             {
       
   716             if ( pageIndex == ESettingsPage )
       
   717                 {
       
   718                 if( iIsUIConstructionCompleted )
       
   719     				{
       
   720         			ShowSettingPageL( ETrue );
       
   721     				}
       
   722     			else
       
   723     			    {
       
   724     				#if defined(_DEBUG) || defined(DEBUG)
       
   725     				RDebug::Print(_L("CEapTlsUiDialog::ProcessCommandL - UI not ready - Ignoring key press.\n") );
       
   726     				#endif						
       
   727     			    }
       
   728                 }    
       
   729             break;
       
   730             }
       
   731 
       
   732         case ETlsUiCmdEnable:
       
   733             {
       
   734             if ( pageIndex == ECipherSuitePage )    // Safety check in tls.
       
   735                 {
       
   736                 TInt index = iCipherSuiteListBox->CurrentItemIndex();
       
   737                 iUiCipherSuites->At( index ).iIsEnabled = ETrue;
       
   738                 iCipherSuites->Update();
       
   739                 DrawCipherSuitesL();
       
   740                 CEikButtonGroupContainer& cba = ButtonGroupContainer();
       
   741                 cba.SetCommandSetL( R_TLS_UI_SOFTKEYS_OPTIONS_BACK_DISABLE );
       
   742                 cba.DrawDeferred();
       
   743                 }
       
   744             break;
       
   745             }
       
   746 
       
   747         case ETlsUiCmdDisable:
       
   748             {
       
   749             if ( pageIndex == ECipherSuitePage )    // Safety check in tls.
       
   750                 {
       
   751                 TInt index = iCipherSuiteListBox->CurrentItemIndex();
       
   752                 iUiCipherSuites->At( index ).iIsEnabled = EFalse;
       
   753                 iCipherSuites->Update();                
       
   754                 DrawCipherSuitesL();
       
   755                 CEikButtonGroupContainer& cba = ButtonGroupContainer();
       
   756                 cba.SetCommandSetL( R_TLS_UI_SOFTKEYS_OPTIONS_BACK_ENABLE );
       
   757                 cba.DrawDeferred();
       
   758                 }            
       
   759             break;
       
   760             }
       
   761 
       
   762         default:
       
   763             {
       
   764             break;
       
   765             }
       
   766         }
       
   767     }
       
   768     
       
   769     
       
   770 // -----------------------------------------------------------------------------
       
   771 // CEapTlsUiDialog::PageChangedL
       
   772 // -----------------------------------------------------------------------------
       
   773 //
       
   774 void CEapTlsUiDialog::PageChangedL( TInt aPageId )
       
   775     {
       
   776     if ( !iIsUIConstructionCompleted )
       
   777         {
       
   778         return;
       
   779         }
       
   780     
       
   781     if ( aPageId == KEAPTLSSETTINGSPAGE )
       
   782         {
       
   783         if (iSettingListBox->ScrollBarFrame())
       
   784             {
       
   785             iSettingListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(ETrue);
       
   786             }
       
   787         if (iCipherSuiteListBox->ScrollBarFrame())
       
   788             {
       
   789             iCipherSuiteListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(EFalse);
       
   790             }
       
   791         }
       
   792 
       
   793     else if ( aPageId == KEAPTLSCIPHERPAGE )
       
   794         {
       
   795         if (iSettingListBox->ScrollBarFrame())
       
   796             {
       
   797             iSettingListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(EFalse);
       
   798             }
       
   799         if (iCipherSuiteListBox->ScrollBarFrame())
       
   800             {
       
   801             iCipherSuiteListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(ETrue);
       
   802             }
       
   803         }
       
   804         
       
   805     CEikButtonGroupContainer& cba = ButtonGroupContainer();
       
   806     if( aPageId == KEAPTLSSETTINGSPAGE )
       
   807         {
       
   808         cba.SetCommandSetL( R_TLS_UI_SOFTKEYS_OPTIONS_BACK_EDIT );
       
   809         }
       
   810     else if( aPageId == KEAPTLSCIPHERPAGE )
       
   811         {
       
   812         TInt index = iCipherSuiteListBox->CurrentItemIndex();
       
   813         if( ( *iUiCipherSuites )[ index ].iIsEnabled )
       
   814             {
       
   815             cba.SetCommandSetL( R_TLS_UI_SOFTKEYS_OPTIONS_BACK_DISABLE );
       
   816             }
       
   817         else
       
   818             {
       
   819             cba.SetCommandSetL( R_TLS_UI_SOFTKEYS_OPTIONS_BACK_ENABLE );
       
   820             }
       
   821         }
       
   822     cba.DrawDeferred();
       
   823     }
       
   824 
       
   825 
       
   826 // -----------------------------------------------------------------------------
       
   827 // CEapTlsUiDialog::ShowSettingPageL
       
   828 // -----------------------------------------------------------------------------
       
   829 //
       
   830 void CEapTlsUiDialog::ShowSettingPageL( TInt aCalledFromMenu ) 
       
   831     {
       
   832     TInt index = iSettingListBox->CurrentItemIndex();
       
   833     if ( index == EUserCertificateItem )
       
   834         {
       
   835         TInt activeUserCertificate = CheckActiveUserCertificate();
       
   836         CDesCArrayFlat* tempArray = new( ELeave )CDesCArrayFlat( 
       
   837                                                 KCertificateArrayGranularity );
       
   838         CleanupStack::PushL( tempArray );
       
   839     
       
   840         TDesC* noneText = iEikonEnv->AllocReadResourceLC( 
       
   841                                                         R_TLS_NONE_SELECTION );
       
   842         tempArray->InsertL( 0, *noneText );
       
   843         CleanupStack::PopAndDestroy( noneText );
       
   844     
       
   845         for ( TInt i = 0; i < iUiUserCertificates->Count() ; i++ )
       
   846             {
       
   847             TEapTlsPeapUiCertificate certificate = 
       
   848                                                 iUiUserCertificates->At( i );
       
   849             SCertEntry entry = certificate.iCertEntry;
       
   850 			TBuf<KMaxFullCertLabelLength> text;
       
   851 			GetFullCertLabel( entry, text);
       
   852 			tempArray->InsertL( i+1, text );
       
   853             }
       
   854 
       
   855         TInt selected( 0 );    
       
   856         if ( activeUserCertificate == KErrNotFound )
       
   857             {
       
   858             selected = ShowRadioButtonSettingPageL( R_TLS_USER_CERT_SETTING, 
       
   859                                                     tempArray, 0 );
       
   860             }
       
   861         else 
       
   862             {
       
   863             selected = ShowRadioButtonSettingPageL( R_TLS_USER_CERT_SETTING, 
       
   864                                                     tempArray, 
       
   865                                                     activeUserCertificate+1 );
       
   866                                     //Plus 1 cause we added 'none' selection
       
   867             }
       
   868 
       
   869         CleanupStack::PopAndDestroy( tempArray );
       
   870         UserCertificateHouseKeeping( selected );    
       
   871         iCertificates->Update();
       
   872         DrawSettingsListL(); // List must be drawn again at this stage
       
   873         }
       
   874     else if ( index == ECaCertificateItem )
       
   875         {
       
   876         TInt activeCaCertificate = CheckActiveCaCertificate();
       
   877 
       
   878         CDesCArrayFlat* tempArray = new( ELeave )CDesCArrayFlat( 
       
   879                                                 KCertificateArrayGranularity );
       
   880         CleanupStack::PushL( tempArray );
       
   881 
       
   882         TDesC* noneText = iEikonEnv->AllocReadResourceLC( 
       
   883                                                         R_TLS_NONE_SELECTION );
       
   884         tempArray->InsertL( 0, *noneText );
       
   885         CleanupStack::PopAndDestroy( noneText );
       
   886 
       
   887         for ( TInt i = 0; i < iUiCACertificates->Count(); i++ )
       
   888             {
       
   889             TEapTlsPeapUiCertificate certificate = iUiCACertificates->At( i );
       
   890             SCertEntry entry = certificate.iCertEntry;
       
   891             TBuf<KMaxFullCertLabelLength> text;
       
   892 			GetFullCertLabel( entry, text );
       
   893 			tempArray->InsertL( i+1, text );
       
   894             }
       
   895 
       
   896         TInt selected( 0 );
       
   897         if ( activeCaCertificate == KErrNotFound )
       
   898             {
       
   899             selected = ShowRadioButtonSettingPageL( R_TLS_CA_CERT_SETTING, 
       
   900                                                     tempArray, 0 );
       
   901             }
       
   902         else
       
   903             {
       
   904             selected = ShowRadioButtonSettingPageL( R_TLS_CA_CERT_SETTING, 
       
   905                                                     tempArray, 
       
   906                                                     activeCaCertificate+1 );
       
   907                                     //Plus 1 cause we added 'none' selection
       
   908             }
       
   909 
       
   910         CleanupStack::PopAndDestroy( tempArray );
       
   911         CaCertificateHouseKeeping( selected );
       
   912         iCertificates->Update();
       
   913         DrawSettingsListL(); // List must be drawn again at this stage
       
   914         }
       
   915     else
       
   916         {
       
   917         CAknSettingItem* item = iSettingArray->Array()->At( index );
       
   918         item->EditItemL( aCalledFromMenu );
       
   919         item->StoreL();
       
   920         }
       
   921     DrawNow();
       
   922     }
       
   923 
       
   924 
       
   925 // -----------------------------------------------------------------------------
       
   926 // CEapTlsUiDialog::ShowRadioButtonSettingPageL
       
   927 // -----------------------------------------------------------------------------
       
   928 //
       
   929 TInt CEapTlsUiDialog::ShowRadioButtonSettingPageL( TInt aTitle, 
       
   930                                                    CDesCArrayFlat* aValues,
       
   931                                                    TInt aCurrentItem )
       
   932     {
       
   933     // title of the dialog
       
   934     HBufC* title = iCoeEnv->AllocReadResourceLC( aTitle );
       
   935 
       
   936     // We have everything to create dialog
       
   937     CAknRadioButtonSettingPage* dlg = new( ELeave )CAknRadioButtonSettingPage(
       
   938                                                 R_RADIO_BUTTON_SETTING_PAGE,
       
   939                                                 aCurrentItem, 
       
   940                                                 aValues );
       
   941     CleanupStack::PushL( dlg );
       
   942     dlg->SetSettingTextL( *title ); 
       
   943     CleanupStack::Pop( dlg ); 
       
   944     dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
       
   945     CleanupStack::PopAndDestroy( title ); 
       
   946     // index must be re-turned upside down, because options list is upside down
       
   947     return aCurrentItem;
       
   948     }
       
   949   
       
   950  
       
   951   
       
   952 // -----------------------------------------------------------------------------
       
   953 // CEapTlsUiDialog::DrawCipherSuitesL
       
   954 // -----------------------------------------------------------------------------
       
   955 //
       
   956 void CEapTlsUiDialog::DrawCipherSuitesL()
       
   957     {
       
   958     iCipherSuitesViewArray->Reset();
       
   959     TInt listCount( 0 );
       
   960     TBuf<KMaxLengthOfSuiteName> temp;
       
   961 
       
   962     for ( TInt i = 0; i < iUiCipherSuites->Count() ; i++ )
       
   963         {
       
   964         temp.Zero();
       
   965         _LIT( KTab, "\t" );
       
   966         temp.Append( KTab );
       
   967         TEapTlsPeapUiCipherSuite suite = iUiCipherSuites->At( i );
       
   968         TUint32 suiteId = suite.iCipherSuite;
       
   969 
       
   970         switch ( suiteId )
       
   971             {
       
   972             case 0x0004:
       
   973                 {
       
   974                 HBufC* suite = iCoeEnv->AllocReadResourceLC( 
       
   975                                                 R_TLS_SUITE_RSARC4MD5 );
       
   976                 temp.Append( *suite );
       
   977                 CleanupStack::PopAndDestroy( suite );
       
   978                 break;
       
   979                 }
       
   980 
       
   981             case 0x0005:
       
   982                 {
       
   983                 HBufC* suite = iCoeEnv->AllocReadResourceLC( 
       
   984                                                 R_TLS_SUITE_RSARC4SHA );
       
   985                 temp.Append( *suite );
       
   986                 CleanupStack::PopAndDestroy( suite );
       
   987                 break;
       
   988                 }
       
   989 
       
   990             case 0x000a:
       
   991                 {
       
   992                 HBufC* suite = iCoeEnv->AllocReadResourceLC( 
       
   993                                                 R_TLS_SUITE_RSA3DESSHA );
       
   994                 temp.Append( *suite );
       
   995                 CleanupStack::PopAndDestroy( suite );
       
   996                 break;
       
   997                 }
       
   998 
       
   999             case 0x0016:
       
  1000                 {
       
  1001                 HBufC* suite = iCoeEnv->AllocReadResourceLC( 
       
  1002                                                 R_TLS_SUITE_DHERSA3DESSHA );
       
  1003                 temp.Append( *suite );
       
  1004                 CleanupStack::PopAndDestroy( suite );            
       
  1005                 break;
       
  1006                 }
       
  1007 
       
  1008             case 0x0013:
       
  1009                 {
       
  1010                 HBufC* suite = iCoeEnv->AllocReadResourceLC( 
       
  1011                                                 R_TLS_SUITE_DHEDSS3DESSHA );
       
  1012                 temp.Append( *suite );
       
  1013                 CleanupStack::PopAndDestroy( suite );        
       
  1014                 break;
       
  1015                 }
       
  1016 
       
  1017             case 0x002F:
       
  1018                 {
       
  1019                 HBufC* suite = iCoeEnv->AllocReadResourceLC( 
       
  1020                                                 R_TLS_SUITE_RSAAESSHA );
       
  1021                 temp.Append( *suite );
       
  1022                 CleanupStack::PopAndDestroy( suite );                
       
  1023                 break;
       
  1024                 }
       
  1025 
       
  1026             case 0x0032:
       
  1027                 {
       
  1028                 HBufC* suite = iCoeEnv->AllocReadResourceLC( 
       
  1029                                                 R_TLS_SUITE_DHERSAAESSHA );
       
  1030                 temp.Append( *suite );
       
  1031                 CleanupStack::PopAndDestroy( suite );        
       
  1032                 break;
       
  1033                 }
       
  1034 
       
  1035             case 0x0033:
       
  1036                 {
       
  1037                 HBufC* suite = iCoeEnv->AllocReadResourceLC( 
       
  1038                                                 R_TLS_SUITE_DHEDSSAESSHA );
       
  1039                 temp.Append( *suite );
       
  1040                 CleanupStack::PopAndDestroy( suite );                     
       
  1041                 break;
       
  1042                 }
       
  1043 
       
  1044             default:
       
  1045                 {
       
  1046                 temp.Append( KEmptyString );                                    
       
  1047                 break;
       
  1048                 }
       
  1049 
       
  1050             }
       
  1051 
       
  1052         if (iUiCipherSuites->At( i ).iIsEnabled)
       
  1053             {
       
  1054             // Add mark icon to indicate that the suite is enabled
       
  1055             _LIT( KTab0, "\t0" );
       
  1056             temp.Append( KTab0 );    
       
  1057             }
       
  1058 
       
  1059         iCipherSuitesViewArray->InsertL( listCount, temp );
       
  1060         listCount++;                
       
  1061         }
       
  1062 
       
  1063     iCipherSuiteListBox->Model()->SetItemTextArray( iCipherSuitesViewArray );
       
  1064     iCipherSuiteListBox->HandleItemAdditionL();
       
  1065     iCipherSuiteListBox->DrawDeferred();
       
  1066     iCipherSuiteListBox->UpdateScrollBarsL();        
       
  1067     }
       
  1068 
       
  1069 
       
  1070 // -----------------------------------------------------------------------------
       
  1071 // CEapTlsUiDialog::CheckActiveUserCertificate
       
  1072 // -----------------------------------------------------------------------------
       
  1073 //
       
  1074 TInt CEapTlsUiDialog::CheckActiveUserCertificate()
       
  1075     {
       
  1076     for ( TInt i = 0; i < iUiUserCertificates->Count(); i++ )
       
  1077         {
       
  1078         if ( iUiUserCertificates->At( i ).iIsEnabled )
       
  1079             {
       
  1080             return i;
       
  1081             }
       
  1082         }
       
  1083 
       
  1084     return KErrNotFound;
       
  1085     }
       
  1086 
       
  1087 
       
  1088 // -----------------------------------------------------------------------------
       
  1089 // CEapTlsUiDialog::CheckActiveCaCertificate
       
  1090 // -----------------------------------------------------------------------------
       
  1091 //
       
  1092 TInt CEapTlsUiDialog::CheckActiveCaCertificate()
       
  1093     {
       
  1094     for ( TInt i = 0; i < iUiCACertificates->Count(); i++ )
       
  1095         {
       
  1096         if ( iUiCACertificates->At( i ).iIsEnabled )
       
  1097             {
       
  1098             return i;
       
  1099             }
       
  1100         }
       
  1101 
       
  1102     return KErrNotFound;
       
  1103     }
       
  1104 
       
  1105 
       
  1106 // -----------------------------------------------------------------------------
       
  1107 // CEapTlsUiDialog::UserCertificateHouseKeeping
       
  1108 // -----------------------------------------------------------------------------
       
  1109 //
       
  1110 void CEapTlsUiDialog::UserCertificateHouseKeeping( TInt aSelected )
       
  1111     {
       
  1112     for ( TInt i = 0; i < iUiUserCertificates->Count(); i++ )
       
  1113         {
       
  1114         iUiUserCertificates->At( i ).iIsEnabled = EFalse;
       
  1115         }
       
  1116 
       
  1117     if ( aSelected != 0 ) // Zero index is none
       
  1118         {
       
  1119         iUiUserCertificates->At( aSelected-1 ).iIsEnabled = ETrue;
       
  1120         }
       
  1121     }
       
  1122 
       
  1123 
       
  1124 // -----------------------------------------------------------------------------
       
  1125 // CEapTlsUiDialog::CaCertificateHouseKeeping
       
  1126 // -----------------------------------------------------------------------------
       
  1127 //
       
  1128 void CEapTlsUiDialog::CaCertificateHouseKeeping( TInt aSelected )
       
  1129     {
       
  1130     for ( TInt i = 0; i < iUiCACertificates->Count(); i++ )
       
  1131         {
       
  1132         iUiCACertificates->At( i ).iIsEnabled = EFalse;
       
  1133         }
       
  1134 
       
  1135     if ( aSelected != 0 ) // Zero index is none
       
  1136         {        
       
  1137         iUiCACertificates->At( aSelected-1 ).iIsEnabled = ETrue;
       
  1138         }
       
  1139     }
       
  1140 
       
  1141 
       
  1142 // -----------------------------------------------------------------------------
       
  1143 // CEapTlsUiDialog::SetIconsL
       
  1144 // -----------------------------------------------------------------------------
       
  1145 //
       
  1146 void CEapTlsUiDialog::SetIconsL()
       
  1147     {
       
  1148     CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( 1 );
       
  1149     CleanupStack::PushL( icons );
       
  1150 
       
  1151     MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
       
  1152 
       
  1153 /*    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
       
  1154                                         KAknsIIDQgnIndiMarkedAdd,
       
  1155                                         AknIconUtils::AvkonIconFileName(),
       
  1156                                         EMbmAvkonQgn_indi_marked_add, 
       
  1157                                         EMbmAvkonQgn_indi_marked_add_mask ) );
       
  1158 */
       
  1159 
       
  1160     CGulIcon* icon = CGulIcon::NewLC();
       
  1161     CFbsBitmap* bitmap = NULL;
       
  1162     CFbsBitmap* mask = NULL;    
       
  1163     AknsUtils::CreateColorIconL( skinInstance,
       
  1164                                  KAknsIIDQgnIndiMarkedAdd, 
       
  1165                                  KAknsIIDQsnIconColors, 
       
  1166                                  EAknsCIQsnIconColorsCG13, 
       
  1167                                  bitmap, 
       
  1168                                  mask, 
       
  1169                                  AknIconUtils::AvkonIconFileName(),
       
  1170                                  EMbmAvkonQgn_indi_marked_add, 
       
  1171                                  EMbmAvkonQgn_indi_marked_add_mask,
       
  1172                                  KRgbBlack );
       
  1173     icon->SetBitmap( bitmap );
       
  1174     icon->SetMask( mask );    
       
  1175     icons->AppendL( icon );
       
  1176                 
       
  1177     CleanupStack::Pop( icon ); 
       
  1178     CleanupStack::Pop( icons ); // icons
       
  1179 
       
  1180     iCipherSuiteListBox->ItemDrawer()->ColumnData()->SetIconArray( icons );
       
  1181 
       
  1182     }
       
  1183 
       
  1184 
       
  1185 // -----------------------------------------------------------------------------
       
  1186 // CEapTlsUiDialog::GetHelpContext
       
  1187 // -----------------------------------------------------------------------------
       
  1188 //
       
  1189 void CEapTlsUiDialog::GetHelpContext( TCoeHelpContext& aContext ) const
       
  1190     {
       
  1191     aContext.iMajor = KHelpUidPlugin;
       
  1192     TPageIds index = static_cast< TPageIds >( ActivePageIndex() );
       
  1193     switch ( index )
       
  1194         {
       
  1195         case ECipherSuitePage:
       
  1196             {
       
  1197             aContext.iContext = KSET_HLP_WLAN_EAP_TLS_SUITES;
       
  1198             break;
       
  1199             }
       
  1200 
       
  1201         default:
       
  1202             {
       
  1203             aContext.iContext = KSET_HLP_WLAN_EAP_TLS_SETT;
       
  1204             break;
       
  1205             }
       
  1206         }
       
  1207     }
       
  1208 
       
  1209 
       
  1210 
       
  1211 void CEapTlsUiDialog::GetFullCertLabel( const SCertEntry& aCert, 
       
  1212                                         TDes& aFullLabel )
       
  1213     {
       
  1214     TInt length = 0;
       
  1215 
       
  1216 	// For label.
       
  1217     length += aCert.iLabel.Length();
       
  1218 
       
  1219 	// For separator between label and primary name.    
       
  1220     length += KNameSeparator.iTypeLength;    
       
  1221     
       
  1222     // For primary name.
       
  1223     length += aCert.iPrimaryName.Length();
       
  1224 
       
  1225     if ( !( aCert.iLabel.Length() ) )
       
  1226         {	
       
  1227     	// For secondary name.
       
  1228 	    length += aCert.iSecondaryName.Length();
       
  1229         }
       
  1230     
       
  1231     if( length > aFullLabel.MaxLength() )
       
  1232         {
       
  1233 #if defined(_DEBUG) || defined(DEBUG)
       
  1234 		RDebug::Print(_L("CEapTlsUiDialog::GetFullCertLabel - ERROR! Length Mismatch in Certificate's full name\n") );
       
  1235 #endif
       
  1236         }
       
  1237 
       
  1238     HBufC* label = NULL;
       
  1239     TRAPD(err, label = HBufC::NewL( length ));
       
  1240     if (err)
       
  1241         {
       
  1242 #if defined(_DEBUG) || defined(DEBUG)
       
  1243         RDebug::Print(_L("CEapTlsUiDialog::GetFullCertLabel - ERROR! LEAVE: HBufC::NewL\n") );
       
  1244 #endif
       
  1245         return;
       
  1246         }
       
  1247     label->Des().Append( aCert.iLabel );
       
  1248 
       
  1249     label->Des().Append( KNameSeparator );
       
  1250     label->Des().Append( aCert.iPrimaryName );
       
  1251 
       
  1252     if ( !( aCert.iLabel.Length() ) )
       
  1253         {
       
  1254     	// Secondary name, only if no label. Certificate manager does the same way.
       
  1255 	    label->Des().Append( aCert.iSecondaryName );
       
  1256         }
       
  1257             
       
  1258 	aFullLabel.Copy( label->Des().Left( aFullLabel.MaxLength() ) );   
       
  1259     
       
  1260     delete label;
       
  1261     label = NULL;
       
  1262     }
       
  1263 
       
  1264 
       
  1265 //  End of File