1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Defines dialog for access point view/edit. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "APSettingsHandlerUIVariant.hrh" |
|
22 |
|
23 |
|
24 #include <aknnavide.h> |
|
25 #include <akntitle.h> |
|
26 #include <AknQueryDialog.h> |
|
27 #include <akntextsettingpage.h> |
|
28 #include <aknpopupsettingpage.h> |
|
29 #include <aknradiobuttonsettingpage.h> |
|
30 #include <aknpasswordsettingpage.h> |
|
31 #include <aknmfnesettingpage.h> |
|
32 |
|
33 #include <ApAccessPointItem.h> |
|
34 #include <utf.h> |
|
35 |
|
36 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
37 #include <nifvar_internal.h> |
|
38 #endif |
|
39 |
|
40 |
|
41 #include "ApSettingsLookups.h" |
|
42 #include "ApSettingsDlg.h" |
|
43 #include "ApSettingsModel.h" |
|
44 #include <apsetui.rsg> |
|
45 |
|
46 #include "ApSettingsHandlerUI.hrh" |
|
47 #include "ApsettingshandleruiImpl.h" |
|
48 #include "ApSettingsHandlerConsts.h" |
|
49 #include <ApSettingsHandlerCommons.h> |
|
50 |
|
51 #include "ApSettingsHandlerLogger.h" |
|
52 |
|
53 #include <commonphoneparser.h> |
|
54 |
|
55 #include "ApNetSelPopupList.h" |
|
56 |
|
57 #include "AccessPointTextSettingPage.h" |
|
58 |
|
59 |
|
60 #include <featmgr.h> |
|
61 |
|
62 #include "FeatureManagerWrapper.h" |
|
63 #include "ApMultiLineDataQueryDialog.h" |
|
64 |
|
65 #include <ConnectionUiUtilities.h> |
|
66 #include <wlanmgmtcommon.h> |
|
67 #include <centralrepository.h> |
|
68 |
|
69 // CONSTANTS |
|
70 // General Settings UID, Hardcoded |
|
71 // const TUid KGeneralSettingsUid={0X100058EC}; |
|
72 // const TInt KOptionalDefaultValue = 1; |
|
73 |
|
74 |
|
75 |
|
76 const TInt KIspCallAnalogue = 0; |
|
77 const TInt KIspCallIsdn110 = 1; |
|
78 const TInt KIspCallIsdn120 = 2; |
|
79 |
|
80 const TInt KBearerListGprs = 0; |
|
81 const TInt KBearerListWLAN = 1; |
|
82 const TInt KBearerListCSD = 2; |
|
83 const TInt KBearerListHSCSD = 3; |
|
84 |
|
85 |
|
86 |
|
87 // They provide the indexes. |
|
88 const TInt KBearerArrayCSD = 0; |
|
89 const TInt KBearerArrayGPRS = 1; |
|
90 const TInt KBearerArrayHSCSD = 2; |
|
91 const TInt KBearerArrayWLAN = 3; |
|
92 |
|
93 const TInt KBoolMaxNumber = 1; |
|
94 |
|
95 _LIT( KEmptyText, "" ); |
|
96 _LIT( KTxtListItemFormat, " \t%S\t\t%S" ); |
|
97 _LIT( KTxtMenuListItemFormat, " \t%S\t\t" ); |
|
98 _LIT( KTxtCompulsory, "\t*" ); |
|
99 |
|
100 _LIT( KTxtNumber, "%d" ); |
|
101 |
|
102 |
|
103 _LIT( KKnownNameServer1, "fec0:000:0000:ffff::1" ); |
|
104 _LIT( KKnownNameServer2, "fec0:000:0000:ffff::2" ); |
|
105 |
|
106 |
|
107 const TInt KStaredPasswordLength = 4; |
|
108 |
|
109 const TUint32 KDefAdhocChannel = 7; |
|
110 |
|
111 |
|
112 const TInt KItemIndex0 = 0; |
|
113 const TInt KItemIndex1 = 1; |
|
114 const TInt KItemIndex2 = 2; |
|
115 const TInt KItemIndex3 = 3; |
|
116 |
|
117 // ================= MEMBER FUNCTIONS ======================= |
|
118 // --------------------------------------------------------- |
|
119 // CApSettingsDlg::ConstructAndRunLD |
|
120 // Constructs the dialog and runs it. |
|
121 // --------------------------------------------------------- |
|
122 // |
|
123 TInt CApSettingsDlg::ConstructAndRunLD( CApSettingsModel& aModel, |
|
124 CApSettingsHandlerImpl& aHandler, |
|
125 TUint32& aUid, |
|
126 CApAccessPointItem* aItem ) |
|
127 { |
|
128 APSETUILOGGER_ENTERFN( ESettings,"Settings::ConstructAndRunLD") |
|
129 |
|
130 CleanupStack::PushL( this ); |
|
131 |
|
132 iFeatureManagerWrapper = CFeatureManagerWrapper::NewL(); |
|
133 |
|
134 iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp ); |
|
135 |
|
136 #ifdef __TEST_OOMDEBUG |
|
137 RFs fs; |
|
138 User::LeaveIfError( fs.Connect() ); |
|
139 CleanupClosePushL<RFs>( fs ); |
|
140 TUint att; |
|
141 if ( fs.Att( KTestFileName, att ) == KErrNone ) |
|
142 { |
|
143 iMemTestOn = ETrue; |
|
144 } |
|
145 else |
|
146 { |
|
147 iMemTestOn = EFalse; |
|
148 } |
|
149 CleanupStack::PopAndDestroy(); // fs, will also close it |
|
150 #endif // __TEST_OOMDEBUG |
|
151 |
|
152 |
|
153 iUid = &aUid; |
|
154 |
|
155 iDataModel = &aModel; |
|
156 iHandler = &aHandler; |
|
157 iVariant = iHandler->iExt->iVariant; |
|
158 |
|
159 |
|
160 CApAccessPointItem* ap = CApAccessPointItem::NewLC(); |
|
161 |
|
162 iBearerItemArray = |
|
163 new( ELeave )CArrayPtrFlat<CApAccessPointItem>( KBearers ); |
|
164 iBearerItemArray->ResetAndDestroy(); |
|
165 for ( TInt i=0; i<KBearers; i++ ) |
|
166 { |
|
167 iBearerItemArray->AppendL( NULL ); |
|
168 } |
|
169 TApBearerType ab = ap->BearerTypeL(); |
|
170 iBearerItemArray->At( BearerToArrayIndexL( ab ) ) = ap; |
|
171 // Now iApItem is part of array-> destructed member var, pop it. |
|
172 CleanupStack::Pop( ap ); |
|
173 |
|
174 iApItem = ap; |
|
175 |
|
176 if ( !aItem ) |
|
177 { |
|
178 iDataModel->AccessPointDataL( *iUid, *iApItem ); |
|
179 } |
|
180 else |
|
181 { |
|
182 iApItem->CopyFromL( *aItem ); |
|
183 } |
|
184 iDataModel->ClearWEPAndWPASettings(); |
|
185 |
|
186 iOldApItem = CApAccessPointItem::NewLC(); |
|
187 CleanupStack::Pop(); // member var |
|
188 |
|
189 iOldApItem->CopyFromL( *iApItem ); |
|
190 |
|
191 iOriginalBearerType = iApItem->BearerTypeL(); |
|
192 |
|
193 ConstructL( R_APSETTINGS_MENUBAR ); |
|
194 |
|
195 SetBearerTypeL( iApItem->BearerTypeL() ); |
|
196 // ExecuteLD will PushL( this ), so we have to Pop it... |
|
197 CleanupStack::Pop(); // this |
|
198 |
|
199 |
|
200 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ConstructAndRunLD") |
|
201 return ExecuteLD( R_APSETTINGS_DIALOG ); |
|
202 } |
|
203 |
|
204 |
|
205 |
|
206 // Destructor |
|
207 CApSettingsDlg::~CApSettingsDlg() |
|
208 { |
|
209 APSETUILOGGER_ENTERFN( ESettings,"Settings::~CApSettingsDlg") |
|
210 |
|
211 delete iFeatureManagerWrapper; |
|
212 |
|
213 if ( iDataModel ) |
|
214 {// Remove ourselves from observers... |
|
215 iDataModel->Database()->RemoveObserver( this ); |
|
216 } |
|
217 |
|
218 if ( iOldApItem ) |
|
219 { |
|
220 delete iOldApItem; |
|
221 } |
|
222 |
|
223 if ( iNaviDecorator ) |
|
224 { |
|
225 delete iNaviDecorator; |
|
226 } |
|
227 |
|
228 if ( iTitlePane ) |
|
229 { |
|
230 // set old text back, if we have it... |
|
231 if ( iOldTitleText ) |
|
232 { |
|
233 if ( iExitReason != EShutDown ) |
|
234 { |
|
235 TRAP_IGNORE( iTitlePane->SetTextL( *iOldTitleText ) ); |
|
236 } |
|
237 delete iOldTitleText; |
|
238 } |
|
239 } |
|
240 |
|
241 if ( iBearerItemArray ) |
|
242 { |
|
243 iBearerItemArray->ResetAndDestroy(); |
|
244 delete iBearerItemArray; |
|
245 } |
|
246 |
|
247 if (iBackupApItem) |
|
248 { |
|
249 delete iBackupApItem; |
|
250 } |
|
251 |
|
252 APSETUILOGGER_LEAVEFN( ESettings,"Settings::~CApSettingsDlg") |
|
253 } |
|
254 |
|
255 |
|
256 |
|
257 // --------------------------------------------------------- |
|
258 // CApSettingsDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
259 // TEventCode aType ) |
|
260 // Handles key events |
|
261 // --------------------------------------------------------- |
|
262 // |
|
263 TKeyResponse CApSettingsDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
264 TEventCode aType ) |
|
265 { |
|
266 APSETUILOGGER_ENTERFN( ESettings,"Settings::OfferKeyEventL") |
|
267 |
|
268 TKeyResponse retval( EKeyWasNotConsumed ); |
|
269 // Only interested in standard key events |
|
270 if ( aType == EEventKey ) |
|
271 { |
|
272 // If a menu is showing offer key events to it. |
|
273 if ( CAknDialog::MenuShowing() ) |
|
274 { |
|
275 retval = CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
276 } |
|
277 else |
|
278 { |
|
279 if ( iList ) |
|
280 { |
|
281 // as list IS consuming, must handle because it |
|
282 // IS the SHUTDOWN... |
|
283 // or, a view switch is shutting us down... |
|
284 if ( aKeyEvent.iCode == EKeyEscape ) |
|
285 { |
|
286 ProcessCommandL( EEikCmdExit ); |
|
287 retval = EKeyWasConsumed; |
|
288 } |
|
289 else |
|
290 { |
|
291 retval = iList->OfferKeyEventL( aKeyEvent, aType ); |
|
292 if ( iSecSettingsExitReason ) |
|
293 { |
|
294 if ( iSecSettingsExitReason |
|
295 & KApUiEventShutDownRequested ) |
|
296 { |
|
297 ProcessCommandL( EAknCmdExit ); |
|
298 } |
|
299 else |
|
300 { |
|
301 if ( iSecSettingsExitReason |
|
302 & KApUiEventExitRequested ) |
|
303 { |
|
304 ProcessCommandL( EApSelCmdExit ); |
|
305 } |
|
306 } |
|
307 } |
|
308 } |
|
309 } |
|
310 else |
|
311 { |
|
312 if ( aKeyEvent.iCode == EKeyOK ) |
|
313 { |
|
314 ProcessCommandL( EApSelCmdChange ); |
|
315 retval = EKeyWasConsumed; |
|
316 } |
|
317 } |
|
318 } |
|
319 } |
|
320 |
|
321 APSETUILOGGER_LEAVEFN( ESettings,"Settings::OfferKeyEventL") |
|
322 return retval; |
|
323 } |
|
324 |
|
325 |
|
326 |
|
327 // --------------------------------------------------------- |
|
328 // CApSettingsDlg::NewL |
|
329 // Two-phase dconstructor, second phase is ConstructAndRunLD |
|
330 // --------------------------------------------------------- |
|
331 // |
|
332 CApSettingsDlg* CApSettingsDlg::NewL( TInt aIspFilter, |
|
333 TInt aBearerFilter, |
|
334 TInt aSortType, |
|
335 TUint32& aEventStore, |
|
336 TInt aReqIpvType |
|
337 ) |
|
338 { |
|
339 APSETUILOGGER_ENTERFN( ESettings,"Settings::NewL") |
|
340 |
|
341 CApSettingsDlg* db = |
|
342 new ( ELeave )CApSettingsDlg( aIspFilter, |
|
343 aBearerFilter, |
|
344 aSortType, |
|
345 aEventStore, |
|
346 aReqIpvType |
|
347 ); |
|
348 |
|
349 APSETUILOGGER_LEAVEFN( ESettings,"Settings::NewL") |
|
350 return db; |
|
351 |
|
352 } |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 // Constructor |
|
358 CApSettingsDlg::CApSettingsDlg( TInt aIspFilter, TInt aBearerFilter, |
|
359 TInt aSortType, TUint32& aEventStore, |
|
360 TInt aReqIpvType ) |
|
361 : |
|
362 iLevel( 0 ), |
|
363 iOldIndex( 0 ), |
|
364 iOldTopIndex( 0 ), |
|
365 iAdvIndex( 0 ), |
|
366 iBearerType( EApBearerTypeAll ), |
|
367 iIspFilter( aIspFilter ), |
|
368 iBearerFilter( aBearerFilter ), |
|
369 iSortType( aSortType ), |
|
370 iEventStore( &aEventStore ), |
|
371 iFieldCount( 0 ), |
|
372 iAdvancedFieldCount( 0 ), |
|
373 iExitReason( EExitNone ), |
|
374 iReqIpvType( aReqIpvType ), |
|
375 iL2Ipv4( ETrue ), |
|
376 iSecSettingsExitReason(0) |
|
377 { |
|
378 iBackupApItem = NULL; |
|
379 } |
|
380 |
|
381 |
|
382 // --------------------------------------------------------- |
|
383 // CApSettingsDlg::OkToExitL( TInt aButtonId) |
|
384 // called by framework when the OK button is pressed |
|
385 // --------------------------------------------------------- |
|
386 // |
|
387 TBool CApSettingsDlg::OkToExitL( TInt aButtonId ) |
|
388 { |
|
389 APSETUILOGGER_ENTERFN( ESettings,"Settings::OkToExitL") |
|
390 |
|
391 // Translate the button presses into commands for the appui & current |
|
392 // view to handle |
|
393 TBool retval( EFalse ); |
|
394 if ( aButtonId == EAknSoftkeyOptions ) |
|
395 { |
|
396 DisplayMenuL() ; |
|
397 } |
|
398 else |
|
399 { |
|
400 if ( (aButtonId == EApSelCmdChange) |
|
401 || (aButtonId == EApSelCmdQuickChange)) |
|
402 { |
|
403 ProcessCommandL(aButtonId); |
|
404 if ( iSecSettingsExitReason ) |
|
405 { |
|
406 if ( iSecSettingsExitReason |
|
407 & KApUiEventShutDownRequested ) |
|
408 { |
|
409 ProcessCommandL( EAknCmdExit ); |
|
410 // retval = ETrue; // exit the dialog |
|
411 } |
|
412 else |
|
413 { |
|
414 if ( iSecSettingsExitReason |
|
415 & KApUiEventExitRequested ) |
|
416 { |
|
417 ProcessCommandL( EApSelCmdExit ); |
|
418 // retval = ETrue; // exit the dialog |
|
419 } |
|
420 } |
|
421 } |
|
422 } |
|
423 else |
|
424 { |
|
425 if ( aButtonId == EAknSoftkeyBack ) |
|
426 { |
|
427 if ( iLevel ) |
|
428 { |
|
429 TSaveAction cansave( EApNoAction ); |
|
430 if ( iLevel == 2 ) |
|
431 {// coming back from Ipv4 settings |
|
432 // check if Wlan and has compulsory fields |
|
433 if (iBearerType == EApBearerTypeWLAN) |
|
434 { // WLAN |
|
435 TApMember member; |
|
436 cansave = CanSaveWlanCompulsoriesL( member ); |
|
437 switch (cansave) |
|
438 { |
|
439 case EApCanSave: |
|
440 { |
|
441 // nothing to do in this case, simply go on. |
|
442 iLevel --; |
|
443 break; |
|
444 } |
|
445 case EApMustDelete: |
|
446 { |
|
447 // user said quit without save, |
|
448 // restore from iBackupApItem |
|
449 RestoreIpv4SettingsL(); |
|
450 iLevel --; |
|
451 break; |
|
452 } |
|
453 case EApShallGoBack: |
|
454 { |
|
455 // user wants to re-edit, do not come back... |
|
456 // no change in iLevel |
|
457 |
|
458 // Set correct item to edit |
|
459 switch ( member ) |
|
460 { |
|
461 case EApWlanIpNetMask: |
|
462 case EApIspIPNetMask: |
|
463 { |
|
464 if ( IsWlanSupported() ) |
|
465 { |
|
466 SelectItem( KListIndexWLANSubnetMask ); |
|
467 retval = EFalse; |
|
468 } |
|
469 else |
|
470 { |
|
471 User::Leave( KErrNotSupported ); |
|
472 } |
|
473 break; |
|
474 } |
|
475 case EApIspIPGateway: |
|
476 case EApWlanIpGateway: |
|
477 { |
|
478 if ( IsWlanSupported() ) |
|
479 { |
|
480 SelectItem( KListIndexWLANDefaultGateway ); |
|
481 retval = EFalse; |
|
482 } |
|
483 else |
|
484 { |
|
485 User::Leave( KErrNotSupported ); |
|
486 } |
|
487 break; |
|
488 } |
|
489 default: |
|
490 {// otherwise, nothing to do... |
|
491 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
492 break; |
|
493 } |
|
494 } |
|
495 break; |
|
496 } |
|
497 case EApNoAction: |
|
498 default: |
|
499 { |
|
500 // this is not a valid case as it always one from |
|
501 // the above 3, |
|
502 // nothing to do, |
|
503 iLevel --; |
|
504 break; |
|
505 } |
|
506 } |
|
507 } |
|
508 else |
|
509 { |
|
510 iLevel--; |
|
511 } |
|
512 } |
|
513 else |
|
514 { |
|
515 iLevel--; |
|
516 } |
|
517 HandleListboxDataChangeL( EFalse ); |
|
518 if ( iOldIndex >=0 ) |
|
519 { |
|
520 if ( cansave != EApShallGoBack ) |
|
521 { |
|
522 iList->SetTopItemIndex( iOldTopIndex ); |
|
523 iList->SetCurrentItemIndexAndDraw( iOldIndex ); |
|
524 } |
|
525 if ( *iEventStore & KApUiEventExitRequested ) |
|
526 { |
|
527 ProcessCommandL( EApSelCmdExit ); |
|
528 } |
|
529 } |
|
530 } |
|
531 else |
|
532 { |
|
533 if ( iExitReason == EShutDown ) |
|
534 { |
|
535 retval = ETrue; |
|
536 } |
|
537 else |
|
538 { |
|
539 if ( !(*iEventStore & KApUiEventShutDownRequested ) ) |
|
540 { |
|
541 retval = SaveDataL( ); |
|
542 } |
|
543 else |
|
544 { |
|
545 retval = ETrue; |
|
546 } |
|
547 } |
|
548 } |
|
549 } |
|
550 } |
|
551 } |
|
552 |
|
553 APSETUILOGGER_LEAVEFN( ESettings,"Settings::OkToExitL") |
|
554 return retval; |
|
555 } |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 // --------------------------------------------------------- |
|
561 // CApSettingsDlg::InitTextsL |
|
562 // called before the dialog is shown |
|
563 // to initialize localized textual data |
|
564 // --------------------------------------------------------- |
|
565 // |
|
566 void CApSettingsDlg::InitTextsL() |
|
567 { |
|
568 APSETUILOGGER_ENTERFN( ESettings,"Settings::InitTextsL") |
|
569 |
|
570 // set pane texts |
|
571 // first get StatusPane |
|
572 iStatusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
573 // then get TitlePane |
|
574 iTitlePane = ( CAknTitlePane* ) iStatusPane->ControlL( |
|
575 TUid::Uid( EEikStatusPaneUidTitle ) ); |
|
576 // if not already stored, store it for restoring |
|
577 if ( !iOldTitleText ) |
|
578 { |
|
579 iOldTitleText = iTitlePane->Text()->AllocL(); |
|
580 } |
|
581 // set new titlepane text |
|
582 iTitlePane->SetTextL( iApItem->ConnectionName() ); |
|
583 // if not already done, clear NaviPane with adding en empty one |
|
584 if ( !iNaviDecorator ) |
|
585 { |
|
586 iNaviPane = ( CAknNavigationControlContainer* ) |
|
587 iStatusPane->ControlL( |
|
588 TUid::Uid( EEikStatusPaneUidNavi ) ); |
|
589 iNaviDecorator = iNaviPane->CreateNavigationLabelL( KEmpty ); |
|
590 iNaviPane->PushL( *iNaviDecorator ); |
|
591 } |
|
592 |
|
593 APSETUILOGGER_LEAVEFN( ESettings,"Settings::InitTextsL") |
|
594 } |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 // --------------------------------------------------------- |
|
600 // CApSettingsDlg::DynInitMenuPaneL |
|
601 // --------------------------------------------------------- |
|
602 // |
|
603 void CApSettingsDlg::DynInitMenuPaneL |
|
604 ( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
605 { |
|
606 APSETUILOGGER_ENTERFN( ESettings,"Settings::DynInitMenuPaneL") |
|
607 |
|
608 CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
609 if ( aResourceId == R_APSETTINGS_MENU ) |
|
610 { |
|
611 if ( iLevel ) |
|
612 { |
|
613 // Disallow Advanced settings item if already in advanced |
|
614 // or in SMS. |
|
615 aMenuPane->DeleteMenuItem( EApSelCmdAdvanced ); |
|
616 } |
|
617 if ( !iHelpSupported ) |
|
618 { |
|
619 aMenuPane->DeleteMenuItem( EAknCmdHelp ); |
|
620 } |
|
621 } |
|
622 |
|
623 APSETUILOGGER_LEAVEFN( ESettings,"Settings::DynInitMenuPaneL") |
|
624 } |
|
625 |
|
626 |
|
627 |
|
628 // --------------------------------------------------------- |
|
629 // CApSettingsDlg::HandleListboxDataChangeL |
|
630 // called before the dialog is shown to initialize listbox data |
|
631 // --------------------------------------------------------- |
|
632 // |
|
633 void CApSettingsDlg::HandleListboxDataChangeL( TBool aReRead ) |
|
634 { |
|
635 APSETUILOGGER_ENTERFN( ESettings,"Settings::HandleListboxDataChangeL") |
|
636 |
|
637 if ( aReRead && ( *iUid != KApNoneUID ) ) |
|
638 { // reload the whole ApItem ! |
|
639 // if it does not yet exists, no need to do so... |
|
640 iDataModel->AccessPointDataL( *iUid, *iApItem ); |
|
641 iDataModel->ClearWEPAndWPASettings(); |
|
642 } |
|
643 |
|
644 iBearerType = iApItem->BearerTypeL(); |
|
645 |
|
646 // fill up our new list with data |
|
647 CDesCArrayFlat* ItemArray = new ( ELeave ) CDesCArrayFlat( 4 ); |
|
648 CleanupStack::PushL( ItemArray ); |
|
649 switch ( iLevel ) |
|
650 { |
|
651 case 0: |
|
652 { |
|
653 FillListWithDataL( *ItemArray, *iField, iFieldCount, |
|
654 iTitles, iCompulsory ); |
|
655 break; |
|
656 } |
|
657 case 1: |
|
658 { |
|
659 FillListWithDataL( *ItemArray, *iFieldAdvanced, |
|
660 iAdvancedFieldCount, iTitlesAdvanced, |
|
661 iCompulsoryAdvanced ); |
|
662 break; |
|
663 } |
|
664 case 2: |
|
665 { |
|
666 FillListWithDataL( *ItemArray, *iFieldL2, iFieldCountL2, |
|
667 iTitlesL2, iCompulsoryL2 ); |
|
668 break; |
|
669 } |
|
670 default: |
|
671 { |
|
672 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
673 break; |
|
674 } |
|
675 } |
|
676 |
|
677 |
|
678 // if not already stored, store it for restoring |
|
679 if ( !iOldTitleText ) |
|
680 { |
|
681 iOldTitleText = iTitlePane->Text()->AllocL(); |
|
682 } |
|
683 // set new title text |
|
684 if ( iLevel == 2 ) |
|
685 { |
|
686 HBufC* value; |
|
687 if ( iL2Ipv4 ) |
|
688 { |
|
689 value = iEikonEnv->AllocReadResourceLC( |
|
690 R_APUI_VIEW_IPV4_SETTINGS ); |
|
691 } |
|
692 else |
|
693 { |
|
694 value = iEikonEnv->AllocReadResourceLC( |
|
695 R_APUI_VIEW_IPV6_SETTINGS ); |
|
696 } |
|
697 iTitlePane->SetTextL( *value ); |
|
698 CleanupStack::PopAndDestroy( value ); |
|
699 } |
|
700 else |
|
701 { |
|
702 iTitlePane->SetTextL( iApItem->ConnectionName() ); |
|
703 } |
|
704 |
|
705 iList->Model()->SetItemTextArray( ItemArray ); |
|
706 // now it is owned by the LB, so pop it |
|
707 CleanupStack::Pop(); // do not destroy ! |
|
708 iItemArray = ItemArray; |
|
709 |
|
710 iList->HandleItemAdditionL(); |
|
711 |
|
712 APSETUILOGGER_LEAVEFN( ESettings,"Settings::HandleListboxDataChangeL") |
|
713 } |
|
714 |
|
715 |
|
716 |
|
717 // --------------------------------------------------------- |
|
718 // CApSettingsDlg::SetTextOverrides |
|
719 // --------------------------------------------------------- |
|
720 // |
|
721 void CApSettingsDlg::SetTextOverrides( CTextOverrides* aOverrides ) |
|
722 { |
|
723 APSETUILOGGER_ENTERFN( ESettings,"Settings::SetTextOverrides<->") |
|
724 |
|
725 __ASSERT_DEBUG( aOverrides, Panic( ENullPointer ) ); |
|
726 iTextOverrides = aOverrides; |
|
727 } |
|
728 |
|
729 |
|
730 |
|
731 // --------------------------------------------------------- |
|
732 // CApSettingsDlg::HandleApDbEventL |
|
733 // called by the active access point framework |
|
734 // --------------------------------------------------------- |
|
735 // |
|
736 void CApSettingsDlg::HandleApDbEventL( TEvent anEvent ) |
|
737 { |
|
738 APSETUILOGGER_ENTERFN( ESettings,"Settings::HandleApDbEventL") |
|
739 |
|
740 switch ( anEvent ) |
|
741 { |
|
742 case EDbChanged: |
|
743 { |
|
744 HandleListboxDataChangeL( ETrue ); |
|
745 break; |
|
746 } |
|
747 case EDbClosing: |
|
748 { |
|
749 break; |
|
750 } |
|
751 case EDbAvailable: |
|
752 { |
|
753 break; |
|
754 } |
|
755 default: |
|
756 { |
|
757 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
758 break; |
|
759 } |
|
760 } |
|
761 |
|
762 APSETUILOGGER_LEAVEFN( ESettings,"Settings::HandleApDbEventL") |
|
763 } |
|
764 |
|
765 |
|
766 |
|
767 // --------------------------------------------------------- |
|
768 // CApSettingsDlg::GetHelpContext() |
|
769 // --------------------------------------------------------- |
|
770 // |
|
771 void CApSettingsDlg::GetHelpContext(TCoeHelpContext& aContext) const |
|
772 { |
|
773 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetHelpContext") |
|
774 |
|
775 aContext.iMajor = iHandler->iHelpMajor; |
|
776 |
|
777 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetHelpContext") |
|
778 } |
|
779 |
|
780 |
|
781 // --------------------------------------------------------- |
|
782 // CApSettingsDlg::PreLayoutDynInitL(); |
|
783 // called by framework before dialog is shown |
|
784 // --------------------------------------------------------- |
|
785 // |
|
786 void CApSettingsDlg::PreLayoutDynInitL() |
|
787 { |
|
788 APSETUILOGGER_ENTERFN( ESettings,"Settings::PreLayoutDynInitL") |
|
789 |
|
790 InitTextsL(); |
|
791 |
|
792 iList = STATIC_CAST( CAknSettingStyleListBox*, |
|
793 Control( KApSettingsListboxId ) ); |
|
794 |
|
795 iList->CreateScrollBarFrameL( ETrue ); |
|
796 iList->ScrollBarFrame()->SetScrollBarVisibilityL |
|
797 ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
798 HandleListboxDataChangeL( EFalse ); |
|
799 iList->SetCurrentItemIndex( 0 ); |
|
800 iList->SetListBoxObserver( this ); |
|
801 |
|
802 iDataModel->Database()->AddObserverL( this ); |
|
803 |
|
804 APSETUILOGGER_LEAVEFN( ESettings,"Settings::PreLayoutDynInitL") |
|
805 } |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 // From MEikCommandObserver |
|
811 void CApSettingsDlg::ProcessCommandL( TInt aCommandId ) |
|
812 { |
|
813 APSETUILOGGER_ENTERFN( ESettings,"Settings::ProcessCommandL") |
|
814 |
|
815 if ( MenuShowing() ) |
|
816 { |
|
817 HideMenu(); |
|
818 } |
|
819 |
|
820 switch ( aCommandId ) |
|
821 { |
|
822 case EApSelCmdQuickChange: |
|
823 { |
|
824 ChangeSettingsL( ETrue ); |
|
825 break; |
|
826 } |
|
827 case EApSelCmdChange: |
|
828 { |
|
829 ChangeSettingsL( EFalse ); |
|
830 break; |
|
831 } |
|
832 case EApSelCmdAdvanced: |
|
833 { |
|
834 if ( iLevel == 0 ) |
|
835 { |
|
836 iLevel ++; |
|
837 iOldIndex = iList->CurrentItemIndex(); |
|
838 iOldTopIndex = iList->TopItemIndex(); |
|
839 iList->SetCurrentItemIndex( 0 ); |
|
840 TRAPD( err, HandleListboxDataChangeL( EFalse ) ); |
|
841 if ( err ) |
|
842 { |
|
843 iLevel--; |
|
844 User::Leave( err ); |
|
845 } |
|
846 } |
|
847 break; |
|
848 } |
|
849 case EAknCmdHelp: |
|
850 { |
|
851 if ( iHelpSupported ) |
|
852 { |
|
853 iDataModel->LaunchHelpL(); |
|
854 } |
|
855 break; |
|
856 } |
|
857 // case EAknSoftkeyBack: |
|
858 case EApSelCmdExit: |
|
859 { |
|
860 iExitReason = EExit; |
|
861 *iEventStore |= KApUiEventExitRequested; |
|
862 TryExitL( EAknSoftkeyBack ); |
|
863 break; |
|
864 } |
|
865 case EAknCmdExit: |
|
866 case EEikCmdExit: |
|
867 { |
|
868 *iEventStore |= KApUiEventShutDownRequested; |
|
869 iExitReason = EShutDown; |
|
870 TryExitL( EAknSoftkeyBack ); |
|
871 break; |
|
872 } |
|
873 default: |
|
874 { |
|
875 // silently ignore it |
|
876 break; |
|
877 } |
|
878 } |
|
879 |
|
880 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ProcessCommandL") |
|
881 } |
|
882 |
|
883 |
|
884 // From MEikListBoxObserver |
|
885 void CApSettingsDlg::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
886 TListBoxEvent aEventType ) |
|
887 { |
|
888 APSETUILOGGER_ENTERFN( ESettings,"Settings::HandleListBoxEventL") |
|
889 |
|
890 switch ( aEventType ) |
|
891 { |
|
892 case EEventEnterKeyPressed: |
|
893 // both handled in the same way for now... |
|
894 case EEventItemDoubleClicked: |
|
895 case EEventItemSingleClicked: |
|
896 { |
|
897 ChangeSettingsL( ETrue ); |
|
898 break; |
|
899 } |
|
900 case EEventItemClicked: |
|
901 { |
|
902 break; |
|
903 } |
|
904 case EEventEditingStarted: |
|
905 { |
|
906 break; |
|
907 } |
|
908 case EEventEditingStopped: |
|
909 { |
|
910 break; |
|
911 } |
|
912 default: |
|
913 { |
|
914 // __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
915 }; |
|
916 }; |
|
917 |
|
918 APSETUILOGGER_LEAVEFN( ESettings,"Settings::HandleListBoxEventL") |
|
919 } |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 //---------------------------------------------------------- |
|
925 // CApSettingsDlg::FillListWithDataL |
|
926 //---------------------------------------------------------- |
|
927 // |
|
928 void CApSettingsDlg::FillListWithDataL( CDesCArrayFlat& aItemArray, |
|
929 const TApMember& arr, TInt aLength, |
|
930 const TInt* aRes, |
|
931 const TInt* aCompulsory ) |
|
932 { |
|
933 APSETUILOGGER_ENTERFN( ESettings,"Settings::FillListWithDataL") |
|
934 |
|
935 TInt i; |
|
936 TApMember* sgd = MUTABLE_CAST( TApMember*, &arr ); |
|
937 for( i=0; i<aLength; i++ ) |
|
938 { |
|
939 switch ( *sgd ) |
|
940 { |
|
941 case EApWapGatewayAddress: |
|
942 // case EApIspIPAddr: |
|
943 case EApGprsIPNameServer1: |
|
944 case EApIspIPNameServer1: |
|
945 case EApGprsIPNameServer2: |
|
946 case EApIspIPNameServer2: |
|
947 case EApWapAccessPointName: |
|
948 case EApWapStartPage: |
|
949 case EApGprsAccessPointName: |
|
950 case EApIspLoginName: |
|
951 case EApIspLoginPass: |
|
952 case EApIspIfAuthName: |
|
953 case EApIspIfAuthPass: |
|
954 case EApIspDefaultTelNumber: |
|
955 case EApIspInitString: |
|
956 case EApIspIfCallbackInfo: |
|
957 case EApIspLoginScript: |
|
958 case EApProxyServerAddress: |
|
959 case EApProxyPortNumber: |
|
960 case EApNetworkName: |
|
961 case EApWlanNetworkName: |
|
962 // case EApIspIPNetMask: |
|
963 // case EApWlanIpGateway: |
|
964 { |
|
965 AddTextualListBoxItemL( aItemArray, *sgd, |
|
966 *aRes, *aCompulsory ); |
|
967 break; |
|
968 } |
|
969 case EApWlanIpNetMask: |
|
970 case EApIspIPNetMask: |
|
971 case EApIspIPGateway: |
|
972 case EApWlanIpGateway: |
|
973 { // check if they do really needed to be displayed... |
|
974 if ( IsNetMaskAndGatewayVisibleL() ) |
|
975 { |
|
976 AddTextualListBoxItemL( aItemArray, *sgd, |
|
977 *aRes, *aCompulsory ); |
|
978 } |
|
979 break; |
|
980 } |
|
981 case EApIspIPAddr: |
|
982 { // GPRS, IPv4 or CSD, IPv4 settings |
|
983 if ( iApItem->BearerTypeL() == EApBearerTypeGPRS ) |
|
984 { |
|
985 TUint32 tint; |
|
986 iApItem->ReadUint( EApGprsPdpType, tint ); |
|
987 if ( tint != EIPv6 ) |
|
988 { |
|
989 AddTextualListBoxItemL( aItemArray, *sgd, |
|
990 *aRes, *aCompulsory ); |
|
991 } |
|
992 } |
|
993 else |
|
994 { // CSD |
|
995 if ( iL2Ipv4 ) |
|
996 { |
|
997 AddTextualListBoxItemL( aItemArray, *sgd, |
|
998 *aRes, *aCompulsory ); |
|
999 } |
|
1000 } |
|
1001 break; |
|
1002 } |
|
1003 case EApWapCurrentBearer: |
|
1004 case EApWapSecurity: |
|
1005 case EApWapWspOption: |
|
1006 case EApIspPromptForLogin: |
|
1007 case EApGprsDisablePlainTextAuth: |
|
1008 case EApIspDisablePlainTextAuth: |
|
1009 case EApIspBearerCallTypeIsdn: |
|
1010 case EApIspIfCallbackEnabled: |
|
1011 case EApIspIfCallbackType: |
|
1012 case EApIspEnableSWCompression: |
|
1013 case EApGprsHeaderCompression: |
|
1014 case EApIspUseLoginScript: |
|
1015 case EApIspBearerSpeed: |
|
1016 case EApGprsPdpType: |
|
1017 case EApIP6DNSAddrFromServer: |
|
1018 case EApWlanNetworkMode: |
|
1019 case EApWlanSecurityMode: |
|
1020 case EApWlanScanSSID: |
|
1021 { |
|
1022 AddOnOffListBoxItemL( aItemArray, *sgd, *aRes, *aCompulsory ); |
|
1023 break; |
|
1024 } |
|
1025 case EApWlanChannelId: |
|
1026 { |
|
1027 if ( IsAdhocChannelVisible() ) |
|
1028 { |
|
1029 AddOnOffListBoxItemL( aItemArray, *sgd, *aRes, |
|
1030 *aCompulsory ); |
|
1031 } |
|
1032 break; |
|
1033 } |
|
1034 case EApIpv4Settings: |
|
1035 case EApIpv6Settings: |
|
1036 { |
|
1037 AddMenuListBoxItemL( aItemArray, *sgd, *aRes, *aCompulsory ); |
|
1038 break; |
|
1039 } |
|
1040 case EApWlanSecuritySettings: |
|
1041 { |
|
1042 AddMenuListBoxItemL( aItemArray, *sgd, *aRes, *aCompulsory ); |
|
1043 break; |
|
1044 } |
|
1045 default: |
|
1046 { |
|
1047 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
1048 break; |
|
1049 } |
|
1050 } |
|
1051 sgd++; |
|
1052 aRes++; |
|
1053 aCompulsory++; |
|
1054 } |
|
1055 |
|
1056 APSETUILOGGER_LEAVEFN( ESettings,"Settings::FillListWithDataL") |
|
1057 } |
|
1058 |
|
1059 |
|
1060 //---------------------------------------------------------- |
|
1061 // CApSettingsDlg::AddTextualListBoxItemL |
|
1062 //---------------------------------------------------------- |
|
1063 // |
|
1064 void CApSettingsDlg::AddTextualListBoxItemL( CDesCArrayFlat& aItemArray, |
|
1065 TApMember aMember, TInt aRes, |
|
1066 TInt aCompulsory ) |
|
1067 { |
|
1068 APSETUILOGGER_ENTERFN( ESettings,"Settings::AddTextualListBoxItemL") |
|
1069 |
|
1070 HBufC* sgd = CreateTextualListBoxItemL( aMember, aRes, aCompulsory ); |
|
1071 CleanupStack::PushL( sgd ); |
|
1072 aItemArray.AppendL( sgd->Des() ); |
|
1073 CleanupStack::PopAndDestroy( sgd ); |
|
1074 |
|
1075 APSETUILOGGER_LEAVEFN( ESettings,"Settings::AddTextualListBoxItemL") |
|
1076 } |
|
1077 |
|
1078 |
|
1079 //---------------------------------------------------------- |
|
1080 // CApSettingsDlg::AddOnOffListBoxItem |
|
1081 //---------------------------------------------------------- |
|
1082 // |
|
1083 void CApSettingsDlg::AddOnOffListBoxItemL( CDesCArrayFlat& aItemArray, |
|
1084 TApMember aMember, TInt aRes, |
|
1085 TInt aCompulsory ) |
|
1086 { |
|
1087 APSETUILOGGER_ENTERFN( ESettings,"Settings::AddOnOffListBoxItemL") |
|
1088 |
|
1089 // Read up title text from resource |
|
1090 HBufC* sgd = CreateOnOffListBoxItemL( aMember, aRes, aCompulsory ); |
|
1091 CleanupStack::PushL( sgd ); |
|
1092 aItemArray.AppendL( sgd->Des() ); |
|
1093 CleanupStack::PopAndDestroy( sgd ); |
|
1094 |
|
1095 APSETUILOGGER_LEAVEFN( ESettings,"Settings::AddOnOffListBoxItemL") |
|
1096 } |
|
1097 |
|
1098 |
|
1099 //---------------------------------------------------------- |
|
1100 // CApSettingsDlg::UpdateOnOffListBoxItemL |
|
1101 //---------------------------------------------------------- |
|
1102 // |
|
1103 void CApSettingsDlg::UpdateOnOffListBoxItemL( TApMember aMember, TInt aRes, |
|
1104 TInt aPos, TInt aCompulsory ) |
|
1105 { |
|
1106 APSETUILOGGER_ENTERFN( ESettings,"Settings::UpdateOnOffListBoxItemL") |
|
1107 |
|
1108 // Read up title text from resource |
|
1109 HBufC* sgd = CreateOnOffListBoxItemL( aMember, aRes, aCompulsory ); |
|
1110 CleanupStack::PushL( sgd ); |
|
1111 // first try to add, if Leaves, list will be untouched |
|
1112 iItemArray->InsertL( aPos, sgd->Des() ); |
|
1113 // if successful, previous item is scrolled up with one, |
|
1114 // so delete that one... |
|
1115 if ( ++aPos < iItemArray->MdcaCount() ) |
|
1116 { |
|
1117 iItemArray->Delete( aPos ); |
|
1118 } |
|
1119 CleanupStack::PopAndDestroy( sgd ); |
|
1120 |
|
1121 APSETUILOGGER_LEAVEFN( ESettings,"Settings::UpdateOnOffListBoxItemL") |
|
1122 } |
|
1123 |
|
1124 |
|
1125 //---------------------------------------------------------- |
|
1126 // CApSettingsDlg::TextualListBoxItemL |
|
1127 //---------------------------------------------------------- |
|
1128 // |
|
1129 void CApSettingsDlg::UpdateTextualListBoxItemL( TApMember aMember, TInt aRes, |
|
1130 TInt aPos, TInt aCompulsory ) |
|
1131 { |
|
1132 APSETUILOGGER_ENTERFN( ESettings,"Settings::UpdateTextualListBoxItemL") |
|
1133 |
|
1134 HBufC* sgd = CreateTextualListBoxItemL( aMember, aRes, aCompulsory ); |
|
1135 CleanupStack::PushL( sgd ); |
|
1136 // first try to add, if Leaves, list will be untouched |
|
1137 iItemArray->InsertL( aPos, sgd->Des() ); |
|
1138 // if successful, previous item is scrolled up with one, |
|
1139 // so delete that one... |
|
1140 if ( ++aPos < iItemArray->MdcaCount() ) |
|
1141 { |
|
1142 iItemArray->Delete( aPos ); |
|
1143 } |
|
1144 CleanupStack::PopAndDestroy( sgd ); |
|
1145 |
|
1146 APSETUILOGGER_LEAVEFN( ESettings,"Settings::UpdateTextualListBoxItemL") |
|
1147 } |
|
1148 |
|
1149 |
|
1150 //---------------------------------------------------------- |
|
1151 // CApSettingsDlg::CreateTextualListBoxItem |
|
1152 //---------------------------------------------------------- |
|
1153 // |
|
1154 HBufC* CApSettingsDlg::CreateTextualListBoxItemL( TApMember aMember, |
|
1155 TInt aRes, |
|
1156 TInt aCompulsory ) |
|
1157 { |
|
1158 APSETUILOGGER_ENTERFN( ESettings,"Settings::CreateTextualListBoxItemL") |
|
1159 |
|
1160 // both variables needed independently of the following |
|
1161 // conditions so I must declare them here... |
|
1162 HBufC16* value; |
|
1163 TBool Pushed( EFalse ); |
|
1164 if ( ( aMember == EApIspLoginScript ) || ( aMember == EApWapStartPage ) |
|
1165 || ( aMember == EApGprsAccessPointName ) |
|
1166 || ( aMember == EApProxyServerAddress ) ) |
|
1167 { |
|
1168 // allocates as much as needed... |
|
1169 value = iApItem->ReadConstLongTextL( aMember )->AllocLC(); |
|
1170 } |
|
1171 else |
|
1172 { |
|
1173 value = HBufC::NewLC( KModifiableTextLength ); |
|
1174 // handle different 'types' (8 bit or 16 bit) descriptors |
|
1175 // and bring them to common base (16 bit...) |
|
1176 if ( ( aMember == EApIspIfCallbackInfo ) |
|
1177 || ( aMember == EApIspInitString ) ) |
|
1178 { |
|
1179 HBufC8* tmpValue8 = HBufC8::NewLC( KModifiableTextLength ); |
|
1180 TPtr8 ptr( tmpValue8->Des() ); |
|
1181 iApItem->ReadTextL( aMember, ptr ); |
|
1182 value->Des().Copy( *tmpValue8 ); |
|
1183 CleanupStack::PopAndDestroy(); // tmpValue8 |
|
1184 } |
|
1185 else |
|
1186 { |
|
1187 if ( aMember == EApProxyPortNumber ) |
|
1188 { |
|
1189 TUint32 tempint; |
|
1190 iApItem->ReadUint( aMember, tempint ); |
|
1191 TPtr ptr( value->Des() ); |
|
1192 ptr.Format( KTxtNumber, tempint ); |
|
1193 } |
|
1194 else |
|
1195 { |
|
1196 TPtr16 ptr( value->Des() ); |
|
1197 if ( ( aMember == EApIspIfAuthPass ) |
|
1198 || ( aMember == EApIspLoginPass ) ) |
|
1199 { |
|
1200 ptr.SetLength( KStaredPasswordLength ); |
|
1201 ptr.Fill( '*' ); |
|
1202 } |
|
1203 else |
|
1204 { |
|
1205 iApItem->ReadTextL( aMember, ptr ); |
|
1206 } |
|
1207 } |
|
1208 } |
|
1209 switch ( aMember ) |
|
1210 { |
|
1211 case EApIspIPAddr: |
|
1212 { |
|
1213 if ( ( value->Compare( KDynIpAddress ) == 0 ) |
|
1214 || ( value->Compare( KEmptyText ) == 0 ) ) |
|
1215 { |
|
1216 value = iEikonEnv->AllocReadResourceLC( |
|
1217 R_APUI_VIEW_IP_ADDR_DYNAMIC ); |
|
1218 Pushed = ETrue; |
|
1219 } |
|
1220 break; |
|
1221 } |
|
1222 case EApIspIPNetMask: |
|
1223 case EApIspIPGateway: |
|
1224 case EApWlanIpNetMask: |
|
1225 case EApWlanIpGateway: |
|
1226 { |
|
1227 if ( ( value->Compare( KDynIpAddress ) == 0 ) |
|
1228 || ( value->Compare( KEmptyText ) == 0 ) ) |
|
1229 { |
|
1230 value = iEikonEnv->AllocReadResourceLC( |
|
1231 R_APUI_VIEW_COMPULSORY ); |
|
1232 Pushed = ETrue; |
|
1233 } |
|
1234 break; |
|
1235 } |
|
1236 case EApGprsIPNameServer1: |
|
1237 case EApIspIPNameServer1: |
|
1238 case EApGprsIPNameServer2: |
|
1239 case EApIspIPNameServer2: |
|
1240 { |
|
1241 if ( ( value->Compare( KDynIpAddress ) == 0 ) |
|
1242 || ( value->Compare( KEmptyText ) == 0 ) ) |
|
1243 { |
|
1244 value = iEikonEnv->AllocReadResourceLC( |
|
1245 R_APUI_VIEW_NEW_AP_DNS_SERVER_AUTOMATIC ); |
|
1246 Pushed = ETrue; |
|
1247 } |
|
1248 break; |
|
1249 } |
|
1250 case EApIspDefaultTelNumber: |
|
1251 case EApWlanNetworkName: |
|
1252 { |
|
1253 if ( value->Compare( KEmptyText ) == 0 ) |
|
1254 { |
|
1255 value = iEikonEnv->AllocReadResourceLC( |
|
1256 R_APUI_VIEW_AVKON_COMPULSORY ); |
|
1257 Pushed = ETrue; |
|
1258 } |
|
1259 break; |
|
1260 } |
|
1261 default: |
|
1262 { |
|
1263 break; |
|
1264 } |
|
1265 } |
|
1266 } |
|
1267 // Define a heap descriptor to hold all the item text |
|
1268 // HBufC is non-modifiable |
|
1269 HBufC* title = iEikonEnv->AllocReadResourceLC( aRes ); |
|
1270 |
|
1271 HBufC* value1 = ReplaceWhiteSpaceCharactersLC( *value ); |
|
1272 |
|
1273 if ( value1->CompareC( KEmpty ) == 0 ) |
|
1274 { // empty, get 'None' as value |
|
1275 HBufC* temp = NULL; |
|
1276 switch ( aMember ) |
|
1277 { |
|
1278 case EApWapStartPage: |
|
1279 { // get special None for homepage |
|
1280 temp = iEikonEnv->AllocReadResourceLC( |
|
1281 R_APUI_SETT_HOME_PAGE_NONE ); |
|
1282 break; |
|
1283 } |
|
1284 case EApIspIfAuthName: |
|
1285 { // user name none |
|
1286 temp = iEikonEnv->AllocReadResourceLC( |
|
1287 R_APUI_VIEW_NEW_AP_USER_NAME_NONE ); |
|
1288 break; |
|
1289 } |
|
1290 case EApProxyServerAddress: |
|
1291 { // proxy server address none |
|
1292 temp = iEikonEnv->AllocReadResourceLC( |
|
1293 R_APUI_VIEW_NEW_AP_PROXY_SERVER_ADDR_NONE ); |
|
1294 break; |
|
1295 } |
|
1296 case EApIspIfCallbackInfo: |
|
1297 { // callback number none |
|
1298 temp = iEikonEnv->AllocReadResourceLC( |
|
1299 R_APUI_VIEW_NEW_AP_CB_NUMBER_NONE ); |
|
1300 break; |
|
1301 } |
|
1302 case EApIspLoginScript: |
|
1303 { // login script none |
|
1304 temp = iEikonEnv->AllocReadResourceLC( |
|
1305 R_APUI_VIEW_NEW_AP_LOGIN_SCRIPT_NONE ); |
|
1306 break; |
|
1307 } |
|
1308 case EApIspInitString: |
|
1309 { // modem init string none |
|
1310 temp = iEikonEnv->AllocReadResourceLC( |
|
1311 R_APUI_VIEW_NEW_AP_MODEM_INIT_NONE ); |
|
1312 break; |
|
1313 } |
|
1314 default: |
|
1315 { // get 'normal' None for others |
|
1316 temp = |
|
1317 iEikonEnv->AllocReadResourceLC( |
|
1318 R_APUI_SETT_VAL_FIELD_NONE ); |
|
1319 break; |
|
1320 } |
|
1321 } |
|
1322 CleanupStack::Pop(); // temp |
|
1323 CleanupStack::PopAndDestroy( value1 ); |
|
1324 CleanupStack::PushL( temp ); |
|
1325 value1 = temp; |
|
1326 } |
|
1327 |
|
1328 // Define a heap descriptor to hold all the item text |
|
1329 TInt length = title->Length() + value1->Length() + 10; |
|
1330 if ( aCompulsory ) |
|
1331 { |
|
1332 length += 3; |
|
1333 } |
|
1334 HBufC* itemText = HBufC::NewLC( length ); |
|
1335 |
|
1336 // handle exotic language number conversion here |
|
1337 TPtr t(title->Des()); |
|
1338 TPtr v(value1->Des()); |
|
1339 AknTextUtils::LanguageSpecificNumberConversion( t ); |
|
1340 AknTextUtils::LanguageSpecificNumberConversion( v ); |
|
1341 |
|
1342 // Define a modifiable pointer descriptor to be able to append text to the |
|
1343 // non-modifiable heap descriptor itemText |
|
1344 TPtr itemTextPtr = itemText->Des(); |
|
1345 itemTextPtr.Format( KTxtListItemFormat, title, value1 ); |
|
1346 if ( aCompulsory ) |
|
1347 { |
|
1348 itemTextPtr.Append( KTxtCompulsory ); |
|
1349 } |
|
1350 CleanupStack::Pop(); // itemtext, |
|
1351 if ( Pushed ) |
|
1352 { |
|
1353 // "Dynamic" text from resource if needed |
|
1354 CleanupStack::PopAndDestroy(); |
|
1355 } |
|
1356 // title, value, value1. !value is allocated with LC in both cases...! |
|
1357 CleanupStack::PopAndDestroy( 3 ); |
|
1358 |
|
1359 APSETUILOGGER_LEAVEFN( ESettings,"Settings::CreateTextualListBoxItemL") |
|
1360 return itemText; |
|
1361 } |
|
1362 |
|
1363 |
|
1364 |
|
1365 //---------------------------------------------------------- |
|
1366 // CApSettingsDlg::CreateOnOffListBoxItemL |
|
1367 //---------------------------------------------------------- |
|
1368 // |
|
1369 HBufC* CApSettingsDlg::CreateOnOffListBoxItemL( TApMember aMember, TInt aRes, |
|
1370 TInt aCompulsory ) |
|
1371 { |
|
1372 APSETUILOGGER_ENTERFN( ESettings,"Settings::CreateOnOffListBoxItemL") |
|
1373 |
|
1374 // Read up title text from resource |
|
1375 HBufC* title = iEikonEnv->AllocReadResourceLC( aRes ); |
|
1376 |
|
1377 TUint32 aValueResourceID = 0; |
|
1378 TBool bvar; |
|
1379 |
|
1380 switch ( aMember ) |
|
1381 { |
|
1382 case EApIspBearerCallTypeIsdn: |
|
1383 {// Data call type "Analogue"/"ISDN" |
|
1384 TUint32 tempint; |
|
1385 iApItem->ReadUint( EApIspBearerCallTypeIsdn, tempint ); |
|
1386 switch ( tempint ) |
|
1387 { |
|
1388 case ECallTypeISDNv110: |
|
1389 { |
|
1390 aValueResourceID = R_APUI_VIEW_DATACALL_ISDN_110; |
|
1391 break; |
|
1392 } |
|
1393 case ECallTypeISDNv120: |
|
1394 { |
|
1395 aValueResourceID = R_APUI_VIEW_DATACALL_ISDN_120; |
|
1396 break; |
|
1397 } |
|
1398 case ECallTypeAnalogue: |
|
1399 default: |
|
1400 { |
|
1401 aValueResourceID = R_APUI_VIEW_DATACALL_ANALOLGUE; |
|
1402 break; |
|
1403 } |
|
1404 } |
|
1405 break; |
|
1406 } |
|
1407 case EApWapWspOption: |
|
1408 { // "Continuous"/"Temporary" |
|
1409 TUint32 tval; |
|
1410 iApItem->ReadUint( aMember, tval ); |
|
1411 if ( tval == EWapWspOptionConnectionOriented ) |
|
1412 { |
|
1413 aValueResourceID = R_APUI_VIEW_CONN_TYPE_CONTIN; |
|
1414 } |
|
1415 else |
|
1416 { |
|
1417 aValueResourceID = R_APUI_VIEW_CONN_TYPE_TEMP; |
|
1418 } |
|
1419 break; |
|
1420 } |
|
1421 case EApIspIfCallbackType: |
|
1422 { // "Use server number"/"Use other number" |
|
1423 TUint32 tval; |
|
1424 iApItem->ReadUint( aMember, tval ); |
|
1425 if ( tval == ECallbackActionMSCBCPAcceptServerSpecifiedNumber ) |
|
1426 { |
|
1427 aValueResourceID = R_APUI_VIEW_CB_USE_SERVER_NUMBER; |
|
1428 } |
|
1429 else |
|
1430 { |
|
1431 if ( tval == |
|
1432 ECallbackActionMSCBCPRequireClientSpecifiedNumber ) |
|
1433 { |
|
1434 aValueResourceID = R_APUI_VIEW_CB_USE_OTHER_NUMBER; |
|
1435 } |
|
1436 } |
|
1437 break; |
|
1438 } |
|
1439 case EApWapSecurity: |
|
1440 { // on/off |
|
1441 iApItem->ReadBool( aMember, bvar ); |
|
1442 if ( bvar ) |
|
1443 { |
|
1444 aValueResourceID = R_APUI_VIEW_WTLS_SECURITY_ON; |
|
1445 } |
|
1446 else |
|
1447 { |
|
1448 aValueResourceID = R_APUI_VIEW_WTLS_SECURITY_OFF; |
|
1449 } |
|
1450 break; |
|
1451 } |
|
1452 case EApIspUseLoginScript: |
|
1453 { |
|
1454 iApItem->ReadBool( aMember, bvar ); |
|
1455 if ( bvar ) |
|
1456 { |
|
1457 aValueResourceID = R_APUI_VIEW_USE_LOGINS_YES; |
|
1458 } |
|
1459 else |
|
1460 { |
|
1461 aValueResourceID = R_APUI_VIEW_USE_LOGINS_NO; |
|
1462 } |
|
1463 break; |
|
1464 } |
|
1465 |
|
1466 case EApIspEnableSWCompression: |
|
1467 case EApGprsHeaderCompression: |
|
1468 { |
|
1469 iApItem->ReadBool( aMember, bvar ); |
|
1470 if ( bvar ) |
|
1471 { |
|
1472 aValueResourceID = R_APUI_VIEW_PPP_COMP_YES; |
|
1473 } |
|
1474 else |
|
1475 { |
|
1476 aValueResourceID = R_APUI_VIEW_PPP_COMP_NO; |
|
1477 } |
|
1478 break; |
|
1479 } |
|
1480 case EApIspPromptForLogin: |
|
1481 { |
|
1482 iApItem->ReadBool( aMember, bvar ); |
|
1483 if ( bvar ) |
|
1484 { |
|
1485 aValueResourceID = R_APUI_VIEW_PROMPT_PASSWD_YES; |
|
1486 } |
|
1487 else |
|
1488 { |
|
1489 aValueResourceID = R_APUI_VIEW_PROMPT_PASSWD_NO; |
|
1490 } |
|
1491 break; |
|
1492 } |
|
1493 case EApIspIfCallbackEnabled: |
|
1494 { // yes/no |
|
1495 iApItem->ReadBool( aMember, bvar ); |
|
1496 if ( bvar ) |
|
1497 { |
|
1498 aValueResourceID = R_APUI_VIEW_USE_CB_YES; |
|
1499 } |
|
1500 else |
|
1501 { |
|
1502 aValueResourceID = R_APUI_VIEW_USE_CB_NO; |
|
1503 } |
|
1504 break; |
|
1505 } |
|
1506 case EApWapCurrentBearer: |
|
1507 { // "Packet data"/"SMS"/"Data call" |
|
1508 if ( iBearerType == EApBearerTypeCSD ) |
|
1509 { |
|
1510 aValueResourceID = R_APUI_VIEW_BEARER_TYPE_CSD; |
|
1511 } |
|
1512 else |
|
1513 { |
|
1514 if ( iBearerType == EApBearerTypeHSCSD ) |
|
1515 { |
|
1516 aValueResourceID = R_APUI_VIEW_BEARER_TYPE_HSCSD; |
|
1517 } |
|
1518 else |
|
1519 { |
|
1520 if ( iBearerType == EApBearerTypeGPRS ) |
|
1521 { |
|
1522 aValueResourceID = R_APUI_VIEW_BEARER_TYPE_GPRS; |
|
1523 } |
|
1524 else |
|
1525 { |
|
1526 if ( IsWlanSupported() ) |
|
1527 { |
|
1528 if ( iBearerType == EApBearerTypeWLAN ) |
|
1529 { |
|
1530 aValueResourceID = |
|
1531 R_APUI_VIEW_BEARER_TYPE_WLAN; |
|
1532 } |
|
1533 else |
|
1534 { |
|
1535 User::Leave( KErrInvalidBearerType ); |
|
1536 } |
|
1537 } |
|
1538 else |
|
1539 { |
|
1540 User::Leave( KErrInvalidBearerType ); |
|
1541 } |
|
1542 } |
|
1543 } |
|
1544 } |
|
1545 break; |
|
1546 } |
|
1547 case EApGprsDisablePlainTextAuth: |
|
1548 case EApIspDisablePlainTextAuth: |
|
1549 { // "Normal"/"Secure" |
|
1550 iApItem->ReadBool( aMember, bvar ); |
|
1551 if ( bvar ) |
|
1552 { |
|
1553 aValueResourceID = R_APUI_VIEW_PASSWORD_AUTH_SECURE; |
|
1554 } |
|
1555 else |
|
1556 { |
|
1557 aValueResourceID = R_APUI_VIEW_PASSWORD_AUTH_NORMAL; |
|
1558 } |
|
1559 break; |
|
1560 } |
|
1561 case EApIspBearerSpeed: |
|
1562 { |
|
1563 TUint32 uvar; |
|
1564 iApItem->ReadUint( aMember, uvar ); |
|
1565 switch ( TApCallSpeed( uvar ) ) |
|
1566 { |
|
1567 case KSpeedAutobaud: |
|
1568 { |
|
1569 aValueResourceID = R_APUI_VIEW_SPEED_AUTODETECT; |
|
1570 break; |
|
1571 } |
|
1572 case KSpeed9600: |
|
1573 { |
|
1574 aValueResourceID = R_APUI_VIEW_SPEED_9600; |
|
1575 break; |
|
1576 } |
|
1577 case KSpeed14400: |
|
1578 { |
|
1579 aValueResourceID = R_APUI_VIEW_SPEED_14400; |
|
1580 break; |
|
1581 } |
|
1582 case KSpeed19200: |
|
1583 { |
|
1584 aValueResourceID = R_APUI_VIEW_SPEED_19200; |
|
1585 break; |
|
1586 } |
|
1587 case KSpeed28800: |
|
1588 { |
|
1589 aValueResourceID = R_APUI_VIEW_SPEED_28800; |
|
1590 break; |
|
1591 } |
|
1592 case KSpeed38400: |
|
1593 { |
|
1594 aValueResourceID = R_APUI_VIEW_SPEED_38400; |
|
1595 break; |
|
1596 } |
|
1597 case KSpeed43200: |
|
1598 { |
|
1599 aValueResourceID = R_APUI_VIEW_SPEED_43200; |
|
1600 break; |
|
1601 } |
|
1602 case KSpeed56000: |
|
1603 { |
|
1604 aValueResourceID = R_APUI_VIEW_SPEED_56000; |
|
1605 break; |
|
1606 } |
|
1607 default: |
|
1608 { |
|
1609 // auto-repair corrupted value |
|
1610 // use 9600 if previous data was not valid... |
|
1611 aValueResourceID = R_APUI_VIEW_SPEED_9600; |
|
1612 } |
|
1613 } |
|
1614 |
|
1615 break; |
|
1616 } |
|
1617 case EApGprsPdpType: |
|
1618 { |
|
1619 TUint32 uvar( 0 ); |
|
1620 iApItem->ReadUint( aMember, uvar ); |
|
1621 if ( uvar == EIPv6 ) |
|
1622 { |
|
1623 aValueResourceID = R_APUI_VIEW_PDP_TYPE_IPV6; |
|
1624 } |
|
1625 else |
|
1626 { |
|
1627 aValueResourceID = R_APUI_VIEW_PDP_TYPE_IPV4; |
|
1628 } |
|
1629 break; |
|
1630 } |
|
1631 case EApIP6DNSAddrFromServer: |
|
1632 { |
|
1633 // Change the 'magic numbers' |
|
1634 // Add the three possibilities here |
|
1635 iApItem->ReadBool( aMember, bvar ); |
|
1636 TInt stype = GetDomainNameServersTypeL(); |
|
1637 |
|
1638 switch ( stype ) |
|
1639 { |
|
1640 case 0: |
|
1641 { |
|
1642 aValueResourceID = |
|
1643 R_APUI_VIEW_NEW_AP_DNS_SERVERS_AUTOMATIC; |
|
1644 break; |
|
1645 } |
|
1646 case 1: |
|
1647 { |
|
1648 aValueResourceID = R_APUI_VIEW_SET_IP_WELL_KNOWN; |
|
1649 break; |
|
1650 } |
|
1651 case 2: |
|
1652 { |
|
1653 aValueResourceID = R_APUI_VIEW_SET_IP_USER_DEFINED; |
|
1654 break; |
|
1655 } |
|
1656 default: |
|
1657 { |
|
1658 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
1659 break; |
|
1660 } |
|
1661 } |
|
1662 break; |
|
1663 } |
|
1664 case EApWlanNetworkMode: |
|
1665 { |
|
1666 TUint32 netmode( 0 ); |
|
1667 iApItem->ReadUint( aMember, netmode ); |
|
1668 if ( netmode == EAdhoc ) |
|
1669 { |
|
1670 aValueResourceID = R_APUI_VIEW_WLAN_NETWORK_MODE_ADHOC; |
|
1671 } |
|
1672 else |
|
1673 { |
|
1674 aValueResourceID = R_APUI_VIEW_WLAN_NETWORK_MODE_INFRA; |
|
1675 } |
|
1676 break; |
|
1677 } |
|
1678 case EApWlanSecurityMode: |
|
1679 { |
|
1680 TUint32 secmode( 0 ); |
|
1681 iApItem->ReadUint( aMember, secmode ); |
|
1682 switch ( secmode ) |
|
1683 { |
|
1684 case EOpen: |
|
1685 { |
|
1686 aValueResourceID = R_APUI_VIEW_WLAN_SECURITY_MODE_OPEN; |
|
1687 break; |
|
1688 } |
|
1689 case EWep: |
|
1690 { |
|
1691 aValueResourceID = R_APUI_VIEW_WLAN_SECURITY_MODE_WEP; |
|
1692 break; |
|
1693 } |
|
1694 case E802_1x: |
|
1695 { |
|
1696 aValueResourceID = R_APUI_VIEW_WLAN_SECURITY_MODE_802_1X; |
|
1697 break; |
|
1698 } |
|
1699 case EWpa: |
|
1700 case EWpa2: |
|
1701 { |
|
1702 aValueResourceID = R_APUI_VIEW_WLAN_SECURITY_MODE_WPA; |
|
1703 break; |
|
1704 } |
|
1705 default: |
|
1706 { |
|
1707 aValueResourceID = R_APUI_VIEW_WLAN_SECURITY_MODE_OPEN; |
|
1708 break; |
|
1709 } |
|
1710 } |
|
1711 |
|
1712 break; |
|
1713 } |
|
1714 case EApWlanScanSSID: |
|
1715 { // yes/no |
|
1716 iApItem->ReadBool( aMember, bvar ); |
|
1717 if ( bvar ) |
|
1718 { |
|
1719 aValueResourceID = R_APUI_VIEW_HIDDEN_NETWORK_YES; |
|
1720 } |
|
1721 else |
|
1722 { |
|
1723 aValueResourceID = R_APUI_VIEW_HIDDEN_NETWORK_NO; |
|
1724 } |
|
1725 break; |
|
1726 } |
|
1727 case EApWlanChannelId: |
|
1728 { // ad-hoc channel auto / user defined |
|
1729 TUint32 channel(0); |
|
1730 iApItem->ReadUint( aMember, channel ); |
|
1731 if ( channel ) |
|
1732 { |
|
1733 aValueResourceID = R_APUI_VIEW_AD_HOC_CHANNEL_USER_DEFINED; |
|
1734 } |
|
1735 else |
|
1736 { |
|
1737 aValueResourceID = R_APUI_VIEW_AD_HOC_CHANNEL_AUTO; |
|
1738 } |
|
1739 break; |
|
1740 } |
|
1741 default: |
|
1742 { |
|
1743 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
1744 break; |
|
1745 } |
|
1746 } |
|
1747 |
|
1748 HBufC* value; |
|
1749 if ( aValueResourceID ) |
|
1750 { |
|
1751 // Read up value text from resource |
|
1752 value = iEikonEnv->AllocReadResourceLC( aValueResourceID ); |
|
1753 } |
|
1754 else |
|
1755 { |
|
1756 value = HBufC::NewLC( 0 ); |
|
1757 } |
|
1758 |
|
1759 |
|
1760 // Define a heap descriptor to hold all the item text |
|
1761 TInt length = title->Length() + value->Length() + 10 ; |
|
1762 if ( aCompulsory ) |
|
1763 { |
|
1764 length += 3; |
|
1765 } |
|
1766 |
|
1767 HBufC* itemText = HBufC::NewLC( length); |
|
1768 |
|
1769 // Define a modifiable pointer descriptor to be able to append text to the |
|
1770 // non-modifiable heap descriptor itemText |
|
1771 TPtr itemTextPtr = itemText->Des(); |
|
1772 itemTextPtr.Format( KTxtListItemFormat, title, value); |
|
1773 if ( aCompulsory ) |
|
1774 { |
|
1775 itemTextPtr.Append( KTxtCompulsory ); |
|
1776 } |
|
1777 |
|
1778 CleanupStack::Pop(); // itemText |
|
1779 CleanupStack::PopAndDestroy( 2 ); // value, title |
|
1780 |
|
1781 APSETUILOGGER_LEAVEFN( ESettings,"Settings::CreateOnOffListBoxItemL") |
|
1782 return itemText; |
|
1783 } |
|
1784 |
|
1785 |
|
1786 |
|
1787 //---------------------------------------------------------- |
|
1788 // CApSettingsDlg::ChangeSettingsL |
|
1789 //---------------------------------------------------------- |
|
1790 // |
|
1791 void CApSettingsDlg::ChangeSettingsL( TBool aQuick ) |
|
1792 { |
|
1793 APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeSettingsL") |
|
1794 |
|
1795 #ifdef __TEST_OOMDEBUG |
|
1796 if ( iMemTestOn ) |
|
1797 { |
|
1798 TInt leavecode( KErrNoMemory ); |
|
1799 |
|
1800 TInt ts( GetTestStateL() ); |
|
1801 |
|
1802 if ( ts == KEditingTest ) |
|
1803 { |
|
1804 TBuf<48> buf; |
|
1805 APSETUILOGGER_WRITE_BUF( _L("Starting Editing memtest") ); |
|
1806 |
|
1807 TUint32 rate( 0 ); |
|
1808 TUint32 retrycount( KOOMRetryCount ); |
|
1809 TUint32 retryoffset( KOOMRetryOffset ); |
|
1810 for ( |
|
1811 rate = 1; |
|
1812 ((rate < 50000) && (leavecode == KErrNoMemory)) || retrycount; |
|
1813 rate++ |
|
1814 ) |
|
1815 { |
|
1816 __UHEAP_SETFAIL( RHeap::EDeterministic, rate ); |
|
1817 TRAP( leavecode, DoChangeSettingsL( aQuick ) ); |
|
1818 __UHEAP_RESET; |
|
1819 if ( !leavecode ) |
|
1820 { |
|
1821 retrycount--; |
|
1822 rate += retryoffset; |
|
1823 } |
|
1824 } |
|
1825 User::LeaveIfError( leavecode ); |
|
1826 buf.Format( _L("\t Memtest finished, max. rate was: %d )"), rate ); |
|
1827 APSETUILOGGER_WRITE_BUF( buf ); |
|
1828 } |
|
1829 else |
|
1830 { |
|
1831 DoChangeSettingsL( aQuick ); |
|
1832 } |
|
1833 } |
|
1834 else |
|
1835 { |
|
1836 DoChangeSettingsL( aQuick ); |
|
1837 } |
|
1838 #else |
|
1839 DoChangeSettingsL( aQuick ); |
|
1840 #endif // __TEST_OOMDEBUG |
|
1841 |
|
1842 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ChangeSettingsL") |
|
1843 } |
|
1844 |
|
1845 |
|
1846 |
|
1847 //---------------------------------------------------------- |
|
1848 // CApSettingsDlg::SetBearerTypeL |
|
1849 //---------------------------------------------------------- |
|
1850 // |
|
1851 void CApSettingsDlg::SetBearerTypeL( TApBearerType aBearer ) |
|
1852 { |
|
1853 APSETUILOGGER_ENTERFN( ESettings,"Settings::SetBearerTypeL") |
|
1854 |
|
1855 iBearerType = aBearer; |
|
1856 |
|
1857 HandleListStructureChangeL(); |
|
1858 |
|
1859 APSETUILOGGER_LEAVEFN( ESettings,"Settings::SetBearerTypeL") |
|
1860 } |
|
1861 |
|
1862 |
|
1863 |
|
1864 //---------------------------------------------------------- |
|
1865 // CApSettingsDlg::InvertSettingsL |
|
1866 //---------------------------------------------------------- |
|
1867 // |
|
1868 void CApSettingsDlg::InvertSettingsL( TApMember aDataMember ) |
|
1869 { |
|
1870 APSETUILOGGER_ENTERFN( ESettings,"Settings::InvertSettingsL") |
|
1871 |
|
1872 switch ( aDataMember ) |
|
1873 { |
|
1874 case EApIspIfCallbackType: |
|
1875 { |
|
1876 TUint32 ctype( ECallbackActionMSCBCPRequireClientSpecifiedNumber ); |
|
1877 iApItem->ReadUint( EApIspIfCallbackType, ctype ); |
|
1878 if ( ctype == ECallbackActionMSCBCPRequireClientSpecifiedNumber ) |
|
1879 { |
|
1880 iApItem->WriteUint( EApIspIfCallbackType, |
|
1881 ECallbackActionMSCBCPAcceptServerSpecifiedNumber ); |
|
1882 } |
|
1883 else |
|
1884 { |
|
1885 iApItem->WriteUint( EApIspIfCallbackType, |
|
1886 ECallbackActionMSCBCPRequireClientSpecifiedNumber ); |
|
1887 } |
|
1888 break; |
|
1889 } |
|
1890 case EApGprsPdpType: |
|
1891 { |
|
1892 TUint32 ipnettype( 0 ); |
|
1893 iApItem->ReadUint( EApGprsPdpType, ipnettype ); |
|
1894 if ( ipnettype == EIPv6 ) |
|
1895 { |
|
1896 iApItem->WriteUint( EApGprsPdpType, EIPv4 ); |
|
1897 } |
|
1898 else |
|
1899 { |
|
1900 iApItem->WriteUint( EApGprsPdpType, EIPv6 ); |
|
1901 } |
|
1902 break; |
|
1903 } |
|
1904 case EApWlanNetworkMode: |
|
1905 { |
|
1906 TUint32 netmode( 0 ); |
|
1907 iApItem->ReadUint( EApWlanNetworkMode, netmode ); |
|
1908 if ( netmode == EAdhoc ) |
|
1909 { |
|
1910 iApItem->WriteUint( EApWlanNetworkMode, EInfra ); |
|
1911 } |
|
1912 else |
|
1913 { |
|
1914 iApItem->WriteUint( EApWlanNetworkMode, EAdhoc ); |
|
1915 LimitSecMode(); |
|
1916 } |
|
1917 break; |
|
1918 } |
|
1919 case EApWapWspOption: |
|
1920 { |
|
1921 TUint32 intvar; |
|
1922 if ( iApItem->ReadUint( aDataMember, intvar ) == KErrNone ) |
|
1923 { |
|
1924 if ( intvar == EWapWspOptionConnectionless ) |
|
1925 { |
|
1926 intvar = EWapWspOptionConnectionOriented; |
|
1927 } |
|
1928 else |
|
1929 { |
|
1930 intvar = EWapWspOptionConnectionless; |
|
1931 } |
|
1932 iApItem->WriteUint( aDataMember, intvar ); |
|
1933 } |
|
1934 break; |
|
1935 } |
|
1936 default: |
|
1937 { |
|
1938 TBool bvar; |
|
1939 if ( iApItem->ReadBool( aDataMember, bvar ) == KErrNone ) |
|
1940 { |
|
1941 bvar = !bvar; |
|
1942 iApItem->WriteBool( aDataMember, bvar ); |
|
1943 } |
|
1944 } |
|
1945 } |
|
1946 |
|
1947 APSETUILOGGER_LEAVEFN( ESettings,"Settings::InvertSettingsL") |
|
1948 } |
|
1949 |
|
1950 |
|
1951 //---------------------------------------------------------- |
|
1952 // CApSettingsDlg::ShowPopupSettingPageL |
|
1953 //---------------------------------------------------------- |
|
1954 // |
|
1955 TBool CApSettingsDlg::ShowPopupSettingPageL( TApMember aData ) |
|
1956 { |
|
1957 APSETUILOGGER_ENTERFN( ESettings,"Settings::ShowPopupSettingPageL") |
|
1958 |
|
1959 TInt currvalue( 0 ); |
|
1960 TBool retval( EFalse ); |
|
1961 TBool mustrepeat( EFalse ); |
|
1962 |
|
1963 CDesCArrayFlat* items = FillPopupSettingPageLC( aData, currvalue ); |
|
1964 |
|
1965 TInt attr_resid( 0 ); |
|
1966 GetResId( aData, attr_resid ); |
|
1967 |
|
1968 do |
|
1969 { |
|
1970 HBufC* titlebuf; |
|
1971 CAknRadioButtonSettingPage* dlg; |
|
1972 if ( attr_resid ) |
|
1973 { |
|
1974 titlebuf = iEikonEnv->AllocReadResourceLC( attr_resid ); |
|
1975 dlg = new ( ELeave )CAknRadioButtonSettingPage( |
|
1976 R_RADIO_BUTTON_SETTING_PAGE, |
|
1977 currvalue, |
|
1978 items ); |
|
1979 // must push 'cause SetSettingTextL can leave... |
|
1980 CleanupStack::PushL( dlg ); |
|
1981 TPtrC ptr( titlebuf->Des() ); |
|
1982 dlg->SetSettingTextL( ptr ); |
|
1983 CleanupStack::Pop(); // dlg |
|
1984 } |
|
1985 else |
|
1986 { |
|
1987 dlg = new ( ELeave )CAknRadioButtonSettingPage( |
|
1988 R_RADIO_BUTTON_SETTING_PAGE, |
|
1989 currvalue, |
|
1990 items ); |
|
1991 } |
|
1992 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) |
|
1993 { |
|
1994 if( AskQueryIfWcdmaL( aData , currvalue) ) |
|
1995 { |
|
1996 UpdateFromPopupSettingPageL( aData, currvalue ); |
|
1997 retval = ETrue; |
|
1998 mustrepeat = EFalse; |
|
1999 } |
|
2000 else |
|
2001 { |
|
2002 mustrepeat = ETrue; |
|
2003 } |
|
2004 } |
|
2005 else |
|
2006 { |
|
2007 mustrepeat = EFalse; |
|
2008 } |
|
2009 if ( attr_resid ) |
|
2010 { |
|
2011 // titlebuf, text title readed from resource... |
|
2012 CleanupStack::PopAndDestroy(); |
|
2013 } |
|
2014 }while( mustrepeat ); |
|
2015 |
|
2016 |
|
2017 // items, will also delete all elements in the array! |
|
2018 CleanupStack::PopAndDestroy( items ); |
|
2019 |
|
2020 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ShowPopupSettingPageL") |
|
2021 return retval; |
|
2022 } |
|
2023 |
|
2024 |
|
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 |
|
2030 //---------------------------------------------------------- |
|
2031 // CApSettingsDlg::ShowPopupTextSettingPageL |
|
2032 //---------------------------------------------------------- |
|
2033 // |
|
2034 TBool CApSettingsDlg::ShowPopupTextSettingPageL( TApMember aData ) |
|
2035 { |
|
2036 APSETUILOGGER_ENTERFN( ESettings,"Settings::ShowPopupTextSettingPageL") |
|
2037 |
|
2038 TBool retval( EFalse ); |
|
2039 |
|
2040 // must be prepared for the worst case... |
|
2041 TBuf<KModifiableLongTextLength> textToChange; |
|
2042 |
|
2043 HBufC* aBuf1 = GetTextLC( aData ); |
|
2044 |
|
2045 HBufC* aBuf = ConvertPerNToDelimLC( aBuf1->Des() ); |
|
2046 |
|
2047 TPtr16 ptr( aBuf->Des() ); |
|
2048 textToChange.Append( ptr ); |
|
2049 |
|
2050 TInt page_resid( 0 ); |
|
2051 TInt TextSettingPageFlags( EAknSettingPageNoOrdinalDisplayed ); |
|
2052 GetTextResId( aData, page_resid, TextSettingPageFlags ); |
|
2053 |
|
2054 |
|
2055 TBool isLatin ( aData == EApWapStartPage ); |
|
2056 |
|
2057 CAccessPointTextSettingPage* dlg = |
|
2058 new( ELeave )CAccessPointTextSettingPage( page_resid, textToChange, |
|
2059 TextSettingPageFlags, |
|
2060 isLatin ); |
|
2061 |
|
2062 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) |
|
2063 { |
|
2064 switch ( aData ) |
|
2065 { |
|
2066 case EApWapStartPage: |
|
2067 case EApGprsAccessPointName: |
|
2068 case EApIspLoginScript: |
|
2069 case EApIspInitString: |
|
2070 case EApWapAccessPointName: |
|
2071 case EApIspLoginName: |
|
2072 case EApIspLoginPass: |
|
2073 case EApIspIfAuthName: |
|
2074 case EApIspIfAuthPass: |
|
2075 { |
|
2076 HBufC* tmp = ConvertDelimToPerNLC( textToChange ); |
|
2077 textToChange.Zero(); |
|
2078 textToChange.Append( tmp->Des() ); |
|
2079 CleanupStack::PopAndDestroy( tmp ); |
|
2080 break; |
|
2081 } |
|
2082 case EApProxyServerAddress: |
|
2083 { |
|
2084 textToChange.Trim(); |
|
2085 break; |
|
2086 } |
|
2087 default: |
|
2088 { // no need for conversion |
|
2089 break; |
|
2090 } |
|
2091 } |
|
2092 if ( ( aData == EApIspLoginScript ) || ( aData == EApWapStartPage ) |
|
2093 || ( aData == EApGprsAccessPointName ) |
|
2094 || ( aData == EApProxyServerAddress ) ) |
|
2095 { |
|
2096 iApItem->WriteLongTextL( aData, textToChange ); |
|
2097 } |
|
2098 else |
|
2099 { |
|
2100 if ( aData == EApProxyPortNumber ) |
|
2101 { |
|
2102 // first remove non-number chars |
|
2103 HBufC* num = StripNonNumberLC( textToChange ); |
|
2104 textToChange.Zero(); |
|
2105 textToChange.Append( num->Des() ); |
|
2106 CleanupStack::PopAndDestroy( num ); |
|
2107 // and now get real numberic value |
|
2108 TInt tempint; |
|
2109 TLex lex; |
|
2110 lex.Assign( textToChange ); |
|
2111 if ( lex.Val( tempint ) ) |
|
2112 { // this means some error, set it to 0 |
|
2113 tempint = 0; |
|
2114 } |
|
2115 iApItem->WriteUint( EApProxyPortNumber, tempint ); |
|
2116 } |
|
2117 else |
|
2118 { |
|
2119 if ( ( aData == EApIspInitString ) ) |
|
2120 { |
|
2121 // must be prepared for the worst case... |
|
2122 TBuf8<KModifiableLongTextLength> textToChange8; |
|
2123 textToChange8.Copy( textToChange ); |
|
2124 iApItem->WriteTextL( aData, textToChange8 ); |
|
2125 } |
|
2126 else |
|
2127 { |
|
2128 if ( aData == EApWapAccessPointName ) |
|
2129 { |
|
2130 iApItem->SetNamesL( textToChange ); |
|
2131 } |
|
2132 else |
|
2133 { |
|
2134 iApItem->WriteTextL( aData, textToChange ); |
|
2135 } |
|
2136 } |
|
2137 } |
|
2138 } |
|
2139 retval = ETrue; |
|
2140 } |
|
2141 *iEventStore |= KApUiEventEdited; |
|
2142 CleanupStack::PopAndDestroy( 2 ); // aBuf, aBuf1 |
|
2143 |
|
2144 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ShowPopupTextSettingPageL") |
|
2145 return retval; |
|
2146 } |
|
2147 |
|
2148 |
|
2149 |
|
2150 //---------------------------------------------------------- |
|
2151 // CApSettingsDlg::GetTextLC |
|
2152 //---------------------------------------------------------- |
|
2153 // |
|
2154 HBufC* CApSettingsDlg::GetTextLC( TApMember aData ) |
|
2155 { |
|
2156 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetTextLC") |
|
2157 |
|
2158 HBufC* ret; |
|
2159 switch ( aData ) |
|
2160 { |
|
2161 case EApWapStartPage: |
|
2162 { // Long text !!! |
|
2163 if ( iApItem->ReadTextLengthL( aData ) ) |
|
2164 { |
|
2165 // allocates as much as needed... |
|
2166 ret = iApItem->ReadConstLongTextL( aData )->AllocLC(); |
|
2167 } |
|
2168 else |
|
2169 { |
|
2170 ret = iEikonEnv->AllocReadResourceLC( |
|
2171 R_APUI_VIEW_WAP_START_PAGE_DEFAULT ); |
|
2172 } |
|
2173 break; |
|
2174 } |
|
2175 case EApGprsAccessPointName: |
|
2176 { |
|
2177 // allocates as much as needed... |
|
2178 ret = iApItem->ReadConstLongTextL( aData )->AllocLC(); |
|
2179 break; |
|
2180 } |
|
2181 case EApIspLoginScript: |
|
2182 { |
|
2183 // allocates as much as needed... |
|
2184 ret = iApItem->ReadConstLongTextL( aData )->AllocLC(); |
|
2185 break; |
|
2186 } |
|
2187 case EApProxyServerAddress: |
|
2188 { |
|
2189 // allocates as much as needed... |
|
2190 ret = iApItem->ReadConstLongTextL( aData )->AllocLC(); |
|
2191 break; |
|
2192 } |
|
2193 case EApWapGatewayAddress: |
|
2194 case EApIspIPAddr: |
|
2195 case EApIspIPNetMask: |
|
2196 case EApWlanIpNetMask: |
|
2197 case EApIspIPGateway: |
|
2198 case EApWlanIpGateway: |
|
2199 case EApGprsIPNameServer1: |
|
2200 case EApIspIPNameServer1: |
|
2201 case EApGprsIPNameServer2: |
|
2202 case EApIspIPNameServer2: |
|
2203 { |
|
2204 ret = HBufC::NewLC( KModifiableTextLength ); |
|
2205 TPtr16 ptr( ret->Des() ); |
|
2206 iApItem->ReadTextL( aData, ptr ); |
|
2207 if ( ptr.Compare( KEmptyText ) == 0 ) |
|
2208 { |
|
2209 *ret = KDynIpAddress; |
|
2210 } |
|
2211 break; |
|
2212 } |
|
2213 case EApIspInitString: |
|
2214 { |
|
2215 ret = HBufC::NewLC( KModifiableTextLength ); |
|
2216 HBufC8* tmpValue8 = HBufC8::NewLC( KModifiableTextLength ); |
|
2217 TPtr8 ptr( tmpValue8->Des() ); |
|
2218 iApItem->ReadTextL( aData, ptr ); |
|
2219 ret->Des().Copy( ptr ); |
|
2220 CleanupStack::PopAndDestroy(); // tmpValue8 |
|
2221 break; |
|
2222 } |
|
2223 case EApProxyPortNumber: |
|
2224 { |
|
2225 TUint32 tempint; |
|
2226 iApItem->ReadUint( EApProxyPortNumber, tempint ); |
|
2227 ret = HBufC::NewLC( KMaxProxyPortNumberLength ); |
|
2228 TPtr itemTextPtr = ret->Des(); |
|
2229 itemTextPtr.Format( KTxtNumber, tempint ); |
|
2230 break; |
|
2231 } |
|
2232 default: |
|
2233 { |
|
2234 ret = HBufC::NewLC( KModifiableTextLength ); |
|
2235 TPtr16 ptr( ret->Des() ); |
|
2236 iApItem->ReadTextL( aData, ptr ); |
|
2237 break; |
|
2238 } |
|
2239 } |
|
2240 |
|
2241 switch ( aData ) |
|
2242 { |
|
2243 case EApWapStartPage: |
|
2244 case EApGprsAccessPointName: |
|
2245 case EApIspLoginScript: |
|
2246 case EApIspInitString: |
|
2247 case EApWapAccessPointName: |
|
2248 case EApIspLoginName: |
|
2249 case EApIspLoginPass: |
|
2250 case EApIspIfAuthName: |
|
2251 case EApIspIfAuthPass: |
|
2252 { |
|
2253 break; |
|
2254 } |
|
2255 default: |
|
2256 { |
|
2257 // nothing to do |
|
2258 break; |
|
2259 } |
|
2260 } |
|
2261 |
|
2262 |
|
2263 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetTextLC") |
|
2264 return ret; |
|
2265 } |
|
2266 |
|
2267 |
|
2268 //---------------------------------------------------------- |
|
2269 // CApSettingsDlg::GetTextResId |
|
2270 //---------------------------------------------------------- |
|
2271 // |
|
2272 void CApSettingsDlg::GetTextResId( TApMember aData, TInt& apage, |
|
2273 TInt& aTextSettingPageFlags ) |
|
2274 { |
|
2275 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetTextResId") |
|
2276 |
|
2277 if ( ( aData != EApWapAccessPointName ) |
|
2278 && ( aData != EApIspDefaultTelNumber ) ) |
|
2279 { |
|
2280 aTextSettingPageFlags |= CAknTextSettingPage::EZeroLengthAllowed; |
|
2281 } |
|
2282 else |
|
2283 { |
|
2284 aTextSettingPageFlags &= (~CAknTextSettingPage::EZeroLengthAllowed); |
|
2285 } |
|
2286 |
|
2287 switch ( aData ) |
|
2288 { |
|
2289 case EApIspInitString: |
|
2290 { |
|
2291 apage = R_TEXT_SETTING_PAGE_MODEM_INIT_STRING; |
|
2292 break; |
|
2293 } |
|
2294 case EApWapAccessPointName: |
|
2295 { |
|
2296 apage = R_TEXT_SETTING_PAGE_CONN_NAME; |
|
2297 break; |
|
2298 } |
|
2299 case EApGprsAccessPointName: |
|
2300 { |
|
2301 apage = R_TEXT_SETTING_PAGE_GPRSAP_NAME; |
|
2302 break; |
|
2303 } |
|
2304 case EApIspLoginScript:// use EDWIN for script. |
|
2305 { |
|
2306 apage = R_TEXT_SETTING_PAGE_LOGIN_SCRIPT; |
|
2307 break; |
|
2308 } |
|
2309 case EApIspLoginName: |
|
2310 case EApIspIfAuthName: |
|
2311 { |
|
2312 apage = R_TEXT_SETTING_PAGE_LOGIN_NAME; |
|
2313 break; |
|
2314 } |
|
2315 case EApWapStartPage: |
|
2316 { |
|
2317 apage = R_TEXT_SETTING_PAGE_STARTING_PAGE; |
|
2318 break; |
|
2319 } |
|
2320 // use EDWINS as no such thing as PhoneNumber editor... |
|
2321 case EApIspDefaultTelNumber: |
|
2322 { |
|
2323 apage = R_TEXT_SETTING_PAGE_ACCESS_NUM; |
|
2324 break; |
|
2325 } |
|
2326 case EApIspIfCallbackInfo: |
|
2327 { |
|
2328 apage = R_TEXT_SETTING_PAGE_CB_NUM; |
|
2329 break; |
|
2330 } |
|
2331 case EApWapGatewayAddress: |
|
2332 { |
|
2333 apage = R_TEXT_SETTING_PAGE_GW_ADDR; |
|
2334 break; |
|
2335 } |
|
2336 case EApProxyServerAddress: |
|
2337 { |
|
2338 apage = R_TEXT_SETTING_PAGE_PROXY_SERVER_ADDR; |
|
2339 break; |
|
2340 } |
|
2341 case EApProxyPortNumber: |
|
2342 { |
|
2343 apage = R_TEXT_SETTING_PAGE_PROXY_PORT_NUMBER; |
|
2344 break; |
|
2345 } |
|
2346 case EApIspIPAddr: |
|
2347 { |
|
2348 apage = R_TEXT_SETTING_PAGE_ISPIP_ADDR; |
|
2349 break; |
|
2350 } |
|
2351 case EApIspIPNetMask: |
|
2352 case EApWlanIpNetMask: |
|
2353 { |
|
2354 apage = R_TEXT_SETTING_PAGE_ISP_NET_MASK; |
|
2355 break; |
|
2356 } |
|
2357 case EApIspIPGateway: |
|
2358 case EApWlanIpGateway: |
|
2359 { |
|
2360 apage = R_TEXT_SETTING_PAGE_ISP_GATEWAY; |
|
2361 break; |
|
2362 } |
|
2363 case EApGprsIPNameServer1: |
|
2364 case EApIspIPNameServer1: |
|
2365 { |
|
2366 apage = R_TEXT_SETTING_PAGE_NAME_SERV1; |
|
2367 break; |
|
2368 } |
|
2369 case EApGprsIPNameServer2: |
|
2370 case EApIspIPNameServer2: |
|
2371 { |
|
2372 apage = R_TEXT_SETTING_PAGE_NAME_SERV2; |
|
2373 break; |
|
2374 } |
|
2375 case EApIspLoginPass: |
|
2376 case EApIspIfAuthPass: |
|
2377 { // use EEikCtSecretEd |
|
2378 apage = R_TEXT_SETTING_PAGE_LOGIN_PASSWD; |
|
2379 break; |
|
2380 } |
|
2381 |
|
2382 case EApIspUseLoginScript: |
|
2383 {// use EDWIN: |
|
2384 apage = R_SETTING_APP_EDWIN_LOGIN_SCRIPT; |
|
2385 break; |
|
2386 } |
|
2387 case EApWlanNetworkName: |
|
2388 { |
|
2389 apage = R_TEXT_SETTING_PAGE_NETW_NAME; |
|
2390 break; |
|
2391 } |
|
2392 default: |
|
2393 { |
|
2394 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
2395 apage = 0; |
|
2396 break; |
|
2397 } |
|
2398 } |
|
2399 |
|
2400 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetTextResId") |
|
2401 } |
|
2402 |
|
2403 |
|
2404 |
|
2405 //---------------------------------------------------------- |
|
2406 // CApSettingsDlg::GetResId |
|
2407 //---------------------------------------------------------- |
|
2408 // |
|
2409 void CApSettingsDlg::GetResId( TApMember aData, TInt& aattr ) |
|
2410 { |
|
2411 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetResId") |
|
2412 |
|
2413 // not text based ones: |
|
2414 switch ( aData ) |
|
2415 { |
|
2416 case EApWapCurrentBearer: |
|
2417 { |
|
2418 aattr = R_APUI_VIEW_BEARER_TYPE; |
|
2419 break; |
|
2420 } |
|
2421 case EApWapSecurity: |
|
2422 { |
|
2423 aattr = R_APUI_VIEW_WTLS_SECURITY; |
|
2424 break; |
|
2425 } |
|
2426 case EApWapWspOption: |
|
2427 { |
|
2428 aattr = R_APUI_VIEW_CONNECTION_TYPE; |
|
2429 break; |
|
2430 } |
|
2431 case EApIspPromptForLogin: |
|
2432 { |
|
2433 aattr = R_APUI_VIEW_PROMPT_PASSWORD; |
|
2434 break; |
|
2435 } |
|
2436 case EApGprsDisablePlainTextAuth: |
|
2437 case EApIspDisablePlainTextAuth: |
|
2438 { |
|
2439 aattr = R_APUI_VIEW_PASSWORD_AUTH; |
|
2440 break; |
|
2441 } |
|
2442 case EApIspBearerCallTypeIsdn: // used for data call type |
|
2443 { |
|
2444 aattr = R_APUI_VIEW_DATA_CALL_TYPE; |
|
2445 break; |
|
2446 } |
|
2447 case EApIspBearerSpeed: |
|
2448 { |
|
2449 aattr = R_APUI_VIEW_MAX_CONN_SPEED; |
|
2450 break; |
|
2451 } |
|
2452 case EApIspIfCallbackEnabled: |
|
2453 { |
|
2454 aattr = R_APUI_VIEW_USE_CALL_BACK; |
|
2455 break; |
|
2456 } |
|
2457 case EApIspIfCallbackType: |
|
2458 { |
|
2459 aattr = R_APUI_VIEW_CALL_BACK_TYPE; |
|
2460 break; |
|
2461 } |
|
2462 case EApIspEnableSWCompression: |
|
2463 case EApGprsHeaderCompression: |
|
2464 { |
|
2465 aattr = R_APUI_VIEW_ENABLE_PPP_COMP; |
|
2466 break; |
|
2467 } |
|
2468 case EApIspInitString: |
|
2469 { |
|
2470 aattr = R_APUI_VIEW_MODEM_INIT_STRING; |
|
2471 break; |
|
2472 } |
|
2473 case EApIspUseLoginScript: |
|
2474 { |
|
2475 aattr = R_APUI_VIEW_USE_LOGIN_SCRIPT; |
|
2476 break; |
|
2477 } |
|
2478 case EApGprsPdpType: |
|
2479 { |
|
2480 aattr = R_APUI_VIEW_PDP_TYPE; |
|
2481 break; |
|
2482 } |
|
2483 case EApIP6DNSAddrFromServer: |
|
2484 { |
|
2485 aattr = R_APUI_VIEW_SET_DNS_SERVERS_IP; |
|
2486 break; |
|
2487 } |
|
2488 case EApWlanNetworkName: |
|
2489 { |
|
2490 aattr = R_APUI_VIEW_WLAN_NETWORK_NAME; |
|
2491 break; |
|
2492 } |
|
2493 case EApWlanNetworkMode: |
|
2494 { |
|
2495 aattr = R_APUI_VIEW_WLAN_NETWORK_MODE; |
|
2496 break; |
|
2497 } |
|
2498 case EApWlanSecurityMode: |
|
2499 { |
|
2500 aattr = R_APUI_VIEW_WLAN_SECURITY_MODE; |
|
2501 break; |
|
2502 } |
|
2503 case EApWlanScanSSID: |
|
2504 { |
|
2505 aattr = R_APUI_VIEW_WLAN_HIDDEN_NETWORK; |
|
2506 break; |
|
2507 } |
|
2508 case EApWlanChannelId: |
|
2509 { |
|
2510 aattr = R_APUI_VIEW_AD_HOC; |
|
2511 break; |
|
2512 } |
|
2513 default: |
|
2514 { |
|
2515 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
2516 aattr = 0; |
|
2517 break; |
|
2518 } |
|
2519 } |
|
2520 |
|
2521 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetResId") |
|
2522 } |
|
2523 |
|
2524 |
|
2525 |
|
2526 |
|
2527 // --------------------------------------------------------- |
|
2528 // CApSettingsDlg::FillPopupSettingPageL |
|
2529 // --------------------------------------------------------- |
|
2530 // |
|
2531 CDesCArrayFlat* CApSettingsDlg::FillPopupSettingPageLC( TApMember aData, |
|
2532 TInt& aCurrvalue ) |
|
2533 { |
|
2534 APSETUILOGGER_ENTERFN( ESettings,"Settings::FillPopupSettingPageLC") |
|
2535 |
|
2536 CDesCArrayFlat* items = new( ELeave)CDesCArrayFlat( 1 ); |
|
2537 CleanupStack::PushL( items ); |
|
2538 |
|
2539 TUint32 tval( 0 ); |
|
2540 |
|
2541 switch ( aData ) |
|
2542 { |
|
2543 case EApIspPromptForLogin: |
|
2544 { |
|
2545 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2546 R_APUI_VIEW_PROMPT_PASSWD_YES ) ); |
|
2547 CleanupStack::PopAndDestroy(); |
|
2548 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2549 R_APUI_VIEW_PROMPT_PASSWD_NO ) ); |
|
2550 CleanupStack::PopAndDestroy(); |
|
2551 GetBoolDataValue( aData, ETrue, aCurrvalue ); |
|
2552 break; |
|
2553 } |
|
2554 case EApWapSecurity: |
|
2555 { |
|
2556 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2557 R_APUI_VIEW_WTLS_SECURITY_ON ) ); |
|
2558 CleanupStack::PopAndDestroy(); |
|
2559 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2560 R_APUI_VIEW_WTLS_SECURITY_OFF ) ); |
|
2561 CleanupStack::PopAndDestroy(); |
|
2562 GetBoolDataValue( aData, ETrue, aCurrvalue ); |
|
2563 break; |
|
2564 } |
|
2565 case EApIspIfCallbackEnabled: |
|
2566 { |
|
2567 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2568 R_APUI_VIEW_USE_CB_YES ) ); |
|
2569 CleanupStack::PopAndDestroy(); |
|
2570 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2571 R_APUI_VIEW_USE_CB_NO ) ); |
|
2572 CleanupStack::PopAndDestroy(); |
|
2573 GetBoolDataValue( aData, ETrue, aCurrvalue ); |
|
2574 break; |
|
2575 } |
|
2576 case EApIspEnableSWCompression: |
|
2577 case EApGprsHeaderCompression: |
|
2578 { |
|
2579 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2580 R_APUI_VIEW_PPP_COMP_YES ) ); |
|
2581 CleanupStack::PopAndDestroy(); |
|
2582 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2583 R_APUI_VIEW_PPP_COMP_NO ) ); |
|
2584 CleanupStack::PopAndDestroy(); |
|
2585 GetBoolDataValue( aData, ETrue, aCurrvalue ); |
|
2586 break; |
|
2587 } |
|
2588 case EApWapCurrentBearer: |
|
2589 { |
|
2590 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2591 R_APUI_VIEW_BEARER_TYPE_GPRS ) ); |
|
2592 CleanupStack::PopAndDestroy(); |
|
2593 |
|
2594 if ( IsWlanSupported() ) |
|
2595 { |
|
2596 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2597 R_APUI_VIEW_BEARER_TYPE_WLAN ) ); |
|
2598 CleanupStack::PopAndDestroy(); |
|
2599 } |
|
2600 |
|
2601 TBool isCsdSupported = |
|
2602 FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ); |
|
2603 #ifdef __TEST_CSD_SUPPORT |
|
2604 isCsdSupported = ETrue; |
|
2605 #endif // __TEST_CSD_SUPPORT |
|
2606 |
|
2607 if ( isCsdSupported ) |
|
2608 { |
|
2609 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2610 R_APUI_VIEW_BEARER_TYPE_CSD ) ); |
|
2611 CleanupStack::PopAndDestroy(); |
|
2612 |
|
2613 if ( IsHSCSDEnabledL() ) |
|
2614 { |
|
2615 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2616 R_APUI_VIEW_BEARER_TYPE_HSCSD ) ); |
|
2617 CleanupStack::PopAndDestroy(); |
|
2618 } |
|
2619 } |
|
2620 aCurrvalue = BearerType2BearerItemPosL( iBearerType ); |
|
2621 break; |
|
2622 } |
|
2623 case EApGprsDisablePlainTextAuth: |
|
2624 case EApIspDisablePlainTextAuth: |
|
2625 { |
|
2626 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2627 R_APUI_VIEW_PASSWORD_AUTH_NORMAL ) ); |
|
2628 CleanupStack::PopAndDestroy(); |
|
2629 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2630 R_APUI_VIEW_PASSWORD_AUTH_SECURE ) ); |
|
2631 CleanupStack::PopAndDestroy(); |
|
2632 GetBoolDataValue( aData, EFalse, aCurrvalue ); |
|
2633 // needs to be inverted? |
|
2634 break; |
|
2635 } |
|
2636 case EApWapWspOption: |
|
2637 { |
|
2638 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2639 R_APUI_VIEW_CONN_TYPE_CONTIN ) ); |
|
2640 CleanupStack::PopAndDestroy(); |
|
2641 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2642 R_APUI_VIEW_CONN_TYPE_TEMP ) ); |
|
2643 CleanupStack::PopAndDestroy(); |
|
2644 iApItem->ReadUint( aData, tval ); |
|
2645 aCurrvalue = Min( 1, tval ); |
|
2646 aCurrvalue = !aCurrvalue; |
|
2647 break; |
|
2648 } |
|
2649 case EApIspBearerCallTypeIsdn: // used for data call type |
|
2650 { |
|
2651 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2652 R_APUI_VIEW_DATACALL_ANALOLGUE ) ); |
|
2653 CleanupStack::PopAndDestroy(); |
|
2654 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2655 R_APUI_VIEW_DATACALL_ISDN_110 ) ); |
|
2656 CleanupStack::PopAndDestroy(); |
|
2657 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2658 R_APUI_VIEW_DATACALL_ISDN_120 ) ); |
|
2659 CleanupStack::PopAndDestroy(); |
|
2660 iApItem->ReadUint( EApIspBearerCallTypeIsdn, tval ); |
|
2661 switch ( tval ) |
|
2662 { |
|
2663 case ECallTypeISDNv110: |
|
2664 { |
|
2665 aCurrvalue = KIspCallIsdn110; |
|
2666 break; |
|
2667 } |
|
2668 case ECallTypeISDNv120: |
|
2669 { |
|
2670 aCurrvalue = KIspCallIsdn120; |
|
2671 break; |
|
2672 } |
|
2673 default: |
|
2674 case ECallTypeAnalogue: |
|
2675 { |
|
2676 aCurrvalue = KIspCallAnalogue; |
|
2677 break; |
|
2678 } |
|
2679 } |
|
2680 break; |
|
2681 } |
|
2682 case EApIspBearerSpeed: |
|
2683 { |
|
2684 FillUpBearerSpeedValuesL( *items, aCurrvalue ); |
|
2685 break; |
|
2686 } |
|
2687 case EApIspIfCallbackType: |
|
2688 { |
|
2689 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2690 R_APUI_VIEW_CB_USE_SERVER_NUMBER ) ); |
|
2691 CleanupStack::PopAndDestroy(); |
|
2692 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2693 R_APUI_VIEW_CB_USE_OTHER_NUMBER ) ); |
|
2694 CleanupStack::PopAndDestroy(); |
|
2695 iApItem->ReadUint( aData, tval ); |
|
2696 if ( tval == ECallbackActionMSCBCPRequireClientSpecifiedNumber ) |
|
2697 { |
|
2698 aCurrvalue = 1; |
|
2699 } |
|
2700 else |
|
2701 { |
|
2702 aCurrvalue = 0; |
|
2703 } |
|
2704 break; |
|
2705 } |
|
2706 case EApIspUseLoginScript: |
|
2707 { |
|
2708 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2709 R_APUI_VIEW_USE_LOGINS_YES ) ); |
|
2710 CleanupStack::PopAndDestroy(); |
|
2711 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2712 R_APUI_VIEW_USE_LOGINS_NO ) ); |
|
2713 CleanupStack::PopAndDestroy(); |
|
2714 GetBoolDataValue( aData, ETrue, aCurrvalue ); |
|
2715 break; |
|
2716 } |
|
2717 case EApGprsPdpType: |
|
2718 { |
|
2719 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2720 R_APUI_VIEW_PDP_TYPE_IPV4 ) ); |
|
2721 CleanupStack::PopAndDestroy(); |
|
2722 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2723 R_APUI_VIEW_PDP_TYPE_IPV6 ) ); |
|
2724 CleanupStack::PopAndDestroy(); |
|
2725 iApItem->ReadUint( aData, tval ); |
|
2726 if ( tval == EIPv6 ) |
|
2727 { |
|
2728 aCurrvalue = 1; |
|
2729 } |
|
2730 else |
|
2731 { |
|
2732 aCurrvalue = 0; |
|
2733 } |
|
2734 break; |
|
2735 } |
|
2736 case EApIP6DNSAddrFromServer: |
|
2737 { |
|
2738 TApBearerType b = iApItem->BearerTypeL(); |
|
2739 TBool hasAuto = ( b != EApBearerTypeCSD ) |
|
2740 && ( b != EApBearerTypeHSCSD ) ; |
|
2741 if ( hasAuto ) |
|
2742 { |
|
2743 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2744 R_APUI_VIEW_NEW_AP_DNS_SERVERS_AUTOMATIC ) ); |
|
2745 CleanupStack::PopAndDestroy(); |
|
2746 } |
|
2747 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2748 R_APUI_VIEW_SET_IP_WELL_KNOWN ) ); |
|
2749 CleanupStack::PopAndDestroy(); |
|
2750 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2751 R_APUI_VIEW_SET_IP_USER_DEFINED ) ); |
|
2752 CleanupStack::PopAndDestroy(); |
|
2753 TBool bval; |
|
2754 iApItem->ReadBool( aData, bval ); |
|
2755 if ( !bval ) |
|
2756 { |
|
2757 aCurrvalue = GetIPv6DNSTypeL(); |
|
2758 if ( !hasAuto ) |
|
2759 { // no Auto item, dec. currvalue |
|
2760 aCurrvalue--; |
|
2761 } |
|
2762 } |
|
2763 else |
|
2764 { |
|
2765 aCurrvalue = 0; |
|
2766 } |
|
2767 break; |
|
2768 } |
|
2769 case EApWlanNetworkName: |
|
2770 { |
|
2771 if ( IsWlanSupported() ) |
|
2772 { |
|
2773 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2774 R_APUI_VIEW_WLAN_NETWORK_NAME_USER ) ); |
|
2775 CleanupStack::PopAndDestroy(); |
|
2776 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2777 R_APUI_VIEW_WLAN_NETWORK_NAME_SCAN ) ); |
|
2778 CleanupStack::PopAndDestroy(); |
|
2779 // set current value as user defined: if not yet given, |
|
2780 // it is true, if it had been already specified, |
|
2781 // we could not know if it was the user or was it scanned |
|
2782 aCurrvalue = 0; |
|
2783 } |
|
2784 else |
|
2785 { |
|
2786 User::Leave( KErrNotSupported ); |
|
2787 } |
|
2788 break; |
|
2789 } |
|
2790 case EApWlanNetworkMode: |
|
2791 { |
|
2792 if ( IsWlanSupported() ) |
|
2793 { |
|
2794 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2795 R_APUI_VIEW_WLAN_NETWORK_MODE_INFRA ) ); |
|
2796 CleanupStack::PopAndDestroy(); |
|
2797 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2798 R_APUI_VIEW_WLAN_NETWORK_MODE_ADHOC ) ); |
|
2799 CleanupStack::PopAndDestroy(); |
|
2800 iApItem->ReadUint( aData, tval ); |
|
2801 if ( tval == EAdhoc ) |
|
2802 { |
|
2803 aCurrvalue = 1; |
|
2804 } |
|
2805 else |
|
2806 { |
|
2807 aCurrvalue = 0; |
|
2808 } |
|
2809 } |
|
2810 else |
|
2811 { |
|
2812 User::Leave( KErrNotSupported ); |
|
2813 } |
|
2814 break; |
|
2815 } |
|
2816 case EApWlanScanSSID: |
|
2817 { |
|
2818 if ( IsWlanSupported() ) |
|
2819 { |
|
2820 TBool bval(EFalse); |
|
2821 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2822 R_APUI_VIEW_HIDDEN_NETWORK_NO ) ); |
|
2823 CleanupStack::PopAndDestroy(); |
|
2824 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2825 R_APUI_VIEW_HIDDEN_NETWORK_YES ) ); |
|
2826 CleanupStack::PopAndDestroy(); |
|
2827 iApItem->ReadBool( aData, bval ); |
|
2828 if ( bval ) |
|
2829 { |
|
2830 aCurrvalue = 1; |
|
2831 } |
|
2832 else |
|
2833 { |
|
2834 aCurrvalue = 0; |
|
2835 } |
|
2836 } |
|
2837 else |
|
2838 { |
|
2839 User::Leave( KErrNotSupported ); |
|
2840 } |
|
2841 break; |
|
2842 } |
|
2843 case EApWlanChannelId: |
|
2844 { |
|
2845 if ( IsWlanSupported() ) |
|
2846 { |
|
2847 TUint32 channel(0); |
|
2848 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2849 R_APUI_VIEW_AD_HOC_CHANNEL_AUTO ) ); |
|
2850 CleanupStack::PopAndDestroy(); |
|
2851 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2852 R_APUI_VIEW_AD_HOC_CHANNEL_USER_DEFINED ) ); |
|
2853 CleanupStack::PopAndDestroy(); |
|
2854 iApItem->ReadUint( aData, channel ); |
|
2855 if ( channel ) |
|
2856 { |
|
2857 aCurrvalue = 1; |
|
2858 } |
|
2859 else |
|
2860 { |
|
2861 aCurrvalue = 0; |
|
2862 } |
|
2863 } |
|
2864 else |
|
2865 { |
|
2866 User::Leave( KErrNotSupported ); |
|
2867 } |
|
2868 break; |
|
2869 } |
|
2870 case EApWlanSecurityMode: |
|
2871 { |
|
2872 if ( IsWlanSupported() ) |
|
2873 { |
|
2874 TUint32 netmode(0); |
|
2875 |
|
2876 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2877 R_APUI_VIEW_WLAN_SECURITY_MODE_OPEN ) ); |
|
2878 CleanupStack::PopAndDestroy(); |
|
2879 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2880 R_APUI_VIEW_WLAN_SECURITY_MODE_WEP ) ); |
|
2881 CleanupStack::PopAndDestroy(); |
|
2882 |
|
2883 iApItem->ReadUint( EApWlanNetworkMode, netmode ); |
|
2884 if ( netmode == EInfra ) |
|
2885 { |
|
2886 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2887 R_APUI_VIEW_WLAN_SECURITY_MODE_802_1X ) ); |
|
2888 CleanupStack::PopAndDestroy(); |
|
2889 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
2890 R_APUI_VIEW_WLAN_SECURITY_MODE_WPA ) ); |
|
2891 CleanupStack::PopAndDestroy(); |
|
2892 } |
|
2893 |
|
2894 iApItem->ReadUint( aData, tval ); |
|
2895 switch ( tval ) |
|
2896 { |
|
2897 case EOpen: |
|
2898 { |
|
2899 aCurrvalue = 0; |
|
2900 break; |
|
2901 } |
|
2902 case EWep: |
|
2903 { |
|
2904 aCurrvalue = 1; |
|
2905 break; |
|
2906 } |
|
2907 case E802_1x: |
|
2908 { |
|
2909 aCurrvalue = 2; |
|
2910 if ( netmode != EInfra ) |
|
2911 { |
|
2912 aCurrvalue--; |
|
2913 } |
|
2914 break; |
|
2915 } |
|
2916 case EWpa: |
|
2917 case EWpa2: |
|
2918 { |
|
2919 aCurrvalue = 3; |
|
2920 if ( netmode != EInfra ) |
|
2921 { |
|
2922 aCurrvalue-= 2; |
|
2923 } |
|
2924 break; |
|
2925 } |
|
2926 default: |
|
2927 { |
|
2928 aCurrvalue = 0; |
|
2929 break; |
|
2930 } |
|
2931 } |
|
2932 } |
|
2933 else |
|
2934 { |
|
2935 User::Leave( KErrNotSupported ); |
|
2936 } |
|
2937 break; |
|
2938 } |
|
2939 default: |
|
2940 { |
|
2941 __ASSERT_DEBUG( EFalse, Panic ( EUnknownCase ) ); |
|
2942 User::Leave( KErrInvalidColumn ); |
|
2943 break; |
|
2944 } |
|
2945 } |
|
2946 |
|
2947 APSETUILOGGER_LEAVEFN( ESettings,"Settings::FillPopupSettingPageLC") |
|
2948 return items; |
|
2949 } |
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 // --------------------------------------------------------- |
|
2955 // CApSettingsDlg::UpdateFromPopupSettingPageL |
|
2956 // --------------------------------------------------------- |
|
2957 // |
|
2958 void CApSettingsDlg::UpdateFromPopupSettingPageL( TApMember aData, |
|
2959 TInt aCurrvalue ) |
|
2960 { |
|
2961 APSETUILOGGER_ENTERFN( ESettings,"Settings::UpdateFromPopupSettingPageL") |
|
2962 |
|
2963 switch ( aData ) |
|
2964 { |
|
2965 case EApWapSecurity: |
|
2966 case EApIspPromptForLogin: |
|
2967 case EApIspIfCallbackEnabled: |
|
2968 case EApIspEnableSWCompression: |
|
2969 case EApGprsHeaderCompression: |
|
2970 case EApIspUseLoginScript: |
|
2971 { // INVERTED! |
|
2972 iApItem->WriteBool( aData, !( TBool( aCurrvalue ) ) ); |
|
2973 break; |
|
2974 } |
|
2975 case EApWlanScanSSID: |
|
2976 case EApGprsDisablePlainTextAuth: |
|
2977 case EApIspDisablePlainTextAuth: |
|
2978 { // NOT INVERTED! |
|
2979 iApItem->WriteBool( aData, ( TBool( aCurrvalue ) ) ); |
|
2980 break; |
|
2981 } |
|
2982 case EApWapWspOption: |
|
2983 { |
|
2984 if ( aCurrvalue ) |
|
2985 { |
|
2986 iApItem->WriteUint( EApWapWspOption, |
|
2987 EWapWspOptionConnectionless ); |
|
2988 } |
|
2989 else |
|
2990 { |
|
2991 iApItem->WriteUint( EApWapWspOption, |
|
2992 EWapWspOptionConnectionOriented ); |
|
2993 } |
|
2994 break; |
|
2995 } |
|
2996 case EApWapCurrentBearer: |
|
2997 { |
|
2998 DoBearerChangeL( aCurrvalue ); |
|
2999 break; |
|
3000 } |
|
3001 case EApIspBearerSpeed: |
|
3002 { |
|
3003 iApItem->WriteUint( EApIspBearerSpeed, |
|
3004 GetBearerSpeedForSelection( aCurrvalue ) |
|
3005 ); |
|
3006 break; |
|
3007 } |
|
3008 case EApIspIfCallbackType: |
|
3009 { // UINT |
|
3010 if ( aCurrvalue ) |
|
3011 { |
|
3012 iApItem->WriteUint( EApIspIfCallbackType, |
|
3013 ECallbackActionMSCBCPRequireClientSpecifiedNumber ); |
|
3014 } |
|
3015 else |
|
3016 { |
|
3017 iApItem->WriteUint( EApIspIfCallbackType, |
|
3018 ECallbackActionMSCBCPAcceptServerSpecifiedNumber ); |
|
3019 } |
|
3020 break; |
|
3021 } |
|
3022 case EApIspBearerCallTypeIsdn: // used for data call type |
|
3023 { |
|
3024 // as order is the same in UI and in enum, simply write it |
|
3025 iApItem->WriteUint( EApIspBearerCallTypeIsdn, aCurrvalue ); |
|
3026 LimitSpeed(); |
|
3027 break; |
|
3028 } |
|
3029 case EApGprsPdpType: |
|
3030 { |
|
3031 // get value to write |
|
3032 if ( aCurrvalue ) |
|
3033 { |
|
3034 aCurrvalue = EIPv6; |
|
3035 } |
|
3036 else |
|
3037 { |
|
3038 aCurrvalue = EIPv4; |
|
3039 } |
|
3040 iApItem->WriteUint( EApGprsPdpType, aCurrvalue ); |
|
3041 break; |
|
3042 } |
|
3043 case EApIP6DNSAddrFromServer: |
|
3044 { |
|
3045 // if it is CSD or HSCSD, there is NO AUTOMATIC value, |
|
3046 // just the next two: Well-known & User defined... |
|
3047 // So in those cases, aCurrvalue must be 0 & 1, which |
|
3048 // corresponds to the normal 1, 2 so it should be incremented |
|
3049 TInt realvalue = aCurrvalue; |
|
3050 TApBearerType b = iApItem->BearerTypeL(); |
|
3051 if ( ( b == EApBearerTypeCSD ) || ( b == EApBearerTypeHSCSD ) ) |
|
3052 { |
|
3053 realvalue++; |
|
3054 } |
|
3055 |
|
3056 if ( realvalue == 2 ) |
|
3057 { // user defined!!! |
|
3058 TBool isip6( EFalse ); |
|
3059 if ( iApItem->BearerTypeL() == EApBearerTypeGPRS ) |
|
3060 { |
|
3061 TUint32 ival(0); |
|
3062 iApItem->ReadUint( EApGprsPdpType, ival ); |
|
3063 if ( ival == EIPv6 ) |
|
3064 { |
|
3065 isip6 = ETrue; |
|
3066 } |
|
3067 } |
|
3068 else |
|
3069 { |
|
3070 isip6 = !iL2Ipv4; |
|
3071 } |
|
3072 GetNameServersL( isip6 ); |
|
3073 } |
|
3074 else |
|
3075 { |
|
3076 if ( realvalue == 1 ) |
|
3077 { // well-known |
|
3078 // write default well known name server values |
|
3079 iApItem->WriteTextL( EApIP6NameServer1, |
|
3080 KKnownNameServer1 ); |
|
3081 iApItem->WriteTextL( EApIP6NameServer2, |
|
3082 KKnownNameServer2 ); |
|
3083 } |
|
3084 else |
|
3085 { |
|
3086 iApItem->WriteTextL( EApIP6NameServer1, KDynIpv6Address ); |
|
3087 iApItem->WriteTextL( EApIP6NameServer2, KDynIpv6Address ); |
|
3088 } |
|
3089 } |
|
3090 break; |
|
3091 } |
|
3092 case EApWlanNetworkMode: |
|
3093 { |
|
3094 if ( IsWlanSupported() ) |
|
3095 { |
|
3096 if ( aCurrvalue ) |
|
3097 { |
|
3098 iApItem->WriteUint( EApWlanNetworkMode, EAdhoc ); |
|
3099 LimitSecMode(); |
|
3100 } |
|
3101 else |
|
3102 { |
|
3103 iApItem->WriteUint( EApWlanNetworkMode, EInfra ); |
|
3104 } |
|
3105 |
|
3106 } |
|
3107 else |
|
3108 { |
|
3109 User::Leave( KErrNotSupported ); |
|
3110 } |
|
3111 break; |
|
3112 } |
|
3113 case EApWlanSecurityMode: |
|
3114 { |
|
3115 if ( IsWlanSupported() ) |
|
3116 { |
|
3117 TInt secmode(EOpen); |
|
3118 switch ( aCurrvalue ) |
|
3119 { |
|
3120 case KItemIndex0: |
|
3121 { |
|
3122 secmode = EOpen; |
|
3123 break; |
|
3124 } |
|
3125 case KItemIndex1: |
|
3126 { |
|
3127 secmode = EWep; |
|
3128 break; |
|
3129 } |
|
3130 case KItemIndex2: |
|
3131 { |
|
3132 secmode = E802_1x; |
|
3133 break; |
|
3134 } |
|
3135 case KItemIndex3: |
|
3136 { |
|
3137 secmode = EWpa; |
|
3138 break; |
|
3139 } |
|
3140 default: |
|
3141 { |
|
3142 secmode = EOpen; |
|
3143 break; |
|
3144 } |
|
3145 } |
|
3146 iApItem->WriteUint( EApWlanSecurityMode, secmode ); |
|
3147 } |
|
3148 else |
|
3149 { |
|
3150 User::Leave( KErrNotSupported ); |
|
3151 } |
|
3152 break; |
|
3153 } |
|
3154 case EApWlanChannelId: |
|
3155 { |
|
3156 if ( IsWlanSupported() ) |
|
3157 { |
|
3158 if ( aCurrvalue ) |
|
3159 { // user defined, ask number from user, offer 7 as default |
|
3160 TUint32 channel = GetAdHocChannelL(); |
|
3161 iApItem->WriteUint( EApWlanChannelId, channel ); |
|
3162 } |
|
3163 else |
|
3164 { // auto, write 0 |
|
3165 iApItem->WriteUint( EApWlanChannelId, aCurrvalue ); |
|
3166 } |
|
3167 } |
|
3168 else |
|
3169 { |
|
3170 User::Leave( KErrNotSupported ); |
|
3171 } |
|
3172 break; |
|
3173 } |
|
3174 default: |
|
3175 { |
|
3176 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
3177 User::Leave( KErrInvalidColumn ); |
|
3178 break; |
|
3179 } |
|
3180 } |
|
3181 |
|
3182 APSETUILOGGER_LEAVEFN( ESettings,"Settings::UpdateFromPopupSettingPageL") |
|
3183 } |
|
3184 |
|
3185 |
|
3186 |
|
3187 // --------------------------------------------------------- |
|
3188 // CApSettingsDlg::CanSaveL( ) |
|
3189 // --------------------------------------------------------- |
|
3190 // |
|
3191 CApSettingsDlg::TSaveAction CApSettingsDlg::CanSaveL( TApMember& aDataNeeded ) |
|
3192 { |
|
3193 APSETUILOGGER_ENTERFN( ESettings,"Settings::CanSaveL") |
|
3194 |
|
3195 TSaveAction retval( EApCanSave ); |
|
3196 |
|
3197 // it is used in two cases, less code by doing it here |
|
3198 HBufC *sgd = HBufC::NewLC( KModifiableTextLength ); |
|
3199 TPtr16 ptr( sgd->Des() ); |
|
3200 |
|
3201 switch ( iBearerType ) |
|
3202 { |
|
3203 case EApBearerTypeCSD: |
|
3204 case EApBearerTypeHSCSD: |
|
3205 { |
|
3206 iApItem->ReadTextL( EApIspDefaultTelNumber, ptr ); |
|
3207 if ( *sgd == KEmptyText ) |
|
3208 { |
|
3209 retval = EApMustDelete; |
|
3210 if ( !( *iEventStore & KApUiEventExitRequested ) ) |
|
3211 { |
|
3212 if ( ! AskQueryL( R_APUI_AP_ACCESS_NUMBER_NOT ) ) |
|
3213 { |
|
3214 retval = EApShallGoBack; |
|
3215 aDataNeeded = EApIspDefaultTelNumber; |
|
3216 } |
|
3217 } |
|
3218 } |
|
3219 break; |
|
3220 } |
|
3221 case EApBearerTypeGPRS: |
|
3222 { |
|
3223 // nothing to do... |
|
3224 break; |
|
3225 } |
|
3226 case EApBearerTypeWLAN: |
|
3227 { |
|
3228 if ( IsWlanSupported() ) |
|
3229 { |
|
3230 iApItem->ReadTextL( EApWlanNetworkName, ptr ); |
|
3231 if ( *sgd == KEmptyText ) |
|
3232 { |
|
3233 retval = EApShallGoBack; |
|
3234 aDataNeeded = EApWlanNetworkName; |
|
3235 if ( !( *iEventStore & KApUiEventExitRequested ) ) |
|
3236 { |
|
3237 if ( AskQueryL( R_APUI_AP_WLAN_NAME_NOT_DEFINED ) ) |
|
3238 { |
|
3239 retval = EApMustDelete; |
|
3240 } |
|
3241 } |
|
3242 } |
|
3243 if ( (retval != EApShallGoBack) && (retval != EApMustDelete) |
|
3244 && IsNetMaskAndGatewayVisibleL() ) |
|
3245 { // now check compulsory fields |
|
3246 iApItem->ReadTextL( EApWlanIpNetMask, ptr ); |
|
3247 if ( ( ptr.Compare( KDynIpAddress ) == 0 ) |
|
3248 || ( ptr.Compare( KEmptyText ) == 0 ) ) |
|
3249 { |
|
3250 retval = EApShallGoBack; |
|
3251 aDataNeeded = EApWlanIpNetMask; |
|
3252 if ( AskQueryL( |
|
3253 R_APUI_VIEW_NETW_QUEST_IAP_INCOMPLETE_DELETE ) ) |
|
3254 { |
|
3255 retval = EApMustDelete; |
|
3256 } |
|
3257 } |
|
3258 else |
|
3259 { |
|
3260 iApItem->ReadTextL( EApIspIPGateway, ptr ); |
|
3261 if ( ( sgd->Compare( KDynIpAddress ) == 0 ) |
|
3262 || ( sgd->Compare( KEmptyText ) == 0 ) ) |
|
3263 { |
|
3264 retval = EApShallGoBack; |
|
3265 aDataNeeded = EApIspIPGateway; |
|
3266 if ( AskQueryL( |
|
3267 R_APUI_VIEW_NETW_QUEST_IAP_INCOMPLETE_DELETE ) |
|
3268 ) |
|
3269 { |
|
3270 retval = EApMustDelete; |
|
3271 } |
|
3272 } |
|
3273 } |
|
3274 } |
|
3275 if ( (retval != EApShallGoBack) && (retval != EApMustDelete) |
|
3276 && (!HasSecuritySettingsFilledL()) ) |
|
3277 { |
|
3278 retval = EApShallGoBack; |
|
3279 aDataNeeded = EApWlanSecuritySettings; |
|
3280 if ( !( *iEventStore & KApUiEventExitRequested ) ) |
|
3281 { |
|
3282 if ( AskQueryL( R_APUI_AP_WLAN_SEC_SETT_EMPTY ) ) |
|
3283 { |
|
3284 retval = EApMustDelete; |
|
3285 } |
|
3286 } |
|
3287 } |
|
3288 } |
|
3289 else |
|
3290 { |
|
3291 User::Leave( KErrNotSupported ); |
|
3292 } |
|
3293 break; |
|
3294 } |
|
3295 default: |
|
3296 { // in release, leave, in debug, PANIC |
|
3297 __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) ); |
|
3298 User::Leave( KErrInvalidBearerType ); |
|
3299 break; |
|
3300 } |
|
3301 } |
|
3302 CleanupStack::PopAndDestroy( sgd ); // sgd |
|
3303 |
|
3304 if ( ( retval == EApShallGoBack ) && |
|
3305 ( *iEventStore & KApUiEventExitRequested ) ) |
|
3306 { |
|
3307 retval = EApNoAction; |
|
3308 } |
|
3309 |
|
3310 APSETUILOGGER_LEAVEFN( ESettings,"Settings::CanSaveL") |
|
3311 return retval; |
|
3312 } |
|
3313 |
|
3314 |
|
3315 |
|
3316 |
|
3317 |
|
3318 |
|
3319 //---------------------------------------------------------- |
|
3320 // CApSettingsDlg::ShowPopupIpAddrSettingPageL |
|
3321 //---------------------------------------------------------- |
|
3322 // |
|
3323 void CApSettingsDlg::ShowPopupIpAddrSettingPageL( TApMember aData ) |
|
3324 { |
|
3325 APSETUILOGGER_ENTERFN( ESettings,"Settings::ShowPopupIpAddrSettingPageL") |
|
3326 |
|
3327 HBufC* aBuf = HBufC::NewLC( KModifiableTextLength ); |
|
3328 TPtr16 ptr( aBuf->Des() ); |
|
3329 |
|
3330 iApItem->ReadTextL( aData, ptr ); |
|
3331 |
|
3332 TBuf<KModifiableTextLength> textToChange; |
|
3333 |
|
3334 textToChange.Append( ptr ); |
|
3335 |
|
3336 TInt page_resid( 0 ); |
|
3337 TInt TextSettingPageFlags( EAknSettingPageNoOrdinalDisplayed ); |
|
3338 GetTextResId( aData, page_resid, TextSettingPageFlags ); |
|
3339 |
|
3340 TInetAddr AddrToChange; |
|
3341 AddrToChange.Input( textToChange ); |
|
3342 CAknIpFieldSettingPage* dlg = |
|
3343 new( ELeave )CAknIpFieldSettingPage( page_resid, AddrToChange ); |
|
3344 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) |
|
3345 { |
|
3346 // first need to check phone number validity, if not, |
|
3347 // display error msg, |
|
3348 AddrToChange.Output( textToChange ); |
|
3349 iApItem->WriteTextL( aData, textToChange ); |
|
3350 } |
|
3351 CleanupStack::PopAndDestroy(); // aBuf |
|
3352 |
|
3353 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ShowPopupIpAddrSettingPageL") |
|
3354 } |
|
3355 |
|
3356 |
|
3357 |
|
3358 |
|
3359 |
|
3360 |
|
3361 //---------------------------------------------------------- |
|
3362 // CApSettingsDlg::ShowPopupPhoneNumSettingPageL |
|
3363 //---------------------------------------------------------- |
|
3364 // |
|
3365 void CApSettingsDlg::ShowPopupPhoneNumSettingPageL( TApMember aData ) |
|
3366 { |
|
3367 APSETUILOGGER_ENTERFN( ESettings,"Settings::ShowPopupPhoneNumSettingPageL") |
|
3368 |
|
3369 HBufC* aBuf = HBufC::NewLC( KModifiableTextLength ); |
|
3370 TPtr16 ptr( aBuf->Des() ); |
|
3371 |
|
3372 if ( aData == EApIspIfCallbackInfo ) |
|
3373 { // 8 bit text |
|
3374 HBufC8* tmpValue8 = HBufC8::NewLC( KModifiableTextLength ); |
|
3375 TPtr8 ptr8( tmpValue8->Des() ); |
|
3376 iApItem->ReadTextL( aData, ptr8 ); |
|
3377 ptr.Copy( ptr8 ); |
|
3378 CleanupStack::PopAndDestroy(); // tmpvalue8 |
|
3379 } |
|
3380 else |
|
3381 { |
|
3382 iApItem->ReadTextL( aData, ptr ); |
|
3383 } |
|
3384 |
|
3385 TBuf<KModifiableTextLength> textToChange; |
|
3386 |
|
3387 textToChange.Append( ptr ); |
|
3388 |
|
3389 TInt page_resid( 0 ); |
|
3390 TInt TextSettingPageFlags( EAknSettingPageNoOrdinalDisplayed ); |
|
3391 GetTextResId( aData, page_resid, TextSettingPageFlags ); |
|
3392 TBool mustgoon( ETrue ); |
|
3393 do |
|
3394 { |
|
3395 CAknSettingPage* dlg = |
|
3396 new( ELeave )CAknTextSettingPage( page_resid, |
|
3397 textToChange, |
|
3398 TextSettingPageFlags ); |
|
3399 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) |
|
3400 { |
|
3401 // first need to check phone number validity, |
|
3402 // if not, dispaly error msg, |
|
3403 // bearing in mind that if empty is not allowed, |
|
3404 // we can not got empty text from editor, so IF it is not a valid |
|
3405 // phone number, but it is empty, thna it is allowed and |
|
3406 // it is the user's wish, so go on as valid... |
|
3407 // MNAN-6XBFNB: Digits that are not western should also be accepted |
|
3408 // Convert digits to western and check the phone number like this. |
|
3409 TBuf<KModifiableTextLength> temp; |
|
3410 temp = textToChange; |
|
3411 AknTextUtils::ConvertDigitsTo( temp, EDigitTypeWestern ); |
|
3412 |
|
3413 if ( CommonPhoneParser::IsValidPhoneNumber |
|
3414 ( temp, CommonPhoneParser::EContactCardNumber ) |
|
3415 || ( temp.Compare( KEmpty ) == 0) ) |
|
3416 { |
|
3417 if ( aData == EApIspIfCallbackInfo ) |
|
3418 { // 8 bit text |
|
3419 HBufC8* tmpValue8 = HBufC8::NewLC( KModifiableTextLength ); |
|
3420 TPtr8 ptr8( tmpValue8->Des() ); |
|
3421 iApItem->ReadTextL( aData, ptr8 ); |
|
3422 ptr8.Copy( textToChange ); |
|
3423 iApItem->WriteTextL( aData, ptr8 ); |
|
3424 CleanupStack::PopAndDestroy(); // tmpvalue8 |
|
3425 } |
|
3426 else |
|
3427 { |
|
3428 iApItem->WriteTextL( aData, textToChange ); |
|
3429 } |
|
3430 mustgoon = EFalse; |
|
3431 } |
|
3432 else |
|
3433 { // give invalid number message |
|
3434 ShowNoteL( R_APUI_VIEW_INVALID_NUMBER ); |
|
3435 } |
|
3436 } |
|
3437 else |
|
3438 { |
|
3439 mustgoon = EFalse; |
|
3440 } |
|
3441 } |
|
3442 while( mustgoon ); |
|
3443 CleanupStack::PopAndDestroy(); // aBuf |
|
3444 |
|
3445 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ShowPopupPhoneNumSettingPageL") |
|
3446 } |
|
3447 |
|
3448 |
|
3449 |
|
3450 |
|
3451 //---------------------------------------------------------- |
|
3452 // CApSettingsDlg::ShowPopupPasswordPageL |
|
3453 //---------------------------------------------------------- |
|
3454 // |
|
3455 void CApSettingsDlg::ShowPopupPasswordPageL( TApMember aData ) |
|
3456 { |
|
3457 APSETUILOGGER_ENTERFN( ESettings,"Settings::ShowPopupPasswordPageL") |
|
3458 |
|
3459 // must be prepared for the worst case... |
|
3460 TBuf<KMaxLoginPasswordLength> newpass; |
|
3461 |
|
3462 TUint32 txtLength = iApItem->ReadTextLengthL( aData ); |
|
3463 // allocates as much as needed... |
|
3464 HBufC* oldpass = HBufC::NewLC( txtLength ); |
|
3465 TPtr16 ptr( oldpass->Des() ); |
|
3466 iApItem->ReadTextL( aData, ptr ); |
|
3467 |
|
3468 CAknAlphaPasswordSettingPage* dlg = |
|
3469 new( ELeave )CAknAlphaPasswordSettingPage( |
|
3470 R_TEXT_SETTING_PAGE_LOGIN_PASSWD, |
|
3471 newpass, ptr ); |
|
3472 CleanupStack::PushL(dlg); |
|
3473 // As password is asked only once... |
|
3474 dlg->SetMaxPasswordLength( KMaxLoginPasswordLength ); |
|
3475 CleanupStack::Pop(); |
|
3476 if ( dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged) ) |
|
3477 { |
|
3478 iApItem->WriteTextL( aData, newpass ); |
|
3479 } |
|
3480 CleanupStack::PopAndDestroy(); // oldpass |
|
3481 |
|
3482 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ShowPopupPasswordPageL") |
|
3483 } |
|
3484 |
|
3485 |
|
3486 |
|
3487 //---------------------------------------------------------- |
|
3488 // CApSettingsDlg::GetBoolDataValue |
|
3489 //---------------------------------------------------------- |
|
3490 // |
|
3491 void CApSettingsDlg::GetBoolDataValue( TApMember aData, TBool aInvert, |
|
3492 TInt& aCurrvalue) |
|
3493 { |
|
3494 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetBoolDataValue") |
|
3495 |
|
3496 iApItem->ReadBool( aData, aCurrvalue); |
|
3497 // just to be on the sure side... |
|
3498 aCurrvalue = Min( KBoolMaxNumber, aCurrvalue); |
|
3499 if ( aInvert) |
|
3500 { |
|
3501 aCurrvalue = !aCurrvalue; |
|
3502 } |
|
3503 |
|
3504 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetBoolDataValue") |
|
3505 } |
|
3506 |
|
3507 |
|
3508 //---------------------------------------------------------- |
|
3509 // CApSettingsDlg::DoBearerChangeL |
|
3510 //---------------------------------------------------------- |
|
3511 // |
|
3512 void CApSettingsDlg::DoBearerChangeL( TInt aCurrvalue) |
|
3513 { |
|
3514 APSETUILOGGER_ENTERFN( ESettings,"Settings::DoBearerChangeL") |
|
3515 |
|
3516 TApBearerType newbearer = BearerItemPos2BearerTypeL( aCurrvalue ); |
|
3517 HandleBearerChangeL( newbearer ); |
|
3518 |
|
3519 APSETUILOGGER_LEAVEFN( ESettings,"Settings::DoBearerChangeL") |
|
3520 } |
|
3521 |
|
3522 |
|
3523 |
|
3524 //---------------------------------------------------------- |
|
3525 // CApSettingsDlg::HandleBearerChangeL |
|
3526 //---------------------------------------------------------- |
|
3527 // |
|
3528 void CApSettingsDlg::HandleBearerChangeL( TApBearerType aBearer) |
|
3529 { |
|
3530 APSETUILOGGER_ENTERFN( ESettings,"Settings::HandleBearerChangeL") |
|
3531 |
|
3532 if ( iBearerItemArray->At( BearerToArrayIndexL( aBearer)) == NULL) |
|
3533 { |
|
3534 CApAccessPointItem* ap = CApAccessPointItem::NewLC(); |
|
3535 ap->CopyFromL( *iApItem); |
|
3536 ap->WriteUint( EApWapAccessPointID, iApItem->WapUid()); |
|
3537 iBearerItemArray->At( BearerToArrayIndexL( aBearer)) = ap; |
|
3538 iApItem = ap; |
|
3539 CleanupStack::Pop(); // ap |
|
3540 } |
|
3541 else |
|
3542 { |
|
3543 iApItem = iBearerItemArray->At( BearerToArrayIndexL( aBearer)); |
|
3544 } |
|
3545 iApItem->SetBearerTypeL( aBearer ); |
|
3546 SetBearerTypeL( aBearer ); |
|
3547 |
|
3548 APSETUILOGGER_LEAVEFN( ESettings,"Settings::HandleBearerChangeL") |
|
3549 } |
|
3550 |
|
3551 |
|
3552 //---------------------------------------------------------- |
|
3553 // CApSettingsDlg::BearerToArrayIndexL |
|
3554 //---------------------------------------------------------- |
|
3555 // |
|
3556 TInt32 CApSettingsDlg::BearerToArrayIndexL( TApBearerType aBearer) |
|
3557 { |
|
3558 APSETUILOGGER_ENTERFN( ESettings,"Settings::BearerToArrayIndexL") |
|
3559 |
|
3560 TInt32 retval( KBearerArrayGPRS ); |
|
3561 switch( aBearer ) |
|
3562 { |
|
3563 case EApBearerTypeCSD: |
|
3564 { |
|
3565 retval = KBearerArrayCSD; |
|
3566 break; |
|
3567 } |
|
3568 case EApBearerTypeGPRS: |
|
3569 { |
|
3570 retval = KBearerArrayGPRS; |
|
3571 break; |
|
3572 } |
|
3573 case EApBearerTypeHSCSD: |
|
3574 { |
|
3575 retval = KBearerArrayHSCSD; |
|
3576 break; |
|
3577 } |
|
3578 case EApBearerTypeWLAN: |
|
3579 { |
|
3580 if ( IsWlanSupported() ) |
|
3581 { |
|
3582 retval = KBearerArrayWLAN; |
|
3583 } |
|
3584 else |
|
3585 { |
|
3586 User::Leave( KErrNotSupported ); |
|
3587 } |
|
3588 break; |
|
3589 } |
|
3590 default: |
|
3591 { |
|
3592 __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) ); |
|
3593 User::Leave( KErrInvalidBearerType ); |
|
3594 break; |
|
3595 } |
|
3596 } |
|
3597 |
|
3598 APSETUILOGGER_LEAVEFN( ESettings,"Settings::BearerToArrayIndexL") |
|
3599 return retval; |
|
3600 } |
|
3601 |
|
3602 /* |
|
3603 //---------------------------------------------------------- |
|
3604 // CApSettingsDlg::ArrayIndexToBearer |
|
3605 //---------------------------------------------------------- |
|
3606 // |
|
3607 TApBearerType CApSettingsDlg::ArrayIndexToBearer( TInt32 aIndex) |
|
3608 { |
|
3609 APSETUILOGGER_ENTERFN( ESettings,"Settings::ArrayIndexToBearer") |
|
3610 |
|
3611 TApBearerType retval( EApBearerTypeGPRS ); |
|
3612 switch( aIndex ) |
|
3613 { |
|
3614 case KBearerArrayCSD: |
|
3615 { |
|
3616 retval = EApBearerTypeCSD; |
|
3617 break; |
|
3618 } |
|
3619 case KBearerArrayGPRS: |
|
3620 { |
|
3621 retval = EApBearerTypeGPRS; |
|
3622 break; |
|
3623 } |
|
3624 case KBearerArrayHSCSD: |
|
3625 { |
|
3626 retval = EApBearerTypeHSCSD; |
|
3627 break; |
|
3628 } |
|
3629 case KBearerArrayWLAN: |
|
3630 { |
|
3631 if ( IsWlanSupported() ) |
|
3632 { |
|
3633 retval = EApBearerTypeWLAN; |
|
3634 } |
|
3635 else |
|
3636 { |
|
3637 User::Leave( KErrNotSupported ); |
|
3638 } |
|
3639 break; |
|
3640 } |
|
3641 default: |
|
3642 { |
|
3643 __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) ); |
|
3644 break; |
|
3645 } |
|
3646 } |
|
3647 |
|
3648 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ArrayIndexToBearer") |
|
3649 return retval; |
|
3650 } |
|
3651 |
|
3652 */ |
|
3653 |
|
3654 |
|
3655 //---------------------------------------------------------- |
|
3656 // CApSettingsDlg::FillUpBearerSpeedValuesL |
|
3657 //---------------------------------------------------------- |
|
3658 // |
|
3659 void CApSettingsDlg::FillUpBearerSpeedValuesL( CDesCArrayFlat& aItems, |
|
3660 TInt& aCurrvalue ) |
|
3661 { |
|
3662 APSETUILOGGER_ENTERFN( ESettings,"Settings::FillUpBearerSpeedValuesL") |
|
3663 |
|
3664 TUint32 tval( 0 ); |
|
3665 TUint32 bval( 0 ); |
|
3666 |
|
3667 iApItem->ReadUint( EApIspBearerSpeed, tval ); |
|
3668 iApItem->ReadUint( EApIspBearerCallTypeIsdn, bval ); |
|
3669 TApBearerType btype = iApItem->BearerTypeL(); |
|
3670 const TInt* actResSpeeds = NULL; |
|
3671 const TInt* actSpeeds = NULL; |
|
3672 |
|
3673 TBool isWcdma = |
|
3674 FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ); |
|
3675 |
|
3676 switch ( bval ) |
|
3677 { |
|
3678 case ECallTypeAnalogue: |
|
3679 { // CSD/HSCSD, Analogue |
|
3680 if ( btype == EApBearerTypeHSCSD ) |
|
3681 { |
|
3682 actResSpeeds = KResHcsdAnalogue; |
|
3683 actSpeeds = KHcsdAnalogue; |
|
3684 } |
|
3685 else |
|
3686 { |
|
3687 actResSpeeds = KResCsdAnalogue; |
|
3688 actSpeeds = KCsdAnalogue; |
|
3689 if ( isWcdma ) |
|
3690 { |
|
3691 actResSpeeds = KResCsdAnalogueWcdma; |
|
3692 actSpeeds = KCsdAnalogueWcdma; |
|
3693 } |
|
3694 } |
|
3695 break; |
|
3696 } |
|
3697 case ECallTypeISDNv110: |
|
3698 { // CSD/HSCSD, ISDN v110: |
|
3699 if ( btype == EApBearerTypeHSCSD ) |
|
3700 { |
|
3701 actResSpeeds = KResHcsdIsdn110; |
|
3702 actSpeeds = KHcsdIsdn110; |
|
3703 } |
|
3704 else |
|
3705 { |
|
3706 actResSpeeds = KResCsdIsdn110; |
|
3707 actSpeeds = KCsdIsdn110; |
|
3708 if ( isWcdma ) |
|
3709 { |
|
3710 actResSpeeds = KResCsdIsdn110Wcdma; |
|
3711 actSpeeds = KCsdIsdn110Wcdma; |
|
3712 } |
|
3713 } |
|
3714 break; |
|
3715 } |
|
3716 case ECallTypeISDNv120: |
|
3717 { |
|
3718 if ( btype == EApBearerTypeHSCSD ) |
|
3719 { |
|
3720 actResSpeeds = KResHcsdIsdn120; |
|
3721 actSpeeds = KHcsdIsdn120; |
|
3722 } |
|
3723 else |
|
3724 { |
|
3725 actResSpeeds = KResCsdIsdn120; |
|
3726 actSpeeds = KCsdIsdn120; |
|
3727 if ( isWcdma ) |
|
3728 { |
|
3729 actResSpeeds = KResCsdIsdn120Wcdma; |
|
3730 actSpeeds = KCsdIsdn120Wcdma; |
|
3731 } |
|
3732 } |
|
3733 break; |
|
3734 } |
|
3735 default: |
|
3736 { |
|
3737 break; |
|
3738 } |
|
3739 } |
|
3740 |
|
3741 if ( actResSpeeds ) |
|
3742 { |
|
3743 while ( *actResSpeeds != KEndOfArray ) |
|
3744 { |
|
3745 aItems.AppendL( *iEikonEnv->AllocReadResourceLC( *actResSpeeds ) ); |
|
3746 CleanupStack::PopAndDestroy(); |
|
3747 ++actResSpeeds; |
|
3748 } |
|
3749 } |
|
3750 |
|
3751 if( actSpeeds ) |
|
3752 { |
|
3753 aCurrvalue = 0; |
|
3754 TInt nextSpeed = *( actSpeeds + aCurrvalue + 1) ; |
|
3755 while ( ( nextSpeed != KEndOfArray ) |
|
3756 && ( *( actSpeeds + aCurrvalue) < ( TInt )tval ) |
|
3757 && ( nextSpeed <= ( TInt )tval ) ) |
|
3758 { |
|
3759 ++aCurrvalue; |
|
3760 nextSpeed = *( actSpeeds + aCurrvalue + 1) ; |
|
3761 } |
|
3762 } |
|
3763 |
|
3764 APSETUILOGGER_LEAVEFN( ESettings,"Settings::FillUpBearerSpeedValuesL") |
|
3765 } |
|
3766 |
|
3767 |
|
3768 |
|
3769 //---------------------------------------------------------- |
|
3770 // CApSettingsDlg::SaveDataL |
|
3771 //---------------------------------------------------------- |
|
3772 // |
|
3773 TBool CApSettingsDlg::SaveDataL( ) |
|
3774 { |
|
3775 APSETUILOGGER_ENTERFN( ESettings,"Settings::SaveDataL") |
|
3776 |
|
3777 TApMember aDataNeeded; |
|
3778 TSaveAction action(EApCanSave); |
|
3779 TBool retval( ETrue ); |
|
3780 TInt err (KErrNone ); |
|
3781 |
|
3782 // first handle ALL db stuff because Symbian DB does handles |
|
3783 // consequtive transactions wrongly... |
|
3784 TTransactionResult ownTransaction = |
|
3785 iDataModel->StartTransactionLC( |
|
3786 /*aWrite*/EFalse, |
|
3787 /*aShowNote*/ETrue, |
|
3788 /*aRetry*/ETrue ); |
|
3789 if ( ownTransaction != EFailedWithLocked ) |
|
3790 { |
|
3791 action = CanSaveL(aDataNeeded); |
|
3792 switch ( action ) |
|
3793 { |
|
3794 case EApCanSave: |
|
3795 #ifdef __WINS__ |
|
3796 case EApMustDelete: |
|
3797 #endif // __WINS__ |
|
3798 { // save data |
|
3799 if ( ( *iOldApItem != *iApItem ) || ( *iUid == KApNoneUID ) |
|
3800 || iDataModel->iWepSecSettings |
|
3801 || iDataModel->iWpaSecSettings ) |
|
3802 { // save if different or NEW BLANK |
|
3803 *iEventStore |= KApUiEventEdited; |
|
3804 if ( *iUid == KApNoneUID ) |
|
3805 { |
|
3806 HBufC* buf = HBufC::NewLC( KApMaxConnNameLength ); |
|
3807 // now check if name is unique, if it is, |
|
3808 // save and commit, if it is not, show note |
|
3809 // and no save at all, Rollback! |
|
3810 TPtr16 ptr( buf->Des() ); |
|
3811 iApItem->ReadTextL( EApWapAccessPointName, ptr ); |
|
3812 TBool b(EFalse); |
|
3813 TRAP( err, b = |
|
3814 iDataModel->ApUtils()->IsValidNameL( ptr ) ); |
|
3815 CleanupStack::PopAndDestroy( buf ); |
|
3816 if ( b ) |
|
3817 { |
|
3818 TRAP( err, |
|
3819 iDataModel->CreateFromDataL( *iApItem ) ); |
|
3820 if ( err == KErrNone ) |
|
3821 { |
|
3822 iApItem->ReadUint( EApWapAccessPointID, |
|
3823 *iUid ); |
|
3824 *iEventStore |= KApUiEventCreatedBlank; |
|
3825 } |
|
3826 } |
|
3827 else |
|
3828 { |
|
3829 err = KErrAlreadyExists; |
|
3830 // no DB call after this point, as transaction must be rolled back, |
|
3831 // but we can do it only at the end |
|
3832 if ( ownTransaction == EOwnTransaction ) |
|
3833 { |
|
3834 CleanupStack::PopAndDestroy(); //Rollback |
|
3835 // set as if no need to commit... |
|
3836 ownTransaction = EUsingAlreadyStarted; |
|
3837 } |
|
3838 } |
|
3839 } |
|
3840 else |
|
3841 { |
|
3842 // If the name is not unique, |
|
3843 // it will leave with KErrAlreadyExists |
|
3844 TRAP( err, |
|
3845 iDataModel->UpdateAccessPointDataL( *iApItem ) ); |
|
3846 } |
|
3847 } |
|
3848 break; |
|
3849 } |
|
3850 #ifndef __WINS__ |
|
3851 case EApMustDelete: |
|
3852 { |
|
3853 if ( *iUid != KApNoneUID ) |
|
3854 { |
|
3855 TUint32 WapUid( 0 ); |
|
3856 iApItem->ReadUint( EApWapAccessPointID, WapUid ); |
|
3857 iDataModel->RemoveApL( WapUid ); |
|
3858 } |
|
3859 break; |
|
3860 } |
|
3861 #endif // __WINS__ |
|
3862 case EApShallGoBack: |
|
3863 { |
|
3864 switch ( aDataNeeded ) |
|
3865 { |
|
3866 case EApIspDefaultTelNumber: |
|
3867 { |
|
3868 SelectItem( KListIndexCSDAccessNumber ); |
|
3869 retval = EFalse; |
|
3870 break; |
|
3871 } |
|
3872 case EApWlanNetworkName: |
|
3873 { |
|
3874 if ( IsWlanSupported() ) |
|
3875 { |
|
3876 SelectItem( KListIndexWLANNetworkName ); |
|
3877 retval = EFalse; |
|
3878 } |
|
3879 else |
|
3880 { |
|
3881 User::Leave( KErrNotSupported ); |
|
3882 } |
|
3883 break; |
|
3884 } |
|
3885 case EApWlanIpNetMask: |
|
3886 case EApIspIPNetMask: |
|
3887 { |
|
3888 if ( IsWlanSupported() ) |
|
3889 { |
|
3890 SelectItem( KListIndexWLANSubnetMask ); |
|
3891 retval = EFalse; |
|
3892 } |
|
3893 else |
|
3894 { |
|
3895 User::Leave( KErrNotSupported ); |
|
3896 } |
|
3897 break; |
|
3898 } |
|
3899 case EApIspIPGateway: |
|
3900 case EApWlanIpGateway: |
|
3901 { |
|
3902 if ( IsWlanSupported() ) |
|
3903 { |
|
3904 SelectItem( KListIndexWLANDefaultGateway ); |
|
3905 retval = EFalse; |
|
3906 } |
|
3907 else |
|
3908 { |
|
3909 User::Leave( KErrNotSupported ); |
|
3910 } |
|
3911 break; |
|
3912 } |
|
3913 case EApWlanSecuritySettings: |
|
3914 { |
|
3915 if ( IsWlanSupported() ) |
|
3916 { |
|
3917 SelectItem( KListIndexWLANSecuritySettings ); |
|
3918 retval = EFalse; |
|
3919 ChangeSettingsL( EFalse ); |
|
3920 } |
|
3921 else |
|
3922 { |
|
3923 User::Leave( KErrNotSupported ); |
|
3924 } |
|
3925 break; |
|
3926 } |
|
3927 default: |
|
3928 {// otherwise, nothing to do... |
|
3929 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
3930 break; |
|
3931 } |
|
3932 } |
|
3933 break; |
|
3934 } |
|
3935 case EApNoAction: |
|
3936 { // can not save, do not go back: Exit, do nothing but ignore... |
|
3937 break; |
|
3938 } |
|
3939 default: |
|
3940 { |
|
3941 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
3942 break; |
|
3943 } |
|
3944 } |
|
3945 |
|
3946 if ( ownTransaction == EOwnTransaction ) |
|
3947 { |
|
3948 err = iDataModel->Database()->Database()->CommitTransaction(); |
|
3949 User::LeaveIfError( err ); |
|
3950 CleanupStack::Pop(); // RollbackTransaction |
|
3951 } |
|
3952 } |
|
3953 else |
|
3954 { |
|
3955 User::Leave( KErrLocked ); |
|
3956 } |
|
3957 // end transaction stuff |
|
3958 // and handle possible other stuff like |
|
3959 // displaying notifications, redirecting the user, etc... |
|
3960 |
|
3961 if ( err == KErrAlreadyExists ) |
|
3962 { |
|
3963 // Check if exit and if it is, Exit, |
|
3964 // if it is not, then show note |
|
3965 // and move user back to editor... |
|
3966 if ( !( *iEventStore & KApUiEventExitRequested ) ) |
|
3967 { |
|
3968 HBufC* buf = HBufC::NewLC( KApMaxConnNameLength ); |
|
3969 TPtr16 ptr( buf->Des() ); |
|
3970 iApItem->ReadTextL( EApWapAccessPointName, ptr ); |
|
3971 ShowNoteL( R_APUI_IAP_NAME_ALREADY_EXISTS, buf ); |
|
3972 CleanupStack::PopAndDestroy( buf ); // buf |
|
3973 SelectItem( KListIndexConnectionName ); |
|
3974 retval = EFalse; |
|
3975 ChangeSettingsL( EFalse ); |
|
3976 } |
|
3977 } |
|
3978 else |
|
3979 { |
|
3980 if ( err == KErrInvalidName ) |
|
3981 { |
|
3982 ShowNoteL( R_APUI_VIEW_INVALID_CONN_NAME ); |
|
3983 SelectItem( KListIndexConnectionName ); |
|
3984 retval = EFalse; |
|
3985 } |
|
3986 else |
|
3987 { |
|
3988 if ( !( *iEventStore & KApUiEventExitRequested ) ) |
|
3989 { |
|
3990 User::LeaveIfError( err ); |
|
3991 } |
|
3992 iOldApItem->CopyFromL( *iApItem ); |
|
3993 } |
|
3994 } |
|
3995 |
|
3996 APSETUILOGGER_LEAVEFN( ESettings,"Settings::SaveDataL") |
|
3997 return retval; |
|
3998 } |
|
3999 |
|
4000 |
|
4001 |
|
4002 //---------------------------------------------------------- |
|
4003 // CApSettingsDlg::HandleListStructureChangeL |
|
4004 //---------------------------------------------------------- |
|
4005 // |
|
4006 void CApSettingsDlg::HandleListStructureChangeL() |
|
4007 { |
|
4008 APSETUILOGGER_ENTERFN( ESettings,"Settings::HandleListStructureChangeL") |
|
4009 |
|
4010 TUint32 l = iApItem->ReadTextLengthL( EApWapGatewayAddress ); |
|
4011 HBufC* buf = HBufC::NewLC( l ); |
|
4012 TPtr16 ptr( buf->Des() ); |
|
4013 iApItem->ReadTextL( EApWapGatewayAddress, ptr ); |
|
4014 |
|
4015 if ( ( iBearerType == EApBearerTypeCSD ) |
|
4016 || ( iBearerType == EApBearerTypeHSCSD ) ) |
|
4017 { |
|
4018 GetCSDSettingArrays( iVariant ); |
|
4019 } |
|
4020 else |
|
4021 { |
|
4022 if ( iBearerType == EApBearerTypeGPRS ) |
|
4023 { |
|
4024 GetGPRSSettingArrays( iVariant ); |
|
4025 } |
|
4026 else |
|
4027 { |
|
4028 if ( IsWlanSupported() ) |
|
4029 { |
|
4030 if ( iBearerType == EApBearerTypeWLAN ) |
|
4031 { |
|
4032 GetWLANSettingArraysL( iVariant ); |
|
4033 } |
|
4034 else |
|
4035 { |
|
4036 User::Leave( KErrInvalidBearer ); |
|
4037 } |
|
4038 } |
|
4039 else |
|
4040 { |
|
4041 User::Leave( KErrInvalidBearer ); |
|
4042 } |
|
4043 } |
|
4044 } |
|
4045 CleanupStack::PopAndDestroy( buf ); |
|
4046 |
|
4047 APSETUILOGGER_LEAVEFN( ESettings,"Settings::HandleListStructureChangeL") |
|
4048 } |
|
4049 |
|
4050 |
|
4051 |
|
4052 //---------------------------------------------------------- |
|
4053 // CApSettingsDlg::LimitSpeed |
|
4054 //---------------------------------------------------------- |
|
4055 // |
|
4056 void CApSettingsDlg::LimitSpeed() |
|
4057 { |
|
4058 APSETUILOGGER_ENTERFN( ESettings,"Settings::LimitSpeed") |
|
4059 |
|
4060 // now 'limit' the speeds |
|
4061 TUint32 speed( 0 ); |
|
4062 iApItem->ReadUint( EApIspBearerSpeed, speed ); |
|
4063 TUint32 calltype( EFalse ); |
|
4064 iApItem->ReadUint( EApIspBearerCallTypeIsdn, calltype ); |
|
4065 const TInt* actSpeeds = NULL; |
|
4066 TBool isWcdma = |
|
4067 FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ) ; |
|
4068 switch ( iBearerType ) |
|
4069 { |
|
4070 case EApBearerTypeCSD: |
|
4071 { |
|
4072 switch ( calltype ) |
|
4073 { |
|
4074 case ECallTypeISDNv110: |
|
4075 { |
|
4076 actSpeeds = isWcdma ? KCsdIsdn110Wcdma : KCsdIsdn110; |
|
4077 break; |
|
4078 } |
|
4079 case ECallTypeISDNv120: |
|
4080 { |
|
4081 actSpeeds = isWcdma ? KCsdIsdn120Wcdma : KCsdIsdn120; |
|
4082 break; |
|
4083 } |
|
4084 case ECallTypeAnalogue: |
|
4085 default: |
|
4086 { |
|
4087 actSpeeds = isWcdma ? KCsdAnalogueWcdma : KCsdAnalogue; |
|
4088 } |
|
4089 } |
|
4090 break; |
|
4091 } |
|
4092 case EApBearerTypeHSCSD: |
|
4093 { |
|
4094 switch ( calltype ) |
|
4095 { |
|
4096 case ECallTypeISDNv110: |
|
4097 { |
|
4098 actSpeeds = KHcsdIsdn110; |
|
4099 break; |
|
4100 } |
|
4101 case ECallTypeISDNv120: |
|
4102 { |
|
4103 actSpeeds = KHcsdIsdn120; |
|
4104 break; |
|
4105 } |
|
4106 case ECallTypeAnalogue: |
|
4107 default: |
|
4108 { |
|
4109 actSpeeds = KHcsdAnalogue; |
|
4110 } |
|
4111 } |
|
4112 break; |
|
4113 } |
|
4114 default: |
|
4115 { |
|
4116 break; |
|
4117 } |
|
4118 } |
|
4119 |
|
4120 if( actSpeeds ) |
|
4121 { |
|
4122 TInt tempSpeed = *actSpeeds; |
|
4123 TInt nextSpeed = *( actSpeeds + 1 ); |
|
4124 while ( ( nextSpeed != KEndOfArray ) |
|
4125 && ( tempSpeed < ( TInt )speed ) |
|
4126 && ( nextSpeed <= ( TInt )speed ) ) |
|
4127 { |
|
4128 tempSpeed = *( ++actSpeeds ); |
|
4129 nextSpeed = *( actSpeeds + 1 ); |
|
4130 } |
|
4131 speed = tempSpeed ; |
|
4132 } |
|
4133 |
|
4134 |
|
4135 iApItem->WriteUint( EApIspBearerSpeed, speed ); |
|
4136 |
|
4137 APSETUILOGGER_LEAVEFN( ESettings,"Settings::LimitSpeed") |
|
4138 } |
|
4139 |
|
4140 |
|
4141 //---------------------------------------------------------- |
|
4142 // CApSettingsDlg::SelectItem |
|
4143 //---------------------------------------------------------- |
|
4144 // |
|
4145 void CApSettingsDlg::SelectItem( TInt aItemIndex ) |
|
4146 { |
|
4147 APSETUILOGGER_ENTERFN( ESettings,"Settings::SelectItem") |
|
4148 |
|
4149 iList->ScrollToMakeItemVisible( aItemIndex ); |
|
4150 iList->SetCurrentItemIndexAndDraw( aItemIndex ); |
|
4151 |
|
4152 APSETUILOGGER_LEAVEFN( ESettings,"Settings::SelectItem") |
|
4153 } |
|
4154 |
|
4155 |
|
4156 |
|
4157 |
|
4158 |
|
4159 // Converting EParagraphDelimiters to \ns |
|
4160 // --------------------------------------------------------- |
|
4161 // CApSettingsDlg::ConvertDelimToPerNLC |
|
4162 // --------------------------------------------------------- |
|
4163 // |
|
4164 HBufC* CApSettingsDlg::ConvertDelimToPerNLC( const TDesC& aInText ) |
|
4165 { |
|
4166 APSETUILOGGER_ENTERFN( ESettings,"Settings::ConvertDelimToPerNLC") |
|
4167 |
|
4168 TInt size = aInText.Length(); |
|
4169 HBufC* outText = HBufC::NewLC( size ); |
|
4170 TPtr ptr = outText->Des(); |
|
4171 |
|
4172 for ( TInt ii=0; ii<size; ++ii ) |
|
4173 { |
|
4174 TText ch = aInText[ii]; |
|
4175 if ( ch == CEditableText::ELineBreak || |
|
4176 ch == CEditableText::EParagraphDelimiter ) |
|
4177 { |
|
4178 ch = '\n'; |
|
4179 } |
|
4180 ptr.Append( ch ); |
|
4181 } |
|
4182 |
|
4183 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ConvertDelimToPerNLC") |
|
4184 return outText; |
|
4185 } |
|
4186 |
|
4187 |
|
4188 |
|
4189 // Converting \ns to EParagraphDelimiters |
|
4190 // --------------------------------------------------------- |
|
4191 // CApSettingsDlg::ConvertPerNToDelimLC |
|
4192 // --------------------------------------------------------- |
|
4193 // |
|
4194 |
|
4195 HBufC* CApSettingsDlg::ConvertPerNToDelimLC( const TDesC& aInText ) |
|
4196 { |
|
4197 APSETUILOGGER_ENTERFN( ESettings,"Settings::ConvertPerNToDelimLC") |
|
4198 |
|
4199 TInt size = aInText.Length(); |
|
4200 HBufC* outText = HBufC::NewLC( size ); |
|
4201 TPtr ptr = outText->Des(); |
|
4202 |
|
4203 TText ch; |
|
4204 for (TInt ii=0; ii<size; ii++) |
|
4205 { |
|
4206 ch = TText( aInText[ii] ); |
|
4207 switch (ch) |
|
4208 { |
|
4209 case '\r': |
|
4210 // ignore |
|
4211 ptr.Append(ch); |
|
4212 break; |
|
4213 case '\n': |
|
4214 ptr.Append( CEditableText::EParagraphDelimiter ); |
|
4215 break; |
|
4216 default: |
|
4217 ptr.Append(ch); |
|
4218 break; |
|
4219 } |
|
4220 } |
|
4221 |
|
4222 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ConvertPerNToDelimLC") |
|
4223 return outText; |
|
4224 } |
|
4225 |
|
4226 |
|
4227 //---------------------------------------------------------- |
|
4228 // CApSettingsDlg::DoChangeSettingsL |
|
4229 //---------------------------------------------------------- |
|
4230 // |
|
4231 void CApSettingsDlg::DoChangeSettingsL( TBool aQuick ) |
|
4232 { |
|
4233 APSETUILOGGER_ENTERFN( ESettings,"Settings::DoChangeSettingsL") |
|
4234 |
|
4235 TInt itemnum = ( Max( iList->CurrentItemIndex(), 0 ) ); |
|
4236 TApMember* ptr; |
|
4237 TInt* tptr; |
|
4238 TInt* compulsptr; |
|
4239 switch ( iLevel ) |
|
4240 { |
|
4241 case 0: |
|
4242 { |
|
4243 ptr = iField; |
|
4244 tptr = iTitles; |
|
4245 compulsptr = iCompulsory; |
|
4246 break; |
|
4247 } |
|
4248 case 1: |
|
4249 { |
|
4250 ptr = iFieldAdvanced; |
|
4251 tptr = iTitlesAdvanced; |
|
4252 compulsptr = iCompulsoryAdvanced; |
|
4253 break; |
|
4254 } |
|
4255 case 2: |
|
4256 { |
|
4257 ptr = iFieldL2; |
|
4258 tptr = iTitlesL2; |
|
4259 compulsptr = iCompulsoryL2; |
|
4260 break; |
|
4261 } |
|
4262 default: |
|
4263 { |
|
4264 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
4265 return; // just to suppress warnings about ptr's |
|
4266 // beeing used uninitialised |
|
4267 } |
|
4268 } |
|
4269 |
|
4270 |
|
4271 |
|
4272 ptr += itemnum; |
|
4273 tptr += itemnum; |
|
4274 compulsptr += itemnum; |
|
4275 TInt topitem( iList->TopItemIndex() ); |
|
4276 |
|
4277 TApBearerType bearer = iApItem->BearerTypeL(); |
|
4278 if ( bearer == EApBearerTypeGPRS ) |
|
4279 { |
|
4280 TUint32 tint; |
|
4281 iApItem->ReadUint( EApGprsPdpType, tint ); |
|
4282 if ( tint == EIPv6 ) |
|
4283 { |
|
4284 if ( iLevel == 1 ) |
|
4285 { |
|
4286 if ( itemnum ) |
|
4287 { |
|
4288 ptr++; |
|
4289 tptr++; |
|
4290 compulsptr++; |
|
4291 } |
|
4292 } |
|
4293 } |
|
4294 } |
|
4295 else |
|
4296 { // others |
|
4297 if ( bearer == EApBearerTypeWLAN ) |
|
4298 { |
|
4299 // if we are in iL2Ipv4, AND |
|
4300 // EApIspIPNetMask and EApIspIPGateway fields are not added |
|
4301 // skip those items... |
|
4302 if ( !IsNetMaskAndGatewayVisibleL() ) |
|
4303 { |
|
4304 if ( *ptr == EApIspIPNetMask ) |
|
4305 { |
|
4306 ptr++; |
|
4307 tptr++; |
|
4308 compulsptr++; |
|
4309 } |
|
4310 if ( *ptr == EApIspIPGateway ) |
|
4311 { |
|
4312 ptr++; |
|
4313 tptr++; |
|
4314 compulsptr++; |
|
4315 } |
|
4316 } |
|
4317 if ( !IsAdhocChannelVisible() ) |
|
4318 { |
|
4319 if ( ( *ptr == EApWlanChannelId ) |
|
4320 || ( *ptr == EApProxyServerAddress ) ) |
|
4321 { |
|
4322 ptr++; |
|
4323 tptr++; |
|
4324 compulsptr++; |
|
4325 } |
|
4326 } |
|
4327 } |
|
4328 else |
|
4329 { |
|
4330 // CSD |
|
4331 if ( *ptr == EApIspIPAddr ) |
|
4332 { |
|
4333 if ( !iL2Ipv4 ) |
|
4334 { |
|
4335 ptr++; |
|
4336 tptr++; |
|
4337 compulsptr++; |
|
4338 } |
|
4339 } |
|
4340 } |
|
4341 } |
|
4342 |
|
4343 |
|
4344 switch ( *ptr ) |
|
4345 { |
|
4346 case EApIspPromptForLogin: |
|
4347 case EApWapSecurity: |
|
4348 case EApIspIfCallbackEnabled: |
|
4349 case EApIspEnableSWCompression: |
|
4350 case EApGprsHeaderCompression: |
|
4351 case EApIspUseLoginScript: |
|
4352 case EApGprsDisablePlainTextAuth: |
|
4353 case EApIspDisablePlainTextAuth: |
|
4354 case EApWapWspOption: |
|
4355 case EApIspIfCallbackType: |
|
4356 case EApGprsPdpType: |
|
4357 case EApWlanNetworkMode: |
|
4358 case EApWlanScanSSID: |
|
4359 { // type 4 setting item with two available values |
|
4360 TBool changed( ETrue ); |
|
4361 if ( aQuick ) |
|
4362 { |
|
4363 InvertSettingsL( *ptr ); |
|
4364 } |
|
4365 else |
|
4366 { |
|
4367 changed = ShowPopupSettingPageL( *ptr ); |
|
4368 } |
|
4369 if ( changed ) |
|
4370 { |
|
4371 if ( *ptr == EApGprsPdpType ) |
|
4372 { |
|
4373 HandleListboxDataChangeL( EFalse ); |
|
4374 } |
|
4375 UpdateOnOffListBoxItemL( *ptr, *tptr, itemnum, *compulsptr ); |
|
4376 if ( *ptr == EApWlanNetworkMode ) |
|
4377 { |
|
4378 UpdateOnOffListBoxItemL( *( ptr+1 ), *( tptr+1 ), |
|
4379 itemnum+1, |
|
4380 *( compulsptr + 1 ) ); |
|
4381 if ( (itemnum+1) <= iList->BottomItemIndex() ) |
|
4382 { |
|
4383 iList->DrawItem( itemnum+1 ); |
|
4384 } |
|
4385 } |
|
4386 } |
|
4387 break; |
|
4388 } |
|
4389 case EApIspDefaultTelNumber: |
|
4390 case EApIspIfCallbackInfo: |
|
4391 { // type 1, Phone number editor |
|
4392 ShowPopupPhoneNumSettingPageL( *ptr ); |
|
4393 UpdateTextualListBoxItemL( *ptr, *tptr, itemnum, *compulsptr ); |
|
4394 break; |
|
4395 } |
|
4396 case EApWapGatewayAddress: |
|
4397 case EApIspIPAddr: |
|
4398 case EApIspIPNetMask: |
|
4399 case EApWlanIpNetMask: |
|
4400 case EApIspIPGateway: |
|
4401 case EApWlanIpGateway: |
|
4402 case EApGprsIPNameServer1: |
|
4403 case EApIspIPNameServer1: |
|
4404 case EApGprsIPNameServer2: |
|
4405 case EApIspIPNameServer2: |
|
4406 {// above ones are type 1, IP Address editors! |
|
4407 ShowPopupIpAddrSettingPageL( *ptr ); |
|
4408 UpdateTextualListBoxItemL( *ptr, *tptr, itemnum, *compulsptr ); |
|
4409 if ( *ptr == EApWapGatewayAddress ) |
|
4410 { |
|
4411 HandleListStructureChangeL(); |
|
4412 HandleListboxDataChangeL( EFalse ); |
|
4413 } |
|
4414 if ( *ptr == EApIspIPAddr ) |
|
4415 { |
|
4416 HandleListboxDataChangeL( EFalse ); |
|
4417 } |
|
4418 break; |
|
4419 } |
|
4420 case EApWapAccessPointName: |
|
4421 case EApGprsAccessPointName: |
|
4422 case EApIspLoginName: |
|
4423 case EApIspIfAuthName: |
|
4424 case EApIspLoginScript: |
|
4425 case EApWapStartPage: |
|
4426 case EApIspInitString: |
|
4427 case EApProxyServerAddress: |
|
4428 case EApProxyPortNumber: |
|
4429 { // type 1, Text setting item |
|
4430 if ( ShowPopupTextSettingPageL( *ptr ) ) |
|
4431 { |
|
4432 UpdateTextualListBoxItemL( *ptr, *tptr, itemnum, *compulsptr ); |
|
4433 if ( *ptr == EApWapAccessPointName ) |
|
4434 { |
|
4435 iTitlePane->SetTextL( iApItem->ConnectionName() ); |
|
4436 } |
|
4437 } |
|
4438 break; |
|
4439 } |
|
4440 case EApIspLoginPass: |
|
4441 case EApIspIfAuthPass: |
|
4442 |
|
4443 { // re-confirm, secreted, etc, |
|
4444 ShowPopupPasswordPageL( *ptr ); |
|
4445 UpdateTextualListBoxItemL( *ptr, *tptr, itemnum, *compulsptr ); |
|
4446 break; |
|
4447 } |
|
4448 case EApWapCurrentBearer: |
|
4449 case EApIspBearerCallTypeIsdn: // used for data call type |
|
4450 case EApIspBearerSpeed: |
|
4451 case EApWlanChannelId: |
|
4452 { // type 2, Pop-up setting item |
|
4453 if ( ShowPopupSettingPageL( *ptr ) ) |
|
4454 { |
|
4455 if ( *ptr == EApWapCurrentBearer ) |
|
4456 { |
|
4457 // if ==, the whole list needs to be updated ! |
|
4458 SetBearerTypeL( iApItem->BearerTypeL() ); |
|
4459 LimitSpeed(); |
|
4460 HandleListboxDataChangeL( EFalse ); |
|
4461 iList->SetTopItemIndex( topitem ); |
|
4462 iList->DrawNow(); |
|
4463 } |
|
4464 else |
|
4465 { |
|
4466 if ( *ptr == EApIspBearerCallTypeIsdn ) |
|
4467 { // first limit the speed if neccessary |
|
4468 LimitSpeed(); |
|
4469 // need to redraw EApIspBearerSpeed, too |
|
4470 // because it is possible that it had been changed |
|
4471 // to keep constrains simply update next field, |
|
4472 // too, 'cause they are next to each other... |
|
4473 UpdateOnOffListBoxItemL( *( ptr+1 ), *( tptr+1 ), |
|
4474 itemnum+1, |
|
4475 *( compulsptr + 1 ) ); |
|
4476 iList->DrawItem( itemnum+1 ); |
|
4477 } |
|
4478 UpdateOnOffListBoxItemL( *ptr, *tptr, |
|
4479 itemnum, *compulsptr ); |
|
4480 } |
|
4481 } |
|
4482 break; |
|
4483 } |
|
4484 case EApWlanSecurityMode: |
|
4485 { // type 2, Pop-up setting item |
|
4486 if ( ShowPopupSettingPageL( *ptr ) ) |
|
4487 { |
|
4488 // security mode has changed, re-create security settings! |
|
4489 UpdateOnOffListBoxItemL( *ptr, *tptr, |
|
4490 itemnum, *compulsptr ); |
|
4491 iHandler->iModel->UpdateSecurityModeL( *iApItem ); |
|
4492 } |
|
4493 break; |
|
4494 } |
|
4495 case EApIP6DNSAddrFromServer: |
|
4496 { |
|
4497 // if GPRS, PDP type Ipv4, DNS data query |
|
4498 // if GPRS, PDP type Ipv6, type 2, Pop-up setting item |
|
4499 TUint32 ival(0); |
|
4500 iApItem->ReadUint( EApGprsPdpType, ival ); |
|
4501 TBool changed( EFalse ); |
|
4502 if ( iApItem->BearerTypeL() == EApBearerTypeGPRS ) |
|
4503 { |
|
4504 if ( ival == EIPv6 ) |
|
4505 { |
|
4506 // GPRS, PDP type Ipv6, DNS pop-up setting item |
|
4507 changed = ShowPopupSettingPageL( *ptr ); |
|
4508 } |
|
4509 else |
|
4510 { |
|
4511 // GPRS, PDP type Ipv4, DNS data query |
|
4512 changed = GetNameServersL( EFalse ); |
|
4513 } |
|
4514 } |
|
4515 else |
|
4516 { // CSD/HSCSD |
|
4517 if ( iL2Ipv4 ) |
|
4518 { |
|
4519 changed = GetNameServersL( EFalse ); |
|
4520 } |
|
4521 else |
|
4522 { |
|
4523 changed = ShowPopupSettingPageL( *ptr ); |
|
4524 } |
|
4525 } |
|
4526 if ( changed ) |
|
4527 { |
|
4528 UpdateOnOffListBoxItemL( *ptr, *tptr, itemnum, *compulsptr ); |
|
4529 } |
|
4530 break; |
|
4531 } |
|
4532 case EApNetworkName: |
|
4533 { |
|
4534 ChangeNetworkGroupL(); |
|
4535 UpdateTextualListBoxItemL( *ptr, *tptr, itemnum, *compulsptr ); |
|
4536 break; |
|
4537 } |
|
4538 case EApIpv4Settings: |
|
4539 case EApIpv6Settings: |
|
4540 { |
|
4541 iL2Ipv4 = ( *ptr == EApIpv4Settings ); |
|
4542 if ( iLevel ) |
|
4543 { |
|
4544 // enter Ipv4 or Ipv6 settings |
|
4545 if ( iL2Ipv4 ) |
|
4546 { |
|
4547 // save current state so we can roll back to it |
|
4548 // if needed, e.g. if user fills but discards values... |
|
4549 if (!iBackupApItem ) |
|
4550 { |
|
4551 iBackupApItem = CApAccessPointItem::NewLC(); |
|
4552 CleanupStack::Pop(); // member var |
|
4553 } |
|
4554 iBackupApItem->CopyFromL( *iApItem ); |
|
4555 } |
|
4556 iLevel++; |
|
4557 HandleListStructureChangeL(); |
|
4558 iOldIndex = iList->CurrentItemIndex(); |
|
4559 iOldTopIndex = iList->TopItemIndex(); |
|
4560 iList->SetCurrentItemIndex( 0 ); |
|
4561 HandleListboxDataChangeL( EFalse ); |
|
4562 itemnum = 0; |
|
4563 } |
|
4564 break; |
|
4565 } |
|
4566 case EApWlanNetworkName: |
|
4567 { |
|
4568 if ( IsWlanSupported() ) |
|
4569 { |
|
4570 // Temporarily use plain text editor to input |
|
4571 // network name... |
|
4572 ChangeWlanNetworkNameL(); |
|
4573 // as it sets connection mode and security mode, |
|
4574 // we must update the full list... |
|
4575 HandleListboxDataChangeL( EFalse ); |
|
4576 } |
|
4577 else |
|
4578 { |
|
4579 User::Leave( KErrNotSupported ); |
|
4580 } |
|
4581 break; |
|
4582 } |
|
4583 case EApWlanSecuritySettings: |
|
4584 { |
|
4585 if ( IsWlanSupported() ) |
|
4586 { |
|
4587 iSecSettingsExitReason = ChangeWlanSecuritySettingsL(); |
|
4588 } |
|
4589 else |
|
4590 { |
|
4591 User::Leave( KErrNotSupported ); |
|
4592 } |
|
4593 break; |
|
4594 } |
|
4595 /* |
|
4596 case EApWlanChannelId: |
|
4597 { |
|
4598 breaaak; |
|
4599 } |
|
4600 */ |
|
4601 default: |
|
4602 { |
|
4603 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
4604 break; |
|
4605 } |
|
4606 } |
|
4607 SelectItem( itemnum ); |
|
4608 |
|
4609 APSETUILOGGER_LEAVEFN( ESettings,"Settings::DoChangeSettingsL") |
|
4610 } |
|
4611 |
|
4612 |
|
4613 |
|
4614 |
|
4615 //---------------------------------------------------------- |
|
4616 // CApSettingsDlg::GetSpeedForSelection |
|
4617 //---------------------------------------------------------- |
|
4618 // |
|
4619 TApCallSpeed CApSettingsDlg::GetBearerSpeedForSelection( TInt aCurrvalue ) |
|
4620 { |
|
4621 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetBearerSpeedForSelection") |
|
4622 |
|
4623 TApCallSpeed sp( KSpeed9600 ); |
|
4624 |
|
4625 |
|
4626 TUint32 tval( 0 ); |
|
4627 iApItem->ReadUint( EApIspBearerCallTypeIsdn, tval ); |
|
4628 |
|
4629 const TInt* actSpeeds = NULL; |
|
4630 TBool isWcdma = |
|
4631 FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ); |
|
4632 |
|
4633 switch ( tval ) |
|
4634 { |
|
4635 case ECallTypeAnalogue: |
|
4636 { // CSD/HSCSD, Analogue |
|
4637 switch ( iBearerType ) |
|
4638 { |
|
4639 case EApBearerTypeCSD: |
|
4640 { |
|
4641 actSpeeds = isWcdma ? KCsdAnalogueWcdma : KCsdAnalogue; |
|
4642 break; |
|
4643 } |
|
4644 case EApBearerTypeHSCSD: |
|
4645 { |
|
4646 actSpeeds = KHcsdAnalogue; |
|
4647 break; |
|
4648 } |
|
4649 default: |
|
4650 { |
|
4651 // this can only mean programmer error as no other |
|
4652 // bearer type is supperted with speed settings |
|
4653 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
4654 break; |
|
4655 } |
|
4656 } |
|
4657 break; |
|
4658 } |
|
4659 case ECallTypeISDNv110: |
|
4660 { |
|
4661 switch ( iBearerType ) |
|
4662 { |
|
4663 case EApBearerTypeCSD: |
|
4664 { |
|
4665 actSpeeds = isWcdma ? KCsdIsdn110Wcdma : KCsdIsdn110; |
|
4666 break; |
|
4667 } |
|
4668 case EApBearerTypeHSCSD: |
|
4669 { |
|
4670 actSpeeds = KHcsdIsdn110; |
|
4671 break; |
|
4672 } |
|
4673 default: |
|
4674 { |
|
4675 // this can only mean programmer error as no other |
|
4676 // bearer type is supperted with speed settings |
|
4677 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
4678 break; |
|
4679 } |
|
4680 } |
|
4681 break; |
|
4682 } |
|
4683 case ECallTypeISDNv120: |
|
4684 { |
|
4685 switch ( iBearerType ) |
|
4686 { |
|
4687 case EApBearerTypeCSD: |
|
4688 { |
|
4689 actSpeeds = isWcdma ? KCsdIsdn120Wcdma : KCsdIsdn120; |
|
4690 break; |
|
4691 } |
|
4692 case EApBearerTypeHSCSD: |
|
4693 { |
|
4694 actSpeeds = KHcsdIsdn120; |
|
4695 break; |
|
4696 } |
|
4697 default: |
|
4698 { |
|
4699 // this can only mean programmer error as no other |
|
4700 // bearer type is supperted with speed settings |
|
4701 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
4702 break; |
|
4703 } |
|
4704 } |
|
4705 break; |
|
4706 } |
|
4707 default: |
|
4708 { |
|
4709 // this can only mean programmer error as no other |
|
4710 // bearer type is supperted with speed settings |
|
4711 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
4712 break; |
|
4713 } |
|
4714 } |
|
4715 |
|
4716 sp = (TApCallSpeed) *(actSpeeds + aCurrvalue); |
|
4717 |
|
4718 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetBearerSpeedForSelection") |
|
4719 return sp; |
|
4720 } |
|
4721 |
|
4722 |
|
4723 |
|
4724 //---------------------------------------------------------- |
|
4725 // CApSettingsDlg::GetCurrIndexFromBearerSpeed |
|
4726 //---------------------------------------------------------- |
|
4727 // |
|
4728 TInt CApSettingsDlg::GetCurrIndexFromBearerSpeed( ) |
|
4729 { |
|
4730 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetCurrIndexFromBearerSpeed") |
|
4731 |
|
4732 TUint32 tval( 0 ); |
|
4733 TUint32 bval( 0 ); |
|
4734 TInt retval( 0 ); |
|
4735 |
|
4736 iApItem->ReadUint( EApIspBearerSpeed, tval ); |
|
4737 iApItem->ReadUint( EApIspBearerCallTypeIsdn, bval ); |
|
4738 |
|
4739 TBool isWcdma = |
|
4740 FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ); |
|
4741 |
|
4742 const TInt* actSpeeds = NULL; |
|
4743 |
|
4744 switch ( bval ) |
|
4745 { |
|
4746 case ECallTypeAnalogue: |
|
4747 { // CSD/HSCSD, Analogue |
|
4748 switch ( iBearerType ) |
|
4749 { |
|
4750 case EApBearerTypeCSD: |
|
4751 { |
|
4752 actSpeeds = isWcdma ? KCsdAnalogueWcdma : KCsdAnalogue; |
|
4753 break; |
|
4754 } |
|
4755 case EApBearerTypeHSCSD: |
|
4756 { |
|
4757 actSpeeds = KHcsdAnalogue; |
|
4758 break; |
|
4759 } |
|
4760 default: |
|
4761 { |
|
4762 // this can only mean programmer error as no other |
|
4763 // bearer type is supperted with speed settings |
|
4764 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
4765 break; |
|
4766 } |
|
4767 } |
|
4768 break; |
|
4769 } |
|
4770 case ECallTypeISDNv110: |
|
4771 { |
|
4772 switch ( iBearerType ) |
|
4773 { |
|
4774 case EApBearerTypeCSD: |
|
4775 { |
|
4776 actSpeeds = isWcdma ? KCsdIsdn110Wcdma : KCsdIsdn110; |
|
4777 break; |
|
4778 } |
|
4779 case EApBearerTypeHSCSD: |
|
4780 { |
|
4781 actSpeeds = KHcsdIsdn110; |
|
4782 break; |
|
4783 } |
|
4784 default: |
|
4785 { |
|
4786 // this can only mean programmer error as no other |
|
4787 // bearer type is supperted with speed settings |
|
4788 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
4789 break; |
|
4790 } |
|
4791 } |
|
4792 break; |
|
4793 } |
|
4794 case ECallTypeISDNv120: |
|
4795 { |
|
4796 switch ( iBearerType ) |
|
4797 { |
|
4798 case EApBearerTypeCSD: |
|
4799 { |
|
4800 actSpeeds = isWcdma ? KCsdIsdn120Wcdma : KCsdIsdn120; |
|
4801 break; |
|
4802 } |
|
4803 case EApBearerTypeHSCSD: |
|
4804 { |
|
4805 actSpeeds = KHcsdIsdn120; |
|
4806 break; |
|
4807 } |
|
4808 default: |
|
4809 { |
|
4810 // this can only mean programmer error as no other |
|
4811 // bearer type is supperted with speed settings |
|
4812 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
4813 break; |
|
4814 } |
|
4815 } |
|
4816 break; |
|
4817 } |
|
4818 default: |
|
4819 { |
|
4820 // this can only mean programmer error as no other |
|
4821 // bearer type is supperted with speed settings |
|
4822 __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) ); |
|
4823 break; |
|
4824 } |
|
4825 } |
|
4826 |
|
4827 if( actSpeeds ) |
|
4828 { |
|
4829 retval = 0; |
|
4830 while ( ( *( actSpeeds + retval + 1) != KEndOfArray ) |
|
4831 && ( *( actSpeeds + retval) < ( TInt )tval ) |
|
4832 && ( *( actSpeeds + retval + 1) <= ( TInt )tval ) ) |
|
4833 { |
|
4834 ++retval; |
|
4835 } |
|
4836 } |
|
4837 |
|
4838 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetCurrIndexFromBearerSpeed") |
|
4839 return retval; |
|
4840 } |
|
4841 |
|
4842 |
|
4843 //---------------------------------------------------------- |
|
4844 // CApSettingsDlg::ReplaceNonPrintingCharactersLC |
|
4845 //---------------------------------------------------------- |
|
4846 // |
|
4847 HBufC* CApSettingsDlg::ReplaceWhiteSpaceCharactersLC( const TDesC& aInText ) |
|
4848 { |
|
4849 APSETUILOGGER_ENTERFN( ESettings,"Settings::ReplaceWhiteSpaceCharactersLC") |
|
4850 |
|
4851 TInt size = aInText.Length(); |
|
4852 HBufC* aOutText = HBufC::NewLC( size ); |
|
4853 |
|
4854 TPtr ptr = aOutText->Des(); |
|
4855 |
|
4856 for ( TInt ii=0; ii<size; ++ii ) |
|
4857 { |
|
4858 TChar ch = aInText[ii]; |
|
4859 if ( ch.IsSpace() ) |
|
4860 { |
|
4861 ch = ' '; |
|
4862 } |
|
4863 ptr.Append( ch ); |
|
4864 } |
|
4865 |
|
4866 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ReplaceWhiteSpaceCharactersLC") |
|
4867 return aOutText; |
|
4868 } |
|
4869 |
|
4870 |
|
4871 |
|
4872 //---------------------------------------------------------- |
|
4873 // CApSettingsDlg::ChangeNetworkGroupL |
|
4874 //---------------------------------------------------------- |
|
4875 // |
|
4876 void CApSettingsDlg::ChangeNetworkGroupL() |
|
4877 { |
|
4878 APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeNetworkGroupL") |
|
4879 |
|
4880 HBufC* titlebuf; |
|
4881 |
|
4882 titlebuf = iHandler->iModel->EikEnv()->AllocReadResourceLC |
|
4883 ( |
|
4884 R_APUI_VIEW_NETWORK_GROUP |
|
4885 ); |
|
4886 |
|
4887 // needs this Dummy array to pass it to CAknSettingPage's constructor... |
|
4888 CDesCArrayFlat* aItemArray = new ( ELeave ) CDesCArrayFlat( 1 ); |
|
4889 CleanupStack::PushL( aItemArray ); |
|
4890 TUint32 prefUid( 0 ); |
|
4891 TInt currsel( -1 ); |
|
4892 iApItem->ReadUint( EApNetworkID, prefUid ); |
|
4893 |
|
4894 TInt prefInt( prefUid ); |
|
4895 CApNetSelPopupList* dlg = |
|
4896 CApNetSelPopupList::NewL( *iDataModel, *iHandler, currsel, |
|
4897 prefInt, *iEventStore, |
|
4898 aItemArray, ETrue ); |
|
4899 |
|
4900 CleanupStack::PushL( dlg ); |
|
4901 TPtrC ptr( titlebuf->Des() ); |
|
4902 dlg->SetSettingTextL( ptr ); |
|
4903 // dlg must be Pop-ed because ExecuteLD starts with PushL()... |
|
4904 CleanupStack::Pop(); |
|
4905 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
4906 { |
|
4907 // update value in iApItem |
|
4908 // get networkitem and add it to item... |
|
4909 iApItem->WriteUint( EApNetworkID, prefInt ); |
|
4910 // update network data according to new ID |
|
4911 iDataModel->DataHandler()->ReadNetworkPartL( *iApItem ); |
|
4912 } |
|
4913 CleanupStack::PopAndDestroy( aItemArray ); // aItemArray |
|
4914 CleanupStack::PopAndDestroy( titlebuf ); // titlebuf |
|
4915 |
|
4916 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ChangeNetworkGroupL") |
|
4917 } |
|
4918 |
|
4919 |
|
4920 |
|
4921 |
|
4922 //---------------------------------------------------------- |
|
4923 // CApSettingsDlg::IsHSCSDEnabledL |
|
4924 //---------------------------------------------------------- |
|
4925 // |
|
4926 TInt CApSettingsDlg::IsHSCSDEnabledL() |
|
4927 { |
|
4928 APSETUILOGGER_ENTERFN( ESettings,"Settings::IsHSCSDEnabledL") |
|
4929 |
|
4930 TInt EnableHSCSD( ETrue ); |
|
4931 |
|
4932 /* |
|
4933 // Connecting and initialization: |
|
4934 TInt err( KErrNone ); |
|
4935 CRepository* repository; |
|
4936 TRAP( err, repository = CRepository::NewL( KGeneralSettingsUid ) ); |
|
4937 // repository->Get( KGSHSCSDAccessPoints, EnableHSCSD ); |
|
4938 delete repository; |
|
4939 */ |
|
4940 |
|
4941 #ifdef __TEST_NO_HSCSD |
|
4942 EnableHSCSD = EFalse; |
|
4943 #endif |
|
4944 #ifdef __TEST_HSCSD_SUPPORT |
|
4945 EnableHSCSD = ETrue; |
|
4946 #endif // __TEST_HSCSD_SUPPORT |
|
4947 |
|
4948 APSETUILOGGER_LEAVEFN( ESettings,"Settings::IsHSCSDEnabledL") |
|
4949 return EnableHSCSD; |
|
4950 } |
|
4951 |
|
4952 |
|
4953 |
|
4954 |
|
4955 |
|
4956 |
|
4957 |
|
4958 //---------------------------------------------------------- |
|
4959 // CApSettingsDlg::GetCSDSettingArrays |
|
4960 //---------------------------------------------------------- |
|
4961 // |
|
4962 void CApSettingsDlg::GetCSDSettingArrays( TInt variant ) |
|
4963 { |
|
4964 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetCSDSettingArrays") |
|
4965 |
|
4966 // If IPv6 support requested, is the only place where L2 level needed, |
|
4967 // so it is the only place when it is variated... |
|
4968 if ( iReqIpvType & EIPv6 ) |
|
4969 { |
|
4970 if ( iL2Ipv4 ) |
|
4971 { |
|
4972 iFieldL2 = |
|
4973 (TApMember*) &Fields_CSD_L2_IPv4[KApMember][0]; |
|
4974 iFieldCountL2 = |
|
4975 sizeof( Fields_CSD_L2_IPv4[KApMember] )/sizeof( TApMember ); |
|
4976 iTitlesL2 = |
|
4977 MUTABLE_CAST( TInt*, |
|
4978 &Fields_CSD_L2_IPv4[KResourceID][0] ); |
|
4979 iCompulsoryL2 = |
|
4980 MUTABLE_CAST( TInt*, |
|
4981 &Fields_CSD_L2_IPv4[KCompulsory][0] ); |
|
4982 } |
|
4983 else |
|
4984 { |
|
4985 iFieldL2 = |
|
4986 (TApMember*) &Fields_CSD_L2_IPv6[KApMember][0]; |
|
4987 iFieldCountL2 = |
|
4988 sizeof( Fields_CSD_L2_IPv6[KApMember] )/sizeof( TApMember ); |
|
4989 iTitlesL2 = |
|
4990 MUTABLE_CAST( TInt*, |
|
4991 &Fields_CSD_L2_IPv6[KResourceID][0] ); |
|
4992 iCompulsoryL2 = |
|
4993 MUTABLE_CAST( TInt*, |
|
4994 &Fields_CSD_L2_IPv6[KCompulsory][0] ); |
|
4995 } |
|
4996 } |
|
4997 |
|
4998 |
|
4999 |
|
5000 if ( variant & KWSPSettingsVisible ) |
|
5001 { |
|
5002 if ( iReqIpvType & EIPv6 ) |
|
5003 { |
|
5004 iField = (TApMember*) &Fields_CSD_WSP_IPv6[KApMember][0]; |
|
5005 iFieldCount = |
|
5006 sizeof( Fields_CSD_WSP_IPv6[KApMember] )/sizeof( TApMember ); |
|
5007 |
|
5008 iFieldAdvanced = |
|
5009 (TApMember*) &Fields_CSD_Advanced_WSP_IPv6[KApMember][0]; |
|
5010 iAdvancedFieldCount = |
|
5011 sizeof( Fields_CSD_Advanced_WSP_IPv6[KApMember] ) |
|
5012 / sizeof( TApMember ); |
|
5013 |
|
5014 iTitles = |
|
5015 MUTABLE_CAST( TInt*, &Fields_CSD_WSP_IPv6[KResourceID][0] ); |
|
5016 iTitlesAdvanced = |
|
5017 MUTABLE_CAST( TInt*, |
|
5018 &Fields_CSD_Advanced_WSP_IPv6[KResourceID][0] ); |
|
5019 |
|
5020 iCompulsory = |
|
5021 MUTABLE_CAST( TInt*, |
|
5022 &Fields_CSD_WSP_IPv6[KCompulsory][0] ); |
|
5023 iCompulsoryAdvanced = |
|
5024 MUTABLE_CAST( TInt*, |
|
5025 &Fields_CSD_Advanced_WSP_IPv6[KCompulsory][0] ); |
|
5026 |
|
5027 } |
|
5028 else |
|
5029 { |
|
5030 iField = (TApMember*) &Fields_CSD_WSP[KApMember][0]; |
|
5031 iFieldCount = |
|
5032 sizeof( Fields_CSD_WSP[KApMember] )/sizeof( TApMember ); |
|
5033 |
|
5034 iFieldAdvanced = |
|
5035 (TApMember*) &Fields_CSD_Advanced_WSP[KApMember][0]; |
|
5036 iAdvancedFieldCount = |
|
5037 sizeof( Fields_CSD_Advanced_WSP[KApMember] ) |
|
5038 / sizeof( TApMember ); |
|
5039 |
|
5040 iTitles = |
|
5041 MUTABLE_CAST( TInt*, &Fields_CSD_WSP[KResourceID][0] ); |
|
5042 iTitlesAdvanced = |
|
5043 MUTABLE_CAST( TInt*, |
|
5044 &Fields_CSD_Advanced_WSP[KResourceID][0] ); |
|
5045 |
|
5046 iCompulsory = |
|
5047 MUTABLE_CAST( TInt*, &Fields_CSD_WSP[KCompulsory][0] ); |
|
5048 iCompulsoryAdvanced = |
|
5049 MUTABLE_CAST( TInt*, |
|
5050 &Fields_CSD_Advanced_WSP[KCompulsory][0] ); |
|
5051 } |
|
5052 } |
|
5053 else |
|
5054 { |
|
5055 if ( iReqIpvType & EIPv6 ) |
|
5056 { |
|
5057 iField = (TApMember*) &Fields_CSD_IPv6[KApMember][0]; |
|
5058 iFieldCount = |
|
5059 sizeof( Fields_CSD_IPv6[KApMember] )/sizeof( TApMember ); |
|
5060 |
|
5061 iFieldAdvanced = |
|
5062 (TApMember*) &Fields_CSD_Advanced_IPv6[KApMember][0]; |
|
5063 iAdvancedFieldCount = |
|
5064 sizeof( Fields_CSD_Advanced_IPv6[KApMember] ) |
|
5065 / sizeof( TApMember ); |
|
5066 |
|
5067 iTitles = |
|
5068 MUTABLE_CAST( TInt*, |
|
5069 &Fields_CSD_IPv6[KResourceID][0] ); |
|
5070 iTitlesAdvanced = |
|
5071 MUTABLE_CAST( TInt*, |
|
5072 &Fields_CSD_Advanced_IPv6[KResourceID][0] ); |
|
5073 |
|
5074 iCompulsory = |
|
5075 MUTABLE_CAST( TInt*, |
|
5076 &Fields_CSD_IPv6[KCompulsory][0] ); |
|
5077 iCompulsoryAdvanced = |
|
5078 MUTABLE_CAST( TInt*, |
|
5079 &Fields_CSD_Advanced_IPv6[KCompulsory][0] ); |
|
5080 } |
|
5081 else |
|
5082 { |
|
5083 iField = (TApMember*) &Fields_CSD[KApMember][0]; |
|
5084 iFieldCount = sizeof( Fields_CSD[KApMember] )/sizeof( TApMember ); |
|
5085 |
|
5086 iFieldAdvanced = (TApMember*) &Fields_CSD_Advanced[KApMember][0]; |
|
5087 iAdvancedFieldCount = |
|
5088 sizeof( Fields_CSD_Advanced[KApMember] )/sizeof( TApMember ); |
|
5089 |
|
5090 iTitles = MUTABLE_CAST( TInt*, &Fields_CSD[KResourceID][0] ); |
|
5091 iTitlesAdvanced = |
|
5092 MUTABLE_CAST( TInt*, &Fields_CSD_Advanced[KResourceID][0] ); |
|
5093 |
|
5094 iCompulsory = MUTABLE_CAST( TInt*, &Fields_CSD[KCompulsory][0] ); |
|
5095 iCompulsoryAdvanced = |
|
5096 MUTABLE_CAST( TInt*, &Fields_CSD_Advanced[KCompulsory][0] ); |
|
5097 } |
|
5098 } |
|
5099 |
|
5100 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetCSDSettingArrays") |
|
5101 } |
|
5102 |
|
5103 |
|
5104 |
|
5105 //---------------------------------------------------------- |
|
5106 // CApSettingsDlg::GetGPRSSettingArrays |
|
5107 //---------------------------------------------------------- |
|
5108 // |
|
5109 void CApSettingsDlg::GetGPRSSettingArrays( TInt variant ) |
|
5110 { |
|
5111 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetGPRSSettingArrays") |
|
5112 |
|
5113 if ( variant & KWSPSettingsVisible ) |
|
5114 { |
|
5115 if ( iReqIpvType & EIPv6 ) |
|
5116 { |
|
5117 iField = ( TApMember* ) &Fields_GPRS_WSP_IPv6[ KApMember ][0]; |
|
5118 iFieldCount = sizeof( Fields_GPRS_WSP_IPv6[0] ) |
|
5119 / sizeof( TApMember ); |
|
5120 iFieldAdvanced = |
|
5121 ( TApMember* ) &Fields_GPRS_Advanced_WSP_IPv6[ KApMember ][0]; |
|
5122 iAdvancedFieldCount = |
|
5123 sizeof( Fields_GPRS_Advanced_WSP_IPv6[ KApMember ]) |
|
5124 / sizeof( TApMember ); |
|
5125 iTitles = |
|
5126 MUTABLE_CAST( TInt*, &Fields_GPRS_WSP_IPv6[ KResourceID ][0] ); |
|
5127 iTitlesAdvanced = |
|
5128 MUTABLE_CAST( |
|
5129 TInt*, |
|
5130 &Fields_GPRS_Advanced_WSP_IPv6[ KResourceID ][0] ); |
|
5131 iCompulsory = |
|
5132 MUTABLE_CAST( TInt*, &Fields_GPRS_WSP_IPv6[ KCompulsory ][0] ); |
|
5133 iCompulsoryAdvanced = |
|
5134 MUTABLE_CAST( |
|
5135 TInt*, |
|
5136 &Fields_GPRS_Advanced_WSP_IPv6[ KCompulsory ][0] ); |
|
5137 } |
|
5138 else |
|
5139 { |
|
5140 iField = ( TApMember* ) &Fields_GPRS_WSP[ KApMember ][0]; |
|
5141 iFieldCount = sizeof( Fields_GPRS_WSP[0] )/sizeof( TApMember ); |
|
5142 iFieldAdvanced = |
|
5143 ( TApMember* ) &Fields_GPRS_Advanced_WSP[ KApMember ][0]; |
|
5144 iAdvancedFieldCount = |
|
5145 sizeof( Fields_GPRS_Advanced_WSP[ KApMember ]) |
|
5146 / sizeof( TApMember ); |
|
5147 iTitles = |
|
5148 MUTABLE_CAST( TInt*, &Fields_GPRS_WSP[ KResourceID ][0] ); |
|
5149 iTitlesAdvanced = |
|
5150 MUTABLE_CAST( |
|
5151 TInt*, |
|
5152 &Fields_GPRS_Advanced_WSP[ KResourceID ][0] ); |
|
5153 iCompulsory = |
|
5154 MUTABLE_CAST( TInt*, &Fields_GPRS_WSP[ KCompulsory ][0] ); |
|
5155 iCompulsoryAdvanced = |
|
5156 MUTABLE_CAST( |
|
5157 TInt*, |
|
5158 &Fields_GPRS_Advanced_WSP[ KCompulsory ][0] ); |
|
5159 } |
|
5160 } |
|
5161 else |
|
5162 { |
|
5163 if ( iReqIpvType & EIPv6 ) |
|
5164 { |
|
5165 iField = ( TApMember* ) &Fields_GPRS_IPv6[ KApMember ][0]; |
|
5166 iFieldCount = sizeof( Fields_GPRS_IPv6[0] )/sizeof( TApMember ); |
|
5167 iFieldAdvanced = |
|
5168 ( TApMember* ) &Fields_GPRS_Advanced_IPv6[ KApMember ][0]; |
|
5169 iAdvancedFieldCount = |
|
5170 sizeof( Fields_GPRS_Advanced_IPv6[ KApMember ]) |
|
5171 / sizeof( TApMember ); |
|
5172 iTitles = |
|
5173 MUTABLE_CAST( TInt*, &Fields_GPRS_IPv6[ KResourceID ][0] ); |
|
5174 iTitlesAdvanced = |
|
5175 MUTABLE_CAST( TInt*, |
|
5176 &Fields_GPRS_Advanced_IPv6[ KResourceID ][0] ); |
|
5177 iCompulsory = |
|
5178 MUTABLE_CAST( TInt*, &Fields_GPRS_IPv6[ KCompulsory ][0] ); |
|
5179 iCompulsoryAdvanced = |
|
5180 MUTABLE_CAST( TInt*, |
|
5181 &Fields_GPRS_Advanced_IPv6[ KCompulsory ][0] ); |
|
5182 } |
|
5183 else |
|
5184 { |
|
5185 iField = ( TApMember* ) &Fields_GPRS[ KApMember ][0]; |
|
5186 iFieldCount = sizeof( Fields_GPRS[0] )/sizeof( TApMember ); |
|
5187 iFieldAdvanced = |
|
5188 ( TApMember* ) &Fields_GPRS_Advanced[ KApMember ][0]; |
|
5189 iAdvancedFieldCount = |
|
5190 sizeof( Fields_GPRS_Advanced[ KApMember ])/sizeof( TApMember ); |
|
5191 iTitles = |
|
5192 MUTABLE_CAST( TInt*, &Fields_GPRS[ KResourceID ][0] ); |
|
5193 iTitlesAdvanced = |
|
5194 MUTABLE_CAST( TInt*, &Fields_GPRS_Advanced[ KResourceID ][0] ); |
|
5195 iCompulsory = |
|
5196 MUTABLE_CAST( TInt*, &Fields_GPRS[ KCompulsory ][0] ); |
|
5197 iCompulsoryAdvanced = |
|
5198 MUTABLE_CAST( TInt*, &Fields_GPRS_Advanced[ KCompulsory ][0] ); |
|
5199 } |
|
5200 } |
|
5201 |
|
5202 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetGPRSSettingArrays") |
|
5203 } |
|
5204 |
|
5205 |
|
5206 |
|
5207 |
|
5208 //---------------------------------------------------------- |
|
5209 // CApSettingsDlg::GetWLANSettingArraysL |
|
5210 //---------------------------------------------------------- |
|
5211 // |
|
5212 void CApSettingsDlg::GetWLANSettingArraysL( TInt /*aVariant*/ ) |
|
5213 { |
|
5214 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetWLANSettingArraysL") |
|
5215 |
|
5216 if ( IsWlanSupported() ) |
|
5217 { |
|
5218 // If IPv6 support requested, is the only place where L2 level needed, |
|
5219 // so it is the only place when it is variated... |
|
5220 if ( iReqIpvType & EIPv6 ) |
|
5221 { |
|
5222 if ( iL2Ipv4 ) |
|
5223 { |
|
5224 iFieldL2 = |
|
5225 (TApMember*) &Fields_WLAN_L2_IPv4[KApMember][0]; |
|
5226 iFieldCountL2 = |
|
5227 sizeof( Fields_WLAN_L2_IPv4[KApMember] ) |
|
5228 / sizeof( TApMember ); |
|
5229 iTitlesL2 = |
|
5230 MUTABLE_CAST( TInt*, |
|
5231 &Fields_WLAN_L2_IPv4[KResourceID][0] ); |
|
5232 iCompulsoryL2 = |
|
5233 MUTABLE_CAST( TInt*, |
|
5234 &Fields_WLAN_L2_IPv4[KCompulsory][0] ); |
|
5235 } |
|
5236 else |
|
5237 { |
|
5238 iFieldL2 = |
|
5239 (TApMember*) &Fields_CSD_L2_IPv6[KApMember][0]; |
|
5240 iFieldCountL2 = |
|
5241 sizeof( Fields_CSD_L2_IPv6[KApMember] ) |
|
5242 / sizeof( TApMember ); |
|
5243 iTitlesL2 = |
|
5244 MUTABLE_CAST( TInt*, |
|
5245 &Fields_CSD_L2_IPv6[KResourceID][0] ); |
|
5246 iCompulsoryL2 = |
|
5247 MUTABLE_CAST( TInt*, |
|
5248 &Fields_CSD_L2_IPv6[KCompulsory][0] ); |
|
5249 } |
|
5250 } |
|
5251 |
|
5252 |
|
5253 if ( iReqIpvType & EIPv6 ) |
|
5254 { |
|
5255 iField = ( TApMember* ) &Fields_WLAN_IPv6[ KApMember ][0]; |
|
5256 iFieldCount = sizeof( Fields_WLAN_IPv6[0] )/sizeof( TApMember ); |
|
5257 iFieldAdvanced = |
|
5258 ( TApMember* ) &Fields_WLAN_Advanced_IPv6[ KApMember ][0]; |
|
5259 iAdvancedFieldCount = |
|
5260 sizeof( Fields_WLAN_Advanced_IPv6[ KApMember ]) |
|
5261 / sizeof( TApMember ); |
|
5262 iTitles = |
|
5263 MUTABLE_CAST( TInt*, &Fields_WLAN_IPv6[ KResourceID ][0] ); |
|
5264 iTitlesAdvanced = |
|
5265 MUTABLE_CAST( TInt*, |
|
5266 &Fields_WLAN_Advanced_IPv6[ KResourceID ][0] ); |
|
5267 iCompulsory = |
|
5268 MUTABLE_CAST( TInt*, &Fields_WLAN_IPv6[ KCompulsory ][0] ); |
|
5269 iCompulsoryAdvanced = |
|
5270 MUTABLE_CAST( TInt*, |
|
5271 &Fields_WLAN_Advanced_IPv6[ KCompulsory ][0] ); |
|
5272 } |
|
5273 else |
|
5274 { |
|
5275 iField = ( TApMember* ) &Fields_WLAN_IPv4[ KApMember ][0]; |
|
5276 iFieldCount = sizeof( Fields_WLAN_IPv4[0] )/sizeof( TApMember ); |
|
5277 iFieldAdvanced = |
|
5278 ( TApMember* ) &Fields_WLAN_Advanced_IPv4[ KApMember ][0]; |
|
5279 iAdvancedFieldCount = |
|
5280 sizeof( Fields_WLAN_Advanced_IPv4[ KApMember ]) |
|
5281 / sizeof( TApMember ); |
|
5282 iTitles = |
|
5283 MUTABLE_CAST( TInt*, &Fields_WLAN_IPv4[ KResourceID ][0] ); |
|
5284 iTitlesAdvanced = |
|
5285 MUTABLE_CAST( TInt*, |
|
5286 &Fields_WLAN_Advanced_IPv4[ KResourceID ][0] ); |
|
5287 iCompulsory = |
|
5288 MUTABLE_CAST( TInt*, &Fields_WLAN_IPv4[ KCompulsory ][0] ); |
|
5289 iCompulsoryAdvanced = |
|
5290 MUTABLE_CAST( TInt*, |
|
5291 &Fields_WLAN_Advanced_IPv4[ KCompulsory ][0] ); |
|
5292 } |
|
5293 } |
|
5294 else |
|
5295 { |
|
5296 User::Leave( KErrNotSupported ); |
|
5297 } |
|
5298 |
|
5299 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetWLANSettingArraysL") |
|
5300 } |
|
5301 |
|
5302 |
|
5303 |
|
5304 //---------------------------------------------------------- |
|
5305 // CApSettingsDlg::GetNameServersL |
|
5306 //---------------------------------------------------------- |
|
5307 // |
|
5308 TInt CApSettingsDlg::GetNameServersL( TBool aIp6 ) |
|
5309 { |
|
5310 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetNameServersL") |
|
5311 |
|
5312 TInt retval( 0 ); |
|
5313 |
|
5314 if ( (iReqIpvType & EIPv6) && aIp6 ) |
|
5315 { |
|
5316 retval = GetIpv6NameServerL(); |
|
5317 } |
|
5318 else |
|
5319 { |
|
5320 retval = GetIpv4NameServerL(); |
|
5321 } |
|
5322 |
|
5323 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetNameServersL") |
|
5324 return retval; |
|
5325 } |
|
5326 |
|
5327 |
|
5328 |
|
5329 |
|
5330 |
|
5331 |
|
5332 //---------------------------------------------------------- |
|
5333 // CApSettingsDlg::AddMenuListBoxItemL |
|
5334 //---------------------------------------------------------- |
|
5335 // |
|
5336 void CApSettingsDlg::AddMenuListBoxItemL( CDesCArrayFlat& aItemArray, |
|
5337 TApMember /*aMember*/, TInt aRes, |
|
5338 TInt aCompulsory ) |
|
5339 { |
|
5340 APSETUILOGGER_ENTERFN( ESettings,"Settings::AddMenuListBoxItemL") |
|
5341 |
|
5342 // Define a heap descriptor to hold all the item text |
|
5343 // HBufC is non-modifiable |
|
5344 HBufC* title = iEikonEnv->AllocReadResourceLC( aRes ); |
|
5345 |
|
5346 // Define a heap descriptor to hold all the item text |
|
5347 TInt length = title->Length() + 10; |
|
5348 if ( aCompulsory ) |
|
5349 { |
|
5350 length += 3; |
|
5351 } |
|
5352 HBufC* itemText = HBufC::NewLC( length ); |
|
5353 |
|
5354 |
|
5355 // Define a modifiable pointer descriptor to be able to append text to the |
|
5356 // non-modifiable heap descriptor itemText |
|
5357 TPtr itemTextPtr = itemText->Des(); |
|
5358 itemTextPtr.Format( KTxtMenuListItemFormat, title ); |
|
5359 if ( aCompulsory ) |
|
5360 { |
|
5361 itemTextPtr.Append( KTxtCompulsory ); |
|
5362 } |
|
5363 |
|
5364 aItemArray.AppendL( *itemText ); |
|
5365 CleanupStack::PopAndDestroy( itemText ); |
|
5366 CleanupStack::PopAndDestroy( title ); // title |
|
5367 |
|
5368 APSETUILOGGER_LEAVEFN( ESettings,"Settings::AddMenuListBoxItemL") |
|
5369 } |
|
5370 |
|
5371 |
|
5372 //---------------------------------------------------------- |
|
5373 // CApSettingsDlg::AskQueryIfWcdmaL |
|
5374 //---------------------------------------------------------- |
|
5375 // |
|
5376 TBool CApSettingsDlg::AskQueryIfWcdmaL( TApMember aMember, TInt aCurrvalue ) |
|
5377 { |
|
5378 APSETUILOGGER_ENTERFN( ESettings,"Settings::AskQueryIfWcdmaL") |
|
5379 |
|
5380 TBool accept = ETrue ; |
|
5381 TBool isWcdma = |
|
5382 FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ); |
|
5383 if ( isWcdma && iBearerType == EApBearerTypeCSD && |
|
5384 aMember == EApIspBearerSpeed ) |
|
5385 { |
|
5386 TApCallSpeed newSpeed = GetBearerSpeedForSelection( aCurrvalue ); |
|
5387 switch ( newSpeed) |
|
5388 { |
|
5389 case KSpeed28800: |
|
5390 case KSpeed38400: |
|
5391 case KSpeed56000: |
|
5392 { |
|
5393 accept = AskQueryL( R_APUI_IAP_CONF_MAX_SPEED_WCDMA ); |
|
5394 break; |
|
5395 } |
|
5396 default: |
|
5397 { |
|
5398 break; |
|
5399 } |
|
5400 |
|
5401 } |
|
5402 } |
|
5403 |
|
5404 APSETUILOGGER_LEAVEFN( ESettings,"Settings::AskQueryIfWcdmaL") |
|
5405 return accept; |
|
5406 } |
|
5407 |
|
5408 |
|
5409 |
|
5410 //---------------------------------------------------------- |
|
5411 // CApSettingsDlg::GetDomainNameServersTypeL |
|
5412 //---------------------------------------------------------- |
|
5413 // |
|
5414 TInt CApSettingsDlg::GetDomainNameServersTypeL() |
|
5415 { |
|
5416 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetDomainNameServersTypeL") |
|
5417 |
|
5418 TInt retval( 0 ); |
|
5419 // GPRS, net type 4: |
|
5420 // if IspNameServ <> 0.0.0.0 => User defined |
|
5421 // GPRS, net type 6: |
|
5422 // if IspIPv6NameServ <> 0.0.0.0 => User defined OR well-known |
|
5423 // CSD: |
|
5424 // if in IPv4settings: |
|
5425 // if IspNameServ <> 0.0.0.0 => User defined |
|
5426 // CSD: |
|
5427 // if in IPv6settings: |
|
5428 // if IspIPv6NameServ <> 0.0.0.0 => User defined OR well-known |
|
5429 |
|
5430 if ( iApItem->BearerTypeL() == EApBearerTypeGPRS ) |
|
5431 { |
|
5432 TUint32 ipnettype( 0 ); |
|
5433 iApItem->ReadUint( EApGprsPdpType, ipnettype ); |
|
5434 if ( ipnettype == EIPv6 ) |
|
5435 { |
|
5436 retval = GetIPv6DNSTypeL(); |
|
5437 } |
|
5438 else |
|
5439 { |
|
5440 retval = GetIPv4DNSTypeL(); |
|
5441 } |
|
5442 } |
|
5443 else |
|
5444 { // CSD |
|
5445 // IPv4settings: IspNameServ <> 0.0.0.0 => User defined |
|
5446 // IPv6settings: |
|
5447 // IspIPv6NameServ <> 0.0.0.0 => User defined OR well-known |
|
5448 if ( iL2Ipv4 ) |
|
5449 { // IPv4 settings |
|
5450 retval = GetIPv4DNSTypeL(); |
|
5451 } |
|
5452 else |
|
5453 { // IPv6 settings |
|
5454 retval = GetIPv6DNSTypeL(); |
|
5455 } |
|
5456 } |
|
5457 |
|
5458 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetDomainNameServersTypeL") |
|
5459 return retval; |
|
5460 } |
|
5461 |
|
5462 |
|
5463 |
|
5464 //---------------------------------------------------------- |
|
5465 // CApSettingsDlg::GetIpv4NameServerL |
|
5466 //---------------------------------------------------------- |
|
5467 // |
|
5468 TInt CApSettingsDlg::GetIpv4NameServerL() |
|
5469 { |
|
5470 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetIpv4NameServerL") |
|
5471 |
|
5472 HBufC* dns1 = HBufC::NewLC( KModifiableTextLength ); |
|
5473 HBufC* dns2 = HBufC::NewLC( KModifiableTextLength ); |
|
5474 TPtr dns1ptr( dns1->Des() ); |
|
5475 TPtr dns2ptr( dns2->Des() ); |
|
5476 |
|
5477 TInt ResId( 0 ); |
|
5478 |
|
5479 iApItem->ReadTextL( EApGprsIPNameServer1, dns1ptr ); |
|
5480 iApItem->ReadTextL( EApGprsIPNameServer2, dns2ptr ); |
|
5481 ResId = R_DNSIP4_QUERY; |
|
5482 |
|
5483 TInetAddr dns1Addr; |
|
5484 TInetAddr dns2Addr; |
|
5485 dns1Addr.Input( dns1ptr ); |
|
5486 dns2Addr.Input( dns2ptr ); |
|
5487 |
|
5488 CAknMultiLineIpQueryDialog* ipquery = |
|
5489 CAknMultiLineIpQueryDialog::NewL( dns1Addr, dns2Addr ); |
|
5490 |
|
5491 TInt retval = ipquery->ExecuteLD( ResId ); |
|
5492 if ( retval ) |
|
5493 { |
|
5494 dns1Addr.Output( dns1ptr ); |
|
5495 dns2Addr.Output( dns2ptr ); |
|
5496 if ( dns1ptr.Compare( KDynIpAddress ) == 0 ) |
|
5497 { // move 2nd to first, set second to Dynamic... |
|
5498 iApItem->WriteTextL( EApGprsIPNameServer1, dns2ptr ); |
|
5499 iApItem->WriteTextL( EApGprsIPNameServer2, KDynIpAddress ); |
|
5500 } |
|
5501 else |
|
5502 { |
|
5503 iApItem->WriteTextL( EApGprsIPNameServer1, dns1ptr ); |
|
5504 iApItem->WriteTextL( EApGprsIPNameServer2, dns2ptr ); |
|
5505 } |
|
5506 } |
|
5507 CleanupStack::PopAndDestroy( 2 ); // dns1, dns2 |
|
5508 |
|
5509 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetIpv4NameServerL") |
|
5510 return retval; |
|
5511 } |
|
5512 |
|
5513 |
|
5514 //---------------------------------------------------------- |
|
5515 // CApSettingsDlg::GetIpv6NameServerL |
|
5516 //---------------------------------------------------------- |
|
5517 // |
|
5518 TInt CApSettingsDlg::GetIpv6NameServerL() |
|
5519 { |
|
5520 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetIpv6NameServerL") |
|
5521 |
|
5522 HBufC* dns1 = HBufC::NewLC( KModifiableTextLength ); |
|
5523 HBufC* dns2 = HBufC::NewLC( KModifiableTextLength ); |
|
5524 TPtr dns1ptr( dns1->Des() ); |
|
5525 TPtr dns2ptr( dns2->Des() ); |
|
5526 |
|
5527 TInt ResId( 0 ); |
|
5528 |
|
5529 iApItem->ReadTextL( EApIP6NameServer1, dns1ptr ); |
|
5530 iApItem->ReadTextL( EApIP6NameServer2, dns2ptr ); |
|
5531 ResId = R_DNSIP6_QUERY; |
|
5532 |
|
5533 if ( ( dns1ptr.Compare( KKnownNameServer1 ) == 0 ) |
|
5534 && ( dns2ptr.Compare( KKnownNameServer2 ) == 0 ) ) |
|
5535 { // special value, well-known |
|
5536 // in this case 'dynamic' string must be offered so |
|
5537 // temp data must be changed to 'dynamic' |
|
5538 dns1ptr = KDynIpv6Address; |
|
5539 dns2ptr = KDynIpv6Address; |
|
5540 } |
|
5541 |
|
5542 CApMultiLineDataQueryDialog* ipquery = |
|
5543 CApMultiLineDataQueryDialog::NewL( dns1ptr, dns2ptr ); |
|
5544 |
|
5545 TInt retval = ipquery->ExecuteLD( ResId ); |
|
5546 if ( retval ) |
|
5547 { |
|
5548 TInetAddr dns1Addr; |
|
5549 TInetAddr dns2Addr; |
|
5550 TInt err1( KErrNone ); |
|
5551 TInt err2( KErrNone ); |
|
5552 if ( dns1ptr.Compare( KEmpty ) != 0 ) |
|
5553 { |
|
5554 err1 = dns1Addr.Input( dns1ptr ); |
|
5555 } |
|
5556 if ( dns2ptr.Compare( KEmpty ) != 0 ) |
|
5557 { |
|
5558 err2 = dns2Addr.Input( dns2ptr ); |
|
5559 } |
|
5560 if ( err1 || err2 ) |
|
5561 { |
|
5562 ShowNoteL( R_APUI_VIEW_SET_INFO_INVALID_IP ); |
|
5563 GetIpv6NameServerL(); |
|
5564 } |
|
5565 else |
|
5566 { |
|
5567 if ( |
|
5568 ( dns1ptr.Compare( KDynIpv6Address ) == 0 ) || |
|
5569 ( dns1ptr.Compare( KEmpty ) == 0 ) |
|
5570 ) |
|
5571 { // swap them: move 2nd to first, set second to Dynamic... |
|
5572 iApItem->WriteTextL( EApIP6NameServer1, dns2ptr ); |
|
5573 iApItem->WriteTextL( EApIP6NameServer2, KDynIpv6Address ); |
|
5574 } |
|
5575 else |
|
5576 { // keep the original order |
|
5577 iApItem->WriteTextL( EApIP6NameServer1, dns1ptr ); |
|
5578 iApItem->WriteTextL( EApIP6NameServer2, dns2ptr ); |
|
5579 } |
|
5580 } |
|
5581 } |
|
5582 CleanupStack::PopAndDestroy( 2 ); // dns1, dns2 |
|
5583 |
|
5584 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetIpv6NameServerL") |
|
5585 return retval; |
|
5586 } |
|
5587 |
|
5588 |
|
5589 |
|
5590 //---------------------------------------------------------- |
|
5591 // CApSettingsDlg::GetIPv6DNSTypeL |
|
5592 //---------------------------------------------------------- |
|
5593 // |
|
5594 TInt CApSettingsDlg::GetIPv6DNSTypeL() |
|
5595 { |
|
5596 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetIPv6DNSTypeL") |
|
5597 |
|
5598 TInt retval( 0 ); |
|
5599 |
|
5600 HBufC* buf1 = HBufC::NewLC( KModifiableTextLength ); |
|
5601 TPtr16 ptr1( buf1->Des() ); |
|
5602 |
|
5603 HBufC* buf2 = HBufC::NewLC( KModifiableTextLength ); |
|
5604 TPtr16 ptr2( buf2->Des() ); |
|
5605 |
|
5606 // net type 6: if IspIPv6NameServ <> 0.0.0.0 |
|
5607 // => User defined OR well-known |
|
5608 iApItem->ReadTextL( EApIP6NameServer1, ptr1 ); |
|
5609 iApItem->ReadTextL( EApIP6NameServer2, ptr2 ); |
|
5610 |
|
5611 if ( ( ptr1.Compare( KKnownNameServer1 ) == 0 ) |
|
5612 && ( ptr2.Compare( KKnownNameServer2 ) == 0 ) ) |
|
5613 { // special value, well-known |
|
5614 retval = 1; |
|
5615 } |
|
5616 else |
|
5617 { |
|
5618 // dynamic, if 0:0:... |
|
5619 // OR EMPTY text... |
|
5620 if ( ( ( ptr1.Compare( KDynIpv6Address ) == 0 ) |
|
5621 || ( ptr1.Compare( KEmpty ) == 0 ) ) |
|
5622 &&( ( ptr2.Compare( KDynIpv6Address ) == 0 ) |
|
5623 ||( ptr2.Compare( KEmpty ) == 0 ) ) ) |
|
5624 { // dynamic, 0:0:... |
|
5625 // OR in case of CSD, HSCSD, it might be user defined, |
|
5626 // as for those bearers Dynamic is not possible... |
|
5627 TApBearerType bt = iApItem->BearerTypeL(); |
|
5628 switch (bt) |
|
5629 { |
|
5630 case EApBearerTypeCSD: |
|
5631 case EApBearerTypeHSCSD: |
|
5632 { |
|
5633 retval = 2; // consider it user defined |
|
5634 break; |
|
5635 } |
|
5636 default: |
|
5637 { |
|
5638 retval = 0; |
|
5639 break; |
|
5640 } |
|
5641 } |
|
5642 } |
|
5643 else |
|
5644 { // other value, user defined |
|
5645 retval = 2; |
|
5646 } |
|
5647 } |
|
5648 |
|
5649 CleanupStack::PopAndDestroy( 2 ); |
|
5650 |
|
5651 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetIPv6DNSTypeL") |
|
5652 return retval; |
|
5653 } |
|
5654 |
|
5655 |
|
5656 |
|
5657 |
|
5658 |
|
5659 //---------------------------------------------------------- |
|
5660 // CApSettingsDlg::GetIPv4DNSTypeL |
|
5661 //---------------------------------------------------------- |
|
5662 // |
|
5663 TInt CApSettingsDlg::GetIPv4DNSTypeL() |
|
5664 { |
|
5665 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetIPv4DNSTypeL") |
|
5666 |
|
5667 TInt retval( 0 ); |
|
5668 |
|
5669 HBufC* buf1 = HBufC::NewLC( KModifiableTextLength ); |
|
5670 TPtr16 ptr1( buf1->Des() ); |
|
5671 |
|
5672 HBufC* buf2 = HBufC::NewLC( KModifiableTextLength ); |
|
5673 TPtr16 ptr2( buf2->Des() ); |
|
5674 |
|
5675 // net type 4: if IspNameServ <> 0.0.0.0 => User defined |
|
5676 iApItem->ReadTextL( EApGprsIPNameServer1, ptr1 ); |
|
5677 iApItem->ReadTextL( EApGprsIPNameServer2, ptr2 ); |
|
5678 |
|
5679 if ( ( ptr1.Compare( KDynIpAddress ) == 0 ) |
|
5680 && ( ptr2.Compare( KDynIpAddress ) == 0 ) ) |
|
5681 { // dynamic, 0:0:... |
|
5682 retval = 0; |
|
5683 } |
|
5684 else |
|
5685 { // other value, user defined |
|
5686 retval = 2; |
|
5687 } |
|
5688 |
|
5689 CleanupStack::PopAndDestroy( 2 ); |
|
5690 |
|
5691 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetIPv4DNSTypeL") |
|
5692 return retval; |
|
5693 } |
|
5694 |
|
5695 |
|
5696 |
|
5697 |
|
5698 |
|
5699 // --------------------------------------------------------- |
|
5700 // CApSettingsDlg::StripNonNumberLC |
|
5701 // --------------------------------------------------------- |
|
5702 // |
|
5703 HBufC* CApSettingsDlg::StripNonNumberLC( const TDesC16& aInText ) |
|
5704 { |
|
5705 APSETUILOGGER_ENTERFN( ESettings,"Settings::StripNonNumberLC") |
|
5706 |
|
5707 // CLOG( ( EApItem, 0, _L( "-> CApSettingsDlg::StripNonNumberLC" ) ) ); |
|
5708 |
|
5709 TInt size = aInText.Length(); |
|
5710 HBufC* aOutText = HBufC::NewLC( size ); |
|
5711 TPtr ptr = aOutText->Des(); |
|
5712 |
|
5713 for ( TInt ii=0; ii<size; ++ii ) |
|
5714 { |
|
5715 // TText ch = aInText[ii]; |
|
5716 TChar ch = aInText[ii]; |
|
5717 if ( ch.IsDigit() ) |
|
5718 { |
|
5719 ptr.Append( ch ); |
|
5720 } |
|
5721 } |
|
5722 |
|
5723 APSETUILOGGER_LEAVEFN( ESettings,"Settings::StripNonNumberLC") |
|
5724 return aOutText; |
|
5725 } |
|
5726 |
|
5727 |
|
5728 //---------------------------------------------------------- |
|
5729 // CApSettingsDlg::BearerType2BearerItemPosL |
|
5730 //---------------------------------------------------------- |
|
5731 // |
|
5732 TInt CApSettingsDlg::BearerType2BearerItemPosL( TApBearerType aBearer ) |
|
5733 { |
|
5734 APSETUILOGGER_ENTERFN( ESettings,"Settings::BearerType2BearerItemPosL") |
|
5735 |
|
5736 TInt pos(0); |
|
5737 switch ( aBearer ) |
|
5738 { |
|
5739 case EApBearerTypeGPRS: |
|
5740 { |
|
5741 pos = KBearerListGprs; |
|
5742 break; |
|
5743 } |
|
5744 case EApBearerTypeWLAN: |
|
5745 { |
|
5746 if ( IsWlanSupported() ) |
|
5747 { |
|
5748 pos = KBearerListWLAN; |
|
5749 } |
|
5750 else |
|
5751 { |
|
5752 User::Leave( KErrNotSupported ); |
|
5753 } |
|
5754 break; |
|
5755 } |
|
5756 case EApBearerTypeCSD: |
|
5757 { |
|
5758 TBool isCsdSupported = |
|
5759 FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ); |
|
5760 if ( isCsdSupported ) |
|
5761 { |
|
5762 pos = KBearerListCSD; |
|
5763 if ( !IsWlanSupported() ) |
|
5764 { |
|
5765 pos--; |
|
5766 } |
|
5767 } |
|
5768 else |
|
5769 { // To be determined, what is correct |
|
5770 } |
|
5771 break; |
|
5772 } |
|
5773 case EApBearerTypeHSCSD: |
|
5774 { |
|
5775 if ( IsHSCSDEnabledL() ) |
|
5776 { |
|
5777 pos = KBearerListHSCSD; |
|
5778 if ( !IsWlanSupported() ) |
|
5779 { |
|
5780 pos--; |
|
5781 } |
|
5782 } |
|
5783 else |
|
5784 { // should not be possible, but be defensive, |
|
5785 // correct it to CSD, if possible... |
|
5786 TBool isCsdSupported = |
|
5787 FeatureManager::FeatureSupported( |
|
5788 KFeatureIdAppCsdSupport ); |
|
5789 if ( isCsdSupported ) |
|
5790 { |
|
5791 pos = KBearerListCSD; |
|
5792 if ( !IsWlanSupported() ) |
|
5793 { |
|
5794 pos--; |
|
5795 } |
|
5796 } |
|
5797 else |
|
5798 { // To be determined, what is correct |
|
5799 } |
|
5800 } |
|
5801 break; |
|
5802 } |
|
5803 default: |
|
5804 { |
|
5805 __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) ); |
|
5806 User::Leave( KErrInvalidBearerType ); |
|
5807 break; |
|
5808 } |
|
5809 } |
|
5810 |
|
5811 APSETUILOGGER_LEAVEFN( ESettings,"Settings::BearerType2BearerItemPosL") |
|
5812 return pos; |
|
5813 } |
|
5814 |
|
5815 |
|
5816 //---------------------------------------------------------- |
|
5817 // CApSettingsDlg::BearerItemPos2BearerTypeL |
|
5818 //---------------------------------------------------------- |
|
5819 // |
|
5820 TApBearerType CApSettingsDlg::BearerItemPos2BearerTypeL( TInt aPos ) |
|
5821 { |
|
5822 APSETUILOGGER_ENTERFN( ESettings,"Settings::BearerItemPos2BearerTypeL") |
|
5823 |
|
5824 TApBearerType bearer; |
|
5825 CArrayFixFlat<TApBearerType>* bearerlist = |
|
5826 new(ELeave) CArrayFixFlat<TApBearerType>(4); |
|
5827 CleanupStack::PushL( bearerlist ); |
|
5828 |
|
5829 bearerlist->AppendL( EApBearerTypeGPRS ); |
|
5830 |
|
5831 if ( IsWlanSupported() ) |
|
5832 { |
|
5833 bearerlist->AppendL( EApBearerTypeWLAN ); |
|
5834 } |
|
5835 |
|
5836 TBool isCsdSupported = |
|
5837 FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ); |
|
5838 if ( isCsdSupported ) |
|
5839 { |
|
5840 bearerlist->AppendL( EApBearerTypeCSD ); |
|
5841 } |
|
5842 if ( IsHSCSDEnabledL() && isCsdSupported ) |
|
5843 { |
|
5844 bearerlist->AppendL( EApBearerTypeHSCSD ); |
|
5845 } |
|
5846 |
|
5847 __ASSERT_DEBUG( ( aPos < bearerlist->Count() ), \ |
|
5848 Panic( EInvalidBearerType ) ); |
|
5849 __ASSERT_DEBUG( ( aPos >= 0 ), Panic( EInvalidBearerType ) ); |
|
5850 |
|
5851 aPos = Max( aPos, 0 ); |
|
5852 aPos = Min( aPos, ( bearerlist->Count() - 1 ) ); |
|
5853 |
|
5854 bearer = bearerlist->At( aPos ); |
|
5855 |
|
5856 CleanupStack::PopAndDestroy( bearerlist ); |
|
5857 |
|
5858 APSETUILOGGER_LEAVEFN( ESettings,"Settings::BearerItemPos2BearerTypeL") |
|
5859 return bearer; |
|
5860 } |
|
5861 |
|
5862 |
|
5863 |
|
5864 //---------------------------------------------------------- |
|
5865 // CApSettingsDlg::ChangeWlanNetworkNameL |
|
5866 //---------------------------------------------------------- |
|
5867 // |
|
5868 void CApSettingsDlg::ChangeWlanNetworkNameL() |
|
5869 { |
|
5870 APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeWlanNetworkNameL") |
|
5871 |
|
5872 // Implement WLAN network name change |
|
5873 TInt currvalue( 0 ); |
|
5874 CDesCArrayFlat* items = FillPopupSettingPageLC( EApWlanNetworkName, |
|
5875 currvalue ); |
|
5876 |
|
5877 TInt attr_resid( 0 ); |
|
5878 GetResId( EApWlanNetworkName, attr_resid ); |
|
5879 HBufC* titlebuf; |
|
5880 CAknRadioButtonSettingPage* dlg; |
|
5881 if ( attr_resid ) |
|
5882 { |
|
5883 titlebuf = iEikonEnv->AllocReadResourceLC( attr_resid ); |
|
5884 dlg = new ( ELeave )CAknRadioButtonSettingPage( |
|
5885 R_RADIO_BUTTON_SETTING_PAGE, |
|
5886 currvalue, items ); |
|
5887 // must push 'cause SetSettingTextL can leave... |
|
5888 CleanupStack::PushL( dlg ); |
|
5889 TPtrC ptr( titlebuf->Des() ); |
|
5890 dlg->SetSettingTextL( ptr ); |
|
5891 CleanupStack::Pop(); // dlg |
|
5892 } |
|
5893 else |
|
5894 { |
|
5895 dlg = new ( ELeave )CAknRadioButtonSettingPage( |
|
5896 R_RADIO_BUTTON_SETTING_PAGE, currvalue, items ); |
|
5897 } |
|
5898 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) |
|
5899 { |
|
5900 if ( !currvalue ) |
|
5901 {// user defined |
|
5902 QueryWlanNetworkNameL(); |
|
5903 } |
|
5904 else |
|
5905 { // scan for, select one! |
|
5906 CConnectionUiUtilities* connUiUtils = |
|
5907 CConnectionUiUtilities::NewL(); |
|
5908 CleanupStack::PushL( connUiUtils ); |
|
5909 |
|
5910 TWlanSsid ssid; |
|
5911 TWlanConnectionMode connmode; |
|
5912 TWlanConnectionSecurityMode secmode; |
|
5913 TBool ret = connUiUtils->SearchWLANNetwork( ssid, |
|
5914 connmode, |
|
5915 secmode ); |
|
5916 if ( ret ) |
|
5917 { |
|
5918 HBufC* tmp = HBufC::NewLC( KCommsDbSvrMaxFieldLength ); |
|
5919 TPtr16 tmpPtr16 = tmp->Des(); |
|
5920 CnvUtfConverter::ConvertToUnicodeFromUtf8( tmpPtr16, ssid); |
|
5921 |
|
5922 iApItem->WriteTextL( EApWlanNetworkName, *tmp ); |
|
5923 CleanupStack::PopAndDestroy( tmp ); |
|
5924 // now handle connmode & secmode settings |
|
5925 if ( connmode == EWlanConnectionModeInfrastructure ) |
|
5926 { |
|
5927 iApItem->WriteUint( EApWlanNetworkMode, EInfra ); |
|
5928 } |
|
5929 else |
|
5930 { |
|
5931 if ( connmode == EWlanConnectionModeAdhoc ) |
|
5932 { |
|
5933 iApItem->WriteUint( EApWlanNetworkMode, EAdhoc ); |
|
5934 } |
|
5935 else |
|
5936 { |
|
5937 User::Leave( KErrNotSupported ); |
|
5938 } |
|
5939 } |
|
5940 switch (secmode) |
|
5941 { |
|
5942 case EWlanConnectionSecurityOpen: |
|
5943 { |
|
5944 iApItem->WriteUint( EApWlanSecurityMode, EOpen ); |
|
5945 break; |
|
5946 } |
|
5947 case EWlanConnectionSecurityWep: |
|
5948 { |
|
5949 iApItem->WriteUint( EApWlanSecurityMode, EWep ); |
|
5950 break; |
|
5951 } |
|
5952 case EWlanConnectionSecurity802d1x: |
|
5953 { |
|
5954 iApItem->WriteUint( EApWlanSecurityMode, E802_1x ); |
|
5955 break; |
|
5956 } |
|
5957 case EWlanConnectionSecurityWpa: |
|
5958 { |
|
5959 iApItem->WriteUint( EApWlanSecurityMode, EWpa ); |
|
5960 break; |
|
5961 } |
|
5962 case EWlanConnectionSecurityWpaPsk: |
|
5963 { |
|
5964 iApItem->WriteUint( EApWlanSecurityMode, EWpa ); |
|
5965 break; |
|
5966 } |
|
5967 default: |
|
5968 { |
|
5969 break; |
|
5970 } |
|
5971 } |
|
5972 |
|
5973 } |
|
5974 CleanupStack::PopAndDestroy( connUiUtils ); |
|
5975 } |
|
5976 } |
|
5977 if ( attr_resid ) |
|
5978 { |
|
5979 // titlebuf, text title readed from resource... |
|
5980 CleanupStack::PopAndDestroy(); |
|
5981 } |
|
5982 // items, will also delete all elements in the array! |
|
5983 CleanupStack::PopAndDestroy( items ); |
|
5984 |
|
5985 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ChangeWlanNetworkNameL") |
|
5986 } |
|
5987 |
|
5988 |
|
5989 //---------------------------------------------------------- |
|
5990 // CApSettingsDlg::ChangeWlanSecuritySettings |
|
5991 //---------------------------------------------------------- |
|
5992 // |
|
5993 TInt CApSettingsDlg::ChangeWlanSecuritySettingsL() |
|
5994 { |
|
5995 APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeWlanSecuritySettingsL") |
|
5996 |
|
5997 TInt retval(0); |
|
5998 TUint32 secmode( 0 ); |
|
5999 iApItem->ReadUint( EApWlanSecurityMode, secmode ); |
|
6000 |
|
6001 TBool need2changeid( EFalse ); |
|
6002 TUint32 origServiceId(0); |
|
6003 iApItem->ReadUint( EApIapServiceId, origServiceId ); |
|
6004 if ( iOriginalBearerType != iApItem->BearerTypeL() ) |
|
6005 { |
|
6006 need2changeid = ETrue; |
|
6007 iApItem->WriteUint( EApIapServiceId, 0 ); |
|
6008 } |
|
6009 |
|
6010 switch ( secmode ) |
|
6011 { |
|
6012 case EOpen: |
|
6013 { |
|
6014 ShowNoteL( R_APUI_VIEW_NO_SECURITY_SETTINGS ); |
|
6015 break; |
|
6016 } |
|
6017 case EWep: |
|
6018 { |
|
6019 retval = ChangeWepSecuritySettingsL(); |
|
6020 break; |
|
6021 } |
|
6022 case E802_1x: |
|
6023 { |
|
6024 retval = Change8021xSecuritySettingsL(); |
|
6025 break; |
|
6026 } |
|
6027 case EWpa: |
|
6028 case EWpa2: |
|
6029 { |
|
6030 retval = ChangeWpaSecuritySettingsL(); |
|
6031 break; |
|
6032 } |
|
6033 default: |
|
6034 { |
|
6035 // some weird error, repair it... |
|
6036 __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) ); |
|
6037 break; |
|
6038 } |
|
6039 } |
|
6040 if ( need2changeid ) |
|
6041 { |
|
6042 iApItem->WriteUint( EApIapServiceId, origServiceId ); |
|
6043 } |
|
6044 |
|
6045 APSETUILOGGER_LEAVEFN( ESettings,"Settings::ChangeWlanSecuritySettingsL") |
|
6046 return retval; |
|
6047 } |
|
6048 |
|
6049 |
|
6050 //---------------------------------------------------------- |
|
6051 // CApSettingsDlg::ChangeWepSecuritySettingsL |
|
6052 //---------------------------------------------------------- |
|
6053 // |
|
6054 TInt CApSettingsDlg::ChangeWepSecuritySettingsL() |
|
6055 { |
|
6056 APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeWepSecuritySettingsL<->") |
|
6057 |
|
6058 return iHandler->iModel->ChangeWepSettingsL( iApItem ); |
|
6059 } |
|
6060 |
|
6061 |
|
6062 |
|
6063 //---------------------------------------------------------- |
|
6064 // CApSettingsDlg::ChangeWpaSecuritySettingsL |
|
6065 //---------------------------------------------------------- |
|
6066 // |
|
6067 TInt CApSettingsDlg::ChangeWpaSecuritySettingsL() |
|
6068 { |
|
6069 APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeWpaSecuritySettingsL<->") |
|
6070 |
|
6071 return iHandler->iModel->ChangeWpaSettingsL( iApItem ); |
|
6072 } |
|
6073 |
|
6074 |
|
6075 //---------------------------------------------------------- |
|
6076 // CApSettingsDlg::Change8021xSecuritySettingsL |
|
6077 //---------------------------------------------------------- |
|
6078 // |
|
6079 TInt CApSettingsDlg::Change8021xSecuritySettingsL() |
|
6080 { |
|
6081 APSETUILOGGER_ENTERFN( ESettings,"Settings::Change8021xSecuritySettingsL<->") |
|
6082 |
|
6083 return iHandler->iModel->Change8021xSettingsL( iApItem ); |
|
6084 } |
|
6085 |
|
6086 |
|
6087 |
|
6088 |
|
6089 //---------------------------------------------------------- |
|
6090 // CApSettingsDlg::IsWlanSupported |
|
6091 //---------------------------------------------------------- |
|
6092 // |
|
6093 TBool CApSettingsDlg::IsWlanSupported() |
|
6094 { |
|
6095 APSETUILOGGER_ENTERFN( ESettings,"Settings::IsWlanSupported") |
|
6096 |
|
6097 TBool retval = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); |
|
6098 #ifdef __TEST_WLAN_SUPPORT |
|
6099 retval = ETrue; |
|
6100 #endif // __TEST_WLAN_SUPPORT |
|
6101 |
|
6102 APSETUILOGGER_LEAVEFN( ESettings,"Settings::IsWlanSupported") |
|
6103 return retval; |
|
6104 } |
|
6105 |
|
6106 |
|
6107 |
|
6108 //---------------------------------------------------------- |
|
6109 // CApSettingsDlg::QueryWlanNetworkNameL |
|
6110 //---------------------------------------------------------- |
|
6111 // |
|
6112 TBool CApSettingsDlg::QueryWlanNetworkNameL() |
|
6113 { |
|
6114 APSETUILOGGER_ENTERFN( ESettings,"Settings::QueryWlanNetworkNameL") |
|
6115 |
|
6116 TBool retval( EFalse ); |
|
6117 |
|
6118 HBufC* buff = HBufC::NewLC( KModifiableTextLength ); |
|
6119 TPtr16 ptr( buff->Des() ); |
|
6120 iApItem->ReadTextL( EApWlanNetworkName, ptr ); |
|
6121 |
|
6122 CAknQueryDialog* dlg = |
|
6123 CAknQueryDialog::NewL( ptr, CAknQueryDialog::ENoTone ); |
|
6124 |
|
6125 if ( dlg->ExecuteLD( R_APUI_WLAN_NAME_QUERY ) ) |
|
6126 { |
|
6127 iApItem->WriteTextL( EApWlanNetworkName, ptr ); |
|
6128 retval = ETrue; |
|
6129 } |
|
6130 CleanupStack::PopAndDestroy( buff ); |
|
6131 |
|
6132 APSETUILOGGER_LEAVEFN( ESettings,"Settings::QueryWlanNetworkNameL") |
|
6133 return retval; |
|
6134 } |
|
6135 |
|
6136 |
|
6137 //---------------------------------------------------------- |
|
6138 // CApSettingsDlg::IsNetMaskAndGatewayVisible |
|
6139 //---------------------------------------------------------- |
|
6140 // |
|
6141 TBool CApSettingsDlg::IsNetMaskAndGatewayVisibleL() |
|
6142 { |
|
6143 APSETUILOGGER_ENTERFN( ESettings,"Settings::IsNetMaskAndGatewayVisibleL") |
|
6144 |
|
6145 TBool retval(EFalse); |
|
6146 // display only if: |
|
6147 // Phone IP Addr. <> Automatic (0.0.0.0) |
|
6148 HBufC* tmpValue = HBufC::NewLC( KModifiableTextLength ); |
|
6149 TPtr ptr( tmpValue->Des() ); |
|
6150 iApItem->ReadTextL( EApIspIPAddr, ptr ); |
|
6151 if ( ( tmpValue->Compare( KDynIpAddress ) != 0 ) |
|
6152 && ( tmpValue->Compare( KEmptyText ) != 0 ) ) |
|
6153 { |
|
6154 retval = ETrue; |
|
6155 } |
|
6156 CleanupStack::PopAndDestroy( tmpValue ); |
|
6157 |
|
6158 APSETUILOGGER_LEAVEFN( ESettings,"Settings::IsNetMaskAndGatewayVisibleL") |
|
6159 return retval; |
|
6160 } |
|
6161 |
|
6162 |
|
6163 |
|
6164 //---------------------------------------------------------- |
|
6165 // CApSettingsDlg::GetAdHocChannelL |
|
6166 //---------------------------------------------------------- |
|
6167 // |
|
6168 TUint32 CApSettingsDlg::GetAdHocChannelL() |
|
6169 { |
|
6170 APSETUILOGGER_ENTERFN( ESettings,"Settings::GetAdHocChannelL") |
|
6171 |
|
6172 // Get real ad-hoc channel |
|
6173 // Default: KDefAdhocChannel |
|
6174 TInt channel( KDefAdhocChannel ); |
|
6175 TUint32 retval(0); |
|
6176 iApItem->ReadUint( EApWlanChannelId, retval ); |
|
6177 channel = TInt(retval); |
|
6178 if ( !channel ) |
|
6179 { |
|
6180 channel = KDefAdhocChannel; |
|
6181 } |
|
6182 |
|
6183 CAknNumberQueryDialog* dlg = |
|
6184 CAknNumberQueryDialog::NewL( channel, CAknQueryDialog::ENoTone ); |
|
6185 |
|
6186 if ( dlg->ExecuteLD( R_APUI_WLAN_ADHOC_CHANNEL_QUERY ) ) |
|
6187 { |
|
6188 retval = channel; |
|
6189 } |
|
6190 |
|
6191 APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetAdHocChannelL") |
|
6192 return retval; |
|
6193 } |
|
6194 |
|
6195 |
|
6196 |
|
6197 //---------------------------------------------------------- |
|
6198 // CApSettingsDlg::IsAdhocChannelVisible |
|
6199 //---------------------------------------------------------- |
|
6200 // |
|
6201 TBool CApSettingsDlg::IsAdhocChannelVisible() |
|
6202 { |
|
6203 APSETUILOGGER_ENTERFN( ESettings,"Settings::IsAdhocChannelVisible") |
|
6204 |
|
6205 TBool retval(EFalse); |
|
6206 TUint32 netmode( 0 ); |
|
6207 iApItem->ReadUint( EApWlanNetworkMode, netmode ); |
|
6208 if ( netmode == EAdhoc ) |
|
6209 { |
|
6210 retval = ETrue; |
|
6211 } |
|
6212 |
|
6213 APSETUILOGGER_LEAVEFN( ESettings,"Settings::IsAdhocChannelVisible") |
|
6214 return retval; |
|
6215 } |
|
6216 |
|
6217 |
|
6218 |
|
6219 //---------------------------------------------------------- |
|
6220 // CApSettingsDlg::HasSecuritySettingsFilledL |
|
6221 //---------------------------------------------------------- |
|
6222 // |
|
6223 TBool CApSettingsDlg::HasSecuritySettingsFilledL() |
|
6224 { |
|
6225 APSETUILOGGER_ENTERFN( ESettings,"Settings::HasSecuritySettingsFilledL<->") |
|
6226 |
|
6227 return iDataModel->HasWlanSecSettingsFilledL( *iApItem ); |
|
6228 } |
|
6229 |
|
6230 |
|
6231 |
|
6232 //---------------------------------------------------------- |
|
6233 // CApSettingsDlg::LimitSecMode |
|
6234 //---------------------------------------------------------- |
|
6235 // |
|
6236 void CApSettingsDlg::LimitSecMode() |
|
6237 { |
|
6238 APSETUILOGGER_ENTERFN( ESettings,"Settings::LimitSecMode") |
|
6239 |
|
6240 TUint32 secmode( 0 ); |
|
6241 iApItem->ReadUint( EApWlanSecurityMode, secmode ); |
|
6242 switch ( secmode ) |
|
6243 { |
|
6244 case EOpen: |
|
6245 case EWep: |
|
6246 // nothing to do in this case |
|
6247 { |
|
6248 break; |
|
6249 } |
|
6250 case E802_1x: |
|
6251 case EWpa: |
|
6252 case EWpa2: |
|
6253 default: |
|
6254 { |
|
6255 iApItem->WriteUint( EApWlanSecurityMode, EOpen ); |
|
6256 break; |
|
6257 } |
|
6258 } |
|
6259 |
|
6260 APSETUILOGGER_LEAVEFN( ESettings,"Settings::LimitSecMode") |
|
6261 } |
|
6262 |
|
6263 |
|
6264 |
|
6265 |
|
6266 // --------------------------------------------------------- |
|
6267 // CApSettingsDlg::CanSaveWlanCompulsoriesL( ) |
|
6268 // --------------------------------------------------------- |
|
6269 // |
|
6270 CApSettingsDlg::TSaveAction CApSettingsDlg::CanSaveWlanCompulsoriesL( |
|
6271 TApMember& aDataNeeded ) |
|
6272 { |
|
6273 TSaveAction retval( EApCanSave ); |
|
6274 |
|
6275 HBufC *sgd = HBufC::NewLC( KModifiableTextLength ); |
|
6276 TPtr16 ptr( sgd->Des() ); |
|
6277 |
|
6278 if ( (retval != EApShallGoBack) && (retval != EApMustDelete) |
|
6279 && IsNetMaskAndGatewayVisibleL() ) |
|
6280 { // now check compulsory fields |
|
6281 iApItem->ReadTextL( EApWlanIpNetMask, ptr ); |
|
6282 if ( ( ptr.Compare( KDynIpAddress ) == 0 ) |
|
6283 || ( ptr.Compare( KEmptyText ) == 0 ) ) |
|
6284 { |
|
6285 retval = EApShallGoBack; |
|
6286 aDataNeeded = EApWlanIpNetMask; |
|
6287 if ( AskQueryL( |
|
6288 R_APUI_VIEW_NETW_QUEST_IAP_INCOMPLETE_DELETE ) ) |
|
6289 { |
|
6290 retval = EApMustDelete; |
|
6291 } |
|
6292 } |
|
6293 else |
|
6294 { |
|
6295 iApItem->ReadTextL( EApIspIPGateway, ptr ); |
|
6296 if ( ( sgd->Compare( KDynIpAddress ) == 0 ) |
|
6297 || ( sgd->Compare( KEmptyText ) == 0 ) ) |
|
6298 { |
|
6299 retval = EApShallGoBack; |
|
6300 aDataNeeded = EApIspIPGateway; |
|
6301 if ( AskQueryL( |
|
6302 R_APUI_VIEW_NETW_QUEST_IAP_INCOMPLETE_DELETE ) |
|
6303 ) |
|
6304 { |
|
6305 retval = EApMustDelete; |
|
6306 } |
|
6307 } |
|
6308 } |
|
6309 } |
|
6310 CleanupStack::PopAndDestroy( sgd ); // sgd |
|
6311 |
|
6312 return retval; |
|
6313 } |
|
6314 |
|
6315 |
|
6316 // --------------------------------------------------------- |
|
6317 // CApSettingsDlg::RestoreIpv4SettingsL() |
|
6318 // --------------------------------------------------------- |
|
6319 // |
|
6320 void CApSettingsDlg::RestoreIpv4SettingsL() |
|
6321 { |
|
6322 HBufC* buf = HBufC::NewLC( KModifiableTextLength ); |
|
6323 TPtr ptr( buf->Des() ); |
|
6324 |
|
6325 iBackupApItem->ReadTextL( EApIspIPAddr, ptr ); |
|
6326 iApItem->WriteTextL( EApIspIPAddr, ptr ); |
|
6327 |
|
6328 iBackupApItem->ReadTextL( EApIspIPNetMask, ptr ); |
|
6329 iApItem->WriteTextL( EApIspIPNetMask, ptr ); |
|
6330 |
|
6331 iBackupApItem->ReadTextL( EApIspIPGateway, ptr ); |
|
6332 iApItem->WriteTextL( EApIspIPGateway, ptr ); |
|
6333 |
|
6334 iBackupApItem->ReadTextL( EApIspIPNameServer1, ptr ); |
|
6335 iApItem->WriteTextL( EApIspIPNameServer1, ptr ); |
|
6336 |
|
6337 iBackupApItem->ReadTextL( EApIspIPNameServer2, ptr ); |
|
6338 iApItem->WriteTextL( EApIspIPNameServer2, ptr ); |
|
6339 |
|
6340 CleanupStack::PopAndDestroy( buf ); |
|
6341 |
|
6342 } |
|
6343 |
|
6344 |
|
6345 |
|
6346 // End of File |
|