|
1 /* |
|
2 * Copyright (c) 2006 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 "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: Dialog for editing wlan settings for a wlan connection method |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <badesca.h> |
|
19 #include <cmcommonui.h> |
|
20 #include <WEPSecuritySettingsUI.h> |
|
21 #include <WPASecuritySettingsUI.h> |
|
22 #include <wapisecuritysettingsui.h> |
|
23 #include <StringLoader.h> |
|
24 #include <akntextsettingpage.h> |
|
25 #include <cmwlanui.rsg> |
|
26 #include <ConnectionUiUtilities.h> |
|
27 #include <csxhelp/cp.hlp.hrh> |
|
28 #include <featmgr.h> |
|
29 #include "cmlogger.h" |
|
30 #include "cmwlancommonconstants.h" |
|
31 #include "cmpwlansettingsdlg.h" |
|
32 #include "cmpwlansettingsdlgadv.h" |
|
33 #include <cmpluginwlandef.h> |
|
34 #include "cmpluginwlan.h" |
|
35 #include "cmpluginmenucommands.hrh" |
|
36 #include <cmcommonconstants.h> |
|
37 #include <cmpsettingsconsts.h> |
|
38 #include "cmmanagerimpl.h" |
|
39 |
|
40 using namespace CMManager; |
|
41 |
|
42 const TUint32 KScanSSIDSelectionItems[] = |
|
43 { |
|
44 R_QTN_WLAN_SETT_HIDDEN_NETWORK_NO, |
|
45 R_QTN_WLAN_SETT_HIDDEN_NETWORK_YES, |
|
46 0 |
|
47 }; |
|
48 |
|
49 const TUint32 KSecModeRBSelectionItems[] = |
|
50 { |
|
51 R_QTN_WLAN_SETT_SECURITY_MODE_OPEN, |
|
52 R_QTN_WLAN_SETT_SECURITY_MODE_WEP, |
|
53 0 |
|
54 }; |
|
55 |
|
56 const TUint32 KSecModeRBIRSelectionItems[] = |
|
57 { |
|
58 R_QTN_WLAN_SETT_SECURITY_MODE_OPEN, |
|
59 R_QTN_WLAN_SETT_SECURITY_MODE_WEP, |
|
60 R_QTN_WLAN_SETT_SECURITY_MODE_802_1X, |
|
61 R_QTN_WLAN_SETT_SECURITY_MODE_WPA, |
|
62 0 |
|
63 }; |
|
64 |
|
65 const TUint32 KSecModeRBIRSelectionItemsWAPI[] = |
|
66 { |
|
67 R_QTN_WLAN_SETT_SECURITY_MODE_OPEN, |
|
68 R_QTN_WLAN_SETT_SECURITY_MODE_WEP, |
|
69 R_QTN_WLAN_SETT_SECURITY_MODE_802_1X, |
|
70 R_QTN_WLAN_SETT_SECURITY_MODE_WPA, |
|
71 R_QTN_WLAN_SETT_SECURITY_MODE_WAPI, |
|
72 0 |
|
73 }; |
|
74 |
|
75 const TUint32 KNetworkRBSelectionItems[] = |
|
76 { |
|
77 R_QTN_WLAN_SETT_NETWORK_MODE_INFRA, |
|
78 R_QTN_WLAN_SETT_NETWORK_MODE_ADHOC, |
|
79 0 |
|
80 }; |
|
81 |
|
82 const TUint32 KNWNameSelectionItems[] = |
|
83 { |
|
84 R_QTN_WLAN_SETT_NETWORK_NAME_USER_DEFINED, |
|
85 R_QTN_WLAN_SETT_NETWORK_NAME_SCAN, |
|
86 0 |
|
87 }; |
|
88 |
|
89 // ================= MEMBER FUNCTIONS ======================================= |
|
90 |
|
91 // -------------------------------------------------------------------------- |
|
92 // CmPluginWlanSettingsDlg::NewL() |
|
93 // -------------------------------------------------------------------------- |
|
94 // |
|
95 CmPluginWlanSettingsDlg* CmPluginWlanSettingsDlg::NewL( |
|
96 CCmPluginBaseEng& aCmPluginBase ) |
|
97 { |
|
98 CmPluginWlanSettingsDlg* self = |
|
99 new (ELeave) CmPluginWlanSettingsDlg( aCmPluginBase ); |
|
100 return self; |
|
101 } |
|
102 |
|
103 // -------------------------------------------------------------------------- |
|
104 // CmPluginWlanSettingsDlg::CmPluginWlanSettingsDlg() |
|
105 // -------------------------------------------------------------------------- |
|
106 // |
|
107 CmPluginWlanSettingsDlg::CmPluginWlanSettingsDlg( |
|
108 CCmPluginBaseEng& aCmPluginBase ) |
|
109 : CmPluginBaseSettingsDlg( aCmPluginBase ) |
|
110 , iNotifyFromAdv( KCmNotifiedNone ) |
|
111 { |
|
112 |
|
113 } |
|
114 |
|
115 // -------------------------------------------------------------------------- |
|
116 // CmPluginWlanSettingsDlg::ConstructAndRunLD |
|
117 // -------------------------------------------------------------------------- |
|
118 // |
|
119 TInt CmPluginWlanSettingsDlg::ConstructAndRunLD( ) |
|
120 { |
|
121 // Set this flag to allow edit continue |
|
122 iCanEditingContinue = ETrue; |
|
123 |
|
124 CleanupStack::PushL( this ); |
|
125 LoadResourceL( KPluginWlanResDirAndFileName ); |
|
126 CleanupStack::Pop( this ); |
|
127 |
|
128 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
|
129 cmMgr.WatcherRegisterL( this ); |
|
130 |
|
131 return CmPluginBaseSettingsDlg::ConstructAndRunLD( ); |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------- |
|
135 // CmPluginWlanSettingsDlg::~CmPluginWlanSettingsDlg |
|
136 // Destructor |
|
137 // --------------------------------------------------------- |
|
138 // |
|
139 CmPluginWlanSettingsDlg::~CmPluginWlanSettingsDlg() |
|
140 { |
|
141 iResourceReader.Close(); |
|
142 } |
|
143 |
|
144 // -------------------------------------------------------------------------- |
|
145 // CmPluginWlanSettingsDlg::RunAdvancedSettingsL |
|
146 // -------------------------------------------------------------------------- |
|
147 // |
|
148 void CmPluginWlanSettingsDlg::RunAdvancedSettingsL() |
|
149 { |
|
150 CmPluginWlanSettingsDlgAdv* AdvDlg = |
|
151 CmPluginWlanSettingsDlgAdv::NewL( iCmPluginBaseEng ); |
|
152 |
|
153 if (!iHasSettingChanged) |
|
154 { |
|
155 iHasSettingChanged = ETrue; |
|
156 } |
|
157 |
|
158 // This view may have to un-register as watcher here |
|
159 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
|
160 cmMgr.WatcherUnRegister(); |
|
161 |
|
162 AdvDlg->RegisterParentView( this ); |
|
163 TInt ret = AdvDlg->ConstructAndRunLD(); |
|
164 |
|
165 if( iNotifyFromAdv == KCmNotifiedNone ) |
|
166 { |
|
167 if( ret == KDialogUserExit ) |
|
168 { |
|
169 iExitReason = KDialogUserExit; |
|
170 ExitSettingsL(EFalse); |
|
171 } |
|
172 else |
|
173 { |
|
174 // Re-register as watcher if advanced view comes back or exists normally |
|
175 cmMgr.WatcherRegisterL( this ); |
|
176 } |
|
177 } |
|
178 else |
|
179 { |
|
180 HandleCommsDatChangeL(); |
|
181 } |
|
182 } |
|
183 |
|
184 // -------------------------------------------------------------------------- |
|
185 // CmPluginBaseSettingsDlg::UpdateListBoxContentBearerSpecificL |
|
186 // -------------------------------------------------------------------------- |
|
187 // |
|
188 void CmPluginWlanSettingsDlg::UpdateListBoxContentBearerSpecificL( |
|
189 CDesCArray& aItemArray ) |
|
190 { |
|
191 TBool boolSettingVal( EFalse ); // just for helping make code readable |
|
192 TInt valResId(0); |
|
193 |
|
194 // DATA BEARER - only for real bearer types |
|
195 AppendSettingTextsL( aItemArray, ECmBearerSettingName ); |
|
196 // NETWORK NAME |
|
197 AppendSettingTextsL( aItemArray, EWlanSSID ); |
|
198 // NETWORK STATUS |
|
199 boolSettingVal = iCmPluginBaseEng.GetBoolAttributeL( EWlanScanSSID ); |
|
200 AppendSettingTextsL( aItemArray, |
|
201 EWlanScanSSID, |
|
202 boolSettingVal ? |
|
203 R_QTN_WLAN_SETT_HIDDEN_NETWORK_YES : |
|
204 R_QTN_WLAN_SETT_HIDDEN_NETWORK_NO ); |
|
205 // WLAN NETWORK MODE |
|
206 switch( iCmPluginBaseEng.GetIntAttributeL( EWlanConnectionMode ) ) |
|
207 { |
|
208 case EAdhoc: |
|
209 { |
|
210 valResId = R_QTN_WLAN_SETT_NETWORK_MODE_ADHOC; |
|
211 break; |
|
212 } |
|
213 case EInfra: |
|
214 // fall-through intended here |
|
215 default: |
|
216 { |
|
217 valResId = R_QTN_WLAN_SETT_NETWORK_MODE_INFRA; |
|
218 break; |
|
219 } |
|
220 } |
|
221 |
|
222 AppendSettingTextsL( aItemArray, EWlanConnectionMode, valResId ); |
|
223 // WLAN SECURITY MODE |
|
224 switch( iCmPluginBaseEng.GetIntAttributeL( EWlanSecurityMode ) ) |
|
225 { |
|
226 case EWlanSecModeWep : |
|
227 { |
|
228 valResId = R_QTN_WLAN_SETT_SECURITY_MODE_WEP; |
|
229 break; |
|
230 } |
|
231 case EWlanSecMode802_1x: |
|
232 { |
|
233 valResId = R_QTN_WLAN_SETT_SECURITY_MODE_802_1X; |
|
234 break; |
|
235 } |
|
236 case EWlanSecModeWpa: |
|
237 case EWlanSecModeWpa2: |
|
238 { |
|
239 valResId = R_QTN_WLAN_SETT_SECURITY_MODE_WPA; |
|
240 break; |
|
241 } |
|
242 case EWlanSecModeWAPI: |
|
243 { |
|
244 valResId = R_QTN_WLAN_SETT_SECURITY_MODE_WAPI; |
|
245 break; |
|
246 } |
|
247 case EWlanSecModeOpen: |
|
248 // fall-through intended here |
|
249 default: |
|
250 { |
|
251 valResId = R_QTN_WLAN_SETT_SECURITY_MODE_OPEN; |
|
252 break; |
|
253 } |
|
254 } |
|
255 AppendSettingTextsL( aItemArray, EWlanSecurityMode, valResId ); |
|
256 // WLAN SECURITY SETTINGS |
|
257 AppendSettingTextsL( aItemArray, |
|
258 EWlanSecuritySettings, |
|
259 R_QTN_WLAN_SETT_SECURITY_SETTINGS, |
|
260 0 ); |
|
261 // HOMEPAGE |
|
262 AppendSettingTextsL( aItemArray, ECmStartPage ); |
|
263 } |
|
264 |
|
265 |
|
266 //--------------------------------------------------------------------------- |
|
267 // CmPluginWlanSettingsDlg::ChangeBoolSettingL |
|
268 //--------------------------------------------------------------------------- |
|
269 // |
|
270 void CmPluginWlanSettingsDlg::ChangeBoolSettingL( TUint32 aAttribute, |
|
271 TInt aCommandId ) |
|
272 { |
|
273 // Change was selected from menu |
|
274 if ( aCommandId == EPluginBaseCmdChange ) |
|
275 { |
|
276 TInt selected = |
|
277 iCmPluginBaseEng.GetBoolAttributeL( aAttribute ); |
|
278 TInt origVal = selected; |
|
279 |
|
280 if ( ShowRadioButtonSettingPageL( KScanSSIDSelectionItems, |
|
281 selected, |
|
282 R_QTN_WLAN_SETT_HIDDEN_NETWORK ) && |
|
283 origVal != selected ) |
|
284 { |
|
285 iCmPluginBaseEng.SetBoolAttributeL( aAttribute, |
|
286 selected ); |
|
287 UpdateListBoxContentL(); |
|
288 } |
|
289 } |
|
290 // Selection key was selected |
|
291 else |
|
292 { |
|
293 switch ( aAttribute ) |
|
294 { |
|
295 case EWlanScanSSID: |
|
296 { |
|
297 TBool boolFromCM = EFalse; |
|
298 boolFromCM = iCmPluginBaseEng.GetBoolAttributeL( aAttribute ); |
|
299 iCmPluginBaseEng.SetBoolAttributeL( aAttribute , !boolFromCM ); |
|
300 UpdateListBoxContentL(); |
|
301 break; |
|
302 } |
|
303 case EWlanConnectionMode: |
|
304 { |
|
305 TInt intFromCM = 0; |
|
306 intFromCM = iCmPluginBaseEng.GetIntAttributeL( aAttribute ); |
|
307 iCmPluginBaseEng.SetIntAttributeL( aAttribute , !intFromCM ); |
|
308 UpdateListBoxContentL(); |
|
309 break; |
|
310 } |
|
311 } |
|
312 } |
|
313 } |
|
314 |
|
315 //--------------------------------------------------------------------------- |
|
316 // CmPluginWlanSettingsDlg::ShowSecurityModeRBPageL |
|
317 //--------------------------------------------------------------------------- |
|
318 // |
|
319 void CmPluginWlanSettingsDlg::ShowSecurityModeRBPageL() |
|
320 { |
|
321 TInt selected = 0; |
|
322 TInt secMode = iCmPluginBaseEng.GetIntAttributeL( EWlanSecurityMode ); |
|
323 const TUint32* items = NULL; |
|
324 |
|
325 //converting secMode to idex |
|
326 switch ( secMode ) |
|
327 { |
|
328 case EWlanSecModeOpen: |
|
329 { |
|
330 selected = 0; |
|
331 break; |
|
332 } |
|
333 case EWlanSecModeWep: |
|
334 { |
|
335 selected = 1; |
|
336 break; |
|
337 } |
|
338 case EWlanSecMode802_1x: |
|
339 { |
|
340 selected = 2; |
|
341 break; |
|
342 } |
|
343 case EWlanSecModeWpa: |
|
344 { |
|
345 selected = 3; |
|
346 break; |
|
347 } |
|
348 // is this a real case? |
|
349 case EWlanSecModeWpa2: |
|
350 { |
|
351 selected = 3; |
|
352 break; |
|
353 } |
|
354 case EWlanSecModeWAPI: |
|
355 { |
|
356 selected = 4; |
|
357 break; |
|
358 } |
|
359 default: |
|
360 { |
|
361 User::Leave( KErrNotSupported ); |
|
362 break; |
|
363 } |
|
364 } |
|
365 |
|
366 if ( iCmPluginBaseEng.GetIntAttributeL( EWlanConnectionMode ) == EInfra ) |
|
367 { |
|
368 if ( !FeatureManager::FeatureSupported( KFeatureIdFfWlanWapi ) ) |
|
369 { |
|
370 items = KSecModeRBIRSelectionItems; |
|
371 } |
|
372 else |
|
373 { |
|
374 items = KSecModeRBIRSelectionItemsWAPI; |
|
375 } |
|
376 } |
|
377 else |
|
378 { |
|
379 items = KSecModeRBSelectionItems; |
|
380 } |
|
381 |
|
382 TInt origVal = selected; |
|
383 if ( ShowRadioButtonSettingPageL( items, |
|
384 selected, |
|
385 R_QTN_WLAN_SETT_SECURITY_MODE ) && |
|
386 origVal != selected ) |
|
387 { |
|
388 if ( !iHasSettingChanged ) |
|
389 { |
|
390 iHasSettingChanged = ETrue; |
|
391 } |
|
392 |
|
393 switch ( selected ) |
|
394 { |
|
395 case 0: |
|
396 { |
|
397 secMode = EWlanSecModeOpen; |
|
398 break; |
|
399 } |
|
400 case 1: |
|
401 { |
|
402 secMode = EWlanSecModeWep; |
|
403 break; |
|
404 } |
|
405 case 2: |
|
406 { |
|
407 secMode = EWlanSecMode802_1x; |
|
408 break; |
|
409 } |
|
410 case 3: |
|
411 { |
|
412 secMode = EWlanSecModeWpa; |
|
413 break; |
|
414 } |
|
415 case 4: |
|
416 { |
|
417 secMode = EWlanSecModeWAPI; |
|
418 break; |
|
419 } |
|
420 default: |
|
421 { |
|
422 User::Leave( KErrNotSupported ); |
|
423 break; |
|
424 } |
|
425 } |
|
426 iCmPluginBaseEng.SetIntAttributeL( EWlanSecurityMode , secMode ); |
|
427 UpdateListBoxContentL(); |
|
428 } |
|
429 } |
|
430 |
|
431 //--------------------------------------------------------------------------- |
|
432 // CmPluginWlanSettingsDlg::ShowNetworkModeRBPageL |
|
433 //--------------------------------------------------------------------------- |
|
434 // |
|
435 void CmPluginWlanSettingsDlg:: ShowNetworkModeRBPageL() |
|
436 { |
|
437 const TUint32* items = KNetworkRBSelectionItems; |
|
438 |
|
439 TInt selected; |
|
440 |
|
441 // convert values to indices for UI |
|
442 TInt netMode = iCmPluginBaseEng.GetIntAttributeL( EWlanConnectionMode ); |
|
443 switch ( netMode ) |
|
444 { |
|
445 case EAdhoc: |
|
446 { |
|
447 selected = 1; |
|
448 break; |
|
449 } |
|
450 case EInfra: |
|
451 { |
|
452 selected = 0; |
|
453 break; |
|
454 } |
|
455 } |
|
456 |
|
457 TInt origVal = selected; |
|
458 if ( ShowRadioButtonSettingPageL( items, |
|
459 selected, |
|
460 R_QTN_WLAN_SETT_NETWORK_MODE ) && |
|
461 origVal != selected ) |
|
462 { |
|
463 // convert indices back to proper values |
|
464 switch ( selected ) |
|
465 { |
|
466 case 0: |
|
467 { |
|
468 netMode = EInfra; |
|
469 break; |
|
470 } |
|
471 case 1: |
|
472 { |
|
473 netMode = EAdhoc; |
|
474 TInt secMode = iCmPluginBaseEng.GetIntAttributeL( |
|
475 EWlanSecurityMode ); |
|
476 if( secMode != EWlanSecModeOpen && |
|
477 secMode != EWlanSecModeWep ) |
|
478 { |
|
479 iCmPluginBaseEng.SetIntAttributeL( EWlanSecurityMode, |
|
480 EWlanSecModeOpen ); |
|
481 } |
|
482 break; |
|
483 } |
|
484 default: |
|
485 { |
|
486 User::Leave( KErrNotSupported ); |
|
487 break; |
|
488 } |
|
489 } |
|
490 iCmPluginBaseEng.SetIntAttributeL( EWlanConnectionMode , netMode ); |
|
491 UpdateListBoxContentL(); |
|
492 } |
|
493 } |
|
494 |
|
495 //--------------------------------------------------------------------------- |
|
496 // CmPluginWlanSettingsDlg::ShowWlanNWNamePageL |
|
497 //--------------------------------------------------------------------------- |
|
498 // |
|
499 void CmPluginWlanSettingsDlg::ShowWlanNWNamePageL() |
|
500 { |
|
501 const TCmAttribConvTable* convItem = |
|
502 iCmPluginBaseEng.ConvTableItem( EWlanSSID ); |
|
503 |
|
504 const TUint32* items = KNWNameSelectionItems; |
|
505 TInt selected ( EWlanNwNameUserDefined ); |
|
506 |
|
507 // Display a radio button page with options: User defined and Scan for Networks |
|
508 if ( ShowRadioButtonSettingPageL( items, |
|
509 selected, |
|
510 R_QTN_WLAN_SETT_NETWORK_NAME ) ) |
|
511 { |
|
512 if ( selected == EWlanNwNameUserDefined ) |
|
513 { |
|
514 HBufC* oldssId = iCmPluginBaseEng.GetStringAttributeL( EWlanSSID ); |
|
515 CleanupStack::PushL( oldssId ); |
|
516 |
|
517 TBuf<KCmWlanNWNameMaxLength> buf; |
|
518 buf.Copy( *oldssId ); |
|
519 |
|
520 if ( TCmCommonUi::ShowConfirmationQueryWithInputL( |
|
521 R_QTN_WLAN_PRMPT_NETWORK_NAME, |
|
522 buf ) ) |
|
523 { |
|
524 if( buf.Compare( *oldssId ) ) |
|
525 // SSID is changed |
|
526 { |
|
527 iCmPluginBaseEng.SetStringAttributeL( EWlanSSID, buf ); |
|
528 UpdateListBoxContentL(); |
|
529 } |
|
530 } |
|
531 CleanupStack::PopAndDestroy( oldssId ); |
|
532 } |
|
533 else |
|
534 { |
|
535 // Let's search for a WLAN network |
|
536 TWlanSsid ssid; |
|
537 TWlanConnectionMode connectionMode; |
|
538 TWlanConnectionSecurityMode securityMode; |
|
539 |
|
540 CConnectionUiUtilities* uiUtils = CConnectionUiUtilities::NewL(); |
|
541 CleanupStack::PushL( uiUtils ); |
|
542 |
|
543 if ( uiUtils->SearchWLANNetwork( ssid, connectionMode, securityMode ) ) |
|
544 { |
|
545 HBufC* temp = HBufC::NewLC( convItem->iMaxLength ); |
|
546 temp->Des().Copy( ssid ); |
|
547 iCmPluginBaseEng.SetStringAttributeL( EWlanSSID, *temp ); |
|
548 CleanupStack::PopAndDestroy( temp ); |
|
549 |
|
550 UpdateListBoxContentL(); |
|
551 } |
|
552 CleanupStack::PopAndDestroy( uiUtils ); |
|
553 } |
|
554 } |
|
555 } |
|
556 |
|
557 //--------------------------------------------------------------------------- |
|
558 // CmPluginWlanSettingsDlg::ShowPopupSettingPageL |
|
559 //--------------------------------------------------------------------------- |
|
560 // |
|
561 TBool CmPluginWlanSettingsDlg::ShowPopupSettingPageL( TUint32 aAttribute, |
|
562 TInt aCommandId ) |
|
563 { |
|
564 TBool retval = EFalse; |
|
565 switch( aAttribute ) |
|
566 { |
|
567 // Boolean settings |
|
568 case EWlanScanSSID: |
|
569 { |
|
570 ChangeBoolSettingL( aAttribute, aCommandId ); |
|
571 break; |
|
572 } |
|
573 // Textual Settings |
|
574 case ECmStartPage: |
|
575 { |
|
576 ShowPopupTextSettingPageL( aAttribute ); |
|
577 break; |
|
578 } |
|
579 case EWlanSecurityMode: |
|
580 { |
|
581 ShowSecurityModeRBPageL(); |
|
582 break; |
|
583 } |
|
584 case EWlanSecuritySettings: |
|
585 { |
|
586 TInt secmode = iCmPluginBaseEng.GetIntAttributeL( EWlanSecurityMode ); |
|
587 if( secmode == EWlanSecModeOpen ) |
|
588 { |
|
589 TCmCommonUi::ShowNoteL( R_QTN_WLAN_INFO_NO_SECURITY_SETTINGS, |
|
590 TCmCommonUi::ECmInfoNote); |
|
591 } |
|
592 else |
|
593 { |
|
594 TInt exitValue = |
|
595 STATIC_CAST( CCmPluginWlan*, &iCmPluginBaseEng )-> |
|
596 EditSecuritySettingsL( *( CEikonEnv::Static() ) ); |
|
597 if ( secmode == EWlanSecModeWep ) |
|
598 { // WEP |
|
599 if ( exitValue & CWEPSecuritySettings::EExitReq ) |
|
600 { |
|
601 iSecDialExit = ETrue; |
|
602 iExitReason = KDialogUserExit; |
|
603 ExitSettingsL(EFalse); |
|
604 } |
|
605 } |
|
606 else if ( secmode == EWlanSecModeWAPI ) |
|
607 { |
|
608 if ( exitValue & CWAPISecuritySettings::EExitReq ) |
|
609 { |
|
610 iSecDialExit = ETrue; |
|
611 iExitReason = KDialogUserExit; |
|
612 ExitSettingsL(EFalse); |
|
613 } |
|
614 } |
|
615 else |
|
616 {// 802.1x, WPA/WPA2 |
|
617 if ( exitValue & CWPASecuritySettings::EExitReq ) |
|
618 { |
|
619 iSecDialExit = ETrue; |
|
620 iExitReason = KDialogUserExit; |
|
621 ExitSettingsL(EFalse); |
|
622 } |
|
623 } |
|
624 } |
|
625 break; |
|
626 } |
|
627 case EWlanConnectionMode: |
|
628 { |
|
629 if ( aCommandId == EPluginBaseCmdChange ) |
|
630 { |
|
631 ShowNetworkModeRBPageL(); |
|
632 } |
|
633 else |
|
634 { |
|
635 TInt netMode = |
|
636 iCmPluginBaseEng.GetIntAttributeL( EWlanConnectionMode ); |
|
637 // OK has been used: switch the value without opening the setting page |
|
638 if ( netMode == EInfra ) |
|
639 { |
|
640 netMode = EAdhoc; |
|
641 TInt secMode = iCmPluginBaseEng.GetIntAttributeL( |
|
642 EWlanSecurityMode ); |
|
643 if( secMode != EWlanSecModeOpen && |
|
644 secMode != EWlanSecModeWep ) |
|
645 { |
|
646 iCmPluginBaseEng.SetIntAttributeL( EWlanSecurityMode, |
|
647 EWlanSecModeOpen ); |
|
648 } |
|
649 } |
|
650 else |
|
651 { |
|
652 netMode = EInfra; |
|
653 } |
|
654 iCmPluginBaseEng.SetIntAttributeL( EWlanConnectionMode, netMode ); |
|
655 UpdateListBoxContentL(); |
|
656 } |
|
657 break; |
|
658 } |
|
659 case EWlanSSID: |
|
660 { |
|
661 ShowWlanNWNamePageL(); |
|
662 break; |
|
663 } |
|
664 default: |
|
665 { |
|
666 CmPluginBaseSettingsDlg::ShowPopupSettingPageL( aAttribute, |
|
667 aCommandId ); |
|
668 break; |
|
669 } |
|
670 } |
|
671 return retval; |
|
672 } |
|
673 |
|
674 |
|
675 // -------------------------------------------------------------------------- |
|
676 // CmPluginWlanSettingsDlg::ExitSettingsL |
|
677 // -------------------------------------------------------------------------- |
|
678 // |
|
679 void CmPluginWlanSettingsDlg::ExitSettingsL( TBool aConfirm ) |
|
680 { |
|
681 if ( STATIC_CAST( CCmPluginWlan*, &iCmPluginBaseEng )-> |
|
682 AreSecuritySettingsValidL() ) |
|
683 { |
|
684 if ( iIsPossibleToSaveSetting && iHasSettingChanged ) |
|
685 { |
|
686 iCmPluginBaseEng.UpdateL(); |
|
687 iHasSettingChanged = EFalse; |
|
688 } |
|
689 TryExitL( iExitReason ); |
|
690 } |
|
691 else |
|
692 { |
|
693 HBufC* netwName = iCmPluginBaseEng.GetStringAttributeL( EWlanSSID ); |
|
694 TBool noNetwName = ETrue; |
|
695 CleanupStack::PushL( netwName ); |
|
696 if ( *netwName != KNullDesC ) |
|
697 { |
|
698 noNetwName = EFalse; |
|
699 } |
|
700 CleanupStack::PopAndDestroy( netwName ); |
|
701 |
|
702 if ( noNetwName ) |
|
703 { |
|
704 if ( aConfirm ) |
|
705 { |
|
706 if ( TCmCommonUi::ShowConfirmationQueryL( |
|
707 R_QTN_WLAN_QUEST_NW_NAME_NOT_DEFINED ) ) |
|
708 { |
|
709 iExitReason = KDialogUserDelete; |
|
710 TryExitL( iExitReason ); |
|
711 } |
|
712 else |
|
713 { |
|
714 // Find the index of the EWlanSSID item |
|
715 for ( TInt i = 0; i < iSettingIndex->Count(); i++ ) |
|
716 { |
|
717 if ( iSettingIndex->At(i) == EWlanSSID ) |
|
718 { |
|
719 SelectItem(i); |
|
720 break; |
|
721 } |
|
722 } |
|
723 } |
|
724 } |
|
725 else |
|
726 { |
|
727 TryExitL( iExitReason ); |
|
728 } |
|
729 } |
|
730 else |
|
731 { |
|
732 if ( iCmPluginBaseEng.GetIntAttributeL( EWlanSecurityMode ) == |
|
733 EWlanSecModeOpen ) |
|
734 { |
|
735 if ( iIsPossibleToSaveSetting && iHasSettingChanged) |
|
736 { |
|
737 iCmPluginBaseEng.UpdateL(); |
|
738 iHasSettingChanged = EFalse; |
|
739 } |
|
740 TryExitL( iExitReason ); |
|
741 } |
|
742 else |
|
743 { |
|
744 if ( aConfirm ) |
|
745 { |
|
746 if ( TCmCommonUi::ShowConfirmationQueryL( |
|
747 R_QTN_WLAN_QUEST_SECURITY_SETTINGS_EMPTY ) ) |
|
748 { |
|
749 iExitReason = KDialogUserDeleteConfirmed; |
|
750 TryExitL( iExitReason ); |
|
751 } |
|
752 else |
|
753 { |
|
754 // Show the securitysettings page for WEP, other security mode |
|
755 // is not supported here(WPA has a default value)... |
|
756 ShowPopupSettingPageL( EWlanSecuritySettings, EWlanSecModeWep ); |
|
757 } |
|
758 } |
|
759 else |
|
760 { |
|
761 TryExitL( iExitReason ); |
|
762 } |
|
763 } |
|
764 } |
|
765 } |
|
766 } |
|
767 |
|
768 |
|
769 // -------------------------------------------------------------------------- |
|
770 // CmPluginWlanSettingsDlg::OkToExitL |
|
771 // Good to know : EAknSoftkeyCancel is never called, because |
|
772 // EEikDialogFlagNotifyEsc flag is not set in the resource. |
|
773 // -------------------------------------------------------------------------- |
|
774 // |
|
775 TBool CmPluginWlanSettingsDlg::OkToExitL( TInt aButtonId ) |
|
776 { |
|
777 // Database has been changed by other application so exit from this view |
|
778 // without update editings to database |
|
779 if ( !iCanEditingContinue ) |
|
780 { |
|
781 if ( iExitReason == KDialogUserExit ) |
|
782 { |
|
783 iCmPluginBaseEng.CmMgr().WatcherUnRegister(); |
|
784 |
|
785 // Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call |
|
786 TInt exitValue = KDialogUserExit; |
|
787 iExitReason = KDialogUserBack; |
|
788 // If destination has been deleted by other application |
|
789 // then we may have to exit from Cmmgr |
|
790 TryExitL( exitValue ); |
|
791 return EFalse; |
|
792 } |
|
793 else |
|
794 { |
|
795 // Exit from this view here to avoid possible update to databse |
|
796 return ETrue; |
|
797 } |
|
798 } |
|
799 |
|
800 // Translate the button presses into commands for the appui & current |
|
801 // view to handle |
|
802 TBool retval( EFalse ); |
|
803 |
|
804 switch ( aButtonId ) |
|
805 { |
|
806 case EAknSoftkeyOk: |
|
807 case EAknSoftkeyChange: |
|
808 { |
|
809 ProcessCommandL( aButtonId ); |
|
810 break; |
|
811 } |
|
812 case EAknSoftkeyBack: |
|
813 { |
|
814 ProcessCommandL( aButtonId ); |
|
815 break; |
|
816 } |
|
817 case EAknSoftkeyOptions: |
|
818 { |
|
819 DisplayMenuL(); |
|
820 break; |
|
821 } |
|
822 case KDialogUserExit: |
|
823 { |
|
824 if ( iSecDialExit ) |
|
825 { |
|
826 iSecDialExit = EFalse; |
|
827 } |
|
828 retval=ETrue; |
|
829 break; |
|
830 } |
|
831 default: |
|
832 { |
|
833 retval = ETrue; |
|
834 break; |
|
835 } |
|
836 } |
|
837 |
|
838 return retval; |
|
839 } |
|
840 |
|
841 |
|
842 // -------------------------------------------------------------------------- |
|
843 // CmPluginWlanSettingsDlg::ProcessCommandL |
|
844 // -------------------------------------------------------------------------- |
|
845 // |
|
846 void CmPluginWlanSettingsDlg::ProcessCommandL( TInt aCommandId ) |
|
847 { |
|
848 if ( !iCanEditingContinue ) |
|
849 { |
|
850 // We have to block all editing activity if database changed by |
|
851 // other application |
|
852 return; |
|
853 } |
|
854 |
|
855 if ( MenuShowing() ) |
|
856 { |
|
857 HideMenu(); |
|
858 } |
|
859 |
|
860 switch ( aCommandId ) |
|
861 { |
|
862 case EPluginBaseCmdExit: |
|
863 { |
|
864 iExitReason = KDialogUserExit; |
|
865 } |
|
866 case EAknSoftkeyBack: |
|
867 { |
|
868 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
|
869 cmMgr.WatcherUnRegister(); |
|
870 |
|
871 ExitSettingsL(ETrue); |
|
872 break; |
|
873 } |
|
874 case EPluginBaseCmdAdvanced: |
|
875 { |
|
876 RunAdvancedSettingsL(); |
|
877 break; |
|
878 } |
|
879 case EPluginBaseCmdChange: |
|
880 case EAknSoftkeyOk: |
|
881 { |
|
882 TUint32 attrib = iSettingIndex->At( iListbox->CurrentItemIndex() ); |
|
883 ShowPopupSettingPageL( attrib, aCommandId ); |
|
884 break; |
|
885 } |
|
886 default: |
|
887 { |
|
888 CmPluginBaseSettingsDlg::ProcessCommandL( aCommandId ); |
|
889 break; |
|
890 } |
|
891 } |
|
892 } |
|
893 |
|
894 // -------------------------------------------------------------------------- |
|
895 // CmPluginWlanSettingsDlg::GetHelpContext |
|
896 // -------------------------------------------------------------------------- |
|
897 // |
|
898 void CmPluginWlanSettingsDlg::GetHelpContext( TCoeHelpContext& aContext ) const |
|
899 { |
|
900 LOGGER_ENTERFN( "CmPluginWlanSettingsDlg::GetHelpContext" ); |
|
901 aContext.iMajor = KHelpUidPlugin; |
|
902 aContext.iContext = KSET_HLP_AP_SETTING_WLAN; |
|
903 } |
|
904 |
|
905 // -------------------------------------------------------------------------- |
|
906 // CmPluginWlanSettingsDlg::CommsDatChangesL |
|
907 // -------------------------------------------------------------------------- |
|
908 // |
|
909 void CmPluginWlanSettingsDlg::CommsDatChangesL() |
|
910 { |
|
911 if ( !iCanEditingContinue ) |
|
912 { |
|
913 return; |
|
914 } |
|
915 |
|
916 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
|
917 CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination(); |
|
918 |
|
919 if ( parentDest ) |
|
920 { |
|
921 if( !cmMgr.DestinationStillExistedL( parentDest ) ) |
|
922 { |
|
923 // If parent destination is deleted by somebody then the dialog must exit back to main view |
|
924 iExitReason = KDialogUserExit; |
|
925 iCanEditingContinue = EFalse; |
|
926 |
|
927 cmMgr.RemoveDestFromPool( parentDest ); |
|
928 delete parentDest; |
|
929 return; |
|
930 } |
|
931 |
|
932 // We may have to go back to parent view if database is changed by other application |
|
933 iCanEditingContinue = EFalse; |
|
934 |
|
935 cmMgr.RemoveDestFromPool( parentDest ); |
|
936 delete parentDest; |
|
937 } |
|
938 else // Legacy |
|
939 { |
|
940 // We may have to go back to parent view if database is changed by other application |
|
941 iCanEditingContinue = EFalse; |
|
942 } |
|
943 } |
|
944 |
|
945 // -------------------------------------------------------------------------- |
|
946 // CmPluginWlanSettingsDlg::NotifyParentView |
|
947 // -------------------------------------------------------------------------- |
|
948 // |
|
949 void CmPluginWlanSettingsDlg::NotifyParentView( TInt aValue ) |
|
950 { |
|
951 iNotifyFromAdv = aValue; |
|
952 } |
|
953 |
|
954 // -------------------------------------------------------------------------- |
|
955 // CmPluginWlanSettingsDlg::HandleCommsDatChangeL |
|
956 // -------------------------------------------------------------------------- |
|
957 // |
|
958 void CmPluginWlanSettingsDlg::HandleCommsDatChangeL() |
|
959 { |
|
960 if ( iCanEditingContinue ) |
|
961 { |
|
962 // Set iCanEditingContinue to False so that exit fromn this view without update editings |
|
963 iCanEditingContinue = EFalse; |
|
964 } |
|
965 |
|
966 if( iNotifyFromAdv == KCmNotifiedIapIsNotInThisDestination || |
|
967 iNotifyFromAdv == KCmNotifiedIapDisappear ) |
|
968 { |
|
969 TryExitL( iExitReason ); |
|
970 } |
|
971 else if( iNotifyFromAdv == KCmNotifiedDestinationDisappear ) |
|
972 { |
|
973 iExitReason = KDialogUserExit; |
|
974 TryExitL( iExitReason ); |
|
975 } |
|
976 } |