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