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