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