wlansecuritysettings/wepsecuritysettingsui/src/WEPSecuritySettingsDlg.cpp
changeset 0 c8830336c852
child 1 a3e2bfb0107c
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 dialog.  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <aknnavide.h>
       
    21 #include <akntitle.h>
       
    22 #include <aknradiobuttonsettingpage.h>
       
    23 #include <aknmfnesettingpage.h>
       
    24 #include <barsread.h>
       
    25 #include <akntabgrp.h>
       
    26 #include <StringLoader.h>
       
    27 #include <aknnotewrappers.h>
       
    28 #include <WEPSecuritySettingsUI.h>
       
    29 
       
    30 #include <WEPSecuritySettingsUI.rsg>
       
    31 
       
    32 #include "WEPSecuritySettingsImpl.h"
       
    33 #include "WEPSecuritySettingsUiPanic.h"
       
    34 #include "WEPSecuritySettingsDlg.h"
       
    35 #include "WepKeyDataTextSettingPage.h"
       
    36 
       
    37 #include "WEPSecuritySettingsUI.hrh"
       
    38 
       
    39 #include <hlplch.h>
       
    40 #include <csxhelp/cp.hlp.hrh>
       
    41 
       
    42 #include <FeatMgr.h>
       
    43 
       
    44 
       
    45 // CONSTANT DECLARATIONS
       
    46 
       
    47 // Number of fields of main view
       
    48 LOCAL_D const TInt KNumOfFieldsMain = 3;
       
    49 
       
    50 // Number of fields of key configuration view
       
    51 LOCAL_D const TInt KNumOfFieldsKeyConfiguration = 3;
       
    52 
       
    53 // Ratio of ascii and hex key sizes
       
    54 LOCAL_D const TInt KAsciiHexRatio = 2;
       
    55 
       
    56 
       
    57 // ================= MEMBER FUNCTIONS =======================
       
    58 
       
    59 // ---------------------------------------------------------
       
    60 // CWEPSecuritySettingsDlg::CWEPSecuritySettingsDlg
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 CWEPSecuritySettingsDlg::CWEPSecuritySettingsDlg( TInt& aEventStore )
       
    64 : iNaviPane( NULL ), 
       
    65 iTabGroup( NULL ),
       
    66 iActiveTab( 0 ),
       
    67 iLevel( 0 ),
       
    68 iEventStore( &aEventStore )
       
    69     {
       
    70     }
       
    71 
       
    72 
       
    73 // ---------------------------------------------------------
       
    74 // CWEPSecuritySettingsDlg::~CWEPSecuritySettingsDlg
       
    75 // ---------------------------------------------------------
       
    76 //
       
    77 CWEPSecuritySettingsDlg::~CWEPSecuritySettingsDlg()
       
    78     {
       
    79     if ( iNaviDecoratorEmpty )
       
    80         {
       
    81         delete iNaviDecoratorEmpty;
       
    82         }
       
    83 
       
    84     if ( iNaviDecoratorTabbed )
       
    85         {
       
    86         delete iNaviDecoratorTabbed;
       
    87         }
       
    88 
       
    89     if ( iTitlePane )
       
    90         {
       
    91         // set old text back, if we have it...
       
    92         if ( iOldTitleText )
       
    93             {
       
    94             TRAP_IGNORE( iTitlePane->SetTextL( *iOldTitleText ) );
       
    95             delete iOldTitleText;
       
    96             }
       
    97         }
       
    98      
       
    99      FeatureManager::UnInitializeLib();
       
   100      }
       
   101 
       
   102 
       
   103 // ---------------------------------------------------------
       
   104 // CWEPSecuritySettingsDlg::NewL
       
   105 // ---------------------------------------------------------
       
   106 //
       
   107 CWEPSecuritySettingsDlg* CWEPSecuritySettingsDlg::NewL( TInt& aEventStore )
       
   108     {
       
   109     CWEPSecuritySettingsDlg* secSett = 
       
   110                         new ( ELeave )CWEPSecuritySettingsDlg( aEventStore );
       
   111     return secSett;
       
   112     }
       
   113 
       
   114 
       
   115 // ---------------------------------------------------------
       
   116 // CWEPSecuritySettingsDlg::ConstructAndRunLD
       
   117 // ---------------------------------------------------------
       
   118 //
       
   119 TInt CWEPSecuritySettingsDlg::ConstructAndRunLD( 
       
   120                                 CWEPSecuritySettingsImpl* aSecuritySettings,
       
   121                                 const TDesC& aTitle )
       
   122     {
       
   123 	CleanupStack::PushL( this );
       
   124 
       
   125     const TInt Titles_Wep_Main[KNumOfFieldsMain] =
       
   126         {
       
   127         R_WEP_KEY_IN_USE,
       
   128         R_WEP_AUTHENTICATION,
       
   129         R_WEP_KEY_CONFIGURATION
       
   130         };
       
   131 
       
   132     const TInt Fields_Wep_Main[KNumOfFieldsMain] =
       
   133         {
       
   134         CWEPSecuritySettings::EWepKeyInUse,
       
   135         CWEPSecuritySettings::EWepAuthentication,
       
   136         CWEPSecuritySettings::EWepKeyConfiguration
       
   137         };
       
   138 
       
   139     const TInt Fields_Wep_Key_Configuration[KNumOfFieldsKeyConfiguration] =
       
   140         {
       
   141         CWEPSecuritySettings::EWepKeyLength,
       
   142         CWEPSecuritySettings::EWepKeyFormat,
       
   143         CWEPSecuritySettings::EWepKeyData
       
   144         };
       
   145 
       
   146     const TInt Titles_Wep_Key_Configuration[KNumOfFieldsKeyConfiguration] =
       
   147         {
       
   148         R_WEP_KEY_LENGTH,
       
   149         R_WEP_KEY_FORMAT,
       
   150         R_WEP_KEY_DATA
       
   151         };
       
   152 
       
   153     iSecuritySettings = aSecuritySettings;
       
   154     iConnectionName = aTitle;
       
   155 
       
   156     iFieldsMain = ( CWEPSecuritySettings::TWepMember* ) Fields_Wep_Main;
       
   157     iTitlesMain = MUTABLE_CAST( TInt*, Titles_Wep_Main );
       
   158 
       
   159     iFieldsKeyConfiguration = ( CWEPSecuritySettings::TWepMember* ) 
       
   160                                                   Fields_Wep_Key_Configuration;
       
   161     iTitlesKeyConfiguration = MUTABLE_CAST( TInt*, 
       
   162                                                 Titles_Wep_Key_Configuration );
       
   163 
       
   164     FeatureManager::InitializeLibL();
       
   165 
       
   166     ConstructL( R_WEP_SECURITY_SETTINGS_MENUBAR );
       
   167     
       
   168     // ExecuteLD will PushL( this ), so we have to Pop it...
       
   169     CleanupStack::Pop( this ); // this
       
   170 	
       
   171     return ExecuteLD( R_WEPSETTINGS_DIALOG );
       
   172     }
       
   173 
       
   174 
       
   175 // ---------------------------------------------------------
       
   176 // CWEPSecuritySettingsDlg::OkToExitL
       
   177 // ---------------------------------------------------------
       
   178 //
       
   179 TBool CWEPSecuritySettingsDlg::OkToExitL( TInt aButtonId )
       
   180 {
       
   181     // Translate the button presses into commands for the appui & current
       
   182     // view to handle
       
   183     TBool retval( EFalse );
       
   184     if ( aButtonId == EAknSoftkeyOptions )
       
   185         {
       
   186         DisplayMenuL();
       
   187         }
       
   188     else if ( aButtonId == EEikCmdExit )        // ShutDown requested
       
   189         {
       
   190         *iEventStore |= CWEPSecuritySettings::EShutDownReq;
       
   191         retval = ETrue;
       
   192         }
       
   193     else if ( aButtonId == EAknSoftkeyBack || aButtonId == EAknCmdExit )
       
   194         {
       
   195         if ( iSecuritySettings->IsValid() )
       
   196             {
       
   197             *iEventStore |= CWEPSecuritySettings::EValid;
       
   198             retval = ETrue;
       
   199             }
       
   200         else if ( aButtonId == EAknSoftkeyBack )
       
   201             {
       
   202             HBufC* stringHolder = StringLoader::LoadL( 
       
   203                                         R_WEP_DATA_MISSING, iEikonEnv );
       
   204             CleanupStack::PushL( stringHolder );
       
   205 
       
   206             CAknQueryDialog *queryDialog = new (ELeave) CAknQueryDialog();
       
   207 
       
   208             queryDialog->PrepareLC( R_WEP_SEC_SETT_CONF_QUERY );
       
   209             queryDialog->SetPromptL( stringHolder->Des() );
       
   210             if ( queryDialog->RunLD() )
       
   211                 {
       
   212                 retval = ETrue;
       
   213                 }
       
   214             else
       
   215                 {
       
   216                 iActiveTab = iSecuritySettings->KeyInUse();
       
   217                 iTabGroup->SetActiveTabByIndex( iActiveTab );
       
   218                 HandleListboxDataChangeL();
       
   219                 }
       
   220             CleanupStack::PopAndDestroy( stringHolder );   // stringHolder
       
   221             }
       
   222         else
       
   223             {
       
   224             retval = ETrue;
       
   225             }
       
   226 
       
   227         if ( aButtonId == EAknCmdExit )
       
   228             {
       
   229             *iEventStore |= CWEPSecuritySettings::EExitReq;
       
   230             }
       
   231         }
       
   232     else if( aButtonId == EWepSelCmdChange )
       
   233         {
       
   234         ChangeSettingsL( ETrue );
       
   235         retval = EFalse; // don't exit the dialog
       
   236         }
       
   237 
       
   238     return retval;
       
   239 }
       
   240 
       
   241 
       
   242 // ---------------------------------------------------------
       
   243 // CWEPSecuritySettingsDlg::OfferKeyEventL
       
   244 // ---------------------------------------------------------
       
   245 //
       
   246 TKeyResponse CWEPSecuritySettingsDlg::OfferKeyEventL( 
       
   247                                 const TKeyEvent& aKeyEvent, TEventCode aType )
       
   248     {
       
   249     TKeyResponse retval( EKeyWasNotConsumed );
       
   250     TChar charCode( aKeyEvent.iCode );
       
   251 
       
   252     // Only interested in standard key events
       
   253     if ( aType == EEventKey )
       
   254         {
       
   255         // If a menu is showing offer key events to it.
       
   256         if ( CAknDialog::MenuShowing() )
       
   257             {
       
   258             retval = CAknDialog::OfferKeyEventL( aKeyEvent, aType );
       
   259             }
       
   260         else
       
   261             {
       
   262             if ( iList )
       
   263                 {
       
   264                 // as list IS consuming, must handle because it IS the SHUTDOWN...
       
   265                 // or, a view switch is shutting us down...
       
   266                 if ( aKeyEvent.iCode == EKeyEscape )
       
   267                     {
       
   268                     ProcessCommandL( EEikCmdExit );
       
   269                     retval = EKeyWasConsumed;
       
   270                     }
       
   271                 else if ( iLevel && ( charCode == EKeyLeftArrow || 
       
   272                                       charCode == EKeyRightArrow ) )
       
   273                     {
       
   274                     if ( iTabGroup )
       
   275                         {
       
   276                         return iTabGroup->OfferKeyEventL( aKeyEvent, aType );
       
   277                         }
       
   278                     }
       
   279                 else
       
   280                     {
       
   281                     retval = iList->OfferKeyEventL( aKeyEvent, aType );
       
   282                     }
       
   283                 }
       
   284             else
       
   285                 {
       
   286                 if ( aKeyEvent.iCode == EKeyOK )
       
   287                     {
       
   288                     ProcessCommandL( EWepSelCmdChange );
       
   289                     retval = EKeyWasConsumed;
       
   290                     }
       
   291                 }
       
   292             }
       
   293         }
       
   294 
       
   295     return retval;
       
   296     }
       
   297 
       
   298 
       
   299 // ---------------------------------------------------------
       
   300 // CWEPSecuritySettingsDlg::HandleListboxDataChangeL
       
   301 // ---------------------------------------------------------
       
   302 //
       
   303 void CWEPSecuritySettingsDlg::HandleListboxDataChangeL()
       
   304     {
       
   305     // fill up our new list with data
       
   306     CDesCArrayFlat* itemArray = new ( ELeave ) CDesCArrayFlat( 4 );
       
   307     CleanupStack::PushL( itemArray );
       
   308 
       
   309     if ( iLevel )
       
   310         {
       
   311         FillListWithDataL( *itemArray, *iFieldsKeyConfiguration,
       
   312                            KNumOfFieldsKeyConfiguration,
       
   313                            iTitlesKeyConfiguration );
       
   314 
       
   315         iNaviPane->ReplaceL( *iNaviDecoratorEmpty, *iNaviDecoratorTabbed );
       
   316         }
       
   317     else
       
   318         {
       
   319         FillListWithDataL( *itemArray, *iFieldsMain, KNumOfFieldsMain, 
       
   320                            iTitlesMain );
       
   321         iNaviPane->ReplaceL( *iNaviDecoratorTabbed, *iNaviDecoratorEmpty );
       
   322         }
       
   323 
       
   324     iList->Model()->SetItemTextArray( itemArray );
       
   325     
       
   326     CleanupStack::Pop( itemArray ); // now it is owned by the LB, so pop it
       
   327     iItemArray = itemArray;
       
   328 
       
   329     iList->HandleItemAdditionL();
       
   330     }
       
   331 
       
   332 
       
   333 
       
   334 // ---------------------------------------------------------
       
   335 // CWEPSecuritySettingsDlg::ProcessCommandL
       
   336 // ---------------------------------------------------------
       
   337 //
       
   338 void CWEPSecuritySettingsDlg::ProcessCommandL( TInt aCommandId )
       
   339     {
       
   340     if ( MenuShowing() )
       
   341         {
       
   342         HideMenu();
       
   343         }
       
   344 
       
   345     switch ( aCommandId )
       
   346         {
       
   347         case EWepSelCmdChange:
       
   348             {
       
   349             ChangeSettingsL( EFalse );
       
   350             break;
       
   351             }
       
   352 
       
   353         case EAknCmdHelp:
       
   354             {
       
   355             HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
       
   356                                     iEikonEnv->EikAppUi()->AppHelpContextL() );
       
   357             break;
       
   358             }
       
   359 
       
   360         case EAknSoftkeyBack:
       
   361         case EAknCmdExit:
       
   362         case EEikCmdExit:
       
   363             {
       
   364             TryExitL( aCommandId );
       
   365             break;
       
   366             }
       
   367 
       
   368         default:
       
   369             {
       
   370             // silently ignore it
       
   371             break;
       
   372             }
       
   373         }
       
   374     }
       
   375 
       
   376 
       
   377 // ---------------------------------------------------------
       
   378 // CWEPSecuritySettingsDlg::HandleListBoxEventL
       
   379 // ---------------------------------------------------------
       
   380 //
       
   381 void CWEPSecuritySettingsDlg::HandleListBoxEventL( CEikListBox* /*aListBox*/,
       
   382                                                    TListBoxEvent aEventType )
       
   383     {
       
   384     switch ( aEventType )
       
   385         {
       
   386         case EEventEnterKeyPressed:
       
   387             // both handled in the same way for now...
       
   388         case EEventItemSingleClicked:
       
   389             {
       
   390             ChangeSettingsL( ETrue );
       
   391             break;
       
   392             }
       
   393 
       
   394         case EEventEditingStarted:
       
   395         case EEventEditingStopped:
       
   396         case EEventPenDownOnItem:
       
   397         case EEventItemDraggingActioned:
       
   398             {
       
   399             break;
       
   400             }
       
   401 
       
   402 
       
   403         default:
       
   404             {
       
   405             __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
       
   406             break;
       
   407             };
       
   408         };
       
   409     }
       
   410 
       
   411 
       
   412 
       
   413 
       
   414 // ---------------------------------------------------------
       
   415 // CWEPSecuritySettingsDlg::PreLayoutDynInitL()
       
   416 // ---------------------------------------------------------
       
   417 //
       
   418 void CWEPSecuritySettingsDlg::PreLayoutDynInitL()
       
   419     {
       
   420     // first get StatusPane
       
   421     CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
       
   422 
       
   423     // then get TitlePane
       
   424     iTitlePane = ( CAknTitlePane* ) statusPane->ControlL( TUid::Uid( 
       
   425                                                     EEikStatusPaneUidTitle ) );
       
   426     // if not already stored, store it for restoring
       
   427     if ( !iOldTitleText )
       
   428         {
       
   429         iOldTitleText = iTitlePane->Text()->AllocL();
       
   430         }
       
   431 
       
   432     // set new titlepane text
       
   433     iTitlePane->SetTextL( iConnectionName );
       
   434 
       
   435     // Fetch pointer to the default navi pane control
       
   436     iNaviPane = ( CAknNavigationControlContainer* ) 
       
   437                     statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
       
   438 
       
   439     _LIT( KEmpty, "" );
       
   440     if ( !iNaviDecoratorEmpty )
       
   441         {
       
   442         iNaviDecoratorEmpty = iNaviPane->CreateNavigationLabelL( KEmpty );
       
   443         }
       
   444 
       
   445     if ( !iNaviDecoratorTabbed )
       
   446         {
       
   447         iNaviDecoratorTabbed = iNaviPane->CreateTabGroupL();
       
   448         
       
   449         if (iNaviDecoratorTabbed)
       
   450             {
       
   451             iTabGroup = static_cast< CAknTabGroup* >
       
   452                                     ( iNaviDecoratorTabbed->DecoratedControl() );
       
   453             
       
   454             HBufC16* tabText = iEikonEnv->AllocReadResourceLC( R_WEP_TAB_KEY_1 );
       
   455             TPtr localizedTabText( tabText->Des() );
       
   456             AknTextUtils::LanguageSpecificNumberConversion( localizedTabText );
       
   457             iTabGroup->AddTabL( EWEPSecuritySettingsTab1, *tabText );
       
   458             CleanupStack::PopAndDestroy( tabText ); // tabText
       
   459             
       
   460             tabText = iEikonEnv->AllocReadResourceLC( R_WEP_TAB_KEY_2 );
       
   461             localizedTabText.Set( tabText->Des() );
       
   462             AknTextUtils::LanguageSpecificNumberConversion( localizedTabText );
       
   463             iTabGroup->AddTabL( EWEPSecuritySettingsTab2, *tabText );
       
   464             CleanupStack::PopAndDestroy( tabText ); // tabText
       
   465             
       
   466             tabText = iEikonEnv->AllocReadResourceLC( R_WEP_TAB_KEY_3 );
       
   467             localizedTabText.Set( tabText->Des() );
       
   468             AknTextUtils::LanguageSpecificNumberConversion( localizedTabText );
       
   469             iTabGroup->AddTabL( EWEPSecuritySettingsTab3, *tabText );
       
   470             CleanupStack::PopAndDestroy( tabText ); // tabText
       
   471             
       
   472             tabText = iEikonEnv->AllocReadResourceLC( R_WEP_TAB_KEY_4 );
       
   473             localizedTabText.Set( tabText->Des() );
       
   474             AknTextUtils::LanguageSpecificNumberConversion( localizedTabText );
       
   475             iTabGroup->AddTabL( EWEPSecuritySettingsTab4, *tabText );
       
   476             CleanupStack::PopAndDestroy( tabText ); // tabText
       
   477             
       
   478             iTabGroup->SetTabFixedWidthL( EAknTabWidthWithFourTabs );
       
   479             iTabGroup->SetActiveTabByIndex( 0 );
       
   480                 
       
   481             iTabGroup->SetObserver( this );
       
   482             }
       
   483         }
       
   484 
       
   485     iNaviPane->PushL( *iNaviDecoratorEmpty );
       
   486     iList = STATIC_CAST( CAknSettingStyleListBox*, 
       
   487                                         Control( KWepMainSettingsListboxId ) );
       
   488 
       
   489     iList->CreateScrollBarFrameL( ETrue );
       
   490     iList->ScrollBarFrame()->SetScrollBarVisibilityL
       
   491         ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
       
   492 
       
   493     HandleListboxDataChangeL();
       
   494 
       
   495     iList->SetCurrentItemIndex( 0 );
       
   496     iList->SetListBoxObserver( this );
       
   497     }
       
   498 
       
   499 
       
   500 
       
   501 // ---------------------------------------------------------
       
   502 // CWEPSecuritySettingsDlg::DynInitMenuPaneL
       
   503 // ---------------------------------------------------------
       
   504 //
       
   505 void CWEPSecuritySettingsDlg::DynInitMenuPaneL( TInt aResourceId, 
       
   506                                                 CEikMenuPane* aMenuPane )
       
   507     {
       
   508     CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   509     if ( aResourceId == R_WEP_SECURITY_SETTINGS_MENU )
       
   510         {
       
   511         if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   512             {
       
   513             aMenuPane->DeleteMenuItem( EAknCmdHelp );
       
   514             }
       
   515         }
       
   516     }
       
   517 
       
   518 
       
   519 //----------------------------------------------------------
       
   520 // CWEPSecuritySettingsDlg::FillListWithDataL
       
   521 //----------------------------------------------------------
       
   522 //
       
   523 void CWEPSecuritySettingsDlg::FillListWithDataL( CDesCArrayFlat& aItemArray,
       
   524                                    const CWEPSecuritySettings::TWepMember& arr, 
       
   525                                    TInt aLength,
       
   526                                    const TInt* aRes )
       
   527     {
       
   528     _LIT( KTxtMenuListItemFormat, " \t%S\t\t" );
       
   529     const TInt KSpaceAndTabsLength = 4;
       
   530 
       
   531     CWEPSecuritySettings::TWepMember* wepMember = 
       
   532                        MUTABLE_CAST( CWEPSecuritySettings::TWepMember*, &arr );
       
   533 
       
   534     for( TInt i = 0; i < aLength; i++ )
       
   535         {
       
   536         if ( *wepMember == CWEPSecuritySettings::EWepKeyConfiguration )
       
   537             {
       
   538             // Define a heap descriptor to hold all the item text
       
   539             // HBufC is non-modifiable
       
   540             HBufC* title = iEikonEnv->AllocReadResourceLC( *aRes );
       
   541 
       
   542             // Define a heap descriptor to hold all the item text
       
   543             HBufC* itemText = HBufC::NewLC( title->Length() + 
       
   544                                             KSpaceAndTabsLength );
       
   545 
       
   546             // Define a modifiable pointer descriptor to be able to append
       
   547             // text to the non-modifiable heap descriptor itemText
       
   548             TPtr itemTextPtr = itemText->Des();
       
   549             itemTextPtr.Format( KTxtMenuListItemFormat, title );
       
   550 
       
   551             aItemArray.AppendL( *itemText );
       
   552 
       
   553             CleanupStack::PopAndDestroy( 2, title );   // itemText, title
       
   554             }
       
   555         else
       
   556             {
       
   557             HBufC* itemText = CreateTextualListBoxItemL( *wepMember, 
       
   558                                                          *aRes );
       
   559             CleanupStack::PushL( itemText );
       
   560             aItemArray.AppendL( itemText->Des() );
       
   561             CleanupStack::PopAndDestroy( itemText );
       
   562             }
       
   563 
       
   564         wepMember++;
       
   565         aRes++;
       
   566         }
       
   567     }
       
   568 
       
   569 
       
   570 //----------------------------------------------------------
       
   571 // CWEPSecuritySettingsDlg::UpdateListBoxItemL
       
   572 //----------------------------------------------------------
       
   573 //
       
   574 void CWEPSecuritySettingsDlg::UpdateListBoxItemL( 
       
   575                                     CWEPSecuritySettings::TWepMember aMember, 
       
   576                                     TInt aRes, TInt aPos )
       
   577     {
       
   578     HBufC* itemText = CreateTextualListBoxItemL( aMember, aRes );
       
   579     CleanupStack::PushL( itemText );
       
   580     // first try to add, if Leaves, list will be untouched
       
   581     iItemArray->InsertL( aPos, itemText->Des() );
       
   582     // if successful, previous item is scrolled up with one,
       
   583     // so delete that one...
       
   584     if ( ++aPos < iItemArray->MdcaCount() )
       
   585         {
       
   586         iItemArray->Delete( aPos );
       
   587         }
       
   588     CleanupStack::PopAndDestroy( itemText );
       
   589     }
       
   590 
       
   591 
       
   592 //----------------------------------------------------------
       
   593 // CWEPSecuritySettingsDlg::CreateTextualListBoxItemL
       
   594 //----------------------------------------------------------
       
   595 //
       
   596 HBufC* CWEPSecuritySettingsDlg::CreateTextualListBoxItemL( 
       
   597                                       CWEPSecuritySettings::TWepMember aMember,
       
   598                                       TInt aRes )
       
   599     {
       
   600     // Define a heap descriptor to hold all the item text
       
   601     // HBufC is non-modifiable
       
   602     HBufC* title = iEikonEnv->AllocReadResourceLC( aRes );
       
   603 
       
   604     // both variables needed independently of the following conditions so I
       
   605     // must declare them here...
       
   606     HBufC16* value;
       
   607     TUint32 valueResourceID;
       
   608 
       
   609     switch ( aMember )
       
   610         {
       
   611         case CWEPSecuritySettings::EWepKeyInUse:
       
   612             {
       
   613             switch ( iSecuritySettings->KeyInUse() )
       
   614                 {
       
   615                 case CWEPSecuritySettings::EKeyNumber1:
       
   616                     {
       
   617                     valueResourceID = R_WEP_KEY_NUMBER_1;
       
   618                     break;
       
   619                     }
       
   620 
       
   621                 case CWEPSecuritySettings::EKeyNumber2:
       
   622                     {
       
   623                     valueResourceID = R_WEP_KEY_NUMBER_2;
       
   624                     break;
       
   625                     }
       
   626 
       
   627                 case CWEPSecuritySettings::EKeyNumber3:
       
   628                     {
       
   629                     valueResourceID = R_WEP_KEY_NUMBER_3;
       
   630                     break;
       
   631                     }
       
   632 
       
   633                 case CWEPSecuritySettings::EKeyNumber4:
       
   634                     {
       
   635                     valueResourceID = R_WEP_KEY_NUMBER_4;
       
   636                     break;
       
   637                     }
       
   638 
       
   639                 default:
       
   640                     {
       
   641                     valueResourceID = 0;
       
   642                     break;
       
   643                     }
       
   644                 }
       
   645             break;
       
   646             }
       
   647         
       
   648         case CWEPSecuritySettings::EWepAuthentication:
       
   649             {
       
   650             switch ( iSecuritySettings->Authentication() )
       
   651                 {
       
   652                 case CWEPSecuritySettings::EAuthOpen:
       
   653                     {
       
   654                     valueResourceID = R_WEP_AUTHENTICATION_OPEN;
       
   655                     break;
       
   656                     }
       
   657 
       
   658                 case CWEPSecuritySettings::EAuthShared:
       
   659                     {
       
   660                     valueResourceID = R_WEP_AUTHENTICATION_SHARED;
       
   661                     break;
       
   662                     }
       
   663 
       
   664                 default:
       
   665                     {
       
   666                     valueResourceID = 0;
       
   667                     break;
       
   668                     }
       
   669                 }
       
   670             break;
       
   671             }
       
   672 
       
   673         case CWEPSecuritySettings::EWepKeyLength:
       
   674             {
       
   675             switch ( iSecuritySettings->KeyLength( iActiveTab ) )
       
   676                 {
       
   677                 case CWEPSecuritySettings::E40Bits:
       
   678                     {
       
   679                     valueResourceID = R_WEP_KEY_LENGTH_64_BITS;
       
   680                     break;
       
   681                     }
       
   682 
       
   683                 case CWEPSecuritySettings::E104Bits:
       
   684                     {
       
   685                     valueResourceID = R_WEP_KEY_LENGTH_128_BITS;
       
   686                     break;
       
   687                     }
       
   688 
       
   689                 case CWEPSecuritySettings::E232Bits:
       
   690                     {
       
   691                     valueResourceID = iSecuritySettings->WEP256Enabled() ? 
       
   692                                                 R_WEP_KEY_LENGTH_256_BITS : 0;
       
   693                     break;
       
   694                     }
       
   695 
       
   696                 default:
       
   697                     {
       
   698                     valueResourceID = 0;
       
   699                     break;
       
   700                     }
       
   701                 }
       
   702             break;
       
   703             }
       
   704 
       
   705         case CWEPSecuritySettings::EWepKeyFormat:
       
   706             {
       
   707             switch ( iSecuritySettings->KeyFormat( iActiveTab ) )
       
   708                 {
       
   709                 case CWEPSecuritySettings::EAscii:
       
   710                     {
       
   711                     valueResourceID = R_WEP_KEY_FORMAT_ASCII;
       
   712                     break;
       
   713                     }
       
   714 
       
   715                 case CWEPSecuritySettings::EHexadecimal:
       
   716                     {
       
   717                     valueResourceID = R_WEP_KEY_FORMAT_HEX;
       
   718                     break;
       
   719                     }
       
   720 
       
   721                 default:
       
   722                     {
       
   723                     valueResourceID = 0;
       
   724                     break;
       
   725                     }
       
   726                 }
       
   727             break;
       
   728             }
       
   729 
       
   730         case CWEPSecuritySettings::EWepKeyData:
       
   731             {
       
   732             if ( !iSecuritySettings->KeyData( iActiveTab )->Length() )
       
   733                 {
       
   734                 valueResourceID = R_WEP_KEY_DATA_MUST_BE_DEFINED;
       
   735                 }
       
   736             else
       
   737                 {
       
   738                 valueResourceID = 0;
       
   739                 }
       
   740 
       
   741             break;
       
   742             }
       
   743 
       
   744         default:
       
   745             {
       
   746             valueResourceID = 0;
       
   747             break;
       
   748             }
       
   749         }
       
   750 
       
   751     _LIT( KStars, "****" );
       
   752     _LIT( KTxtListItemFormat, " \t%S\t\t%S" );
       
   753     const TInt KSpaceAndTabsLength = 4;
       
   754     _LIT( KTxtCompulsory, "\t*" );
       
   755 
       
   756     if ( valueResourceID )
       
   757         {
       
   758         // Read up value text from resource
       
   759         value = iEikonEnv->AllocReadResourceLC( valueResourceID );
       
   760         if( aMember == CWEPSecuritySettings::EWepKeyInUse )
       
   761             {
       
   762             TPtr localizedValue( value->Des() );
       
   763             AknTextUtils::LanguageSpecificNumberConversion( localizedValue );
       
   764             }
       
   765         }
       
   766     else
       
   767         {
       
   768         value = HBufC::NewLC( KStars().Length() );
       
   769         value->Des().Copy( KStars ); 
       
   770         }
       
   771 
       
   772     // Define a heap descriptor to hold all the item text
       
   773     // +4 for space and tab characters
       
   774     TInt length = title->Length() + value->Length() + KSpaceAndTabsLength;
       
   775     if ( aMember == CWEPSecuritySettings::EWepKeyData )  // Compulsory
       
   776         {
       
   777         length += KTxtCompulsory().Length();
       
   778         }
       
   779 
       
   780     HBufC* itemText = HBufC::NewLC( length );
       
   781 
       
   782     // Define a modifiable pointer descriptor to be able to append text to the
       
   783     // non-modifiable heap descriptor itemText
       
   784     TPtr itemTextPtr = itemText->Des();
       
   785     itemTextPtr.Format( KTxtListItemFormat, title, value );
       
   786     if ( aMember == CWEPSecuritySettings::EWepKeyData )  // Compulsory
       
   787         {
       
   788         itemTextPtr.Append( KTxtCompulsory );
       
   789         }
       
   790     CleanupStack::Pop( itemText );    // itemtext,
       
   791 
       
   792     CleanupStack::PopAndDestroy( 2, title ); // title, value
       
   793 
       
   794     return itemText;
       
   795     }
       
   796 
       
   797 
       
   798 
       
   799 //----------------------------------------------------------
       
   800 // CWEPSecuritySettingsDlg::ShowPopupSettingPageL
       
   801 //----------------------------------------------------------
       
   802 //
       
   803 TBool CWEPSecuritySettingsDlg::ShowPopupSettingPageL( 
       
   804                                        CWEPSecuritySettings::TWepMember aData )
       
   805     {
       
   806     TInt currvalue( 0 );
       
   807     TBool retval( EFalse );
       
   808     CDesCArrayFlat* items = FillPopupSettingPageLC( aData,  currvalue );
       
   809 
       
   810     TInt attr_resid( 0 );
       
   811 
       
   812     // not text based ones:
       
   813     switch ( aData )
       
   814         {
       
   815         case CWEPSecuritySettings::EWepKeyInUse:
       
   816             {
       
   817             attr_resid = R_WEP_KEY_IN_USE;
       
   818             break;
       
   819             }
       
   820 
       
   821         case CWEPSecuritySettings::EWepAuthentication:
       
   822             {
       
   823             attr_resid = R_WEP_AUTHENTICATION;
       
   824             break;
       
   825             }
       
   826 
       
   827         case CWEPSecuritySettings::EWepKeyLength:
       
   828             {
       
   829             attr_resid = R_WEP_KEY_LENGTH;
       
   830             break;
       
   831             }
       
   832 
       
   833         case CWEPSecuritySettings::EWepKeyFormat:
       
   834             {
       
   835             attr_resid = R_WEP_KEY_FORMAT;
       
   836             break;
       
   837             }
       
   838 
       
   839         default:
       
   840             {
       
   841             __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
       
   842             attr_resid = 0;
       
   843             break;
       
   844             }
       
   845         }
       
   846 
       
   847     HBufC* titlebuf;
       
   848     CAknRadioButtonSettingPage* dlg;
       
   849     if ( attr_resid )
       
   850         {
       
   851         titlebuf = iEikonEnv->AllocReadResourceLC( attr_resid );
       
   852         dlg = new ( ELeave )CAknRadioButtonSettingPage( 
       
   853                             R_RADIO_BUTTON_SETTING_PAGE, currvalue, items );
       
   854         CleanupStack::PushL( dlg ); 
       
   855         TPtrC ptr( titlebuf->Des() );
       
   856         dlg->SetSettingTextL( ptr );
       
   857         CleanupStack::Pop( dlg ); // dlg
       
   858         }
       
   859     else
       
   860         {
       
   861         dlg = new ( ELeave )CAknRadioButtonSettingPage( 
       
   862                             R_RADIO_BUTTON_SETTING_PAGE, currvalue, items );
       
   863         }
       
   864     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
       
   865         {
       
   866     	retval = UpdateFromPopupSettingPage( aData, currvalue );
       
   867 	    }
       
   868 
       
   869     if ( attr_resid )
       
   870         {
       
   871         CleanupStack::PopAndDestroy( titlebuf ); // titlebuf
       
   872         }
       
   873 
       
   874     CleanupStack::PopAndDestroy( items );   // items. It deletes also all 
       
   875                                             // elements in the array.
       
   876     return retval;
       
   877     }
       
   878 
       
   879 
       
   880 
       
   881 //----------------------------------------------------------
       
   882 // CWEPSecuritySettingsDlg::ShowPopupTextSettingPageL
       
   883 //----------------------------------------------------------
       
   884 //
       
   885 TBool CWEPSecuritySettingsDlg::ShowPopupTextSettingPageL()
       
   886     {
       
   887     TBool retval( EFalse );
       
   888 
       
   889     CWEPSecuritySettings::TWEPKeyFormat keyFormat = 
       
   890                                     iSecuritySettings->KeyFormat( iActiveTab );
       
   891     TInt expectedLength = iSecuritySettings->ExpectedLengthOfKeyData( 
       
   892                                 iSecuritySettings->KeyLength( iActiveTab ) );
       
   893 
       
   894     if ( keyFormat == CWEPSecuritySettings::EAscii )
       
   895         {
       
   896         expectedLength /= KAsciiHexRatio; //Ascii key is half the length of Hex
       
   897         }
       
   898 
       
   899     HBufC16* bufKeyData = HBufC16::NewLC( expectedLength );
       
   900     TPtr16 ptrKeyData( bufKeyData->Des() );
       
   901 
       
   902     TBool showPage( ETrue );
       
   903     while ( showPage )
       
   904         {
       
   905         CWEPKeyDataTextSettingPage* dlg = 
       
   906             new( ELeave )CWEPKeyDataTextSettingPage( ptrKeyData, 
       
   907                                                      expectedLength,
       
   908                                                      keyFormat );
       
   909 
       
   910         if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
       
   911             {
       
   912             HBufC8* buf8 = HBufC8::NewLC( bufKeyData->Des().Length() );
       
   913             buf8->Des().Copy( bufKeyData->Des() ); 
       
   914 
       
   915             TInt err = iSecuritySettings->VerifyKeyData( *buf8, expectedLength,
       
   916                                 iSecuritySettings->KeyFormat( iActiveTab ) );
       
   917             if ( err == KErrNone )
       
   918                 {
       
   919                 if ( keyFormat == CWEPSecuritySettings::EAscii )
       
   920                     {
       
   921                     HBufC8* buf8Conv = 
       
   922                                 HBufC8::NewLC( bufKeyData->Des().Length()
       
   923                                                             * KAsciiHexRatio );
       
   924                                         // Ascii key is half the length of Hex
       
   925 
       
   926                     iSecuritySettings->ConvertAsciiToHex( buf8->Des(), 
       
   927                                                           buf8Conv );
       
   928                     iSecuritySettings->SetKeyData( iActiveTab, 
       
   929                                                    buf8Conv->Des() );
       
   930                     CleanupStack::PopAndDestroy( buf8Conv ); // buf8Conv
       
   931                     }
       
   932                 else
       
   933                     {
       
   934                     iSecuritySettings->SetKeyData( iActiveTab, buf8->Des() );
       
   935                     }
       
   936 
       
   937                 retval = ETrue;
       
   938                 showPage = EFalse;
       
   939                 }
       
   940             else
       
   941                 {
       
   942                 HBufC* stringLabel;
       
   943                 
       
   944                 if ( err == KErrInvalidLength )
       
   945                     {
       
   946                     stringLabel = StringLoader::LoadL( R_INFO_WEP_KEY_TOO_SHORT,
       
   947                                                        expectedLength, 
       
   948                                                        iEikonEnv );
       
   949                     }
       
   950                 else
       
   951                     {
       
   952                     stringLabel = StringLoader::LoadL( 
       
   953                                                 R_INFO_WEP_KEY_ILLEGAL_CHARS,
       
   954                                                 iEikonEnv );
       
   955                     }
       
   956 
       
   957                 CleanupStack::PushL( stringLabel );
       
   958 
       
   959 	            CAknInformationNote* dialog = new (ELeave)CAknInformationNote( 
       
   960                                                                         ETrue );
       
   961                 CleanupStack::Pop( stringLabel );
       
   962 
       
   963                 dialog->ExecuteLD( *stringLabel );
       
   964 
       
   965                 CleanupStack::PopAndDestroy( stringLabel );   // stringLabel
       
   966 
       
   967                 ptrKeyData.Zero();
       
   968                 }
       
   969 
       
   970             CleanupStack::PopAndDestroy( buf8 ); // buf8
       
   971             }
       
   972         else
       
   973             {
       
   974             showPage = EFalse;
       
   975             }
       
   976         }
       
   977 
       
   978     CleanupStack::PopAndDestroy( bufKeyData ); // bufKeyData
       
   979 
       
   980     return retval;
       
   981     }
       
   982 
       
   983 
       
   984 
       
   985 // ---------------------------------------------------------
       
   986 // CWEPSecuritySettingsDlg::FillPopupSettingPageLC
       
   987 // ---------------------------------------------------------
       
   988 //
       
   989 CDesCArrayFlat* CWEPSecuritySettingsDlg::FillPopupSettingPageLC( 
       
   990                                        CWEPSecuritySettings::TWepMember aData,
       
   991                                        TInt& aCurrvalue )
       
   992     {
       
   993     CDesCArrayFlat* items = new( ELeave)CDesCArrayFlat( 1 );
       
   994     CleanupStack::PushL( items );
       
   995 
       
   996     switch ( aData )
       
   997         {
       
   998         case CWEPSecuritySettings::EWepKeyInUse:
       
   999             {
       
  1000             RBuf16 convert( iEikonEnv->AllocReadResourceL( 
       
  1001                                                         R_WEP_KEY_NUMBER_1 ) );
       
  1002             AknTextUtils::LanguageSpecificNumberConversion( convert );
       
  1003             items->AppendL( convert );
       
  1004             convert.Close();
       
  1005             
       
  1006             convert.Assign( iEikonEnv->AllocReadResourceL(
       
  1007                                                         R_WEP_KEY_NUMBER_2 ) );
       
  1008             AknTextUtils::LanguageSpecificNumberConversion( convert );
       
  1009             items->AppendL( convert );
       
  1010             convert.Close();
       
  1011             
       
  1012             convert.Assign( iEikonEnv->AllocReadResourceL(
       
  1013                                                         R_WEP_KEY_NUMBER_3 ) );
       
  1014             AknTextUtils::LanguageSpecificNumberConversion( convert );
       
  1015             items->AppendL( convert );
       
  1016             convert.Close();
       
  1017             
       
  1018             convert.Assign( iEikonEnv->AllocReadResourceL(
       
  1019                                                         R_WEP_KEY_NUMBER_4 ) );
       
  1020             AknTextUtils::LanguageSpecificNumberConversion( convert );
       
  1021             items->AppendL( convert );
       
  1022             convert.Close();
       
  1023 
       
  1024             aCurrvalue = iSecuritySettings->KeyInUse();
       
  1025             break;
       
  1026             }
       
  1027 
       
  1028         case CWEPSecuritySettings::EWepAuthentication:
       
  1029             {
       
  1030             items->AppendL( *iEikonEnv->AllocReadResourceLC( 
       
  1031                                             R_WEP_AUTHENTICATION_OPEN ) );
       
  1032             CleanupStack::PopAndDestroy();
       
  1033             items->AppendL( *iEikonEnv->AllocReadResourceLC( 
       
  1034                                             R_WEP_AUTHENTICATION_SHARED ) );
       
  1035             CleanupStack::PopAndDestroy();
       
  1036 
       
  1037             aCurrvalue = iSecuritySettings->Authentication();
       
  1038             break;
       
  1039             }
       
  1040 
       
  1041         case CWEPSecuritySettings::EWepKeyLength:
       
  1042             {
       
  1043             items->AppendL( *iEikonEnv->AllocReadResourceLC( 
       
  1044                                             R_WEP_KEY_LENGTH_64_BITS ) );
       
  1045             CleanupStack::PopAndDestroy();
       
  1046             items->AppendL( *iEikonEnv->AllocReadResourceLC( 
       
  1047                                             R_WEP_KEY_LENGTH_128_BITS ) );
       
  1048             CleanupStack::PopAndDestroy();
       
  1049 
       
  1050             if ( iSecuritySettings->WEP256Enabled() )
       
  1051                 {
       
  1052                 items->AppendL( *iEikonEnv->AllocReadResourceLC( 
       
  1053                                             R_WEP_KEY_LENGTH_256_BITS ) );
       
  1054                 CleanupStack::PopAndDestroy();
       
  1055                 }
       
  1056 
       
  1057             aCurrvalue = iSecuritySettings->KeyLength( iActiveTab );
       
  1058             break;
       
  1059             }
       
  1060 
       
  1061         case CWEPSecuritySettings::EWepKeyFormat:
       
  1062             {
       
  1063             items->AppendL( *iEikonEnv->AllocReadResourceLC( 
       
  1064                                             R_WEP_KEY_FORMAT_ASCII ) );
       
  1065             CleanupStack::PopAndDestroy();
       
  1066             items->AppendL( *iEikonEnv->AllocReadResourceLC( 
       
  1067                                             R_WEP_KEY_FORMAT_HEX ) );
       
  1068             CleanupStack::PopAndDestroy();
       
  1069 
       
  1070             aCurrvalue = iSecuritySettings->KeyFormat( iActiveTab );
       
  1071             break;
       
  1072             }
       
  1073 
       
  1074         default:
       
  1075             {
       
  1076             __ASSERT_DEBUG( EFalse, Panic ( EUnknownCase ) );
       
  1077             break;
       
  1078             }
       
  1079         }
       
  1080     return items;
       
  1081     }
       
  1082 
       
  1083 
       
  1084 // ---------------------------------------------------------
       
  1085 // CWEPSecuritySettingsDlg::UpdateFromPopupSettingPage
       
  1086 // ---------------------------------------------------------
       
  1087 //
       
  1088 TBool CWEPSecuritySettingsDlg::UpdateFromPopupSettingPage( 
       
  1089                                         CWEPSecuritySettings::TWepMember aData,
       
  1090                                         TInt aCurrvalue )
       
  1091     {
       
  1092     TBool retVal( EFalse );
       
  1093 
       
  1094     switch ( aData )
       
  1095         {
       
  1096         case CWEPSecuritySettings::EWepKeyInUse:
       
  1097             {
       
  1098             if ( iSecuritySettings->KeyInUse() != 
       
  1099                              ( CWEPSecuritySettings::TWEPKeyInUse )aCurrvalue )
       
  1100                 {
       
  1101                 iSecuritySettings->SetKeyInUse( 
       
  1102                             ( CWEPSecuritySettings::TWEPKeyInUse )aCurrvalue );
       
  1103                 retVal = ETrue;
       
  1104                 }
       
  1105             break;
       
  1106             }
       
  1107 
       
  1108         case CWEPSecuritySettings::EWepAuthentication:
       
  1109             {
       
  1110             if ( iSecuritySettings->Authentication() != 
       
  1111                  ( CWEPSecuritySettings::TWEPAuthentication )aCurrvalue )
       
  1112                 {
       
  1113                 iSecuritySettings->SetAuthentication( 
       
  1114                       ( CWEPSecuritySettings::TWEPAuthentication )aCurrvalue );
       
  1115                 retVal = ETrue;
       
  1116                 }
       
  1117             break;
       
  1118             }
       
  1119 
       
  1120         case CWEPSecuritySettings::EWepKeyLength:
       
  1121             {
       
  1122             if ( iSecuritySettings->KeyLength( iActiveTab ) != 
       
  1123                  ( CWEPSecuritySettings::TWEPKeyLength )aCurrvalue )
       
  1124                 {
       
  1125                 iSecuritySettings->SetKeyLength( iActiveTab, 
       
  1126                            ( CWEPSecuritySettings::TWEPKeyLength )aCurrvalue );
       
  1127                 retVal = ETrue;
       
  1128                 }
       
  1129             break;
       
  1130             }
       
  1131 
       
  1132         case CWEPSecuritySettings::EWepKeyFormat:
       
  1133             {
       
  1134             if ( iSecuritySettings->KeyFormat( iActiveTab ) != 
       
  1135                  ( CWEPSecuritySettings::TWEPKeyFormat )aCurrvalue )
       
  1136                 {
       
  1137                 iSecuritySettings->SetKeyFormat( iActiveTab, 
       
  1138                            ( CWEPSecuritySettings::TWEPKeyFormat )aCurrvalue );
       
  1139                 retVal = ETrue;
       
  1140                 }
       
  1141             break;
       
  1142             }
       
  1143 
       
  1144         default:
       
  1145             {
       
  1146             __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
       
  1147             break;
       
  1148             }
       
  1149         }
       
  1150 
       
  1151     return retVal;
       
  1152     }
       
  1153 
       
  1154 
       
  1155 
       
  1156 //----------------------------------------------------------
       
  1157 // CWEPSecuritySettingsDlg::ChangeSettingsL
       
  1158 //----------------------------------------------------------
       
  1159 //
       
  1160 void CWEPSecuritySettingsDlg::ChangeSettingsL( TBool aQuick )
       
  1161     {
       
  1162     TInt itemIndex = ( Max( iList->CurrentItemIndex(), 0 ) );
       
  1163     CWEPSecuritySettings::TWepMember* ptr = 
       
  1164                   (iLevel ? iFieldsKeyConfiguration : iFieldsMain) + itemIndex;
       
  1165     TInt* tptr = ( iLevel ? iTitlesKeyConfiguration : iTitlesMain ) + itemIndex;
       
  1166 
       
  1167     const TInt KShiftFromKeyLengthToKeyData = 2;
       
  1168     switch ( *ptr  )
       
  1169         {
       
  1170         case CWEPSecuritySettings::EWepKeyInUse:
       
  1171         case CWEPSecuritySettings::EWepKeyLength:
       
  1172             { // Pop-up setting item
       
  1173             if ( ShowPopupSettingPageL( *ptr ) )
       
  1174                 {
       
  1175                 UpdateListBoxItemL( *ptr, *tptr, itemIndex );
       
  1176                 *iEventStore |= CWEPSecuritySettings::EModified;
       
  1177                 if ( *ptr == CWEPSecuritySettings::EWepKeyLength )
       
  1178                     {
       
  1179                     ptr += KShiftFromKeyLengthToKeyData;
       
  1180                     tptr += KShiftFromKeyLengthToKeyData;
       
  1181                     iSecuritySettings->KeyData( iActiveTab )->Zero();
       
  1182                     UpdateListBoxItemL( *ptr, *tptr, 
       
  1183                                     itemIndex+KShiftFromKeyLengthToKeyData );
       
  1184                     iList->SetCurrentItemIndexAndDraw( itemIndex+
       
  1185                                                 KShiftFromKeyLengthToKeyData );
       
  1186                     }
       
  1187                 }
       
  1188             break;
       
  1189             }
       
  1190 
       
  1191         case CWEPSecuritySettings::EWepAuthentication:
       
  1192         case CWEPSecuritySettings::EWepKeyFormat:
       
  1193             { // Setting item with two available values
       
  1194             TBool changed( ETrue );
       
  1195             if ( aQuick )
       
  1196                 {
       
  1197                 InvertSettings( *ptr );
       
  1198                 }
       
  1199             else
       
  1200                 {
       
  1201                 changed = ShowPopupSettingPageL( *ptr );
       
  1202                 }
       
  1203 
       
  1204             if ( changed )
       
  1205                 {
       
  1206                 UpdateListBoxItemL( *ptr, *tptr, itemIndex );
       
  1207                 if ( *ptr == CWEPSecuritySettings::EWepAuthentication )
       
  1208                     {
       
  1209                     *iEventStore |= CWEPSecuritySettings::EModified;
       
  1210                     }
       
  1211                 }
       
  1212             break;
       
  1213             }
       
  1214 
       
  1215         case CWEPSecuritySettings::EWepKeyData:
       
  1216             { // Text setting item
       
  1217             if ( ShowPopupTextSettingPageL() )
       
  1218                 {
       
  1219                 UpdateListBoxItemL( *ptr, *tptr, itemIndex );
       
  1220                 *iEventStore |= CWEPSecuritySettings::EModified;
       
  1221                 }
       
  1222             break;
       
  1223             }
       
  1224 
       
  1225         case CWEPSecuritySettings::EWepKeyConfiguration:
       
  1226             {
       
  1227             iLevel = 1;
       
  1228 
       
  1229             iActiveTab = iSecuritySettings->KeyInUse();
       
  1230             iTabGroup->SetActiveTabByIndex( iActiveTab );
       
  1231 
       
  1232             HandleListboxDataChangeL();
       
  1233             itemIndex = 0;
       
  1234 
       
  1235             break;
       
  1236             }
       
  1237 
       
  1238         default:
       
  1239             {
       
  1240             __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
       
  1241             break;
       
  1242             }
       
  1243         }
       
  1244 
       
  1245     iList->ScrollToMakeItemVisible( itemIndex );
       
  1246     iList->SetCurrentItemIndexAndDraw( itemIndex );
       
  1247     }
       
  1248 
       
  1249 
       
  1250 
       
  1251 
       
  1252 //----------------------------------------------------------
       
  1253 // CWEPSecuritySettingsDlg::InvertSettings
       
  1254 //----------------------------------------------------------
       
  1255 //
       
  1256 void CWEPSecuritySettingsDlg::InvertSettings( CWEPSecuritySettings::TWepMember 
       
  1257                                                                   aDataMember )
       
  1258     {
       
  1259     if ( aDataMember == CWEPSecuritySettings::EWepAuthentication )
       
  1260         {
       
  1261         if ( iSecuritySettings->Authentication() == 
       
  1262                                               CWEPSecuritySettings::EAuthOpen )
       
  1263             {
       
  1264             iSecuritySettings->SetAuthentication( 
       
  1265                                             CWEPSecuritySettings::EAuthShared );
       
  1266             }
       
  1267         else
       
  1268             {
       
  1269             iSecuritySettings->SetAuthentication( 
       
  1270                                               CWEPSecuritySettings::EAuthOpen );
       
  1271             }
       
  1272         }
       
  1273     else if ( aDataMember == CWEPSecuritySettings::EWepKeyFormat )
       
  1274         {
       
  1275         if ( iSecuritySettings->KeyFormat( iActiveTab ) == 
       
  1276                                                  CWEPSecuritySettings::EAscii )
       
  1277             {
       
  1278             iSecuritySettings->SetKeyFormat( iActiveTab, 
       
  1279                                           CWEPSecuritySettings::EHexadecimal );
       
  1280             }
       
  1281         else
       
  1282             {
       
  1283             iSecuritySettings->SetKeyFormat( iActiveTab, 
       
  1284                                                  CWEPSecuritySettings::EAscii );
       
  1285             }
       
  1286         }
       
  1287     }
       
  1288 
       
  1289 
       
  1290 // ---------------------------------------------------------
       
  1291 // CWEPSecuritySettingsDlg::GetHelpContext
       
  1292 // ---------------------------------------------------------
       
  1293 //
       
  1294 void CWEPSecuritySettingsDlg::GetHelpContext( TCoeHelpContext& aContext ) const
       
  1295     {
       
  1296     aContext.iMajor = KWEPSecuritySettingsUiHelpMajor;
       
  1297     if ( iLevel )
       
  1298         {
       
  1299         aContext.iContext = KSET_HLP_WLAN_WEP_KEY_SETT;
       
  1300         }
       
  1301     else
       
  1302         {
       
  1303         aContext.iContext = KSET_HLP_WLAN_WEP_MAIN;
       
  1304         }
       
  1305     }
       
  1306 
       
  1307 
       
  1308 // -----------------------------------------------------------------------------
       
  1309 // CWEPSecuritySettingsDlg::TabChangedL( TInt aIndex )
       
  1310 // -----------------------------------------------------------------------------
       
  1311 // 
       
  1312 void CWEPSecuritySettingsDlg::TabChangedL( TInt aIndex )
       
  1313     {
       
  1314     iActiveTab = aIndex;
       
  1315     HandleListboxDataChangeL();
       
  1316     }
       
  1317 
       
  1318 
       
  1319 // End of File