|
1 /* |
|
2 * Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of EAP TTLS UI settings dialog |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 27.1.1.1.9 % |
|
20 */ |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <eikdialg.h> |
|
24 #include <AknDialog.h> |
|
25 #include <aknlists.h> |
|
26 #include "EapTtlsUiView.h" |
|
27 #include "EapTtlsUi.hrh" |
|
28 #include <eapttlsui.rsg> |
|
29 #include <akntextsettingpage.h> |
|
30 #include <aknsettingitemlist.h> |
|
31 #include "EapTtlsUiSettingArray.h" |
|
32 #include <aknnavi.h> |
|
33 #include <akntabgrp.h> |
|
34 #include <aknnavide.h> |
|
35 #include <aknradiobuttonsettingpage.h> |
|
36 #include <StringLoader.h> |
|
37 #include <aknnotewrappers.h> |
|
38 #include <EapTlsPeapUiCipherSuites.h> |
|
39 #include <EapTlsPeapUiEapTypes.h> |
|
40 #include <EapTlsPeapUiCertificates.h> |
|
41 #include <EapType.h> |
|
42 #include <EapTypeInfo.h> |
|
43 #include <AknIconArray.h> |
|
44 #include <AknsUtils.h> |
|
45 |
|
46 #include <featmgr.h> |
|
47 #include <hlplch.h> |
|
48 #include <csxhelp/cp.hlp.hrh> |
|
49 |
|
50 |
|
51 // CONSTANTS |
|
52 // UID of general settings app, in which help texts are included |
|
53 const TUid KHelpUidPlugin = { 0x100058EC }; |
|
54 |
|
55 static const TInt KSettingArrayGranularity = 4; |
|
56 static const TInt KSuiteArrayGranularity = 5; |
|
57 static const TInt KMaxLengthOfEapLine = 270; |
|
58 static const TInt KCertificateArrayGranularity = 5; |
|
59 static const TInt KMaxLengthOfSuiteName = 255; |
|
60 static const TInt KEapTtlsId = 21; |
|
61 |
|
62 _LIT( KNameSeparator, " " ); |
|
63 _LIT( KEmptyString, "" ); |
|
64 const TUint KFirstElement = 0; |
|
65 const TUint KSecondElement = 1; |
|
66 const TUint KMinEnabledCount = 1; |
|
67 |
|
68 /* This is the maximum length of a certificate's full name, includes |
|
69 label, primary and secondary names */ |
|
70 const TUint32 KMaxFullCertLabelLength = KMaxCertLabelLength + 2 * |
|
71 KMaxNameLength + 1; // 1 is for separator. |
|
72 |
|
73 // MODULE DATA STRUCTURES |
|
74 enum TPageIds |
|
75 { |
|
76 ESettingsPage = 0, |
|
77 EEapTypePage, |
|
78 ECipherSuitePage |
|
79 }; |
|
80 |
|
81 enum TSettingIds |
|
82 { |
|
83 EUserCertificateItem = 0, |
|
84 ECaCertificateItem, |
|
85 EUsernameInUseItem, |
|
86 EUsernameItem, |
|
87 ERealmInUseItem, |
|
88 ERealmItem |
|
89 }; |
|
90 |
|
91 |
|
92 // ============================ MEMBER FUNCTIONS =============================== |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CEapTtlsUiDialog::CEapTtlsUiDialog |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 CEapTtlsUiDialog::CEapTtlsUiDialog( CEapTlsPeapUiConnection* aConnection, |
|
99 TIndexType aIndexType, TInt aIndex, |
|
100 TInt& aButtonId ) |
|
101 : CAknDialog(), |
|
102 iConnection( aConnection ), |
|
103 iIndexType( aIndexType ), |
|
104 iIndex( aIndex ), |
|
105 iButtonId( &aButtonId ), |
|
106 iIsUIConstructionCompleted( EFalse ), |
|
107 iExiting( EFalse ) |
|
108 { |
|
109 } |
|
110 |
|
111 |
|
112 // --------------------------------------------------------- |
|
113 // CEapTtlsUiDialog::ConstructAndRunLD |
|
114 // --------------------------------------------------------- |
|
115 // |
|
116 TInt CEapTtlsUiDialog::ConstructAndRunLD( TInt aResourceId ) |
|
117 { |
|
118 CleanupStack::PushL( this ); |
|
119 |
|
120 iSettingArray = CEapTtlsSettingItemArray::NewL(); |
|
121 |
|
122 User::LeaveIfError( iConnection->Connect() ); |
|
123 |
|
124 // Basic data |
|
125 iDataConnection = iConnection->GetDataConnection(); |
|
126 if ( iDataConnection == 0 ) |
|
127 { |
|
128 User::Leave( KErrNoMemory ); |
|
129 } |
|
130 User::LeaveIfError( iDataConnection->Open() ); |
|
131 User::LeaveIfError( iDataConnection->GetData( &iUiData ) ); |
|
132 |
|
133 // Cipher suites |
|
134 iCipherSuites = iConnection->GetCipherSuiteConnection(); |
|
135 if ( iCipherSuites == 0 ) |
|
136 { |
|
137 User::Leave( KErrNoMemory ); |
|
138 } |
|
139 |
|
140 User::LeaveIfError( iCipherSuites->Open() ); |
|
141 User::LeaveIfError( iCipherSuites->GetCipherSuites( &iUiCipherSuites ) ); |
|
142 |
|
143 iCipherSuitesViewArray = new( ELeave ) CDesCArrayFlat( |
|
144 KSuiteArrayGranularity ); |
|
145 //EAP types |
|
146 iEapTypes = iConnection->GetEapTypeConnection(); |
|
147 if ( iEapTypes == 0 ) |
|
148 { |
|
149 User::Leave( KErrNoMemory ); |
|
150 } |
|
151 User::LeaveIfError( iEapTypes->Open() ); |
|
152 User::LeaveIfError( iEapTypes->GetEapTypes( &iUiEapTypes ) ); |
|
153 if ( iUiEapTypes->Count() == 0 ) |
|
154 { |
|
155 CreateEapTypeDataBaseL(); |
|
156 } |
|
157 |
|
158 iEapTypeViewArray = new( ELeave ) CDesCArrayFlat( |
|
159 KSettingArrayGranularity ); |
|
160 |
|
161 FeatureManager::InitializeLibL(); |
|
162 |
|
163 ConstructL( R_TTLS_MENUBAR ); |
|
164 |
|
165 // ExecuteLD will PushL( this ), so we have to Pop it... |
|
166 CleanupStack::Pop( this ); // this |
|
167 |
|
168 return CAknDialog::ExecuteLD( aResourceId ); |
|
169 } |
|
170 |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CEapTtlsUiDialog::OfferKeyEventL |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 TKeyResponse CEapTtlsUiDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
177 TEventCode aType ) |
|
178 { |
|
179 TKeyResponse result( EKeyWasNotConsumed ); |
|
180 |
|
181 // gently handle impatient users |
|
182 if ( !iIsUIConstructionCompleted ) |
|
183 { |
|
184 return CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
185 } |
|
186 |
|
187 TInt pageId = ActivePageId(); |
|
188 if ( aType == EEventKey && pageId == KEAPTTLSCIPHERPAGE ) |
|
189 { |
|
190 TInt indexBefore = iCipherSuiteListBox->CurrentItemIndex(); |
|
191 |
|
192 if ( aKeyEvent.iCode == EKeyEnter ) |
|
193 { |
|
194 if ( ( *iUiCipherSuites )[indexBefore].iIsEnabled ) |
|
195 { |
|
196 OkToExitL( ETtlsUiCmdDisable ); |
|
197 } |
|
198 else |
|
199 { |
|
200 OkToExitL( ETtlsUiCmdEnable ); |
|
201 } |
|
202 |
|
203 result = EKeyWasConsumed; |
|
204 } |
|
205 else |
|
206 { |
|
207 result = CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
208 } |
|
209 |
|
210 TInt indexAfter = iCipherSuiteListBox->CurrentItemIndex(); |
|
211 |
|
212 if ( indexBefore != indexAfter ) |
|
213 { |
|
214 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
215 if( ( *iUiCipherSuites )[ indexAfter ].iIsEnabled ) |
|
216 { |
|
217 cba.SetCommandSetL( R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_DISABLE ); |
|
218 } |
|
219 else |
|
220 { |
|
221 cba.SetCommandSetL( R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_ENABLE ); |
|
222 } |
|
223 |
|
224 cba.DrawDeferred(); |
|
225 } |
|
226 } |
|
227 else if ( aType == EEventKey && pageId == KEAPTTLSEAPPAGE ) |
|
228 { |
|
229 TInt indexBefore = iEapTypesListBox->CurrentItemIndex(); |
|
230 |
|
231 if ( aKeyEvent.iCode == EKeyEnter ) |
|
232 { |
|
233 if ( ( *iUiEapTypes )[indexBefore].iIsEnabled ) |
|
234 { |
|
235 OkToExitL( ETtlsUiCmdConfigure ); |
|
236 } |
|
237 else |
|
238 { |
|
239 OkToExitL( ETtlsUiCmdEnable ); |
|
240 } |
|
241 |
|
242 result = EKeyWasConsumed; |
|
243 } |
|
244 else |
|
245 { |
|
246 result = CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
247 } |
|
248 |
|
249 TInt indexAfter = iEapTypesListBox->CurrentItemIndex(); |
|
250 |
|
251 if ( indexBefore != indexAfter ) |
|
252 { |
|
253 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
254 if( ( *iUiEapTypes )[indexAfter].iIsEnabled ) |
|
255 { |
|
256 cba.SetCommandSetL( R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_CONFIGURE ); |
|
257 } |
|
258 else |
|
259 { |
|
260 cba.SetCommandSetL( R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_ENABLE ); |
|
261 } |
|
262 |
|
263 cba.DrawDeferred(); |
|
264 } |
|
265 } |
|
266 else |
|
267 { |
|
268 result = CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
269 } |
|
270 |
|
271 return result; |
|
272 } |
|
273 |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // CEapTtlsUiDialog::~CEapTtlsUiDialog |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 CEapTtlsUiDialog::~CEapTtlsUiDialog() |
|
280 { |
|
281 if ( iSettingArray ) |
|
282 { |
|
283 iSettingArray->Array()->ResetAndDestroy(); |
|
284 } |
|
285 |
|
286 delete iSettingArray; |
|
287 |
|
288 iSettingListBox = NULL; |
|
289 |
|
290 iDataConnection->Close(); |
|
291 delete iDataConnection; |
|
292 |
|
293 iCipherSuitesViewArray->Reset(); |
|
294 delete iCipherSuitesViewArray; |
|
295 |
|
296 iEapTypeViewArray->Reset(); |
|
297 delete iEapTypeViewArray; |
|
298 |
|
299 iCertificates->Close(); |
|
300 delete iCertificates; |
|
301 |
|
302 iCipherSuites->Close(); |
|
303 delete iCipherSuites; |
|
304 |
|
305 iEapTypes->Close(); |
|
306 delete iEapTypes; |
|
307 |
|
308 iConnection->Close(); |
|
309 |
|
310 delete iPreviousText; |
|
311 |
|
312 FeatureManager::UnInitializeLib(); |
|
313 } |
|
314 |
|
315 |
|
316 // --------------------------------------------------------- |
|
317 // CEapTtlsUiDialog::HandleListBoxEventL |
|
318 // --------------------------------------------------------- |
|
319 // |
|
320 void CEapTtlsUiDialog::HandleListBoxEventL( CEikListBox* aListBox, |
|
321 TListBoxEvent aEventType ) |
|
322 { |
|
323 switch ( aEventType ) |
|
324 { |
|
325 case EEventEnterKeyPressed: |
|
326 case EEventItemSingleClicked: |
|
327 { |
|
328 if ( aListBox == iSettingListBox ) |
|
329 { |
|
330 OkToExitL( ETtlsUiCmdChange ); |
|
331 } |
|
332 |
|
333 else if ( aListBox == iEapTypesListBox ) |
|
334 { |
|
335 TInt index = iEapTypesListBox->CurrentItemIndex(); |
|
336 if ( iUiEapTypes->At( index ).iIsEnabled ) |
|
337 { |
|
338 ConfigureL(ETrue); |
|
339 } |
|
340 else |
|
341 { |
|
342 OkToExitL( ETtlsUiCmdEnable ); |
|
343 } |
|
344 } |
|
345 |
|
346 else if ( aListBox == iCipherSuiteListBox ) |
|
347 { |
|
348 TInt index = iCipherSuiteListBox->CurrentItemIndex(); |
|
349 if ( iUiCipherSuites->At( index ).iIsEnabled ) |
|
350 { |
|
351 OkToExitL( ETtlsUiCmdDisable ); |
|
352 } |
|
353 else |
|
354 { |
|
355 OkToExitL( ETtlsUiCmdEnable ); |
|
356 } |
|
357 } |
|
358 |
|
359 else |
|
360 { |
|
361 // Do nothing; we should never end up here |
|
362 } |
|
363 |
|
364 break; |
|
365 } |
|
366 |
|
367 case EEventItemActioned: |
|
368 case EEventEditingStarted: |
|
369 case EEventEditingStopped: |
|
370 case EEventPenDownOnItem: |
|
371 case EEventItemDraggingActioned: |
|
372 { |
|
373 break; |
|
374 } |
|
375 |
|
376 default: |
|
377 { |
|
378 break; |
|
379 }; |
|
380 }; |
|
381 } |
|
382 |
|
383 |
|
384 // --------------------------------------------------------- |
|
385 // CEapTtlsUiDialog::HandleDialogPageEventL |
|
386 // --------------------------------------------------------- |
|
387 // |
|
388 void CEapTtlsUiDialog::HandleDialogPageEventL( TInt aEventID ) |
|
389 { |
|
390 CAknDialog::HandleDialogPageEventL( aEventID ); |
|
391 if( iExiting ) |
|
392 { |
|
393 // Exit requested. |
|
394 TryExitL( EAknCmdExit ); |
|
395 } |
|
396 } |
|
397 |
|
398 |
|
399 // --------------------------------------------------------- |
|
400 // CEapTtlsUiDialog::ConfigureL |
|
401 // --------------------------------------------------------- |
|
402 // |
|
403 void CEapTtlsUiDialog::ConfigureL( TBool aQuick ) |
|
404 { |
|
405 RImplInfoPtrArray eapArray; |
|
406 eapArray.Reset(); |
|
407 REComSession::ListImplementationsL( KEapTypeInterfaceUid, |
|
408 eapArray ); |
|
409 TInt itemIndex = iEapTypesListBox->CurrentItemIndex(); |
|
410 TInt eapIndex( 0 ); |
|
411 for ( TInt i = 0; i < eapArray.Count(); ++i ) |
|
412 { |
|
413 CImplementationInformation* tempInfo = eapArray[i]; |
|
414 if ( iUiEapTypes->At( itemIndex ).iEapType == |
|
415 tempInfo->DataType() ) |
|
416 { |
|
417 eapIndex = i; |
|
418 break; |
|
419 } |
|
420 } |
|
421 |
|
422 CEapType* eapType; |
|
423 eapType = CEapType::NewL( eapArray[eapIndex]->DataType(), |
|
424 iIndexType, iIndex ); |
|
425 eapArray.ResetAndDestroy(); |
|
426 eapType->SetTunnelingType( KEapTtlsId ); |
|
427 CleanupStack::PushL( eapType ); |
|
428 TInt buttonId = eapType->InvokeUiL(); |
|
429 CleanupStack::PopAndDestroy( eapType ); |
|
430 if ( buttonId == EAknCmdExit || buttonId == EEikCmdExit ) |
|
431 { |
|
432 if (aQuick == EFalse) |
|
433 { |
|
434 TryExitL( buttonId ); |
|
435 } |
|
436 else |
|
437 { |
|
438 iExiting = ETrue; |
|
439 // Don't exit here. Framework command chain will |
|
440 // cause a KERN-EXEC 3 panic. Handle the exit in |
|
441 // HandleDialogPageEventL(). |
|
442 } |
|
443 } |
|
444 } |
|
445 |
|
446 |
|
447 // ----------------------------------------------------------------------------- |
|
448 // CEapTtlsUiDialog::PreLayoutDynInitL |
|
449 // ----------------------------------------------------------------------------- |
|
450 // |
|
451 void CEapTtlsUiDialog::PreLayoutDynInitL() |
|
452 { |
|
453 // Change title |
|
454 ChangeTitleL( ETrue ); |
|
455 |
|
456 iSettingListBox = static_cast<CAknSettingStyleListBox*>( |
|
457 ControlOrNull( ETtlsSettingsListbox ) ); |
|
458 iSettingListBox->SetComponentsToInheritVisibility( ETrue ); |
|
459 |
|
460 iEapTypesListBox = static_cast<CAknSingleNumberStyleListBox*>( |
|
461 ControlOrNull( ETtlsSettingsEapTypeListbox ) ); |
|
462 iEapTypesListBox->SetComponentsToInheritVisibility( ETrue ); |
|
463 |
|
464 iCipherSuiteListBox = static_cast<CAknSingleNumberStyleListBox*>( |
|
465 ControlOrNull( ETtlsSettingsCipherSuiteListbox ) ); |
|
466 iCipherSuiteListBox->SetComponentsToInheritVisibility( ETrue ); |
|
467 |
|
468 // Get certificates before building the UI. |
|
469 // Will continue when certificates are received |
|
470 iCertificates = iConnection->GetCertificateConnection( this ); |
|
471 User::LeaveIfError( iCertificates->Open() ); |
|
472 iCertificates->GetCertificates( &iUiUserCertificates, &iUiCACertificates ); |
|
473 } |
|
474 |
|
475 |
|
476 // ----------------------------------------------------------------------------- |
|
477 // CEapTtlsUiDialog::CompleteReadCertificates |
|
478 // ----------------------------------------------------------------------------- |
|
479 // |
|
480 void CEapTtlsUiDialog::CompleteReadCertificates( const TInt aResult ) |
|
481 { |
|
482 if ( aResult == KErrNone ) // Certifiocates are received from core |
|
483 { |
|
484 TRAPD( err, CompleteUiConstructionL() ); |
|
485 if ( err != KErrNone ) |
|
486 { |
|
487 TRAP_IGNORE( TryExitL( KErrCancel ) ); |
|
488 } |
|
489 } |
|
490 else |
|
491 { |
|
492 TRAP_IGNORE( TryExitL( KErrCancel ) ); |
|
493 } |
|
494 } |
|
495 |
|
496 |
|
497 // ----------------------------------------------------------------------------- |
|
498 // CEapTtlsUiDialog::CompleteUiConstructionL |
|
499 // ----------------------------------------------------------------------------- |
|
500 // |
|
501 void CEapTtlsUiDialog::CompleteUiConstructionL() |
|
502 { |
|
503 // Initialize setting page |
|
504 iSettingListBox = static_cast<CAknSettingStyleListBox*>( |
|
505 ControlOrNull( ETtlsSettingsListbox ) ); |
|
506 iSettingListBox->SetMopParent( this ); |
|
507 iSettingListBox->CreateScrollBarFrameL( ETrue ); |
|
508 iSettingListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
509 CEikScrollBarFrame::EOff, |
|
510 CEikScrollBarFrame::EAuto ); |
|
511 iSettingListBox->SetListBoxObserver( this ); |
|
512 DrawSettingsListL(); |
|
513 |
|
514 // Initialize EAP types page |
|
515 iEapTypesListBox = static_cast<CAknSingleNumberStyleListBox*>( |
|
516 ControlOrNull( ETtlsSettingsEapTypeListbox ) ); |
|
517 iEapTypesListBox->SetMopParent( this ); |
|
518 iEapTypesListBox->CreateScrollBarFrameL( ETrue ); |
|
519 iEapTypesListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
520 CEikScrollBarFrame::EOff, |
|
521 CEikScrollBarFrame::EAuto ); |
|
522 iEapTypesListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
523 iEapTypesListBox->SetListBoxObserver( this ); |
|
524 |
|
525 // Following deletes internal array created from resources. |
|
526 // To prevent memory leak. |
|
527 MDesCArray* internalArray1 = iEapTypesListBox->Model()->ItemTextArray(); |
|
528 delete internalArray1; |
|
529 |
|
530 // Initialize cipher suites page |
|
531 iCipherSuiteListBox = static_cast<CAknSingleNumberStyleListBox*>( |
|
532 ControlOrNull( ETtlsSettingsCipherSuiteListbox ) ); |
|
533 iCipherSuiteListBox->CreateScrollBarFrameL( ETrue ); |
|
534 iCipherSuiteListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
535 CEikScrollBarFrame::EOff, |
|
536 CEikScrollBarFrame::EAuto ); |
|
537 iCipherSuiteListBox->UpdateScrollBarsL(); |
|
538 iCipherSuiteListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
539 iCipherSuiteListBox->SetListBoxObserver( this ); |
|
540 |
|
541 //Following deletes internal array created from resources. |
|
542 // To prevent memory leak. |
|
543 MDesCArray* internalArray2 = iCipherSuiteListBox->Model()->ItemTextArray(); |
|
544 delete internalArray2; |
|
545 |
|
546 SetEapIconsL(); |
|
547 DrawEapListL( 0 ); |
|
548 |
|
549 SetCipherIconsL(); |
|
550 DrawCipherSuitesL(); |
|
551 |
|
552 iIsUIConstructionCompleted = ETrue; |
|
553 } |
|
554 |
|
555 |
|
556 // ----------------------------------------------------------------------------- |
|
557 // CEapTtlsUiDialog::PostLayoutDynInitL |
|
558 // ----------------------------------------------------------------------------- |
|
559 // |
|
560 void CEapTtlsUiDialog::PostLayoutDynInitL() |
|
561 { |
|
562 TUid naviPaneUid; |
|
563 naviPaneUid.iUid = EEikStatusPaneUidNavi; |
|
564 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
565 CEikStatusPaneBase::TPaneCapabilities subPane = |
|
566 statusPane->PaneCapabilities( naviPaneUid ); |
|
567 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
568 { |
|
569 CAknNavigationControlContainer* naviPane = |
|
570 static_cast<CAknNavigationControlContainer*>( |
|
571 statusPane->ControlL( naviPaneUid ) ); |
|
572 CAknNavigationDecorator* naviDecorator = naviPane->ResourceDecorator(); |
|
573 if ( naviDecorator ) |
|
574 { |
|
575 CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( |
|
576 naviDecorator->DecoratedControl() ); |
|
577 tabGroup->SetActiveTabById( 0 ); |
|
578 tabGroup->SetTabFixedWidthL( KTabWidthWithOneTab ); |
|
579 } |
|
580 } |
|
581 } |
|
582 |
|
583 |
|
584 // ----------------------------------------------------------------------------- |
|
585 // CEapTtlsUiDialog::ChangeTitleL |
|
586 // ----------------------------------------------------------------------------- |
|
587 // |
|
588 void CEapTtlsUiDialog::ChangeTitleL( TBool aIsStarted ) |
|
589 { |
|
590 TUid titlePaneUid; |
|
591 titlePaneUid.iUid = EEikStatusPaneUidTitle; |
|
592 |
|
593 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
594 CEikStatusPaneBase::TPaneCapabilities subPane = |
|
595 statusPane->PaneCapabilities( titlePaneUid ); |
|
596 |
|
597 if ( subPane.IsPresent()&&subPane.IsAppOwned() ) |
|
598 { |
|
599 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>( |
|
600 statusPane->ControlL( titlePaneUid ) ); |
|
601 if ( aIsStarted ) |
|
602 { |
|
603 // Store previous application title text |
|
604 const TDesC* prevText = titlePane->Text(); |
|
605 iPreviousText = HBufC::NewL( prevText->Length() ); |
|
606 iPreviousText->Des().Append( *prevText ); |
|
607 TDesC* titleText = iEikonEnv->AllocReadResourceLC( |
|
608 R_TTLS_SETTINGS_TITLE ); |
|
609 titlePane->SetTextL( *titleText ); |
|
610 CleanupStack::PopAndDestroy( titleText ); |
|
611 } |
|
612 else |
|
613 { |
|
614 // Set calling application title text back |
|
615 titlePane->SetTextL( *iPreviousText ); |
|
616 } |
|
617 } |
|
618 } |
|
619 |
|
620 |
|
621 // ----------------------------------------------------------------------------- |
|
622 // CEapTtlsUiDialog::OkToExitL |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 TBool CEapTtlsUiDialog::OkToExitL( TInt aButtonId ) |
|
626 { |
|
627 TBool ret( EFalse ); |
|
628 switch ( aButtonId ) |
|
629 { |
|
630 case EEikBidOk: |
|
631 { |
|
632 if( iIsUIConstructionCompleted ) |
|
633 { |
|
634 TPageIds index = static_cast<TPageIds>( ActivePageIndex() ); |
|
635 if ( index == ESettingsPage ) |
|
636 { |
|
637 ShowSettingPageL( EFalse ); |
|
638 } |
|
639 else if ( index == EEapTypePage ) |
|
640 { |
|
641 ProcessCommandL( ETtlsUiCmdConfigure ); |
|
642 } |
|
643 } |
|
644 else |
|
645 { |
|
646 #if defined(_DEBUG) || defined(DEBUG) |
|
647 RDebug::Print(_L("CEapTtlsUiDialog::OkToExitL - UI not ready - Ignoring key press.\n") ); |
|
648 #endif |
|
649 } |
|
650 break; |
|
651 } |
|
652 |
|
653 case EAknSoftkeyOptions: |
|
654 { |
|
655 DisplayMenuL(); |
|
656 break; |
|
657 } |
|
658 |
|
659 case EAknSoftkeyBack: |
|
660 case EAknCmdExit: |
|
661 { |
|
662 if( ( GetEnabledEapTypeCount() > KMinEnabledCount ) && |
|
663 ( IsPlainMschapv2Enabled() || IsPapEnabled() ) ) |
|
664 { |
|
665 HBufC* stringLabel; |
|
666 |
|
667 if ( IsPlainMschapv2Enabled() ) |
|
668 { |
|
669 stringLabel = StringLoader::LoadL( |
|
670 R_TTLS_INFO_PLAIN_MSCHAP_CANNOT_ENABLE_ALONG, |
|
671 iEikonEnv ); |
|
672 } |
|
673 else |
|
674 { |
|
675 stringLabel = StringLoader::LoadL( |
|
676 R_TTLS_INFO_PAP_CANNOT_ENABLE_ALONG, |
|
677 iEikonEnv ); |
|
678 } |
|
679 CleanupStack::PushL( stringLabel ); |
|
680 CAknInformationNote* dialog = new ( ELeave ) |
|
681 CAknInformationNote( ETrue ); |
|
682 dialog->ExecuteLD( *stringLabel ); |
|
683 CleanupStack::PopAndDestroy( stringLabel ); |
|
684 |
|
685 // after showing the info note, EAP settings page |
|
686 // must be shown |
|
687 if( ActivePageId() == KEAPTTLSSETTINGSPAGE ) |
|
688 { |
|
689 TKeyEvent keyRight = |
|
690 { |
|
691 EKeyRightArrow, |
|
692 EStdKeyRightArrow, |
|
693 EModifierPureKeycode, |
|
694 0 |
|
695 }; |
|
696 CAknDialog::OfferKeyEventL |
|
697 ( keyRight, |
|
698 EEventKey ); |
|
699 } |
|
700 if( ActivePageId() == KEAPTTLSCIPHERPAGE ) |
|
701 { |
|
702 TKeyEvent keyLeft = |
|
703 { |
|
704 EKeyLeftArrow, |
|
705 EStdKeyLeftArrow, |
|
706 EModifierPureKeycode, |
|
707 0 |
|
708 }; |
|
709 CAknDialog::OfferKeyEventL |
|
710 ( keyLeft, |
|
711 EEventKey ); |
|
712 } |
|
713 |
|
714 iExiting = EFalse; |
|
715 ret = EFalse; |
|
716 } |
|
717 else |
|
718 { |
|
719 if( iIsUIConstructionCompleted ) |
|
720 { |
|
721 iDataConnection->Update(); |
|
722 ChangeTitleL( EFalse ); |
|
723 ret = ETrue; |
|
724 } |
|
725 } |
|
726 break; |
|
727 } |
|
728 |
|
729 case ETtlsUiCmdChange: |
|
730 { |
|
731 TPageIds index = static_cast<TPageIds>( ActivePageIndex() ); |
|
732 if ( index == ESettingsPage ) |
|
733 { |
|
734 if( iIsUIConstructionCompleted ) |
|
735 { |
|
736 ShowSettingPageL( EFalse ); |
|
737 } |
|
738 else |
|
739 { |
|
740 #if defined(_DEBUG) || defined(DEBUG) |
|
741 RDebug::Print(_L("CEapPeapUiDialog::ProcessCommandL - UI not ready - Ignoring key press.\n") ); |
|
742 #endif |
|
743 } |
|
744 } |
|
745 break; |
|
746 } |
|
747 |
|
748 case ETtlsUiCmdConfigure: |
|
749 case ETtlsUiCmdEnable: |
|
750 case ETtlsUiCmdDisable: |
|
751 { |
|
752 ProcessCommandL( aButtonId ); |
|
753 ret = EFalse; |
|
754 break; |
|
755 } |
|
756 |
|
757 default: |
|
758 { |
|
759 break; |
|
760 } |
|
761 } |
|
762 |
|
763 if ( ret ) |
|
764 { |
|
765 *iButtonId = aButtonId; |
|
766 } |
|
767 |
|
768 return ret; |
|
769 } |
|
770 |
|
771 |
|
772 // ----------------------------------------------------------------------------- |
|
773 // CEapTtlsUiDialog::DrawSettingsListL |
|
774 // ----------------------------------------------------------------------------- |
|
775 // |
|
776 void CEapTtlsUiDialog::DrawSettingsListL() |
|
777 { |
|
778 iSettingArray->Array()->ResetAndDestroy(); |
|
779 TInt ordinal = 0; |
|
780 TInt activeUserCertificate = CheckActiveUserCertificate(); |
|
781 TBuf<KMaxFullCertLabelLength> aActiveuserCertificateName = KEmptyString(); |
|
782 if ( activeUserCertificate != KErrNotFound ) |
|
783 { |
|
784 TBuf<KMaxFullCertLabelLength> text; |
|
785 GetFullCertLabelL( |
|
786 iUiUserCertificates->At( activeUserCertificate ).iCertEntry, |
|
787 text ); |
|
788 aActiveuserCertificateName.Copy( text ); |
|
789 } |
|
790 else |
|
791 { |
|
792 TDesC* notDefinedText = iEikonEnv->AllocReadResourceLC( |
|
793 R_TTLS_NOT_DEFINED ); |
|
794 aActiveuserCertificateName.Copy( *notDefinedText ); |
|
795 CleanupStack::PopAndDestroy( notDefinedText ); |
|
796 } |
|
797 |
|
798 iSettingArray->AddTextItemL( aActiveuserCertificateName, |
|
799 ETtlsSettingUserCert, |
|
800 R_TTLS_USER_CERT_STRING, |
|
801 R_TTLS_USERNAME_PAGE, |
|
802 NULL, |
|
803 ordinal++ ); |
|
804 |
|
805 TInt activeCaCertificate = CheckActiveCaCertificate(); |
|
806 TBuf<KMaxFullCertLabelLength> aActiveCaCertificateName = KEmptyString(); |
|
807 if ( activeCaCertificate != KErrNotFound ) |
|
808 { |
|
809 TBuf<KMaxFullCertLabelLength> text; |
|
810 GetFullCertLabelL( |
|
811 iUiCACertificates->At( activeCaCertificate ).iCertEntry, |
|
812 text ); |
|
813 aActiveCaCertificateName.Copy( text ); |
|
814 } |
|
815 else |
|
816 { |
|
817 TDesC* notDefinedText = iEikonEnv->AllocReadResourceLC( |
|
818 R_TTLS_NOT_DEFINED ); |
|
819 aActiveCaCertificateName.Copy( *notDefinedText ); |
|
820 CleanupStack::PopAndDestroy( notDefinedText ); |
|
821 } |
|
822 |
|
823 iSettingArray->AddTextItemL( aActiveCaCertificateName, |
|
824 ETtlsSettingCaCert, |
|
825 R_TTLS_CA_CERT_STRING, |
|
826 R_TTLS_USERNAME_PAGE, |
|
827 NULL, |
|
828 ordinal++ ); |
|
829 |
|
830 iSettingArray->AddBinarySettingItemL( R_TTLS_DISPLAY_AUTOUSECONF_PAGE, |
|
831 R_TTLS_USERNAME_INUSESTRING, |
|
832 R_TTLS_USERNAME_AUTOUSECONF_TEXTS, |
|
833 ordinal++, |
|
834 *iUiData->GetUseManualUsername() ); |
|
835 |
|
836 iSettingArray->AddTextItemL( iUiData->GetManualUsername(), |
|
837 ETtlsTabSheetSettingsUsername, |
|
838 R_TTLS_USERNAME_STRING, |
|
839 R_TTLS_USERNAME_PAGE, |
|
840 NULL, |
|
841 ordinal++ ); |
|
842 |
|
843 iSettingArray->AddBinarySettingItemL( R_TTLS_DISPLAY_AUTOUSECONF_PAGE, |
|
844 R_TTLS_REALM_INUSESTRING, |
|
845 R_TTLS_REALM_AUTOUSECONF_TEXTS, |
|
846 ordinal++, |
|
847 *iUiData->GetUseManualRealm() ); |
|
848 |
|
849 iSettingArray->AddTextItemL( iUiData->GetManualRealm(), |
|
850 ETtlsTabSheetSettingsRealm, |
|
851 R_TTLS_REALM_STRING, |
|
852 R_TTLS_REALM_PAGE, |
|
853 NULL, |
|
854 ordinal++ ); |
|
855 |
|
856 iSettingArray->AddBinarySettingItemL( R_TTLS_DISPLAY_AUTOUSECONF_PAGE, |
|
857 R_TTLS_TLS_PRIVACY_STRING, |
|
858 R_TTLS_TLS_PRIVACY_AUTOUSECONF_TEXTS, |
|
859 ordinal++, |
|
860 *iUiData->GetTlsPrivacy() ); |
|
861 |
|
862 iSettingListBox->Model()->SetItemTextArray( iSettingArray->Array() ); |
|
863 iSettingListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
864 iSettingArray->Array()->RecalculateVisibleIndicesL(); |
|
865 iSettingListBox->HandleItemAdditionL(); |
|
866 iSettingListBox->UpdateScrollBarsL(); |
|
867 } |
|
868 |
|
869 |
|
870 // ----------------------------------------------------------------------------- |
|
871 // CEapTtlsUiDialog::DynInitMenuPaneL |
|
872 // ----------------------------------------------------------------------------- |
|
873 // |
|
874 void CEapTtlsUiDialog::DynInitMenuPaneL( TInt aResourceId, |
|
875 CEikMenuPane* aMenuPane ) |
|
876 { |
|
877 CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
878 |
|
879 if ( aMenuPane && aResourceId == R_TTLS_MENU_PANE ) |
|
880 { |
|
881 if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
882 { |
|
883 aMenuPane->DeleteMenuItem( EAknCmdHelp ); |
|
884 } |
|
885 |
|
886 TPageIds index = static_cast<TPageIds>( ActivePageIndex() ); |
|
887 if ( index == ESettingsPage ) |
|
888 { |
|
889 aMenuPane->SetItemDimmed( ETtlsUiCmdEnable, ETrue ); |
|
890 aMenuPane->SetItemDimmed( ETtlsUiCmdDisable, ETrue ); |
|
891 aMenuPane->SetItemDimmed( ETtlsUiCmdConfigure, ETrue ); |
|
892 aMenuPane->SetItemDimmed( ETtlsUiCmdMoveUp, ETrue ); |
|
893 aMenuPane->SetItemDimmed( ETtlsUiCmdMoveDown, ETrue ); |
|
894 } |
|
895 else if ( index == EEapTypePage ) |
|
896 { |
|
897 aMenuPane->SetItemDimmed( ETtlsUiCmdChange, ETrue ); |
|
898 |
|
899 if ( iEapTypeViewArray->Count() > 0 ) |
|
900 { |
|
901 TInt currentIndex = iEapTypesListBox->CurrentItemIndex(); |
|
902 TBool enabled = iUiEapTypes->At( currentIndex ).iIsEnabled; |
|
903 |
|
904 // Hide either "Enable" or "Disable", as appropriate. |
|
905 aMenuPane->SetItemDimmed( ETtlsUiCmdEnable, enabled ); |
|
906 aMenuPane->SetItemDimmed( ETtlsUiCmdDisable, !enabled ); |
|
907 |
|
908 // Don't display "Configure" for disabled items |
|
909 aMenuPane->SetItemDimmed( ETtlsUiCmdConfigure, !enabled ); |
|
910 |
|
911 // Don't display "Raise priority" nor "Lower priority" for |
|
912 // disabled items |
|
913 aMenuPane->SetItemDimmed( ETtlsUiCmdMoveUp, !enabled ); |
|
914 aMenuPane->SetItemDimmed( ETtlsUiCmdMoveDown, !enabled ); |
|
915 |
|
916 if ( enabled ) |
|
917 { |
|
918 if ( currentIndex == 0 ) |
|
919 { |
|
920 // Can't go higher than top. |
|
921 aMenuPane->SetItemDimmed( ETtlsUiCmdMoveUp, ETrue ); |
|
922 } |
|
923 else if ( currentIndex == iEapTypeViewArray->Count()-1 || |
|
924 ( currentIndex < iEapTypeViewArray->Count()-1 && |
|
925 !iUiEapTypes->At( currentIndex + 1 ).iIsEnabled ) ) |
|
926 { |
|
927 // Can't go lower than the last enabled item |
|
928 aMenuPane->SetItemDimmed( ETtlsUiCmdMoveDown, ETrue ); |
|
929 } |
|
930 } |
|
931 |
|
932 } |
|
933 else |
|
934 { |
|
935 aMenuPane->SetItemDimmed( ETtlsUiCmdEnable, ETrue ); |
|
936 aMenuPane->SetItemDimmed( ETtlsUiCmdDisable, ETrue ); |
|
937 aMenuPane->SetItemDimmed( ETtlsUiCmdConfigure, ETrue ); |
|
938 aMenuPane->SetItemDimmed( ETtlsUiCmdMoveUp, ETrue ); |
|
939 aMenuPane->SetItemDimmed( ETtlsUiCmdMoveDown, ETrue ); |
|
940 aMenuPane->SetItemDimmed( ETtlsUiCmdChange, ETrue ); |
|
941 } |
|
942 } |
|
943 else if ( index == ECipherSuitePage ) |
|
944 { |
|
945 aMenuPane->SetItemDimmed( ETtlsUiCmdConfigure, ETrue ); |
|
946 aMenuPane->SetItemDimmed( ETtlsUiCmdMoveUp, ETrue ); |
|
947 aMenuPane->SetItemDimmed( ETtlsUiCmdMoveDown, ETrue ); |
|
948 aMenuPane->SetItemDimmed( ETtlsUiCmdChange, ETrue ); |
|
949 |
|
950 if ( iCipherSuitesViewArray->Count() > 0 ) |
|
951 { |
|
952 TInt currIndex = iCipherSuiteListBox->CurrentItemIndex(); |
|
953 TBool enabled = iUiCipherSuites->At( currIndex ).iIsEnabled; |
|
954 |
|
955 // Hide either "Enable" or "Disable", as appropriate. |
|
956 aMenuPane->SetItemDimmed( ETtlsUiCmdEnable, enabled ); |
|
957 aMenuPane->SetItemDimmed( ETtlsUiCmdDisable, !enabled ); |
|
958 } |
|
959 else |
|
960 { |
|
961 aMenuPane->SetItemDimmed( ETtlsUiCmdEnable, ETrue ); |
|
962 aMenuPane->SetItemDimmed( ETtlsUiCmdDisable, ETrue ); |
|
963 } |
|
964 } |
|
965 } |
|
966 } |
|
967 |
|
968 |
|
969 // ----------------------------------------------------------------------------- |
|
970 // CEapTtlsUiDialog::ProcessCommandL |
|
971 // ----------------------------------------------------------------------------- |
|
972 // |
|
973 void CEapTtlsUiDialog::ProcessCommandL( TInt aCommand ) |
|
974 { |
|
975 if ( MenuShowing() ) |
|
976 { |
|
977 HideMenu(); |
|
978 } |
|
979 |
|
980 TPageIds pageIndex = static_cast<TPageIds>( ActivePageIndex() ); |
|
981 switch( aCommand ) |
|
982 { |
|
983 case EAknCmdExit: |
|
984 { |
|
985 TryExitL( aCommand ); |
|
986 break; |
|
987 } |
|
988 |
|
989 case EAknCmdHelp: |
|
990 { |
|
991 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
992 iEikonEnv->EikAppUi()->AppHelpContextL() ); |
|
993 break; |
|
994 } |
|
995 |
|
996 case ETtlsUiCmdChange: |
|
997 { |
|
998 if ( pageIndex == ESettingsPage ) |
|
999 { |
|
1000 if( iIsUIConstructionCompleted ) |
|
1001 { |
|
1002 ShowSettingPageL( ETrue ); |
|
1003 } |
|
1004 else |
|
1005 { |
|
1006 #if defined(_DEBUG) || defined(DEBUG) |
|
1007 RDebug::Print(_L("CEapTtlsUiDialog::ProcessCommandL - UI not ready - Ignoring key press.\n") ); |
|
1008 #endif |
|
1009 } |
|
1010 } |
|
1011 break; |
|
1012 } |
|
1013 |
|
1014 case ETtlsUiCmdMoveUp: |
|
1015 { |
|
1016 if ( pageIndex == EEapTypePage ) |
|
1017 { |
|
1018 TInt cur = iEapTypesListBox->CurrentItemIndex(); |
|
1019 MoveEapTypeL( cur, cur - 1 ); |
|
1020 } |
|
1021 break; |
|
1022 } |
|
1023 |
|
1024 case ETtlsUiCmdMoveDown: |
|
1025 { |
|
1026 if ( pageIndex == EEapTypePage ) |
|
1027 { |
|
1028 TInt cur = iEapTypesListBox->CurrentItemIndex(); |
|
1029 MoveEapTypeL( cur, cur + 1 ); |
|
1030 } |
|
1031 break; |
|
1032 } |
|
1033 |
|
1034 case ETtlsUiCmdEnable: |
|
1035 { |
|
1036 if ( pageIndex == ECipherSuitePage ) |
|
1037 { |
|
1038 TInt index = iCipherSuiteListBox->CurrentItemIndex(); |
|
1039 iUiCipherSuites->At( index ).iIsEnabled = ETrue; |
|
1040 iCipherSuites->Update(); |
|
1041 DrawCipherSuitesL(); |
|
1042 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
1043 cba.SetCommandSetL( R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_DISABLE ); |
|
1044 cba.DrawDeferred(); |
|
1045 } |
|
1046 else if ( pageIndex == EEapTypePage ) |
|
1047 { |
|
1048 TInt cur = iEapTypesListBox->CurrentItemIndex(); |
|
1049 iUiEapTypes->At( cur ).iIsEnabled = ETrue; |
|
1050 |
|
1051 iEapTypes->Update(); |
|
1052 |
|
1053 // enabling moves item to the top of the list |
|
1054 MoveEapTypeL( cur, 0 ); |
|
1055 |
|
1056 // load the new CBA from resource |
|
1057 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
1058 cba.SetCommandSetL( R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_CONFIGURE ); |
|
1059 cba.DrawDeferred(); |
|
1060 } |
|
1061 break; |
|
1062 } |
|
1063 |
|
1064 case ETtlsUiCmdDisable: |
|
1065 { |
|
1066 if ( pageIndex == ECipherSuitePage ) |
|
1067 { |
|
1068 TInt index = iCipherSuiteListBox->CurrentItemIndex(); |
|
1069 iUiCipherSuites->At( index ).iIsEnabled = EFalse; |
|
1070 iCipherSuites->Update(); |
|
1071 DrawCipherSuitesL(); |
|
1072 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
1073 cba.SetCommandSetL( R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_ENABLE ); |
|
1074 cba.DrawDeferred(); |
|
1075 } |
|
1076 else if ( pageIndex == EEapTypePage ) |
|
1077 { |
|
1078 TInt itemIndex = iEapTypesListBox->CurrentItemIndex(); |
|
1079 |
|
1080 if( GetEnabledEapTypeCount() > KMinEnabledCount ) |
|
1081 { |
|
1082 // disabling moves item just after the last enabled one, |
|
1083 // so find that position |
|
1084 TInt next = itemIndex; |
|
1085 |
|
1086 while ( next < iUiEapTypes->Count() - 1 && |
|
1087 iUiEapTypes->At( next ).iIsEnabled ) |
|
1088 { |
|
1089 ++next; |
|
1090 } |
|
1091 |
|
1092 if ( next > itemIndex && |
|
1093 !iUiEapTypes->At( next ).iIsEnabled ) |
|
1094 { |
|
1095 --next; |
|
1096 } |
|
1097 |
|
1098 |
|
1099 iUiEapTypes->At( itemIndex ).iIsEnabled = EFalse; |
|
1100 |
|
1101 // move item if needed |
|
1102 MoveEapTypeL( itemIndex, next ); |
|
1103 iEapTypes->Update(); |
|
1104 |
|
1105 // Highlight follows movement. |
|
1106 //iEapTypesListBox->SetCurrentItemIndex( next ); |
|
1107 |
|
1108 // load the new CBA from resource |
|
1109 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
1110 cba.SetCommandSetL( |
|
1111 R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_ENABLE ); |
|
1112 cba.DrawDeferred(); |
|
1113 } |
|
1114 else |
|
1115 { |
|
1116 HBufC* stringLabel; |
|
1117 stringLabel = StringLoader::LoadL( |
|
1118 R_TTLS_INFO_CANNOT_DISABLE_ALL_EAP_PLUGINS, |
|
1119 iEikonEnv ); |
|
1120 CleanupStack::PushL( stringLabel ); |
|
1121 CAknInformationNote* dialog = new ( ELeave ) |
|
1122 CAknInformationNote( ETrue ); |
|
1123 dialog->ExecuteLD( *stringLabel ); |
|
1124 CleanupStack::PopAndDestroy( stringLabel ); |
|
1125 } |
|
1126 } |
|
1127 break; |
|
1128 } |
|
1129 |
|
1130 case ETtlsUiCmdConfigure: |
|
1131 { |
|
1132 if ( pageIndex == EEapTypePage ) |
|
1133 { |
|
1134 ConfigureL(EFalse); |
|
1135 } |
|
1136 break; |
|
1137 } |
|
1138 |
|
1139 default: |
|
1140 { |
|
1141 break; |
|
1142 } |
|
1143 } |
|
1144 } |
|
1145 |
|
1146 |
|
1147 // ----------------------------------------------------------------------------- |
|
1148 // CEapTtlsUiDialog::PageChangedL |
|
1149 // ----------------------------------------------------------------------------- |
|
1150 // |
|
1151 void CEapTtlsUiDialog::PageChangedL( TInt aPageId ) |
|
1152 { |
|
1153 if ( !iIsUIConstructionCompleted ) |
|
1154 { |
|
1155 return; |
|
1156 } |
|
1157 |
|
1158 if ( aPageId == KEAPTTLSSETTINGSPAGE ) |
|
1159 { |
|
1160 if (iSettingListBox->ScrollBarFrame()) |
|
1161 { |
|
1162 iSettingListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(ETrue); |
|
1163 } |
|
1164 if (iEapTypesListBox->ScrollBarFrame()) |
|
1165 { |
|
1166 iEapTypesListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(EFalse); |
|
1167 } |
|
1168 if (iCipherSuiteListBox->ScrollBarFrame()) |
|
1169 { |
|
1170 iCipherSuiteListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(EFalse); |
|
1171 } |
|
1172 } |
|
1173 else if ( aPageId == KEAPTTLSEAPPAGE ) |
|
1174 { |
|
1175 if (iSettingListBox->ScrollBarFrame()) |
|
1176 { |
|
1177 iSettingListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(EFalse); |
|
1178 } |
|
1179 if (iEapTypesListBox->ScrollBarFrame()) |
|
1180 { |
|
1181 iEapTypesListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(ETrue); |
|
1182 } |
|
1183 if (iCipherSuiteListBox->ScrollBarFrame()) |
|
1184 { |
|
1185 iCipherSuiteListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(EFalse); |
|
1186 } |
|
1187 } |
|
1188 else if ( aPageId == KEAPTTLSCIPHERPAGE ) |
|
1189 { |
|
1190 if (iSettingListBox->ScrollBarFrame()) |
|
1191 { |
|
1192 iSettingListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(EFalse); |
|
1193 } |
|
1194 if (iEapTypesListBox->ScrollBarFrame()) |
|
1195 { |
|
1196 iEapTypesListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(EFalse); |
|
1197 } |
|
1198 if (iCipherSuiteListBox->ScrollBarFrame()) |
|
1199 { |
|
1200 iCipherSuiteListBox->ScrollBarFrame()->ComponentControl(0)->MakeVisible(ETrue); |
|
1201 } |
|
1202 } |
|
1203 |
|
1204 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
1205 if( aPageId == KEAPTTLSSETTINGSPAGE ) |
|
1206 { |
|
1207 cba.SetCommandSetL( R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_EDIT ); |
|
1208 } |
|
1209 else if( aPageId == KEAPTTLSEAPPAGE ) |
|
1210 { |
|
1211 cba.SetCommandSetL( R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_CONFIGURE ); |
|
1212 } |
|
1213 else if( aPageId == KEAPTTLSCIPHERPAGE ) |
|
1214 { |
|
1215 TInt index = iCipherSuiteListBox->CurrentItemIndex(); |
|
1216 if( ( *iUiCipherSuites )[ index ].iIsEnabled ) |
|
1217 { |
|
1218 cba.SetCommandSetL( R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_DISABLE ); |
|
1219 } |
|
1220 else |
|
1221 { |
|
1222 cba.SetCommandSetL( R_TTLS_UI_SOFTKEYS_OPTIONS_BACK_ENABLE ); |
|
1223 } |
|
1224 } |
|
1225 cba.DrawDeferred(); |
|
1226 } |
|
1227 |
|
1228 |
|
1229 // ----------------------------------------------------------------------------- |
|
1230 // CEapTtlsUiDialog::ShowSettingPageL |
|
1231 // ----------------------------------------------------------------------------- |
|
1232 // |
|
1233 void CEapTtlsUiDialog::ShowSettingPageL( TInt aCalledFromMenu ) |
|
1234 { |
|
1235 TInt index = iSettingListBox->CurrentItemIndex(); |
|
1236 if ( index == EUserCertificateItem ) |
|
1237 { |
|
1238 TInt activeUserCertificate = CheckActiveUserCertificate(); |
|
1239 CDesCArrayFlat* tempArray = new( ELeave )CDesCArrayFlat( |
|
1240 KCertificateArrayGranularity ); |
|
1241 CleanupStack::PushL( tempArray ); |
|
1242 |
|
1243 TDesC* noneText = iEikonEnv->AllocReadResourceLC( |
|
1244 R_TTLS_NONE_SELECTION ); |
|
1245 tempArray->InsertL( 0, *noneText ); |
|
1246 CleanupStack::PopAndDestroy( noneText ); |
|
1247 |
|
1248 for ( TInt i = 0; i < iUiUserCertificates->Count() ; i++ ) |
|
1249 { |
|
1250 TEapTlsPeapUiCertificate certificate = |
|
1251 iUiUserCertificates->At( i ); |
|
1252 SCertEntry entry = certificate.iCertEntry; |
|
1253 TBuf<KMaxFullCertLabelLength> text; |
|
1254 GetFullCertLabelL( entry, text); |
|
1255 tempArray->InsertL( i+1, text ); |
|
1256 } |
|
1257 TInt selected( 0 ); |
|
1258 if ( activeUserCertificate == KErrNotFound ) |
|
1259 { |
|
1260 selected = ShowRadioButtonSettingPageL( R_TTLS_USER_CERT_STRING, |
|
1261 tempArray, 0 ); |
|
1262 } |
|
1263 else |
|
1264 { |
|
1265 selected = ShowRadioButtonSettingPageL( R_TTLS_USER_CERT_STRING, |
|
1266 tempArray, |
|
1267 activeUserCertificate+1 ); |
|
1268 //Plus 1 cause we added 'none' selection |
|
1269 } |
|
1270 |
|
1271 CleanupStack::PopAndDestroy( tempArray ); |
|
1272 UserCertificateHouseKeeping( selected ); |
|
1273 iCertificates->Update(); |
|
1274 DrawSettingsListL(); // List must be drawn again at this stage |
|
1275 } |
|
1276 else if ( index == ECaCertificateItem ) |
|
1277 { |
|
1278 TInt activeCaCertificate = CheckActiveCaCertificate(); |
|
1279 |
|
1280 CDesCArrayFlat* tempArray = new( ELeave )CDesCArrayFlat( |
|
1281 KCertificateArrayGranularity ); |
|
1282 CleanupStack::PushL( tempArray ); |
|
1283 |
|
1284 TDesC* noneText = iEikonEnv->AllocReadResourceLC( |
|
1285 R_TTLS_NONE_SELECTION ); |
|
1286 tempArray->InsertL( 0, *noneText ); |
|
1287 CleanupStack::PopAndDestroy( noneText ); |
|
1288 |
|
1289 for ( TInt i = 0; i < iUiCACertificates->Count(); i++ ) |
|
1290 { |
|
1291 TEapTlsPeapUiCertificate certificate = iUiCACertificates->At( i ); |
|
1292 SCertEntry entry = certificate.iCertEntry; |
|
1293 TBuf<KMaxFullCertLabelLength> text; |
|
1294 GetFullCertLabelL( entry, text ); |
|
1295 tempArray->InsertL( i+1, text ); |
|
1296 } |
|
1297 |
|
1298 TInt selected( 0 ); |
|
1299 if ( activeCaCertificate == KErrNotFound ) |
|
1300 { |
|
1301 selected = ShowRadioButtonSettingPageL( R_TTLS_CA_CERT_STRING, |
|
1302 tempArray, 0 ); |
|
1303 } |
|
1304 else |
|
1305 { |
|
1306 selected = ShowRadioButtonSettingPageL( R_TTLS_CA_CERT_STRING, |
|
1307 tempArray, |
|
1308 activeCaCertificate+1 ); |
|
1309 //Plus 1 cause we added 'none' selection |
|
1310 } |
|
1311 CleanupStack::PopAndDestroy( tempArray ); |
|
1312 CaCertificateHouseKeeping( selected ); |
|
1313 iCertificates->Update(); |
|
1314 DrawSettingsListL(); // List must be drawn again at this stage |
|
1315 } |
|
1316 else |
|
1317 { |
|
1318 CAknSettingItem* item = iSettingArray->Array()->At( index ); |
|
1319 item->EditItemL( aCalledFromMenu ); |
|
1320 item->StoreL(); |
|
1321 } |
|
1322 |
|
1323 DrawNow(); |
|
1324 } |
|
1325 |
|
1326 |
|
1327 // ----------------------------------------------------------------------------- |
|
1328 // CEapPeapUiDialog::MoveEapTypeL |
|
1329 // ----------------------------------------------------------------------------- |
|
1330 // |
|
1331 void CEapTtlsUiDialog::MoveEapTypeL( TInt aOldPos, TInt aNewPos ) |
|
1332 { |
|
1333 TEapTlsPeapUiEapType originalUpper = iUiEapTypes->At( aOldPos ); |
|
1334 iUiEapTypes->Delete( aOldPos ); |
|
1335 iUiEapTypes->InsertL( aNewPos, originalUpper ); |
|
1336 iUiEapTypes->Compress(); // Might not be needed |
|
1337 iEapTypes->Update(); |
|
1338 DrawEapListL( aNewPos ); |
|
1339 } |
|
1340 |
|
1341 |
|
1342 // ----------------------------------------------------------------------------- |
|
1343 // CEapTtlsUiDialog::DrawEapListL |
|
1344 // ----------------------------------------------------------------------------- |
|
1345 // |
|
1346 void CEapTtlsUiDialog::DrawEapListL( TInt aWantedIndex ) |
|
1347 { |
|
1348 iEapTypeViewArray->Reset(); |
|
1349 RImplInfoPtrArray eapArray; |
|
1350 eapArray.Reset(); |
|
1351 |
|
1352 REComSession::ListImplementationsL( KEapTypeInterfaceUid, eapArray ); |
|
1353 for ( TInt i = 0; i < iUiEapTypes->Count(); i++ ) |
|
1354 { |
|
1355 TBuf<KMaxLengthOfEapLine> tempLine; |
|
1356 |
|
1357 if ( iUiEapTypes->At( i ).iIsEnabled ) |
|
1358 { |
|
1359 _LIT( KNumTab, "%d\t" ); |
|
1360 tempLine.AppendFormat( KNumTab, i+1 ); |
|
1361 } |
|
1362 else |
|
1363 { |
|
1364 _LIT( KTab, "\t" ); |
|
1365 tempLine.Append( KTab ); |
|
1366 } |
|
1367 |
|
1368 for ( TInt index = 0; index < eapArray.Count(); index++ ) |
|
1369 { |
|
1370 if ( eapArray[index]->DataType() == iUiEapTypes->At( i ).iEapType ) |
|
1371 { |
|
1372 tempLine.Append( eapArray[index]->DisplayName() ); |
|
1373 break; |
|
1374 } |
|
1375 } |
|
1376 |
|
1377 if ( iUiEapTypes->At( i ).iIsEnabled ) |
|
1378 { // Add mark icon to indicate that the eap type is enabled |
|
1379 _LIT( KTab0, "\t0" ); |
|
1380 tempLine.Append( KTab0 ); |
|
1381 } |
|
1382 |
|
1383 iEapTypeViewArray->InsertL( i, tempLine ); |
|
1384 } |
|
1385 |
|
1386 eapArray.ResetAndDestroy(); |
|
1387 iEapTypesListBox->Model()->SetItemTextArray( iEapTypeViewArray ); |
|
1388 iEapTypesListBox->HandleItemAdditionL(); |
|
1389 iEapTypesListBox->SetCurrentItemIndex( aWantedIndex ); |
|
1390 iEapTypesListBox->DrawDeferred(); |
|
1391 iEapTypesListBox->UpdateScrollBarsL(); |
|
1392 } |
|
1393 |
|
1394 |
|
1395 // ----------------------------------------------------------------------------- |
|
1396 // CEapTtlsUiDialog::ShowRadioButtonSettingPageL |
|
1397 // ----------------------------------------------------------------------------- |
|
1398 // |
|
1399 TInt CEapTtlsUiDialog::ShowRadioButtonSettingPageL( TInt aTitle, |
|
1400 CDesCArrayFlat* aValues, |
|
1401 TInt aCurrentItem ) |
|
1402 { |
|
1403 // title of the dialog |
|
1404 HBufC* title = iCoeEnv->AllocReadResourceLC( aTitle ); |
|
1405 |
|
1406 // We have everything to create dialog |
|
1407 CAknRadioButtonSettingPage* dlg = new( ELeave )CAknRadioButtonSettingPage( |
|
1408 R_RADIO_BUTTON_SETTING_PAGE, |
|
1409 aCurrentItem, |
|
1410 aValues ); |
|
1411 CleanupStack::PushL( dlg ); |
|
1412 dlg->SetSettingTextL( *title ); |
|
1413 CleanupStack::Pop( dlg ); |
|
1414 dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
1415 CleanupStack::PopAndDestroy( title ); // title |
|
1416 // index must be re-turned upside down, because options list is upside down |
|
1417 return aCurrentItem; |
|
1418 } |
|
1419 |
|
1420 |
|
1421 // ----------------------------------------------------------------------------- |
|
1422 // CEapTtlsUiDialog::DrawCipherSuitesL |
|
1423 // ----------------------------------------------------------------------------- |
|
1424 // |
|
1425 void CEapTtlsUiDialog::DrawCipherSuitesL() |
|
1426 { |
|
1427 iCipherSuitesViewArray->Reset(); |
|
1428 TInt listCount( 0 ); |
|
1429 TBuf<KMaxLengthOfSuiteName> temp; |
|
1430 for ( TInt i = 0; i < iUiCipherSuites->Count(); i++ ) |
|
1431 { |
|
1432 temp.Zero(); |
|
1433 _LIT( KTab, "\t" ); |
|
1434 temp.Append( KTab ); |
|
1435 |
|
1436 TEapTlsPeapUiCipherSuite suite = iUiCipherSuites->At( i ); |
|
1437 TUint32 suiteId = suite.iCipherSuite; |
|
1438 |
|
1439 switch( suiteId ) |
|
1440 { |
|
1441 case 0x0004: |
|
1442 { |
|
1443 HBufC* suite = iCoeEnv->AllocReadResourceLC( |
|
1444 R_TTLS_SUITE_RSARC4MD5 ); |
|
1445 temp.Append( *suite ); |
|
1446 CleanupStack::PopAndDestroy( suite ); |
|
1447 break; |
|
1448 } |
|
1449 |
|
1450 case 0x0005: |
|
1451 { |
|
1452 HBufC* suite = iCoeEnv->AllocReadResourceLC( |
|
1453 R_TTLS_SUITE_RSARC4SHA ); |
|
1454 temp.Append( *suite ); |
|
1455 CleanupStack::PopAndDestroy( suite ); |
|
1456 break; |
|
1457 } |
|
1458 |
|
1459 case 0x000a: |
|
1460 { |
|
1461 HBufC* suite = iCoeEnv->AllocReadResourceLC( |
|
1462 R_TTLS_SUITE_RSA3DESSHA ); |
|
1463 temp.Append( *suite ); |
|
1464 CleanupStack::PopAndDestroy( suite ); |
|
1465 break; |
|
1466 } |
|
1467 |
|
1468 case 0x0016: |
|
1469 { |
|
1470 HBufC* suite = iCoeEnv->AllocReadResourceLC( |
|
1471 R_TTLS_SUITE_DHERSA3DESSHA ); |
|
1472 temp.Append( *suite ); |
|
1473 CleanupStack::PopAndDestroy( suite ); |
|
1474 break; |
|
1475 } |
|
1476 |
|
1477 case 0x0013: |
|
1478 { |
|
1479 HBufC* suite = iCoeEnv->AllocReadResourceLC( |
|
1480 R_TTLS_SUITE_DHEDSS3DESSHA ); |
|
1481 temp.Append( *suite ); |
|
1482 CleanupStack::PopAndDestroy( suite ); |
|
1483 break; |
|
1484 } |
|
1485 |
|
1486 case 0x002F: |
|
1487 { |
|
1488 HBufC* suite = iCoeEnv->AllocReadResourceLC( |
|
1489 R_TTLS_SUITE_RSAAESSHA ); |
|
1490 temp.Append( *suite ); |
|
1491 CleanupStack::PopAndDestroy( suite ); |
|
1492 break; |
|
1493 } |
|
1494 |
|
1495 case 0x0032: |
|
1496 { |
|
1497 HBufC* suite = iCoeEnv->AllocReadResourceLC( |
|
1498 R_TTLS_SUITE_DHERSAAESSHA ); |
|
1499 temp.Append( *suite ); |
|
1500 CleanupStack::PopAndDestroy( suite ); |
|
1501 break; |
|
1502 } |
|
1503 |
|
1504 case 0x0033: |
|
1505 { |
|
1506 HBufC* suite = iCoeEnv->AllocReadResourceLC( |
|
1507 R_TTLS_SUITE_DHEDSSAESSHA ); |
|
1508 temp.Append( *suite ); |
|
1509 CleanupStack::PopAndDestroy( suite ); |
|
1510 break; |
|
1511 } |
|
1512 |
|
1513 default: |
|
1514 { |
|
1515 temp.Append( KEmptyString ); |
|
1516 break; |
|
1517 } |
|
1518 } |
|
1519 |
|
1520 if ( iUiCipherSuites->At( i ).iIsEnabled ) |
|
1521 { // Add mark icon to indicate that the suite is enabled |
|
1522 _LIT( KTab0, "\t0" ); |
|
1523 temp.Append( KTab0 ); |
|
1524 } |
|
1525 |
|
1526 iCipherSuitesViewArray->InsertL( listCount, temp ); |
|
1527 listCount++; |
|
1528 } |
|
1529 |
|
1530 iCipherSuiteListBox->Model()->SetItemTextArray( iCipherSuitesViewArray ); |
|
1531 iCipherSuiteListBox->HandleItemAdditionL(); |
|
1532 iCipherSuiteListBox->DrawDeferred(); |
|
1533 iCipherSuiteListBox->UpdateScrollBarsL(); |
|
1534 } |
|
1535 |
|
1536 |
|
1537 // ----------------------------------------------------------------------------- |
|
1538 // CEapTtlsUiDialog::CheckActiveUserCertificate |
|
1539 // ----------------------------------------------------------------------------- |
|
1540 // |
|
1541 TInt CEapTtlsUiDialog::CheckActiveUserCertificate() |
|
1542 { |
|
1543 for ( TInt i = 0; i < iUiUserCertificates->Count(); i++ ) |
|
1544 { |
|
1545 if ( iUiUserCertificates->At( i ).iIsEnabled ) |
|
1546 { |
|
1547 return i; |
|
1548 } |
|
1549 } |
|
1550 |
|
1551 return KErrNotFound; |
|
1552 } |
|
1553 |
|
1554 |
|
1555 // ----------------------------------------------------------------------------- |
|
1556 // CEapTtlsUiDialog::CheckActiveCaCertificate |
|
1557 // ----------------------------------------------------------------------------- |
|
1558 // |
|
1559 TInt CEapTtlsUiDialog::CheckActiveCaCertificate() |
|
1560 { |
|
1561 for ( TInt i = 0; i < iUiCACertificates->Count(); i++ ) |
|
1562 { |
|
1563 if ( iUiCACertificates->At( i ).iIsEnabled ) |
|
1564 { |
|
1565 return i; |
|
1566 } |
|
1567 } |
|
1568 |
|
1569 return KErrNotFound; |
|
1570 } |
|
1571 |
|
1572 |
|
1573 // ----------------------------------------------------------------------------- |
|
1574 // CEapTtlsUiDialog::UserCertificateHouseKeeping |
|
1575 // ----------------------------------------------------------------------------- |
|
1576 // |
|
1577 void CEapTtlsUiDialog::UserCertificateHouseKeeping( TInt aSelected ) |
|
1578 { |
|
1579 for ( TInt i = 0; i < iUiUserCertificates->Count(); i++ ) |
|
1580 { |
|
1581 iUiUserCertificates->At( i ).iIsEnabled = EFalse; |
|
1582 } |
|
1583 |
|
1584 if ( aSelected != 0 ) // Zero index is none |
|
1585 { |
|
1586 iUiUserCertificates->At( aSelected-1 ).iIsEnabled = ETrue; |
|
1587 } |
|
1588 } |
|
1589 |
|
1590 |
|
1591 // ----------------------------------------------------------------------------- |
|
1592 // CEapTtlsUiDialog::CaCertificateHouseKeeping |
|
1593 // ----------------------------------------------------------------------------- |
|
1594 // |
|
1595 void CEapTtlsUiDialog::CaCertificateHouseKeeping( TInt aSelected ) |
|
1596 { |
|
1597 for ( TInt i = 0; i < iUiCACertificates->Count(); i++ ) |
|
1598 { |
|
1599 iUiCACertificates->At( i ).iIsEnabled = EFalse; |
|
1600 } |
|
1601 |
|
1602 if ( aSelected != 0 ) // Zero index is none |
|
1603 { |
|
1604 iUiCACertificates->At( aSelected-1 ).iIsEnabled = ETrue; |
|
1605 } |
|
1606 } |
|
1607 |
|
1608 |
|
1609 // ----------------------------------------------------------------------------- |
|
1610 // CEapTtlsUiDialog::CreateEapTypeDataBaseL |
|
1611 // ----------------------------------------------------------------------------- |
|
1612 // |
|
1613 void CEapTtlsUiDialog::CreateEapTypeDataBaseL() |
|
1614 { |
|
1615 RImplInfoPtrArray eapArray; |
|
1616 eapArray.Reset(); |
|
1617 |
|
1618 REComSession::ListImplementationsL( KEapTypeInterfaceUid, eapArray ); |
|
1619 TInt allowedInTtlsCount( 0 ); |
|
1620 for ( TInt i = 0; i < eapArray.Count(); i++ ) |
|
1621 { |
|
1622 if ( !CEapType::IsDisallowedInsideTTLS(*eapArray[i]) ) |
|
1623 { |
|
1624 CImplementationInformation* info = eapArray[i]; |
|
1625 TEapTlsPeapUiEapType tempEapType; |
|
1626 tempEapType.iEapType = info->DataType(); |
|
1627 |
|
1628 // BINARY RESOURCE DATA |
|
1629 |
|
1630 // [FE] [00 00 00] [TEapType_bigendian] |
|
1631 // OR |
|
1632 // [FE] [FF FF FF] [MSCHAPv2_bigendian] |
|
1633 |
|
1634 _LIT8( KExpEapFirstQuad, "\xFE\0\0\0" ); |
|
1635 TPtrC8 firstQuad( tempEapType.iEapType.Ptr(), 4 ); |
|
1636 // TUint32 dataType = BigEndian::Get32( tempEapType.iEapType.Ptr()+4 ); |
|
1637 TUint32 dataType = ( tempEapType.iEapType[4] << 24 ) | |
|
1638 ( tempEapType.iEapType[5] << 16 ) | |
|
1639 ( tempEapType.iEapType[6] << 8 ) | |
|
1640 tempEapType.iEapType[7]; |
|
1641 |
|
1642 |
|
1643 if ( !firstQuad.Compare( KExpEapFirstQuad ) && |
|
1644 ( dataType == EAPSettings::EEapSim || |
|
1645 dataType == EAPSettings::EEapAka ) ) |
|
1646 { |
|
1647 tempEapType.iIsEnabled = ETrue; |
|
1648 iUiEapTypes->InsertL( KFirstElement, tempEapType ); |
|
1649 } |
|
1650 else |
|
1651 { |
|
1652 tempEapType.iIsEnabled = EFalse; |
|
1653 iUiEapTypes->InsertL( allowedInTtlsCount, tempEapType ); |
|
1654 } |
|
1655 |
|
1656 allowedInTtlsCount++; |
|
1657 } |
|
1658 } |
|
1659 |
|
1660 __ASSERT_DEBUG( iUiEapTypes->Count() >= 2, User::Panic( _L("EAP-SIM/AKA missing"), 1) ); |
|
1661 |
|
1662 // Check if EAP-SIM and EAP-AKA are in correct order |
|
1663 |
|
1664 // BINARY RESOURCE DATA |
|
1665 const TDesC8& firstEap = iUiEapTypes->At( KFirstElement ).iEapType; |
|
1666 const TDesC8& secondEap = iUiEapTypes->At( KSecondElement ).iEapType; |
|
1667 |
|
1668 TUint32 dataTypeFirst = ( firstEap[4] << 24 ) | |
|
1669 ( firstEap[5] << 16 ) | |
|
1670 ( firstEap[6] << 8 ) | |
|
1671 firstEap[7]; |
|
1672 TUint32 dataTypeSecond = ( secondEap[4] << 24 ) | |
|
1673 ( secondEap[5] << 16 ) | |
|
1674 ( secondEap[6] << 8 ) | |
|
1675 secondEap[7]; |
|
1676 |
|
1677 // If not, switch them |
|
1678 if ( dataTypeFirst == EAPSettings::EEapAka && |
|
1679 dataTypeSecond == EAPSettings::EEapSim ) |
|
1680 { |
|
1681 TEapTlsPeapUiEapType tempEapType = iUiEapTypes->At( KFirstElement ); |
|
1682 iUiEapTypes->Delete( KFirstElement ); |
|
1683 iUiEapTypes->InsertL( KSecondElement, tempEapType ); |
|
1684 } |
|
1685 |
|
1686 iEapTypes->Update(); |
|
1687 eapArray.ResetAndDestroy(); |
|
1688 } |
|
1689 |
|
1690 |
|
1691 // ----------------------------------------------------------------------------- |
|
1692 // CEapTtlsUiDialog::SetCipherIconsL |
|
1693 // ----------------------------------------------------------------------------- |
|
1694 // |
|
1695 void CEapTtlsUiDialog::SetCipherIconsL() |
|
1696 { |
|
1697 CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( 1 ); |
|
1698 CleanupStack::PushL( icons ); |
|
1699 |
|
1700 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
1701 |
|
1702 CGulIcon* icon = CGulIcon::NewLC(); |
|
1703 CFbsBitmap* bitmap = NULL; |
|
1704 CFbsBitmap* mask = NULL; |
|
1705 AknsUtils::CreateColorIconL( skinInstance, |
|
1706 KAknsIIDQgnIndiMarkedAdd, |
|
1707 KAknsIIDQsnIconColors, |
|
1708 EAknsCIQsnIconColorsCG13, |
|
1709 bitmap, |
|
1710 mask, |
|
1711 AknIconUtils::AvkonIconFileName(), |
|
1712 EMbmAvkonQgn_indi_marked_add, |
|
1713 EMbmAvkonQgn_indi_marked_add_mask, |
|
1714 KRgbBlack ); |
|
1715 icon->SetBitmap( bitmap ); |
|
1716 icon->SetMask( mask ); |
|
1717 icons->AppendL( icon ); |
|
1718 |
|
1719 CleanupStack::Pop( icon ); |
|
1720 CleanupStack::Pop( icons ); // icons |
|
1721 |
|
1722 iCipherSuiteListBox->ItemDrawer()->ColumnData()->SetIconArray( icons ); |
|
1723 |
|
1724 } |
|
1725 |
|
1726 |
|
1727 // ----------------------------------------------------------------------------- |
|
1728 // CEapTtlsUiDialog::SetEapIconsL |
|
1729 // ----------------------------------------------------------------------------- |
|
1730 // |
|
1731 void CEapTtlsUiDialog::SetEapIconsL() |
|
1732 { |
|
1733 CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( 1 ); |
|
1734 CleanupStack::PushL( icons ); |
|
1735 |
|
1736 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
1737 |
|
1738 CGulIcon* icon = CGulIcon::NewLC(); |
|
1739 CFbsBitmap* bitmap = NULL; |
|
1740 CFbsBitmap* mask = NULL; |
|
1741 AknsUtils::CreateColorIconL( skinInstance, |
|
1742 KAknsIIDQgnIndiMarkedAdd, |
|
1743 KAknsIIDQsnIconColors, |
|
1744 EAknsCIQsnIconColorsCG13, |
|
1745 bitmap, |
|
1746 mask, |
|
1747 AknIconUtils::AvkonIconFileName(), |
|
1748 EMbmAvkonQgn_indi_marked_add, |
|
1749 EMbmAvkonQgn_indi_marked_add_mask, |
|
1750 KRgbBlack ); |
|
1751 icon->SetBitmap( bitmap ); |
|
1752 icon->SetMask( mask ); |
|
1753 icons->AppendL( icon ); |
|
1754 |
|
1755 CleanupStack::Pop( icon ); |
|
1756 CleanupStack::Pop( icons ); // icons |
|
1757 |
|
1758 iEapTypesListBox->ItemDrawer()->ColumnData()->SetIconArray( icons ); |
|
1759 } |
|
1760 |
|
1761 |
|
1762 // ----------------------------------------------------------------------------- |
|
1763 // CEapTtlsUiDialog::GetEnabledEapTypeCount |
|
1764 // ----------------------------------------------------------------------------- |
|
1765 // |
|
1766 TUint CEapTtlsUiDialog::GetEnabledEapTypeCount() |
|
1767 { |
|
1768 TUint itemCount( 0 ); |
|
1769 for( TInt i( 0 ); i < iUiEapTypes->Count(); ++i ) |
|
1770 { |
|
1771 if( iUiEapTypes->At( i ).iIsEnabled ) |
|
1772 { |
|
1773 ++itemCount; |
|
1774 } |
|
1775 } |
|
1776 return itemCount; |
|
1777 } |
|
1778 |
|
1779 |
|
1780 // ----------------------------------------------------------------------------- |
|
1781 // CEapTtlsUiDialog::IsPlainMschapv2Enabled |
|
1782 // ----------------------------------------------------------------------------- |
|
1783 // |
|
1784 TBool CEapTtlsUiDialog::IsPlainMschapv2Enabled() |
|
1785 { |
|
1786 TBool isEnabled( EFalse ); |
|
1787 for( TUint i( 0 ); i < iUiEapTypes->Count(); ++i ) |
|
1788 { |
|
1789 // was: _LIT8( KPlainMsChapV2ExpandedId, "\xFE\xFF\xFF\xFF\0\0\0\x1A" ); |
|
1790 // workaround: |
|
1791 _LIT8( KPlainMsChapV2ExpandedId, "\xFE\xFF\xFF\xFF\0\0\0\x63" ); |
|
1792 |
|
1793 const TDesC8& currEap = iUiEapTypes->At( i ).iEapType; |
|
1794 |
|
1795 if ( !currEap.Compare( KPlainMsChapV2ExpandedId ) ) |
|
1796 { |
|
1797 isEnabled = iUiEapTypes->At( i ).iIsEnabled; |
|
1798 break; |
|
1799 } |
|
1800 |
|
1801 } |
|
1802 return isEnabled; |
|
1803 } |
|
1804 |
|
1805 // ----------------------------------------------------------------------------- |
|
1806 // CEapTtlsUiDialog::IsPapEnabled |
|
1807 // ----------------------------------------------------------------------------- |
|
1808 // |
|
1809 TBool CEapTtlsUiDialog::IsPapEnabled() |
|
1810 { |
|
1811 TBool isEnabled( EFalse ); |
|
1812 for( TUint i( 0 ); i < iUiEapTypes->Count(); ++i ) |
|
1813 { |
|
1814 _LIT8( KPapExpandedId, "\xFE\xFF\xFF\xFF\0\0\0\x62" ); |
|
1815 const TDesC8& currEap = iUiEapTypes->At( i ).iEapType; |
|
1816 if ( !currEap.Compare( KPapExpandedId ) ) |
|
1817 { |
|
1818 isEnabled = iUiEapTypes->At( i ).iIsEnabled; |
|
1819 break; |
|
1820 } |
|
1821 } |
|
1822 return isEnabled; |
|
1823 } |
|
1824 |
|
1825 |
|
1826 // ----------------------------------------------------------------------------- |
|
1827 // CEapTtlsUiDialog::GetHelpContext |
|
1828 // ----------------------------------------------------------------------------- |
|
1829 // |
|
1830 void CEapTtlsUiDialog::GetHelpContext( TCoeHelpContext& aContext ) const |
|
1831 { |
|
1832 aContext.iMajor = KHelpUidPlugin; |
|
1833 TPageIds index = static_cast<TPageIds>( ActivePageIndex() ); |
|
1834 switch ( index ) |
|
1835 { |
|
1836 case EEapTypePage: |
|
1837 { |
|
1838 aContext.iContext = KSET_HLP_WLAN_EAP_TTLS_TYPES; |
|
1839 break; |
|
1840 } |
|
1841 |
|
1842 case ECipherSuitePage: |
|
1843 { |
|
1844 aContext.iContext = KSET_HLP_WLAN_EAP_TTLS_SUITES; |
|
1845 break; |
|
1846 } |
|
1847 |
|
1848 default: |
|
1849 { |
|
1850 aContext.iContext = KSET_HLP_WLAN_EAP_TTLS_SETT; |
|
1851 break; |
|
1852 } |
|
1853 } |
|
1854 } |
|
1855 |
|
1856 |
|
1857 void CEapTtlsUiDialog::GetFullCertLabelL( const SCertEntry& aCert, |
|
1858 TDes& aFullLabel ) |
|
1859 { |
|
1860 TInt length = 0; |
|
1861 |
|
1862 // For label. |
|
1863 length += aCert.iLabel.Length(); |
|
1864 |
|
1865 // For separator between label and primary name. |
|
1866 length += KNameSeparator.iTypeLength; |
|
1867 |
|
1868 // For primary name. |
|
1869 length += aCert.iPrimaryName.Length(); |
|
1870 |
|
1871 if ( !( aCert.iLabel.Length() ) ) |
|
1872 { |
|
1873 // For secondary name. |
|
1874 length += aCert.iSecondaryName.Length(); |
|
1875 } |
|
1876 |
|
1877 if( length > aFullLabel.MaxLength() ) |
|
1878 { |
|
1879 #if defined(_DEBUG) || defined(DEBUG) |
|
1880 RDebug::Print(_L("CEapTtlsUiDialog::GetFullCertLabelL - ERROR! Length Mismatch in Certificate's full name\n") ); |
|
1881 #endif |
|
1882 } |
|
1883 |
|
1884 HBufC* label = HBufC::NewL( length ); |
|
1885 label->Des().Append( aCert.iLabel ); |
|
1886 |
|
1887 label->Des().Append( KNameSeparator ); |
|
1888 label->Des().Append( aCert.iPrimaryName ); |
|
1889 |
|
1890 if ( !( aCert.iLabel.Length() ) ) |
|
1891 { |
|
1892 // Secondary name, only if no label. Certificate manager does the same way. |
|
1893 label->Des().Append( aCert.iSecondaryName ); |
|
1894 } |
|
1895 |
|
1896 aFullLabel.Copy( label->Des().Left( aFullLabel.MaxLength() ) ); |
|
1897 |
|
1898 delete label; |
|
1899 label = NULL; |
|
1900 } |
|
1901 |
|
1902 |
|
1903 // End of file |