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 the main handler, CApSettingsHandlerImpl for |
|
16 * the Access Point settings. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "APSettingsHandlerUIVariant.hrh" |
|
23 |
|
24 #include <bautils.h> |
|
25 #include <StringLoader.h> |
|
26 #include <apsetui.rsg> |
|
27 #include <ActiveApDb.h> |
|
28 |
|
29 #include "ApsettingshandleruiImpl.h" |
|
30 #include "ApSettingsHandlerUI.hrh" |
|
31 #include "ApSelectorDialog.h" |
|
32 |
|
33 #include "ApSettingsDlg.h" |
|
34 |
|
35 #include "TextOverrides.h" |
|
36 #include "ApSettingsModel.h" |
|
37 #include "ApSelPopupList.h" |
|
38 #include "ApSelQueryDialog.h" |
|
39 |
|
40 #include <aknnotedialog.h> |
|
41 #include <ApListItemList.h> |
|
42 |
|
43 #include <f32file.h> |
|
44 |
|
45 #include "ApSettingsHandlerLogger.h" |
|
46 #include <ApSettingsHandlerCommons.h> |
|
47 |
|
48 |
|
49 #include "ApSettingsHandlerUiPrivateCRKeys.h" |
|
50 #include <centralrepository.h> |
|
51 |
|
52 #include <sysutil.h> |
|
53 |
|
54 #include <ApNetworkItem.h> |
|
55 |
|
56 #include <featmgr.h> |
|
57 #include <VpnApEngine.h> |
|
58 |
|
59 #include <data_caging_path_literals.hrh> |
|
60 |
|
61 #include <shareddataclient.h> |
|
62 |
|
63 // UID of general settings app, in which help texts are included |
|
64 const TUid KHelpUidApSettingsHandler = { 0x100058EC }; |
|
65 |
|
66 |
|
67 //#define __TEST_PERFORMANCE |
|
68 /// ROM drive. |
|
69 _LIT( KApSettingsResDriveZ, "z:" ); |
|
70 /// Access point settings handler UI resource file name. |
|
71 _LIT( KApSettingsResFileName, "apsetui.rsc" ); |
|
72 |
|
73 |
|
74 |
|
75 /// Estimated FFS overhead for deleting (in bytes). |
|
76 LOCAL_C const TInt KEstimatedDeleteFfsOverhead = 48 * 1024; |
|
77 |
|
78 |
|
79 |
|
80 //KFeatureIdIPv6 |
|
81 // #define KFeatureIdIPv6 KOtherFeatureFirst+88 |
|
82 |
|
83 // ================= MEMBER FUNCTIONS ======================= |
|
84 |
|
85 // --------------------------------------------------------- |
|
86 // CApSettingsHandlerImpl::NewLC |
|
87 // --------------------------------------------------------- |
|
88 // |
|
89 CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC( |
|
90 TBool aStartWithSelection, |
|
91 TSelectionListType aListType, |
|
92 TSelectionMenuType aSelMenuType, |
|
93 TInt aIspFilter, |
|
94 TInt aBearerFilter, |
|
95 TInt aSortType, |
|
96 TBool aNoEdit ) |
|
97 { |
|
98 APSETUILOGGER_CREATE; |
|
99 |
|
100 CApSettingsHandlerImpl* db = |
|
101 new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection, |
|
102 aListType, |
|
103 aSelMenuType, |
|
104 aNoEdit ); |
|
105 CleanupStack::PushL( db ); |
|
106 |
|
107 db->ConstructL( aIspFilter, aBearerFilter, aSortType ); |
|
108 |
|
109 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC") |
|
110 |
|
111 return db; |
|
112 } |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 // --------------------------------------------------------- |
|
118 // CApSettingsHandlerImplImpl::NewLC |
|
119 // --------------------------------------------------------- |
|
120 // |
|
121 CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC( |
|
122 CActiveApDb& aDb, |
|
123 TBool aStartWithSelection, |
|
124 TSelectionListType aListType, |
|
125 TSelectionMenuType aSelMenuType, |
|
126 TInt aIspFilter, |
|
127 TInt aBearerFilter, |
|
128 TInt aSortType, |
|
129 TBool aNoEdit |
|
130 ) |
|
131 { |
|
132 APSETUILOGGER_CREATE; |
|
133 |
|
134 CApSettingsHandlerImpl* db = |
|
135 new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection, |
|
136 aListType, |
|
137 aSelMenuType, |
|
138 aNoEdit ); |
|
139 CleanupStack::PushL( db ); |
|
140 |
|
141 db->ConstructL( aDb, aIspFilter, aBearerFilter, aSortType ); |
|
142 |
|
143 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC2") |
|
144 |
|
145 return db; |
|
146 } |
|
147 |
|
148 |
|
149 |
|
150 // --------------------------------------------------------- |
|
151 // CApSettingsHandlerImpl::NewLC |
|
152 // --------------------------------------------------------- |
|
153 // |
|
154 CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC( |
|
155 TBool aStartWithSelection, |
|
156 TSelectionListType aListType, |
|
157 TSelectionMenuType aSelMenuType, |
|
158 TInt aIspFilter, |
|
159 TInt aBearerFilter, |
|
160 TInt aSortType, |
|
161 TInt aReqIpvType, |
|
162 TBool aNoEdit |
|
163 ) |
|
164 { |
|
165 APSETUILOGGER_CREATE; |
|
166 |
|
167 CApSettingsHandlerImpl* db = |
|
168 new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection, |
|
169 aListType, |
|
170 aSelMenuType, |
|
171 aReqIpvType, |
|
172 aNoEdit |
|
173 ); |
|
174 CleanupStack::PushL( db ); |
|
175 |
|
176 db->ConstructL( aIspFilter, aBearerFilter, aSortType ); |
|
177 |
|
178 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC3") |
|
179 |
|
180 return db; |
|
181 } |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 // --------------------------------------------------------- |
|
187 // CApSettingsHandlerImpl::NewLC |
|
188 // --------------------------------------------------------- |
|
189 // |
|
190 CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC( |
|
191 CActiveApDb& aDb, |
|
192 TBool aStartWithSelection, |
|
193 TSelectionListType aListType, |
|
194 TSelectionMenuType aSelMenuType, |
|
195 TInt aIspFilter, |
|
196 TInt aBearerFilter, |
|
197 TInt aSortType, |
|
198 TInt aReqIpvType, |
|
199 TBool aNoEdit |
|
200 ) |
|
201 { |
|
202 APSETUILOGGER_CREATE; |
|
203 |
|
204 CApSettingsHandlerImpl* db = |
|
205 new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection, |
|
206 aListType, |
|
207 aSelMenuType, |
|
208 aReqIpvType, |
|
209 aNoEdit |
|
210 ); |
|
211 CleanupStack::PushL( db ); |
|
212 |
|
213 db->ConstructL( aDb, aIspFilter, aBearerFilter, aSortType ); |
|
214 |
|
215 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC4") |
|
216 |
|
217 return db; |
|
218 } |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 // --------------------------------------------------------- |
|
225 // CApSettingsHandlerImpl::NewLC |
|
226 // --------------------------------------------------------- |
|
227 // |
|
228 CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC( |
|
229 TBool aStartWithSelection, |
|
230 TSelectionListType aListType, |
|
231 TSelectionMenuType aSelMenuType, |
|
232 TInt aIspFilter, |
|
233 TInt aBearerFilter, |
|
234 TInt aSortType, |
|
235 TInt aReqIpvType, |
|
236 TVpnFilterType aVpnFilterType, |
|
237 TBool aNoEdit |
|
238 ) |
|
239 { |
|
240 APSETUILOGGER_CREATE; |
|
241 |
|
242 CApSettingsHandlerImpl* db = |
|
243 new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection, |
|
244 aListType, |
|
245 aSelMenuType, |
|
246 aReqIpvType, |
|
247 aNoEdit |
|
248 ); |
|
249 CleanupStack::PushL( db ); |
|
250 |
|
251 db->ConstructL( aIspFilter, aBearerFilter, |
|
252 aSortType, aVpnFilterType ); |
|
253 |
|
254 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC5") |
|
255 |
|
256 return db; |
|
257 } |
|
258 |
|
259 |
|
260 // --------------------------------------------------------- |
|
261 // CApSettingsHandlerImpl::NewLC |
|
262 // --------------------------------------------------------- |
|
263 // |
|
264 CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC( |
|
265 CActiveApDb& aDb, |
|
266 TBool aStartWithSelection, |
|
267 TSelectionListType aListType, |
|
268 TSelectionMenuType aSelMenuType, |
|
269 TInt aIspFilter, |
|
270 TInt aBearerFilter, |
|
271 TInt aSortType, |
|
272 TInt aReqIpvType, |
|
273 TVpnFilterType aVpnFilterType, |
|
274 TBool aNoEdit |
|
275 ) |
|
276 { |
|
277 APSETUILOGGER_CREATE; |
|
278 |
|
279 CApSettingsHandlerImpl* db = |
|
280 new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection, |
|
281 aListType, |
|
282 aSelMenuType, |
|
283 aReqIpvType, |
|
284 aNoEdit |
|
285 ); |
|
286 CleanupStack::PushL( db ); |
|
287 |
|
288 db->ConstructL( aDb, aIspFilter, aBearerFilter, |
|
289 aSortType, aVpnFilterType ); |
|
290 |
|
291 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC6") |
|
292 |
|
293 return db; |
|
294 } |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 // --------------------------------------------------------- |
|
302 // CApSettingsHandlerImpl::NewLC |
|
303 // --------------------------------------------------------- |
|
304 // |
|
305 CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC( |
|
306 CActiveApDb& aDb, |
|
307 TBool aStartWithSelection, |
|
308 TSelectionListType aListType, |
|
309 TSelectionMenuType aSelMenuType, |
|
310 TInt aIspFilter, |
|
311 TInt aBearerFilter, |
|
312 TInt aSortType, |
|
313 TInt aReqIpvType, |
|
314 TVpnFilterType aVpnFilterType, |
|
315 TBool aIncludeEasyWlan, |
|
316 TBool aNoEdit |
|
317 ) |
|
318 { |
|
319 APSETUILOGGER_CREATE; |
|
320 |
|
321 CApSettingsHandlerImpl* db = |
|
322 new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection, |
|
323 aListType, |
|
324 aSelMenuType, |
|
325 aReqIpvType, |
|
326 aNoEdit |
|
327 ); |
|
328 CleanupStack::PushL( db ); |
|
329 db->ConstructL( aDb, aIspFilter, aBearerFilter, |
|
330 aSortType, aVpnFilterType, aIncludeEasyWlan ); |
|
331 |
|
332 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC7") |
|
333 |
|
334 return db; |
|
335 } |
|
336 |
|
337 |
|
338 |
|
339 // Destructor |
|
340 CApSettingsHandlerImpl::~CApSettingsHandlerImpl() |
|
341 { |
|
342 APSETUILOGGER_DELETE; |
|
343 |
|
344 if ( iTextOverrides ) |
|
345 { |
|
346 delete iTextOverrides; |
|
347 iTextOverrides = NULL; |
|
348 APSETUILOGGER_WRITE( EAPI,"EApImpl::txtoverrides deleted"); |
|
349 } |
|
350 if ( iExt ) |
|
351 { |
|
352 if ( iExt->iResOffset ) |
|
353 { |
|
354 iModel->EikEnv()->DeleteResourceFile( iExt->iResOffset ); |
|
355 APSETUILOGGER_WRITE( EAPI,"EApImpl::Resource file deleted"); |
|
356 } |
|
357 if ( iExt->iIsFeatureManagerInitialised ) |
|
358 { |
|
359 FeatureManager::UnInitializeLib(); |
|
360 APSETUILOGGER_WRITE( EAPI,"EApImpl::FeatMan. uninitialised"); |
|
361 } |
|
362 } |
|
363 |
|
364 if ( iModel ) |
|
365 { |
|
366 delete iModel; |
|
367 iModel = NULL; |
|
368 } |
|
369 |
|
370 APSETUILOGGER_WRITE( EAPI,"EApImpl::imodel deleted"); |
|
371 |
|
372 delete iExt; |
|
373 |
|
374 APSETUILOGGER_WRITE( EAPI,"EApImpl::iext deleted"); |
|
375 } |
|
376 |
|
377 |
|
378 // Constructor |
|
379 CApSettingsHandlerImpl::CApSettingsHandlerImpl( TBool aStartWithSelection, |
|
380 TSelectionListType aListType, |
|
381 TSelectionMenuType aSelMenuType, |
|
382 TBool aNoEdit |
|
383 ) |
|
384 :iStartWithSelection( aStartWithSelection ), |
|
385 iListType( aListType ), |
|
386 iSelMenuType( aSelMenuType ), |
|
387 iIspFilter( KEApIspTypeAll ), |
|
388 iBearerFilter( EApBearerTypeAll ), |
|
389 iReqIpvType( EIPv4 ), |
|
390 iEventStore( KApUiEventNone ), |
|
391 iNoEdit( aNoEdit ) |
|
392 { |
|
393 iHelpMajor = KHelpUidApSettingsHandler; |
|
394 } |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 // Constructor |
|
401 CApSettingsHandlerImpl::CApSettingsHandlerImpl( TBool aStartWithSelection, |
|
402 TSelectionListType aListType, |
|
403 TSelectionMenuType aSelMenuType, |
|
404 TInt aReqIpvType, |
|
405 TBool aNoEdit |
|
406 ) |
|
407 :iStartWithSelection( aStartWithSelection ), |
|
408 iListType( aListType ), |
|
409 iSelMenuType( aSelMenuType ), |
|
410 iIspFilter( KEApIspTypeAll ), |
|
411 iBearerFilter( EApBearerTypeAll ), |
|
412 iReqIpvType( aReqIpvType ), |
|
413 iEventStore( KApUiEventNone ), |
|
414 iNoEdit( aNoEdit ) |
|
415 { |
|
416 iHelpMajor = KHelpUidApSettingsHandler; |
|
417 } |
|
418 |
|
419 |
|
420 |
|
421 // --------------------------------------------------------- |
|
422 // CApSettingsHandlerImpl::ConstructL |
|
423 // --------------------------------------------------------- |
|
424 // |
|
425 void CApSettingsHandlerImpl::ConstructL( TInt aIspFilter, |
|
426 TInt aBearerFilter, |
|
427 TInt aSortType ) |
|
428 { |
|
429 APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL") |
|
430 |
|
431 DoConstructL( NULL, aIspFilter, aBearerFilter, |
|
432 aSortType, EVpnFilterBoth, EFalse ); |
|
433 |
|
434 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL") |
|
435 } |
|
436 |
|
437 |
|
438 |
|
439 // --------------------------------------------------------- |
|
440 // CApSettingsHandlerImpl::ConstructL |
|
441 // --------------------------------------------------------- |
|
442 // |
|
443 void CApSettingsHandlerImpl::ConstructL( CActiveApDb& aDb, |
|
444 TInt aIspFilter, |
|
445 TInt aBearerFilter, |
|
446 TInt aSortType ) |
|
447 { |
|
448 APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL2") |
|
449 |
|
450 DoConstructL( &aDb, aIspFilter, aBearerFilter, |
|
451 aSortType, EVpnFilterBoth, EFalse ); |
|
452 |
|
453 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL2") |
|
454 } |
|
455 |
|
456 |
|
457 |
|
458 // --------------------------------------------------------- |
|
459 // CApSettingsHandlerImpl::ConstructL |
|
460 // --------------------------------------------------------- |
|
461 // |
|
462 void CApSettingsHandlerImpl::ConstructL( |
|
463 TInt aIspFilter, |
|
464 TInt aBearerFilter, |
|
465 TInt aSortType, |
|
466 TVpnFilterType aVpnFilterType |
|
467 ) |
|
468 { |
|
469 APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL3") |
|
470 |
|
471 DoConstructL( NULL, aIspFilter, aBearerFilter, |
|
472 aSortType, aVpnFilterType, EFalse ); |
|
473 |
|
474 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL3") |
|
475 } |
|
476 |
|
477 |
|
478 |
|
479 // --------------------------------------------------------- |
|
480 // CApSettingsHandlerImpl::ConstructL |
|
481 // --------------------------------------------------------- |
|
482 // |
|
483 void CApSettingsHandlerImpl::ConstructL( |
|
484 CActiveApDb& aDb, |
|
485 TInt aIspFilter, |
|
486 TInt aBearerFilter, |
|
487 TInt aSortType, |
|
488 TVpnFilterType aVpnFilterType |
|
489 ) |
|
490 { |
|
491 APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL4") |
|
492 |
|
493 DoConstructL( &aDb, aIspFilter, aBearerFilter, |
|
494 aSortType, aVpnFilterType, EFalse ); |
|
495 |
|
496 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL4") |
|
497 } |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 // --------------------------------------------------------- |
|
503 // CApSettingsHandlerImpl::ConstructL |
|
504 // --------------------------------------------------------- |
|
505 // |
|
506 void CApSettingsHandlerImpl::ConstructL( |
|
507 CActiveApDb& aDb, |
|
508 TInt aIspFilter, |
|
509 TInt aBearerFilter, |
|
510 TInt aSortType, |
|
511 TVpnFilterType aVpnFilterType, |
|
512 TBool aIncludeEasyWlan |
|
513 ) |
|
514 { |
|
515 APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL5") |
|
516 |
|
517 DoConstructL( &aDb, aIspFilter, aBearerFilter, |
|
518 aSortType, aVpnFilterType, aIncludeEasyWlan ); |
|
519 |
|
520 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL5") |
|
521 } |
|
522 |
|
523 |
|
524 // --------------------------------------------------------- |
|
525 // CApSettingsHandlerImpl::SetFilter |
|
526 // --------------------------------------------------------- |
|
527 // |
|
528 void CApSettingsHandlerImpl::SetFilterL( TInt aIspFilter, |
|
529 TInt aBearerFilter, |
|
530 TInt aSortType ) |
|
531 { |
|
532 APSETUILOGGER_ENTERFN( EApImpl,"Impl::SetFilterL") |
|
533 |
|
534 iIspFilter = aIspFilter; |
|
535 iBearerFilter = aBearerFilter; |
|
536 iExt->iSortType = aSortType; |
|
537 |
|
538 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::SetFilterL") |
|
539 } |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 // --------------------------------------------------------- |
|
545 // CApSettingsHandlerImpl::SetTextOverrideL |
|
546 // --------------------------------------------------------- |
|
547 // |
|
548 void CApSettingsHandlerImpl::SetTextOverrideL( TTextID aText2Change, |
|
549 const TDesC& aNewText ) |
|
550 { |
|
551 APSETUILOGGER_ENTERFN( EApImpl,"Impl::SetTextOverrideL") |
|
552 |
|
553 __ASSERT_DEBUG( iTextOverrides, Panic( ENullPointer ) ); |
|
554 iTextOverrides->SetTextOverrideL( aText2Change, aNewText ); |
|
555 |
|
556 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::SetTextOverrideL") |
|
557 } |
|
558 |
|
559 |
|
560 // --------------------------------------------------------- |
|
561 // CApSettingsHandlerImpl::TextOverrideL |
|
562 // --------------------------------------------------------- |
|
563 // |
|
564 const TDesC& CApSettingsHandlerImpl::TextOverrideL( TTextID aTextId ) |
|
565 { |
|
566 APSETUILOGGER_ENTERFN( EApImpl,"Impl::TextOverrideL <- ->") |
|
567 |
|
568 __ASSERT_DEBUG( iTextOverrides, Panic( ENullPointer ) ); |
|
569 return iTextOverrides->TextOverrideL( aTextId ); |
|
570 } |
|
571 |
|
572 |
|
573 |
|
574 // --------------------------------------------------------- |
|
575 // CApSettingsHandlerImpl::RunSettingsL |
|
576 // --------------------------------------------------------- |
|
577 // |
|
578 TInt CApSettingsHandlerImpl::RunSettingsL( TUint32 aHighLight, |
|
579 TUint32& aSelected ) |
|
580 { |
|
581 APSETUILOGGER_ENTERFN( EApImpl,"Impl::RunSettingsL") |
|
582 |
|
583 // this function is only called from outside, need to init iEventStore |
|
584 iEventStore = KApUiEventNone; |
|
585 |
|
586 TRAPD( err, HandleRunSettingsL( aHighLight, aSelected ) ); |
|
587 if ( iEventStore & KApUiEventInternal ) |
|
588 { |
|
589 // internal 'exit', not an error, |
|
590 // clear flag and return normally |
|
591 iEventStore &= (~KApUiEventInternal); |
|
592 } |
|
593 else |
|
594 { |
|
595 User::LeaveIfError(err); |
|
596 } |
|
597 |
|
598 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::RunSettingsL") |
|
599 |
|
600 return iEventStore; |
|
601 } |
|
602 |
|
603 |
|
604 |
|
605 // --------------------------------------------------------- |
|
606 // CApSettingsHandlerImpl::Cvt() |
|
607 // --------------------------------------------------------- |
|
608 // |
|
609 TInt CApSettingsHandlerImpl::Cvt() |
|
610 { |
|
611 APSETUILOGGER_ENTERFN( EApImpl,"Impl::Cvt") |
|
612 |
|
613 return KErrNone; |
|
614 } |
|
615 |
|
616 |
|
617 // --------------------------------------------------------- |
|
618 // CApSettingsHandlerImpl::DoRunSettingsL |
|
619 // --------------------------------------------------------- |
|
620 // |
|
621 TInt CApSettingsHandlerImpl::DoRunSettingsL( TUint32 aHighLight, |
|
622 TUint32& aSelected ) |
|
623 { |
|
624 APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunSettingsL") |
|
625 |
|
626 __ASSERT_DEBUG( iTextOverrides, Panic( ENullPointer ) ); |
|
627 |
|
628 if ( ( iListType == EApSettingsSelListIsPopUp ) || |
|
629 ( iListType == EApSettingsSelListIsPopUpWithNone ) ) |
|
630 { |
|
631 DoRunSetPageSettingsL( aHighLight, aSelected ); |
|
632 } |
|
633 else |
|
634 { |
|
635 DoRunListSettingsL( aHighLight, aSelected ); |
|
636 } |
|
637 |
|
638 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunSettingsL") |
|
639 return 0; |
|
640 } |
|
641 |
|
642 |
|
643 // --------------------------------------------------------- |
|
644 // CApSettingsHandlerImpl::RunViewerL |
|
645 // --------------------------------------------------------- |
|
646 // |
|
647 TInt CApSettingsHandlerImpl::RunViewerL( TUint32 aUid ) |
|
648 { |
|
649 APSETUILOGGER_ENTERFN( EApImpl,"Impl::RunViewerL") |
|
650 |
|
651 // this function is only called from outside, need to init iEventStore |
|
652 iEventStore = KApUiEventNone; |
|
653 |
|
654 #ifdef __TEST_OOMDEBUG |
|
655 if ( iMemTestOn ) |
|
656 { |
|
657 TInt leavecode( KErrNoMemory ); |
|
658 TInt ts( GetTestStateL() ); |
|
659 |
|
660 TBuf<48> buf; |
|
661 buf.Format( _L("\r\n\t( ts: %d )"), ts ); |
|
662 APSETUILOGGER_WRITE_BUF( EApImpl, buf ); |
|
663 |
|
664 if ( ts == KViewerTest ) |
|
665 { |
|
666 TBuf<48> buf; |
|
667 APSETUILOGGER_WRITE_BUF( EApImpl, _L("Starting KViewerTest memtest") ); |
|
668 |
|
669 TUint32 rate( 0 ); |
|
670 TUint32 retrycount( KOOMRetryCount ); |
|
671 TUint32 retryoffset( KOOMRetryOffset ); |
|
672 for ( |
|
673 rate = 1; |
|
674 ((rate < 50000) && (leavecode == KErrNoMemory)) |
|
675 || retrycount; |
|
676 rate++ |
|
677 ) |
|
678 { |
|
679 __UHEAP_SETFAIL( RHeap::EDeterministic, rate ); |
|
680 TRAP( leavecode, DoRunViewerL( aUid ) ); |
|
681 __UHEAP_RESET; |
|
682 if ( !leavecode ) |
|
683 { |
|
684 retrycount--; |
|
685 rate += retryoffset; |
|
686 } |
|
687 } |
|
688 User::LeaveIfError( leavecode ); |
|
689 buf.Format( _L("\t Memtest finished, max. rate was: %d )"), rate ); |
|
690 APSETUILOGGER_WRITE_BUF( EApImpl, buf ); |
|
691 } |
|
692 else |
|
693 { |
|
694 DoRunViewerL( aUid ); |
|
695 } |
|
696 } |
|
697 else |
|
698 { |
|
699 DoRunViewerL( aUid ); |
|
700 } |
|
701 #else |
|
702 DoRunViewerL( aUid ); |
|
703 #endif // __TEST_OOMDEBUG |
|
704 |
|
705 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::RunViewerL") |
|
706 |
|
707 return iEventStore; |
|
708 } |
|
709 |
|
710 |
|
711 |
|
712 // --------------------------------------------------------- |
|
713 // CApSettingsHandlerImpl::DoRunViewerL |
|
714 // --------------------------------------------------------- |
|
715 // |
|
716 TInt CApSettingsHandlerImpl::DoRunViewerL( TUint32 aUid ) |
|
717 { |
|
718 APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunViewerL") |
|
719 |
|
720 TInt retval( KErrNone ); |
|
721 |
|
722 TBool protSupported = FeatureManager::FeatureSupported( |
|
723 KFeatureIdSettingsProtection ); |
|
724 |
|
725 |
|
726 TTransactionResult ownTransaction = iModel->StartTransactionLC |
|
727 ( |
|
728 /*aWrite*/EFalse, |
|
729 /*aShowNote*/ETrue, |
|
730 /*aRetry*/ETrue |
|
731 ); |
|
732 if ( ownTransaction != EFailedWithLocked ) |
|
733 { |
|
734 TBool isinuse = iModel->ApUtils()->IsAPInUseL( aUid ); |
|
735 TBool isprotected(EFalse); |
|
736 if ( protSupported ) |
|
737 { |
|
738 isprotected = iModel->ApUtils()->IsReadOnlyL( aUid ); |
|
739 isprotected |= CApProtHandler::IsTableProtectedL( |
|
740 iModel->Database()->Database() ); |
|
741 } |
|
742 |
|
743 TBool isvpn = iModel->VpnEngine()->IsVpnApL( aUid ); |
|
744 |
|
745 if ( ownTransaction == EOwnTransaction ) |
|
746 { |
|
747 TInt err = iModel->CommitTransaction(); |
|
748 User::LeaveIfError( err ); |
|
749 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
750 } |
|
751 |
|
752 if ( isinuse ) |
|
753 { |
|
754 // Ap is in use right now, can not edit or delete, |
|
755 // show information note qtn_set_note_iap_in_use |
|
756 ShowNoteL( R_APUI_NOTE_AP_IN_USE_EDIT ); |
|
757 } |
|
758 else |
|
759 { |
|
760 if ( protSupported && isprotected ) |
|
761 { |
|
762 ShowNoteL( R_APUI_NOTE_PROTECTED_AP_SETT ); |
|
763 } |
|
764 else |
|
765 { // not in use, not protected, check if it is vpn |
|
766 if ( isvpn ) |
|
767 { |
|
768 ShowNoteL( R_APUI_NOTE_VPN_AP_SETT ); |
|
769 } |
|
770 else |
|
771 { // may start wondering about editing... |
|
772 TApBearerType bearer = iModel->ApUtils()->BearerTypeL( aUid ); |
|
773 #ifdef __TEST_LAN_BEARER |
|
774 if ( bearer == EApBearerTypeLAN ) |
|
775 { |
|
776 User::Leave( KErrNotSupported ); |
|
777 // ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED ); |
|
778 // Leave needed? |
|
779 } |
|
780 else |
|
781 { |
|
782 CApSettingsDlg* iMyDialog = |
|
783 CApSettingsDlg::NewL( iIspFilter, |
|
784 iBearerFilter, |
|
785 iExt->iSortType, |
|
786 iEventStore, |
|
787 iReqIpvType |
|
788 ); |
|
789 |
|
790 iMyDialog->SetTextOverrides( iTextOverrides ); |
|
791 |
|
792 retval = iMyDialog->ConstructAndRunLD( |
|
793 *iModel, *this, aUid ); |
|
794 } |
|
795 #else |
|
796 if ( bearer == EApBearerTypeLANModem ) |
|
797 { |
|
798 User::Leave( KErrNotSupported ); |
|
799 // ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED ); |
|
800 // Leave needed? |
|
801 } |
|
802 else |
|
803 { |
|
804 CApSettingsDlg* iMyDialog = |
|
805 CApSettingsDlg::NewL( iIspFilter, |
|
806 iBearerFilter, |
|
807 iExt->iSortType, |
|
808 iEventStore, |
|
809 iReqIpvType |
|
810 ); |
|
811 |
|
812 iMyDialog->SetTextOverrides( iTextOverrides ); |
|
813 |
|
814 retval = iMyDialog->ConstructAndRunLD( |
|
815 *iModel, *this, aUid ); |
|
816 } |
|
817 #endif // __TEST_LAN_BEARER |
|
818 } |
|
819 } |
|
820 } |
|
821 } |
|
822 |
|
823 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunViewerL") |
|
824 |
|
825 return retval; |
|
826 } |
|
827 |
|
828 |
|
829 |
|
830 //---------------------------------------------------------- |
|
831 // CApSettingsHandlerImpl::HandleApDeleteCmdL |
|
832 //---------------------------------------------------------- |
|
833 // |
|
834 void CApSettingsHandlerImpl::HandleApDeleteCmdL( TUint32 aUid, TBool aIsLast ) |
|
835 { |
|
836 APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleApDeleteCmdL") |
|
837 |
|
838 // OOD handling. If disk space is low, |
|
839 // we try to get some spare. |
|
840 RFs fs; |
|
841 User::LeaveIfError( fs.Connect() ); |
|
842 CleanupClosePushL<RFs>( fs ); |
|
843 TBool diskLow = SysUtil::FFSSpaceBelowCriticalLevelL |
|
844 ( &fs, KEstimatedDeleteFfsOverhead ); |
|
845 |
|
846 RSharedDataClient sdClient; |
|
847 if ( diskLow ) |
|
848 { |
|
849 User::LeaveIfError( sdClient.Connect() ); |
|
850 CleanupClosePushL<RSharedDataClient>( sdClient ); |
|
851 sdClient.RequestFreeDiskSpaceLC |
|
852 ( KEstimatedDeleteFfsOverhead ); |
|
853 } |
|
854 |
|
855 // check that the Ap is not used so it can be deleted!! |
|
856 TTransactionResult ownTransaction = iModel->StartTransactionLC( |
|
857 /*aWrite*/EFalse, |
|
858 /*aShowNote*/ETrue, |
|
859 /*aRetry*/ETrue ); |
|
860 if ( ownTransaction != EFailedWithLocked ) |
|
861 { |
|
862 TBool isinuse = iModel->ApUtils()->IsAPInUseL( aUid ); |
|
863 TApBearerType bearer = iModel->ApUtils()->BearerTypeL( aUid ); |
|
864 #ifdef __TEST_LAN_BEARER |
|
865 if ( bearer == EApBearerTypeLAN ) |
|
866 { |
|
867 User::Leave( KErrNotSupported ); |
|
868 } |
|
869 #endif // __TEST_LAN_BEARER |
|
870 if ( bearer == EApBearerTypeLANModem ) |
|
871 { |
|
872 User::Leave( KErrNotSupported ); |
|
873 // Leave needed? |
|
874 } |
|
875 |
|
876 TBool protSupported = FeatureManager::FeatureSupported( |
|
877 KFeatureIdSettingsProtection ); |
|
878 TBool isprotected(EFalse); |
|
879 if ( protSupported ) |
|
880 { |
|
881 isprotected = iModel->ApUtils()->IsReadOnlyL( aUid ); |
|
882 } |
|
883 |
|
884 if ( ownTransaction == EOwnTransaction ) |
|
885 { |
|
886 TInt err = iModel->CommitTransaction(); |
|
887 User::LeaveIfError( err ); |
|
888 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
889 } |
|
890 |
|
891 if ( isinuse ) |
|
892 { |
|
893 // Ap is in use right now, can not edit or delete, |
|
894 // show information note qtn_set_note_iap_in_use |
|
895 ShowNoteL( R_APUI_NOTE_AP_IN_USE_DELETE ); |
|
896 } |
|
897 else |
|
898 { // not in use, maybe protected? |
|
899 if ( protSupported && isprotected ) |
|
900 { |
|
901 ShowNoteL( R_APUI_NOTE_PROTECTED_AP ); |
|
902 } |
|
903 else |
|
904 { // not in use or protected, may start wondering about delete... |
|
905 // need to check whether it is the last one... |
|
906 TBool candelete( ETrue ); |
|
907 // Linked to VPN? |
|
908 TBool isvpn = iModel->VpnEngine()->IsVpnApL( aUid ); |
|
909 if ( !isvpn ) |
|
910 { |
|
911 if ( iExt->iVariant & KApUiEditOnlyVPNs ) |
|
912 { |
|
913 candelete = EFalse; |
|
914 } |
|
915 else |
|
916 { |
|
917 HBufC* sgd = NULL; |
|
918 sgd = iModel->GetLinkedVpnAccessPointLC( aUid ); |
|
919 if ( sgd ) |
|
920 {// has linked VPN, |
|
921 // According to current spec. there should |
|
922 // be something like linked to VPN, Delete? |
|
923 // BUT it causes incomplete access point to exist |
|
924 // hard to handle, therefore last minute change |
|
925 // is that it can not be delted. |
|
926 /* |
|
927 if ( !AskQueryL( R_APUI_IAP_DEL_IAP_ASSOCIATED, sgd ) ) |
|
928 { |
|
929 candelete = EFalse; |
|
930 } |
|
931 */ |
|
932 ShowNoteL( R_APUI_NOTE_AP_IN_USE_DELETE ); |
|
933 candelete = EFalse; |
|
934 |
|
935 CleanupStack::PopAndDestroy( sgd ); |
|
936 } |
|
937 else |
|
938 { // simply confirm |
|
939 candelete = ConfirmDeleteL( aUid, aIsLast ); |
|
940 } |
|
941 } |
|
942 } |
|
943 else |
|
944 { // simply confirm |
|
945 candelete = ConfirmDeleteL( aUid, aIsLast ); |
|
946 } |
|
947 if ( candelete ) |
|
948 { // seems that we can delete it, so let's go on |
|
949 iModel->RemoveApL( aUid ); |
|
950 iEventStore |= KApUiEventDeleted; |
|
951 } |
|
952 } |
|
953 } |
|
954 } |
|
955 |
|
956 if ( diskLow ) |
|
957 { |
|
958 // Cancel RequestFreeDiskSpaceLC (by popping off an destroy); |
|
959 // close sdClient. |
|
960 CleanupStack::PopAndDestroy( 2 ); |
|
961 } |
|
962 CleanupStack::PopAndDestroy(); // fs, will also close it |
|
963 |
|
964 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleApDeleteCmdL") |
|
965 } |
|
966 |
|
967 |
|
968 //---------------------------------------------------------- |
|
969 // CApSettingsHandlerImpl::HandleApBlankNewL |
|
970 //---------------------------------------------------------- |
|
971 // |
|
972 TUint32 CApSettingsHandlerImpl::HandleApBlankNewL( TInt aBearers, TInt aIsps ) |
|
973 { |
|
974 APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleApBlankNewL") |
|
975 |
|
976 TUint32 retval( KErrNone ); |
|
977 |
|
978 #ifdef __TEST_OOMDEBUG |
|
979 if ( iMemTestOn ) |
|
980 { |
|
981 TInt leavecode( KErrNoMemory ); |
|
982 |
|
983 TInt ts( GetTestStateL() ); |
|
984 |
|
985 if ( ts == KCreateBlankTest ) |
|
986 { |
|
987 TBuf<48> buf; |
|
988 APSETUILOGGER_WRITE_BUF( EApImpl, _L("Starting KCreateBlankTest memtest") ); |
|
989 |
|
990 TUint32 rate( 0 ); |
|
991 TUint32 retrycount( KOOMRetryCount ); |
|
992 TUint32 retryoffset( KOOMRetryOffset ); |
|
993 for ( |
|
994 rate = 1; |
|
995 ((rate < 50000) && (leavecode == KErrNoMemory)) |
|
996 || retrycount; |
|
997 rate++ |
|
998 ) |
|
999 { |
|
1000 __UHEAP_SETFAIL( RHeap::EDeterministic, rate ); |
|
1001 TRAP( leavecode, |
|
1002 retval = DoHandleApBlankNewL( aBearers, aIsps ) ); |
|
1003 __UHEAP_RESET; |
|
1004 if ( !leavecode ) |
|
1005 { |
|
1006 retrycount--; |
|
1007 rate += retryoffset; |
|
1008 } |
|
1009 } |
|
1010 User::LeaveIfError( leavecode ); |
|
1011 buf.Format( _L("\t Memtest finished, max. rate was: %d )"), rate ); |
|
1012 APSETUILOGGER_WRITE_BUF( EApImpl, buf ); |
|
1013 } |
|
1014 else |
|
1015 { |
|
1016 retval = DoHandleApBlankNewL( aBearers, aIsps ); |
|
1017 } |
|
1018 } |
|
1019 else |
|
1020 { |
|
1021 retval = DoHandleApBlankNewL( aBearers, aIsps ); |
|
1022 } |
|
1023 #else |
|
1024 retval = DoHandleApBlankNewL( aBearers, aIsps ); |
|
1025 #endif // __TEST_OOMDEBUG |
|
1026 |
|
1027 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleApBlankNewL") |
|
1028 return retval; |
|
1029 } |
|
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 //---------------------------------------------------------- |
|
1035 // CApSettingsHandlerImpl::HandleApUseOldNewL |
|
1036 //---------------------------------------------------------- |
|
1037 // |
|
1038 TUint32 CApSettingsHandlerImpl::HandleApUseOldNewL() |
|
1039 { |
|
1040 APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleApUseOldNewL") |
|
1041 |
|
1042 TUint32 retval = KErrNone; |
|
1043 |
|
1044 #ifdef __TEST_OOMDEBUG |
|
1045 if ( iMemTestOn ) |
|
1046 { |
|
1047 TInt leavecode( KErrNoMemory ); |
|
1048 TInt ts( GetTestStateL() ); |
|
1049 |
|
1050 TBuf<48> buf; |
|
1051 buf.Format( _L("\r\n\t( ts: %d )"), ts ); |
|
1052 APSETUILOGGER_WRITE_BUF( EApImpl, buf ); |
|
1053 |
|
1054 if ( ts == KQueryTest ) |
|
1055 { |
|
1056 TBuf<48> buf; |
|
1057 APSETUILOGGER_WRITE_BUF( EApImpl, _L("Starting KQueryTest memtest") ); |
|
1058 TUint32 rate( 0 ); |
|
1059 TUint32 retrycount( KOOMRetryCount ); |
|
1060 TUint32 retryoffset( KOOMRetryOffset ); |
|
1061 for ( |
|
1062 rate = 1; |
|
1063 ((rate < 50000) && (leavecode == KErrNoMemory)) |
|
1064 || retrycount; |
|
1065 rate++ |
|
1066 ) |
|
1067 { |
|
1068 __UHEAP_MARK; |
|
1069 __UHEAP_SETFAIL( RHeap::EDeterministic, rate ); |
|
1070 TRAP( leavecode, retval = SelectApToCopyL() ); |
|
1071 __UHEAP_RESET; |
|
1072 __UHEAP_MARKEND; |
|
1073 if ( !leavecode ) |
|
1074 { |
|
1075 retrycount--; |
|
1076 rate += retryoffset; |
|
1077 } |
|
1078 } |
|
1079 User::LeaveIfError( leavecode ); |
|
1080 buf.Format( _L("\t Memtest finished, max. rate was: %d )"), rate ); |
|
1081 APSETUILOGGER_WRITE_BUF( EApImpl, buf ); |
|
1082 } |
|
1083 else |
|
1084 { |
|
1085 retval = SelectApToCopyL(); |
|
1086 } |
|
1087 } |
|
1088 else |
|
1089 { |
|
1090 retval = SelectApToCopyL(); |
|
1091 } |
|
1092 #else |
|
1093 retval = SelectApToCopyL(); |
|
1094 #endif // __TEST_OOMDEBUG |
|
1095 |
|
1096 if ( retval != (TUint32)KErrNone ) |
|
1097 { // so user had chosen something |
|
1098 #ifdef __TEST_OOMDEBUG |
|
1099 if ( iMemTestOn ) |
|
1100 { |
|
1101 TInt leavecode( KErrNoMemory ); |
|
1102 TInt ts( GetTestStateL() ); |
|
1103 if ( ts == KCreateUseExistTest ) |
|
1104 { |
|
1105 TBuf<48> buf; |
|
1106 APSETUILOGGER_WRITE_BUF |
|
1107 ( _L("Starting KCreateUseExistTest memtest") ); |
|
1108 TUint32 rate( 0 ); |
|
1109 TUint32 retrycount( KOOMRetryCount ); |
|
1110 TUint32 retryoffset( KOOMRetryOffset ); |
|
1111 for ( |
|
1112 rate = 1; |
|
1113 ((rate < 50000) && (leavecode == KErrNoMemory)) |
|
1114 || retrycount; |
|
1115 rate++ |
|
1116 ) |
|
1117 { |
|
1118 __UHEAP_SETFAIL( RHeap::EDeterministic, rate ); |
|
1119 TRAP( leavecode, retval = DoHandleApUseOldNewL( retval ) ); |
|
1120 __UHEAP_RESET; |
|
1121 if ( !leavecode ) |
|
1122 { |
|
1123 retrycount--; |
|
1124 rate += retryoffset; |
|
1125 } |
|
1126 } |
|
1127 User::LeaveIfError( leavecode ); |
|
1128 buf.Format( _L("\t Memtest finished, max. rate was: %d )"), |
|
1129 rate ); |
|
1130 APSETUILOGGER_WRITE_BUF( EApImpl, buf ); |
|
1131 } |
|
1132 else |
|
1133 { |
|
1134 retval = DoHandleApUseOldNewL( retval ); |
|
1135 } |
|
1136 } |
|
1137 else |
|
1138 { |
|
1139 retval = DoHandleApUseOldNewL( retval ); |
|
1140 } |
|
1141 #else |
|
1142 retval = DoHandleApUseOldNewL( retval ); |
|
1143 #endif // __TEST_OOMDEBUG |
|
1144 } |
|
1145 |
|
1146 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleApUseOldNewL") |
|
1147 |
|
1148 return retval; |
|
1149 } |
|
1150 |
|
1151 |
|
1152 |
|
1153 //---------------------------------------------------------- |
|
1154 // CApSettingsHandlerImpl::EditAfterCreateL |
|
1155 //---------------------------------------------------------- |
|
1156 // |
|
1157 TUint32 CApSettingsHandlerImpl::EditAfterCreateL( TUint32 aUid, |
|
1158 CApAccessPointItem* aItem ) |
|
1159 { |
|
1160 APSETUILOGGER_ENTERFN( EApImpl,"Impl::EditAfterCreateL") |
|
1161 |
|
1162 CApSettingsDlg* iMySetDialog = CApSettingsDlg::NewL |
|
1163 ( |
|
1164 KEApIspTypeAll, |
|
1165 EApBearerTypeAll, |
|
1166 KEApSortNameAscending, |
|
1167 iEventStore, |
|
1168 iReqIpvType |
|
1169 ); |
|
1170 |
|
1171 iMySetDialog->SetTextOverrides( iTextOverrides ); |
|
1172 iMySetDialog->ConstructAndRunLD( *iModel, *this, aUid, aItem ); |
|
1173 |
|
1174 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::EditAfterCreateL") |
|
1175 |
|
1176 return aUid; |
|
1177 } |
|
1178 |
|
1179 |
|
1180 |
|
1181 //---------------------------------------------------------- |
|
1182 // CApSettingsHandlerImpl::DoConstructL |
|
1183 //---------------------------------------------------------- |
|
1184 // |
|
1185 void CApSettingsHandlerImpl::DoConstructL( CActiveApDb* aDb, |
|
1186 TInt aIspFilter, |
|
1187 TInt aBearerFilter, |
|
1188 TInt aSortType, |
|
1189 TVpnFilterType aVpnFilterType, |
|
1190 TBool aIncludeEasyWlan ) |
|
1191 { |
|
1192 APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoConstructL") |
|
1193 |
|
1194 iExt = new ( ELeave )TApSetHandlerImplExtra; |
|
1195 iExt->iResOffset = 0; |
|
1196 iExt->iIsIpv6Supported = EFalse; |
|
1197 iExt->iIsFeatureManagerInitialised = EFalse; |
|
1198 iExt->iExtra = 0; |
|
1199 iExt->iSortType = KEApSortNameAscending; |
|
1200 iExt->iVpnFilterType = aVpnFilterType; |
|
1201 iExt->iVariant = GetVariantL(); |
|
1202 iExt->iIncludeEasyWlan = aIncludeEasyWlan; |
|
1203 |
|
1204 #ifdef __TEST_CDMA_WRITE_PROTECT |
|
1205 iExt->iVariant |= KApUiEditOnlyVPNs; |
|
1206 #endif // __TEST_CDMA_WRITE_PROTECT |
|
1207 iIspFilter = KEApIspTypeAll; |
|
1208 iBearerFilter = aBearerFilter; |
|
1209 |
|
1210 // get IPv6 features from feature manager |
|
1211 FeatureManager::InitializeLibL(); |
|
1212 iExt->iIsFeatureManagerInitialised = ETrue; |
|
1213 |
|
1214 iExt->iIsIpv6Supported = |
|
1215 FeatureManager::FeatureSupported( KFeatureIdIPv6 ); |
|
1216 #ifdef __TEST_IPV6_SUPPORT |
|
1217 iExt->iIsIpv6Supported = ETrue; |
|
1218 #endif // __TEST_IPV6_SUPPORT |
|
1219 |
|
1220 // we ask IPv6 only if it is asked by client AND supported by the phone |
|
1221 iReqIpvType = iExt->iIsIpv6Supported ? iReqIpvType : EIPv4; |
|
1222 |
|
1223 |
|
1224 #ifdef __TEST_OOMDEBUG |
|
1225 RFs fs; |
|
1226 User::LeaveIfError( fs.Connect() ); |
|
1227 CleanupClosePushL<RFs>( fs ); |
|
1228 TUint att; |
|
1229 if ( fs.Att( KTestFileName, att ) == KErrNone ) |
|
1230 { |
|
1231 iMemTestOn = ETrue; |
|
1232 } |
|
1233 else |
|
1234 { |
|
1235 iMemTestOn = EFalse; |
|
1236 } |
|
1237 CleanupStack::PopAndDestroy(); // fs, will also close it |
|
1238 #endif // __TEST_OOMDEBUG |
|
1239 iTextOverrides = CTextOverrides::NewL(); |
|
1240 // No need to PushL( iTextOverrides ), it's pointer is owned |
|
1241 // & will be deleted in destructor, because 'this' is already |
|
1242 // on the CleanupStack... |
|
1243 if ( aDb ) |
|
1244 { |
|
1245 iModel = CApSettingsModel::NewL( *aDb, aIspFilter, |
|
1246 aBearerFilter, aSortType, |
|
1247 iReqIpvType, |
|
1248 iExt->iVpnFilterType, |
|
1249 iExt->iVariant, |
|
1250 iExt->iIncludeEasyWlan, |
|
1251 iNoEdit ); |
|
1252 } |
|
1253 else |
|
1254 { |
|
1255 iModel = CApSettingsModel::NewL( aIspFilter, aBearerFilter, |
|
1256 aSortType, iReqIpvType, |
|
1257 iExt->iVpnFilterType, |
|
1258 iExt->iVariant, |
|
1259 iExt->iIncludeEasyWlan, |
|
1260 iNoEdit ); |
|
1261 } |
|
1262 SetFilterL( aIspFilter, aBearerFilter, aSortType ); |
|
1263 |
|
1264 // can't use resource here because it has not been added yet.... |
|
1265 TFileName resourceFile; |
|
1266 resourceFile.Append( KApSettingsResDriveZ ); |
|
1267 resourceFile.Append( KDC_RESOURCE_FILES_DIR ); |
|
1268 resourceFile.Append( KApSettingsResFileName ); |
|
1269 BaflUtils::NearestLanguageFile( iModel->EikEnv()->FsSession(), |
|
1270 resourceFile ); |
|
1271 // as we are not an Application having iCoeEnv, we must figure it out, |
|
1272 // no matter what it takes. Also it is getted once per construction... |
|
1273 iExt->iResOffset = iModel->EikEnv()->AddResourceFileL( resourceFile ); |
|
1274 |
|
1275 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoConstructL") |
|
1276 } |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 //---------------------------------------------------------- |
|
1282 // CApSettingsHandlerImpl::DoRunSetPageSettingsL |
|
1283 //---------------------------------------------------------- |
|
1284 // |
|
1285 void CApSettingsHandlerImpl::DoRunSetPageSettingsL( TUint32 aHighLight, |
|
1286 TUint32& aSelected ) |
|
1287 { |
|
1288 APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunSetPageSettingsL") |
|
1289 |
|
1290 TInt aHigh = aHighLight; |
|
1291 |
|
1292 HBufC* titlebuf; |
|
1293 |
|
1294 if ( iTextOverrides->IsTextOverridenL( EPopupPromptText ) ) |
|
1295 { |
|
1296 titlebuf = iTextOverrides->TextOverrideL( |
|
1297 EPopupPromptText |
|
1298 ).AllocLC(); |
|
1299 } |
|
1300 else |
|
1301 { |
|
1302 titlebuf = iModel->EikEnv()->AllocReadResourceLC |
|
1303 ( |
|
1304 R_APUI_VIEW_DEFAULT_AP |
|
1305 ); |
|
1306 } |
|
1307 /* |
|
1308 * We need to pass an int& as starting selection to |
|
1309 * CAknRadioButtonSettingPage |
|
1310 * But we use preferred UID & not list-item nuber... |
|
1311 * Also it sets selection in it's ConstructL() but our list is filled |
|
1312 * up dynamically and it must be done after ConstructL() |
|
1313 * (list must be already constructed...) |
|
1314 * Therefore we pass a dummy int& initialized to 0 as |
|
1315 * selecting the 0th element does no harm... |
|
1316 */ |
|
1317 TInt Dummy( -1 ); |
|
1318 // needs this Dummy array to pass it to CAknSettingPage's constructor... |
|
1319 CDesCArrayFlat* aItemArray = new ( ELeave ) CDesCArrayFlat( 1 ); |
|
1320 CleanupStack::PushL( aItemArray ); |
|
1321 CApSelPopupList* dlg = CApSelPopupList::NewL |
|
1322 ( |
|
1323 *iModel, |
|
1324 *this, |
|
1325 Dummy, |
|
1326 aHigh, |
|
1327 iSelMenuType, |
|
1328 iIspFilter, |
|
1329 iBearerFilter, |
|
1330 iExt->iSortType, |
|
1331 iEventStore, |
|
1332 aItemArray, |
|
1333 iListType == EApSettingsSelListIsPopUpWithNone, |
|
1334 iReqIpvType, |
|
1335 iExt->iVpnFilterType, |
|
1336 iExt->iIncludeEasyWlan, |
|
1337 iNoEdit |
|
1338 ); |
|
1339 CleanupStack::PushL( dlg ); |
|
1340 TPtrC ptr( titlebuf->Des() ); |
|
1341 dlg->SetSettingTextL( ptr ); |
|
1342 // dlg must be Pop-ed because ExecuteLD starts with PushL()... |
|
1343 CleanupStack::Pop(); |
|
1344 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
1345 { |
|
1346 aSelected = aHigh; |
|
1347 } |
|
1348 CleanupStack::PopAndDestroy( 2 ); // aItemArray, titlebuf |
|
1349 |
|
1350 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunSetPageSettingsL") |
|
1351 } |
|
1352 |
|
1353 |
|
1354 |
|
1355 //---------------------------------------------------------- |
|
1356 // CApSettingsHandlerImpl::DoRunListSettingsL |
|
1357 //---------------------------------------------------------- |
|
1358 // |
|
1359 void CApSettingsHandlerImpl::DoRunListSettingsL( TUint32 aHighLight, |
|
1360 TUint32& aSelected ) |
|
1361 { |
|
1362 APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunListSettingsL") |
|
1363 |
|
1364 CApSelectorDialog* iMyDialog = CApSelectorDialog::NewL |
|
1365 ( |
|
1366 iListType, |
|
1367 iSelMenuType, |
|
1368 iIspFilter, |
|
1369 iBearerFilter, |
|
1370 iExt->iSortType, |
|
1371 iEventStore, |
|
1372 iNoEdit, |
|
1373 iReqIpvType |
|
1374 ); |
|
1375 iMyDialog->SetTextOverrides( iTextOverrides ); |
|
1376 |
|
1377 iMyDialog->ConstructAndRunLD( *iModel, *this, aHighLight, aSelected ); |
|
1378 |
|
1379 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunListSettingsL") |
|
1380 } |
|
1381 |
|
1382 |
|
1383 |
|
1384 //---------------------------------------------------------- |
|
1385 // CApSettingsHandlerImpl::DoHandleApUseOldNewL |
|
1386 //---------------------------------------------------------- |
|
1387 // |
|
1388 TUint32 CApSettingsHandlerImpl::DoHandleApUseOldNewL( TUint32 aSelected ) |
|
1389 { |
|
1390 APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoHandleApUseOldNewL") |
|
1391 |
|
1392 TInt retval = KErrNone; |
|
1393 |
|
1394 TTransactionResult ownTransaction = iModel->StartTransactionLC |
|
1395 ( /*aWrite*/ETrue, |
|
1396 /*aShowNote*/ETrue, |
|
1397 /*aRetry*/ETrue |
|
1398 ); |
|
1399 if ( ownTransaction != EFailedWithLocked ) |
|
1400 { |
|
1401 // check the original bearer's type |
|
1402 TApBearerType bearer = iModel->ApUtils()->BearerTypeL( aSelected ); |
|
1403 #ifdef __TEST_LAN_BEARER |
|
1404 if ( bearer == EApBearerTypeLAN ) |
|
1405 { |
|
1406 User::Leave( KErrNotSupported ); |
|
1407 // ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED ); |
|
1408 // User::Leave( KLeaveWithoutAlert ); |
|
1409 } |
|
1410 #endif // __TEST_LAN_BEARER |
|
1411 if ( bearer == EApBearerTypeLANModem ) |
|
1412 { |
|
1413 User::Leave( KErrNotSupported ); |
|
1414 // ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED ); |
|
1415 // User::Leave( KLeaveWithoutAlert ); |
|
1416 } |
|
1417 TBool isprotected( EFalse ); |
|
1418 |
|
1419 TBool protSupported = FeatureManager::FeatureSupported( |
|
1420 KFeatureIdSettingsProtection ); |
|
1421 |
|
1422 if ( protSupported ) |
|
1423 { |
|
1424 isprotected = iModel->ApUtils()->IsReadOnlyL( aSelected ); |
|
1425 isprotected |= CApProtHandler::IsTableProtectedL( |
|
1426 iModel->Database()->Database() ); |
|
1427 } |
|
1428 if ( isprotected ) |
|
1429 { |
|
1430 ShowNoteL( R_APUI_NOTE_PROTECTED_AP_SETT ); |
|
1431 } |
|
1432 if ( !isprotected ) |
|
1433 { |
|
1434 TUint32 aUid = iModel->DataHandler()->CreateCopyFromL( aSelected ); |
|
1435 if ( ownTransaction == EOwnTransaction ) |
|
1436 { |
|
1437 TInt err = iModel->CommitTransaction(); |
|
1438 User::LeaveIfError( err ); |
|
1439 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
1440 } |
|
1441 iEventStore |= KApUiEventCreatedUsedOld; |
|
1442 retval = aUid; |
|
1443 EditAfterCreateL( aUid ); |
|
1444 } |
|
1445 else |
|
1446 { |
|
1447 if ( ownTransaction == EOwnTransaction ) |
|
1448 { |
|
1449 TInt err = iModel->CommitTransaction(); |
|
1450 User::LeaveIfError( err ); |
|
1451 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
1452 } |
|
1453 } |
|
1454 } |
|
1455 |
|
1456 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoHandleApUseOldNewL") |
|
1457 return retval; |
|
1458 } |
|
1459 |
|
1460 |
|
1461 |
|
1462 //---------------------------------------------------------- |
|
1463 // CApSettingsHandlerImpl::SelectApToCopyL |
|
1464 //---------------------------------------------------------- |
|
1465 // |
|
1466 TUint32 CApSettingsHandlerImpl::SelectApToCopyL() |
|
1467 { |
|
1468 APSETUILOGGER_ENTERFN( EApImpl,"Impl::SelectApToCopyL") |
|
1469 |
|
1470 // = KErrNone just to suppress compiler warning C4701 |
|
1471 TUint32 aSelected = KErrNone; |
|
1472 TUint32 retval = KErrNone; |
|
1473 |
|
1474 CApSelQueryDialog* dlg = new ( ELeave ) CApSelQueryDialog( *iModel, |
|
1475 &aSelected ); |
|
1476 TInt iQueryOk = dlg->ExecuteLD( R_LIST_QUERY ); |
|
1477 if ( iQueryOk ) |
|
1478 { |
|
1479 retval = aSelected; |
|
1480 } |
|
1481 |
|
1482 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::SelectApToCopyL") |
|
1483 return retval; |
|
1484 } |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 //---------------------------------------------------------- |
|
1491 // CApSettingsHandlerImpl::DoHandleApBlankNewL |
|
1492 //---------------------------------------------------------- |
|
1493 // |
|
1494 TUint32 CApSettingsHandlerImpl::DoHandleApBlankNewL( TInt aBearers, TInt aIsps ) |
|
1495 { |
|
1496 APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoHandleApBlankNewL") |
|
1497 |
|
1498 CApAccessPointItem* apitem = CApAccessPointItem::NewLC(); |
|
1499 /* |
|
1500 KEApIspTypeInternetOnly: |
|
1501 EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS |
|
1502 |
|
1503 KEApIspTypeInternetAndWAP |
|
1504 EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS |
|
1505 |
|
1506 KEApIspTypeWAPOnly |
|
1507 EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeSMS, EApBearerTypeGPRS |
|
1508 |
|
1509 KEApIspTypeWAPMandatory |
|
1510 EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeSMS, EApBearerTypeGPRS |
|
1511 |
|
1512 KEApIspTypeAll |
|
1513 All |
|
1514 |
|
1515 |
|
1516 EIspTypeInternetOnly, |
|
1517 EIspTypeWAPOnly, |
|
1518 EIspTypeInternetAndWAP |
|
1519 |
|
1520 */ |
|
1521 ChooseBearerTypeL( aBearers, *apitem ); |
|
1522 |
|
1523 if ( aIsps & KEApIspTypeAll ) |
|
1524 { |
|
1525 apitem->WriteUint( EApIspIspType, EIspTypeInternetAndWAP ); |
|
1526 } |
|
1527 else |
|
1528 { |
|
1529 if ( aIsps & KEApIspTypeWAPOnly ) |
|
1530 { // EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS, |
|
1531 apitem->WriteUint( EApIspIspType, EIspTypeWAPOnly ); |
|
1532 } |
|
1533 else |
|
1534 { |
|
1535 if ( aIsps & |
|
1536 ( KEApIspTypeWAPMandatory | KEApIspTypeMMSMandatory ) ) |
|
1537 { // EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS |
|
1538 apitem->WriteUint( EApIspIspType, EIspTypeInternetAndWAP ); |
|
1539 } |
|
1540 else |
|
1541 { |
|
1542 if ( aIsps & KEApIspTypeInternetAndWAP ) |
|
1543 { |
|
1544 apitem->WriteUint( EApIspIspType, EIspTypeInternetAndWAP ); |
|
1545 } |
|
1546 else |
|
1547 { |
|
1548 if ( aIsps & KEApIspTypeInternetOnly ) |
|
1549 { |
|
1550 apitem->WriteUint( EApIspIspType, |
|
1551 EIspTypeInternetOnly ); |
|
1552 } |
|
1553 else |
|
1554 { |
|
1555 __ASSERT_DEBUG( EFalse, Panic( EInvalidIspRequest ) ); |
|
1556 } |
|
1557 } |
|
1558 } |
|
1559 } |
|
1560 } |
|
1561 /* |
|
1562 KEApIspTypeInternetOnly |
|
1563 KEApIspTypeWAPOnly |
|
1564 KEApIspTypeInternetAndWAP |
|
1565 KEApIspTypeWAPMandatory |
|
1566 KEApIspTypeAll |
|
1567 */ |
|
1568 |
|
1569 // apitem->WriteUint( EApIspIspType, EIspTypeInternetOnly ); |
|
1570 |
|
1571 TUint32 aUid( KApNoneUID ); |
|
1572 HBufC* buf = HBufC::NewLC( KApMaxConnNameLength ); |
|
1573 TPtr16 ptr( buf->Des() ); |
|
1574 apitem->ReadTextL( EApWapAccessPointName, ptr ); |
|
1575 |
|
1576 TTransactionResult ownTransaction = iModel->StartTransactionLC( |
|
1577 ETrue, // aWrite |
|
1578 ETrue, // aShowNote |
|
1579 ETrue ); // aRetry |
|
1580 if ( ownTransaction != EFailedWithLocked ) |
|
1581 { |
|
1582 if ( iModel->ApUtils()->MakeValidNameL( ptr ) ) |
|
1583 { |
|
1584 apitem->SetNamesL( ptr ); |
|
1585 } |
|
1586 if ( ownTransaction == EOwnTransaction ) |
|
1587 { |
|
1588 TInt err = iModel->CommitTransaction(); |
|
1589 User::LeaveIfError( err ); |
|
1590 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
1591 } |
|
1592 } |
|
1593 |
|
1594 aUid = EditAfterCreateL( KApNoneUID, apitem ); |
|
1595 CleanupStack::PopAndDestroy( 2 ); // apitem, buf |
|
1596 |
|
1597 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoHandleApBlankNewL") |
|
1598 return aUid; |
|
1599 } |
|
1600 |
|
1601 |
|
1602 |
|
1603 |
|
1604 //---------------------------------------------------------- |
|
1605 // CApSettingsHandlerImpl::HandleNetworkDeleteCmdL |
|
1606 //---------------------------------------------------------- |
|
1607 // |
|
1608 void CApSettingsHandlerImpl::HandleNetworkDeleteCmdL( TUint32 aUid ) |
|
1609 { |
|
1610 APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleNetworkDeleteCmdL") |
|
1611 |
|
1612 // check that the Ap is not used so it can be deleted!! |
|
1613 TTransactionResult ownTransaction = iModel->StartTransactionLC( |
|
1614 /*aWrite*/EFalse, |
|
1615 /*aShowNote*/ETrue, |
|
1616 /*aRetry*/ETrue ); |
|
1617 if ( ownTransaction != EFailedWithLocked ) |
|
1618 { |
|
1619 TBool protSupported = FeatureManager::FeatureSupported( |
|
1620 KFeatureIdSettingsProtection ); |
|
1621 if ( protSupported ) |
|
1622 { |
|
1623 TBool isprotected = iModel->ApUtils()->IsReadOnlyL( aUid ); |
|
1624 if ( isprotected ) |
|
1625 { |
|
1626 ShowNoteL( R_APUI_NOTE_PROTECTED_AP ); |
|
1627 return; |
|
1628 } |
|
1629 } |
|
1630 if ( ownTransaction == EOwnTransaction ) |
|
1631 { |
|
1632 TInt err = iModel->CommitTransaction(); |
|
1633 User::LeaveIfError( err ); |
|
1634 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
1635 } |
|
1636 |
|
1637 // not protected, may start wondering about delete... |
|
1638 // simply confirm |
|
1639 |
|
1640 // OOD handling. If disk space is low, |
|
1641 // we try to get some spare. |
|
1642 RFs fs; |
|
1643 User::LeaveIfError( fs.Connect() ); |
|
1644 CleanupClosePushL<RFs>( fs ); |
|
1645 TBool diskLow = SysUtil::FFSSpaceBelowCriticalLevelL |
|
1646 ( &fs, KEstimatedDeleteFfsOverhead ); |
|
1647 RSharedDataClient sdClient; |
|
1648 if ( diskLow ) |
|
1649 { |
|
1650 User::LeaveIfError( sdClient.Connect() ); |
|
1651 CleanupClosePushL<RSharedDataClient>( sdClient ); |
|
1652 sdClient.RequestFreeDiskSpaceLC |
|
1653 ( KEstimatedDeleteFfsOverhead ); |
|
1654 } |
|
1655 // Handle getting the name, showing the query, |
|
1656 // and deleting the network group. |
|
1657 // get the name: |
|
1658 CApNetworkItem* net = CApNetworkItem::NewLC(); |
|
1659 iModel->DataHandler()->ReadNetworkL( aUid, *net ); |
|
1660 HBufC* buf = net->Name().AllocLC(); |
|
1661 if ( AskQueryL( R_APUI_IAP_ARE_YOU_SURE_TO_DEL, buf ) ) |
|
1662 { |
|
1663 iModel->DataHandler()->RemoveNetworkL( aUid ); |
|
1664 } |
|
1665 CleanupStack::PopAndDestroy( buf ); // buf |
|
1666 CleanupStack::PopAndDestroy( net ); |
|
1667 if ( diskLow ) |
|
1668 { |
|
1669 // Cancel RequestFreeDiskSpaceLC (by popping off an destroy); |
|
1670 // close scClient. |
|
1671 CleanupStack::PopAndDestroy( 2 ); |
|
1672 } |
|
1673 CleanupStack::PopAndDestroy(); // fs, will also close it |
|
1674 } |
|
1675 |
|
1676 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleNetworkDeleteCmdL") |
|
1677 } |
|
1678 |
|
1679 |
|
1680 |
|
1681 //---------------------------------------------------------- |
|
1682 // CApSettingsHandlerImpl::GetVariantL |
|
1683 //---------------------------------------------------------- |
|
1684 // |
|
1685 TInt CApSettingsHandlerImpl::GetVariantL() |
|
1686 { |
|
1687 APSETUILOGGER_ENTERFN( EApImpl,"Impl::GetVariantL") |
|
1688 |
|
1689 TInt variant( 0 ); |
|
1690 // Connecting and initialization: |
|
1691 CRepository* repository = |
|
1692 CRepository::NewL( KCRUidApSettingsHandlerUiLV ); |
|
1693 repository->Get( KApSettingsHandlerUiLVFlags, variant ); |
|
1694 delete repository; |
|
1695 |
|
1696 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::GetVariantL") |
|
1697 return variant; |
|
1698 } |
|
1699 |
|
1700 |
|
1701 //---------------------------------------------------------- |
|
1702 // CApSettingsHandlerImpl::ConfirmDeleteL |
|
1703 //---------------------------------------------------------- |
|
1704 // |
|
1705 TInt CApSettingsHandlerImpl::ConfirmDeleteL( TUint32 aUid, TBool aIsLast ) |
|
1706 { |
|
1707 APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConfirmDeleteL") |
|
1708 |
|
1709 TInt retval( 0 ); |
|
1710 HBufC* sgd = HBufC::NewLC( KModifiableTextLength ); |
|
1711 TPtr ptr( sgd->Des() ); |
|
1712 |
|
1713 // OOD handling. If disk space is low, |
|
1714 // we try to get some spare. |
|
1715 RFs fs; |
|
1716 User::LeaveIfError( fs.Connect() ); |
|
1717 CleanupClosePushL<RFs>( fs ); |
|
1718 TBool diskLow = SysUtil::FFSSpaceBelowCriticalLevelL |
|
1719 ( &fs, KEstimatedDeleteFfsOverhead ); |
|
1720 |
|
1721 RSharedDataClient sdClient; |
|
1722 if ( diskLow ) |
|
1723 { |
|
1724 User::LeaveIfError( sdClient.Connect() ); |
|
1725 CleanupClosePushL<RSharedDataClient>( sdClient ); |
|
1726 sdClient.RequestFreeDiskSpaceLC |
|
1727 ( KEstimatedDeleteFfsOverhead ); |
|
1728 } |
|
1729 |
|
1730 TTransactionResult ownTransaction = iModel->StartTransactionLC |
|
1731 ( |
|
1732 /*aWrite*/ETrue, |
|
1733 /*aShowNote*/ETrue, |
|
1734 /*aRetry*/ETrue, |
|
1735 /*aLFFSChecking*/EFalse |
|
1736 ); |
|
1737 if ( ownTransaction != EFailedWithLocked ) |
|
1738 { |
|
1739 iModel->ApUtils()->NameL( aUid, ptr ); |
|
1740 if ( ownTransaction == EOwnTransaction ) |
|
1741 { |
|
1742 TInt err = iModel->CommitTransaction(); |
|
1743 User::LeaveIfError( err ); |
|
1744 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
1745 } |
|
1746 |
|
1747 if ( aIsLast ) |
|
1748 { // we are deleting the last one, needs to confirm |
|
1749 retval = AskQueryL( R_APUI_IAP_DEL_LAST_AP, sgd ); |
|
1750 } |
|
1751 else |
|
1752 { // not the last one, simply confirm |
|
1753 // handle exotic language number conversion here |
|
1754 TPtr t(sgd->Des()); |
|
1755 AknTextUtils::LanguageSpecificNumberConversion( t ); |
|
1756 retval = AskQueryL( R_APUI_IAP_ARE_YOU_SURE_TO_DEL, sgd ); |
|
1757 } |
|
1758 } |
|
1759 |
|
1760 |
|
1761 CleanupStack::PopAndDestroy(); // sgd |
|
1762 if ( diskLow ) |
|
1763 { |
|
1764 // Cancel RequestFreeDiskSpaceLC (by popping off an destroy); |
|
1765 // close scClient. |
|
1766 CleanupStack::PopAndDestroy( 2 ); |
|
1767 } |
|
1768 CleanupStack::PopAndDestroy(); // fs, will also close it |
|
1769 |
|
1770 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConfirmDeleteL") |
|
1771 return retval; |
|
1772 } |
|
1773 |
|
1774 |
|
1775 |
|
1776 |
|
1777 |
|
1778 //---------------------------------------------------------- |
|
1779 // CApSettingsHandlerImpl::HandleRunSettingsL |
|
1780 //---------------------------------------------------------- |
|
1781 // |
|
1782 void CApSettingsHandlerImpl::HandleRunSettingsL( TUint32 aHighLight, |
|
1783 TUint32& aSelected ) |
|
1784 { |
|
1785 APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleRunSettingsL") |
|
1786 |
|
1787 if ( iStartWithSelection == EFalse ) |
|
1788 { |
|
1789 RunViewerL( aHighLight ); |
|
1790 } |
|
1791 else |
|
1792 { |
|
1793 #ifdef __TEST_OOMDEBUG |
|
1794 if ( iMemTestOn ) |
|
1795 { |
|
1796 TInt leavecode( KErrNoMemory ); |
|
1797 TInt state( GetTestStateL() ); |
|
1798 |
|
1799 if ( ( ( |
|
1800 ( iListType == EApSettingsSelListIsPopUp ) || |
|
1801 ( iListType == EApSettingsSelListIsPopUpWithNone ) ) && |
|
1802 ( state == KPopupListTest ) ) |
|
1803 || |
|
1804 ( |
|
1805 ( iListType == EApSettingsSelListIsListPane ) && |
|
1806 ( state == KDialogListTest ) ) ) |
|
1807 { |
|
1808 TBuf<48> buf; |
|
1809 if ( state == KDialogListTest ) |
|
1810 { |
|
1811 APSETUILOGGER_WRITE_BUF( EApImpl, \ |
|
1812 _L("Doing memtest KDialogListTest") ); |
|
1813 } |
|
1814 if ( state == KPopupListTest ) |
|
1815 { |
|
1816 APSETUILOGGER_WRITE_BUF( EApImpl, \ |
|
1817 _L("Doing memtest KPopupListTest") ); |
|
1818 } |
|
1819 TUint32 rate( 0 ); |
|
1820 TUint32 retrycount( KOOMRetryCount ); |
|
1821 TUint32 retryoffset( KOOMRetryOffset ); |
|
1822 for ( |
|
1823 rate = 1; |
|
1824 ((rate < 50000) && (leavecode == KErrNoMemory)) |
|
1825 || retrycount; |
|
1826 rate++ |
|
1827 ) |
|
1828 { |
|
1829 __UHEAP_SETFAIL( RHeap::EDeterministic, rate ); |
|
1830 TRAP( leavecode, |
|
1831 DoRunSettingsL( aHighLight, aSelected ) ); |
|
1832 __UHEAP_RESET; |
|
1833 if ( !leavecode ) |
|
1834 { |
|
1835 retrycount--; |
|
1836 rate += retryoffset; |
|
1837 } |
|
1838 } |
|
1839 User::LeaveIfError( leavecode ); |
|
1840 buf.Format( _L("\t Memtest finished, max. rate was: %d )"), |
|
1841 rate ); |
|
1842 APSETUILOGGER_WRITE_BUF( EApImpl, buf ); |
|
1843 } |
|
1844 else |
|
1845 { |
|
1846 DoRunSettingsL( aHighLight, aSelected ); |
|
1847 } |
|
1848 } |
|
1849 else |
|
1850 { |
|
1851 DoRunSettingsL( aHighLight, aSelected ); |
|
1852 } |
|
1853 #else |
|
1854 DoRunSettingsL( aHighLight, aSelected ); |
|
1855 #endif // __TEST_OOMDEBUG |
|
1856 } |
|
1857 |
|
1858 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleRunSettingsL") |
|
1859 } |
|
1860 |
|
1861 |
|
1862 //---------------------------------------------------------- |
|
1863 // CApSettingsHandlerImpl::ChooseBearerTypeL |
|
1864 //---------------------------------------------------------- |
|
1865 // |
|
1866 void CApSettingsHandlerImpl::ChooseBearerTypeL( TInt aBearers, |
|
1867 CApAccessPointItem& aItem ) |
|
1868 { |
|
1869 APSETUILOGGER_ENTERFN( EApImpl,"Impl::ChooseBearerTypeL") |
|
1870 |
|
1871 // Check for support in each case!!!!! |
|
1872 TBool gprssupported = ETrue; |
|
1873 TBool csdsupported = ETrue; // OK |
|
1874 TBool hscsdsupported = ETrue; // NO WAY TO CHECK IT |
|
1875 TBool wlansupported = ETrue; // OK |
|
1876 TBool lansupported = ETrue; // NO WAY TO CHECK IT |
|
1877 TBool lanmodemsupported = ETrue; // NO WAY TO CHECK IT |
|
1878 TBool cdmasupported = ETrue; // OK |
|
1879 |
|
1880 if ( iExt->iIsFeatureManagerInitialised ) |
|
1881 { |
|
1882 cdmasupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ); |
|
1883 csdsupported = FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ); |
|
1884 wlansupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); |
|
1885 } |
|
1886 |
|
1887 if ( ( ( aBearers & EApBearerTypeAll ) || |
|
1888 ( aBearers & EApBearerTypeGPRS ) ) && |
|
1889 gprssupported ) |
|
1890 { |
|
1891 aItem.SetBearerTypeL( EApBearerTypeGPRS ); |
|
1892 } |
|
1893 else |
|
1894 { |
|
1895 if ( ( ( aBearers & EApBearerTypeAll ) || |
|
1896 ( aBearers & EApBearerTypeHSCSD ) ) |
|
1897 && hscsdsupported ) |
|
1898 { |
|
1899 aItem.SetBearerTypeL( EApBearerTypeHSCSD ); |
|
1900 } |
|
1901 else |
|
1902 { |
|
1903 if ( ( ( aBearers & EApBearerTypeAll ) || |
|
1904 (aBearers & EApBearerTypeCSD ) ) && csdsupported ) |
|
1905 { |
|
1906 aItem.SetBearerTypeL( EApBearerTypeCSD ); |
|
1907 } |
|
1908 else |
|
1909 { |
|
1910 if ( ( ( aBearers & EApBearerTypeAll ) || |
|
1911 ( aBearers & EApBearerTypeWLAN ) ) |
|
1912 && wlansupported ) |
|
1913 { |
|
1914 aItem.SetBearerTypeL( EApBearerTypeWLAN ); |
|
1915 } |
|
1916 else |
|
1917 { |
|
1918 if ( ( ( aBearers & EApBearerTypeAll ) || |
|
1919 ( aBearers & EApBearerTypeLAN ) ) |
|
1920 && lansupported ) |
|
1921 { |
|
1922 aItem.SetBearerTypeL( EApBearerTypeLAN ); |
|
1923 } |
|
1924 else |
|
1925 { |
|
1926 if ( ( ( aBearers & EApBearerTypeAll ) || |
|
1927 ( aBearers & EApBearerTypeLANModem ) ) |
|
1928 && lanmodemsupported ) |
|
1929 { |
|
1930 aItem.SetBearerTypeL( EApBearerTypeLANModem ); |
|
1931 } |
|
1932 else |
|
1933 { |
|
1934 if ( ( ( aBearers & EApBearerTypeAll ) || |
|
1935 ( aBearers & EApBearerTypeCDMA ) ) |
|
1936 && cdmasupported ) |
|
1937 { |
|
1938 aItem.SetBearerTypeL( EApBearerTypeCDMA ); |
|
1939 } |
|
1940 else |
|
1941 { |
|
1942 User::Leave( KErrInvalidBearerType ); |
|
1943 } |
|
1944 } |
|
1945 } |
|
1946 } |
|
1947 } |
|
1948 } |
|
1949 } |
|
1950 |
|
1951 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ChooseBearerTypeL") |
|
1952 } |
|
1953 |
|
1954 |
|
1955 |
|
1956 |
|
1957 //---------------------------------------------------------- |
|
1958 // CApSettingsHandlerImpl::HandleDuplicateL |
|
1959 //---------------------------------------------------------- |
|
1960 // |
|
1961 TUint32 CApSettingsHandlerImpl::HandleDuplicateL( TUint32 aUid ) |
|
1962 { |
|
1963 APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleDuplicateL") |
|
1964 |
|
1965 TUint32 retval(KErrNone); |
|
1966 // so user had chosen something |
|
1967 #ifdef __TEST_OOMDEBUG |
|
1968 if ( iMemTestOn ) |
|
1969 { |
|
1970 TInt leavecode( KErrNoMemory ); |
|
1971 TInt ts( GetTestStateL() ); |
|
1972 if ( ts == KCreateUseExistTest ) |
|
1973 { |
|
1974 TBuf<48> buf; |
|
1975 APSETUILOGGER_WRITE_BUF |
|
1976 ( _L("Starting KCreateUseExistTest memtest") ); |
|
1977 TUint32 rate( 0 ); |
|
1978 TUint32 retrycount( KOOMRetryCount ); |
|
1979 TUint32 retryoffset( KOOMRetryOffset ); |
|
1980 for ( |
|
1981 rate = 1; |
|
1982 ((rate < 50000) && (leavecode == KErrNoMemory)) |
|
1983 || retrycount; |
|
1984 rate++ |
|
1985 ) |
|
1986 { |
|
1987 __UHEAP_SETFAIL( RHeap::EDeterministic, rate ); |
|
1988 TRAP( leavecode, retval = DoHandleApUseOldNewL( aUid ) ); |
|
1989 __UHEAP_RESET; |
|
1990 if ( !leavecode ) |
|
1991 { |
|
1992 retrycount--; |
|
1993 rate += retryoffset; |
|
1994 } |
|
1995 } |
|
1996 User::LeaveIfError( leavecode ); |
|
1997 buf.Format( _L("\t Memtest finished, max. rate was: %d )"), |
|
1998 rate ); |
|
1999 APSETUILOGGER_WRITE_BUF( EApImpl, buf ); |
|
2000 } |
|
2001 else |
|
2002 { |
|
2003 retval = DoHandleApUseOldNewL( aUid ); |
|
2004 } |
|
2005 } |
|
2006 else |
|
2007 { |
|
2008 retval = DoHandleApUseOldNewL( aUid ); |
|
2009 } |
|
2010 #else |
|
2011 retval = DoHandleApUseOldNewL( aUid ); |
|
2012 #endif // __TEST_OOMDEBUG |
|
2013 |
|
2014 APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleDuplicateL") |
|
2015 return retval; |
|
2016 } |
|
2017 |
|
2018 |
|
2019 // End of File |
|
2020 |
|