|
1 /* |
|
2 * Copyright (c) 2007-2008 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include "iaupdatesettingdialog.h" |
|
24 #include "iaupdateaccesspointhandler.h" |
|
25 #include "iaupdatestatuspanehandler.h" |
|
26 #include "iaupdateapplication.h" |
|
27 #include "iaupdate.hrh" |
|
28 #include "iaupdateprivatecrkeys.h" |
|
29 #include "iaupdatedebug.h" |
|
30 #include <iaupdate.rsg> |
|
31 |
|
32 #include <centralrepository.h> |
|
33 #include <featmgr.h> |
|
34 #include <hlplch.h> |
|
35 |
|
36 |
|
37 _LIT( KSWUPDATE_HLP_SETTINGS, "SWUPDATE_HLP_SETTINGS" ); |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 // cenrep in emulator: |
|
43 // copy 2000F85A.txt to '\epoc32\release\winscw\udeb\Z\private\10202be9\' |
|
44 // delete 2000F85A.txt from 'epoc32\winscw\c\private\10202be9\persists' |
|
45 // |
|
46 // cenrep in hardware: |
|
47 // copy 2000F85A.txt to '\epoc32\data\Z\private\10202be9' |
|
48 // |
|
49 |
|
50 |
|
51 |
|
52 /****************************************************************************** |
|
53 * class CIAUpdateSettingDialog |
|
54 ******************************************************************************/ |
|
55 |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CIAUpdateSettingDialog::ShowDialogL |
|
59 // |
|
60 // ----------------------------------------------------------------------------- |
|
61 TBool CIAUpdateSettingDialog::ShowDialogL() |
|
62 { |
|
63 //__UHEAP_MARK; |
|
64 |
|
65 CIAUpdateSettingDialog* dialog = CIAUpdateSettingDialog::NewL(); |
|
66 |
|
67 TBool ret = dialog->ExecuteLD( R_IAUPDATE_SETTING_DIALOG ); |
|
68 |
|
69 //__UHEAP_MARKEND; |
|
70 |
|
71 return ret; |
|
72 } |
|
73 |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CIAUpdateSettingDialog::NewL |
|
77 // |
|
78 // ----------------------------------------------------------------------------- |
|
79 CIAUpdateSettingDialog* CIAUpdateSettingDialog::NewL() |
|
80 { |
|
81 CIAUpdateSettingDialog* self = new ( ELeave ) CIAUpdateSettingDialog(); |
|
82 CleanupStack::PushL( self ); |
|
83 self->ConstructL(); |
|
84 CleanupStack::Pop( self ); |
|
85 |
|
86 return self; |
|
87 } |
|
88 |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CIAUpdateSettingDialog::CIAUpdateSettingDialog |
|
92 // |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 CIAUpdateSettingDialog::CIAUpdateSettingDialog() |
|
96 { |
|
97 } |
|
98 |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CIAUpdateSettingDialog::ConstructL |
|
102 // |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CIAUpdateSettingDialog::ConstructL() |
|
106 { |
|
107 CAknDialog::ConstructL( R_IAUPDATE_SETTING_DIALOG_MENU ); |
|
108 |
|
109 // get previous title so it can be restored |
|
110 iStatusPaneHandler = CIAUpdateStatusPaneHandler::NewL( iAvkonAppUi ); |
|
111 iStatusPaneHandler->StoreOriginalTitleL(); |
|
112 } |
|
113 |
|
114 |
|
115 // ---------------------------------------------------------------------------- |
|
116 // Destructor |
|
117 // |
|
118 // ---------------------------------------------------------------------------- |
|
119 // |
|
120 CIAUpdateSettingDialog::~CIAUpdateSettingDialog() |
|
121 { |
|
122 delete iStatusPaneHandler; |
|
123 |
|
124 if (iAvkonAppUi) |
|
125 { |
|
126 iAvkonAppUi->RemoveFromStack( this ); |
|
127 } |
|
128 } |
|
129 |
|
130 |
|
131 // --------------------------------------------------------- |
|
132 // CIAUpdateSettingDialog::CreateCustomControlL |
|
133 // --------------------------------------------------------- |
|
134 // |
|
135 SEikControlInfo CIAUpdateSettingDialog::CreateCustomControlL( TInt aControlType ) |
|
136 { |
|
137 SEikControlInfo controlInfo; |
|
138 controlInfo.iControl = NULL; |
|
139 controlInfo.iTrailerTextId = 0; |
|
140 controlInfo.iFlags = 0; |
|
141 |
|
142 switch ( aControlType ) |
|
143 { |
|
144 case EAknCtLastControlId: |
|
145 { |
|
146 controlInfo.iControl = new (ELeave) CIAUpdateSettingItemList(); |
|
147 break; |
|
148 } |
|
149 |
|
150 default: |
|
151 { |
|
152 break; |
|
153 } |
|
154 } |
|
155 return controlInfo; |
|
156 } |
|
157 |
|
158 |
|
159 //------------------------------------------------------------------------------ |
|
160 // CIAUpdateSettingDialog::ActivateL |
|
161 // |
|
162 // Called by system when dialog is activated. |
|
163 //------------------------------------------------------------------------------ |
|
164 // |
|
165 void CIAUpdateSettingDialog::ActivateL() |
|
166 { |
|
167 CAknDialog::ActivateL(); |
|
168 |
|
169 // this cannot be in ConstructL which is executed before dialog is launched |
|
170 iAvkonAppUi->AddToStackL(this); |
|
171 } |
|
172 |
|
173 |
|
174 //------------------------------------------------------------------------------ |
|
175 // CIAUpdateSettingDialog::GetHelpContext |
|
176 // |
|
177 //------------------------------------------------------------------------------ |
|
178 // |
|
179 void CIAUpdateSettingDialog::GetHelpContext( TCoeHelpContext& aContext ) const |
|
180 { |
|
181 aContext.iMajor = KUidIAUpdateApp; |
|
182 aContext.iContext = KSWUPDATE_HLP_SETTINGS; |
|
183 } |
|
184 |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CIAUpdateSettingDialog::HandleListBoxEventL |
|
188 // |
|
189 // ----------------------------------------------------------------------------- |
|
190 void CIAUpdateSettingDialog::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
191 TListBoxEvent /*aEventType*/ ) |
|
192 { |
|
193 } |
|
194 |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // CIAUpdateSettingDialog::PreLayoutDynInitL |
|
198 // |
|
199 // ----------------------------------------------------------------------------- |
|
200 // |
|
201 void CIAUpdateSettingDialog::PreLayoutDynInitL() |
|
202 { |
|
203 iList = (CIAUpdateSettingItemList*) ControlOrNull ( EIAUpdateSettingDialogList ); |
|
204 |
|
205 iList->LoadSettingsL(); // from CAknSettingItemList |
|
206 |
|
207 iStatusPaneHandler->SetTitleL( R_IAUPDATE_SETTING_DIALOG_TITLE ); |
|
208 iStatusPaneHandler->SetNaviPaneTitleL(KNullDesC); |
|
209 } |
|
210 |
|
211 |
|
212 //------------------------------------------------------------------------------ |
|
213 // CIAUpdateSettingDialog::DynInitMenuPaneL |
|
214 // |
|
215 // Called by system before menu is shown. |
|
216 //------------------------------------------------------------------------------ |
|
217 // |
|
218 void CIAUpdateSettingDialog::DynInitMenuPaneL(TInt aResourceID, CEikMenuPane* aMenuPane ) |
|
219 { |
|
220 if( aResourceID == R_IAUPDATE_SETTING_DIALOG_MENU_PANE ) |
|
221 { |
|
222 if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
223 { |
|
224 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); |
|
225 } |
|
226 } |
|
227 } |
|
228 |
|
229 |
|
230 //------------------------------------------------------------------------------ |
|
231 // CIAUpdateSettingDialog::ProcessCommandL |
|
232 // |
|
233 // Handle commands from menu. |
|
234 //------------------------------------------------------------------------------ |
|
235 // |
|
236 void CIAUpdateSettingDialog::ProcessCommandL(TInt aCommandId) |
|
237 { |
|
238 if ( MenuShowing() ) |
|
239 { |
|
240 HideMenu(); |
|
241 } |
|
242 |
|
243 |
|
244 switch ( aCommandId ) |
|
245 { |
|
246 case EAknCmdHelp: |
|
247 { |
|
248 HlpLauncher::LaunchHelpApplicationL( |
|
249 iEikonEnv->WsSession(), |
|
250 iEikonEnv->EikAppUi()->AppHelpContextL() ); |
|
251 break; |
|
252 } |
|
253 |
|
254 case EAknCmdOpen: |
|
255 { |
|
256 EditItemL(); |
|
257 break; |
|
258 } |
|
259 |
|
260 case EAknCmdExit: |
|
261 case EEikCmdExit: |
|
262 { |
|
263 // close dialog and exit calling application |
|
264 iAvkonAppUi->ProcessCommandL( EAknCmdExit ); |
|
265 break; |
|
266 } |
|
267 |
|
268 default: |
|
269 break; |
|
270 } |
|
271 } |
|
272 |
|
273 |
|
274 //------------------------------------------------------------------------------ |
|
275 // CIAUpdateSettingDialog::OkToExitL |
|
276 // |
|
277 //------------------------------------------------------------------------------ |
|
278 // |
|
279 TBool CIAUpdateSettingDialog::OkToExitL(TInt aButtonId) |
|
280 { |
|
281 if ( aButtonId == EEikBidCancel ) |
|
282 { |
|
283 TRAP_IGNORE( SaveSettingsL() ); //potential leave trapped |
|
284 //because IAD is not closed if SaveSettingsL() leaves |
|
285 return ETrue; // close dialog |
|
286 } |
|
287 |
|
288 if ( aButtonId == EAknSoftkeyOpen ) |
|
289 { |
|
290 EditItemL(); |
|
291 |
|
292 return EFalse; // leave dialog open |
|
293 } |
|
294 |
|
295 if ( aButtonId == EAknSoftkeyBack ) |
|
296 { |
|
297 SaveSettingsL(); |
|
298 |
|
299 return ETrue; // close dialog |
|
300 } |
|
301 |
|
302 return CAknDialog::OkToExitL(aButtonId); |
|
303 } |
|
304 |
|
305 |
|
306 |
|
307 // ---------------------------------------------------------------------------- |
|
308 // CIAUpdateSettingDialog::OfferKeyEventL |
|
309 // |
|
310 // ---------------------------------------------------------------------------- |
|
311 // |
|
312 TKeyResponse CIAUpdateSettingDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
313 { |
|
314 if (aType == EEventKey) |
|
315 { |
|
316 switch (aKeyEvent.iCode) |
|
317 { |
|
318 case EKeyEscape: // framework calls this when dialog must shut down |
|
319 { |
|
320 return CAknDialog::OfferKeyEventL(aKeyEvent, aType); |
|
321 } |
|
322 case EKeyUpArrow: |
|
323 case EKeyDownArrow: |
|
324 { |
|
325 break; |
|
326 } |
|
327 default: |
|
328 { |
|
329 break; |
|
330 } |
|
331 } |
|
332 } |
|
333 |
|
334 return CAknDialog::OfferKeyEventL( aKeyEvent, aType); |
|
335 } |
|
336 |
|
337 |
|
338 // ---------------------------------------------------------------------------- |
|
339 // CIAUpdateSettingDialog::HandleResourceChange |
|
340 // |
|
341 // ---------------------------------------------------------------------------- |
|
342 // |
|
343 void CIAUpdateSettingDialog::HandleResourceChange(TInt aType) |
|
344 { |
|
345 if (aType == KEikDynamicLayoutVariantSwitch) //Handle change in layout orientation |
|
346 { |
|
347 TRect mainPaneRect; |
|
348 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); |
|
349 SetRect( mainPaneRect ); |
|
350 |
|
351 iList->HandleResourceChange( aType ); |
|
352 |
|
353 CCoeControl::HandleResourceChange( aType ); |
|
354 DrawDeferred(); |
|
355 return; |
|
356 } |
|
357 |
|
358 if ( aType == KAknsMessageSkinChange ) |
|
359 { |
|
360 } |
|
361 |
|
362 CCoeControl::HandleResourceChange( aType ); |
|
363 } |
|
364 |
|
365 |
|
366 // ---------------------------------------------------------------------------- |
|
367 // CIAUpdateSettingDialog::EditItemL |
|
368 // |
|
369 // ---------------------------------------------------------------------------- |
|
370 // |
|
371 void CIAUpdateSettingDialog::EditItemL() |
|
372 { |
|
373 TInt currentIndex = iList->ListBox()->CurrentItemIndex(); |
|
374 TBool calledFromMenu = ETrue; |
|
375 |
|
376 iList->EditItemL( currentIndex, calledFromMenu ); |
|
377 } |
|
378 |
|
379 |
|
380 // ----------------------------------------------------------------------------- |
|
381 // CIAUpdateSettingDialog::SetVisibility |
|
382 // |
|
383 // ----------------------------------------------------------------------------- |
|
384 // |
|
385 void CIAUpdateSettingDialog::SetVisibility() |
|
386 { |
|
387 } |
|
388 |
|
389 |
|
390 // ----------------------------------------------------------------------------- |
|
391 // CAspContentDialog::SetAllReadOnly |
|
392 // |
|
393 // ----------------------------------------------------------------------------- |
|
394 // |
|
395 void CIAUpdateSettingDialog::SetAllReadOnly() |
|
396 { |
|
397 } |
|
398 |
|
399 |
|
400 // ---------------------------------------------------------------------------- |
|
401 // CIAUpdateSettingDialog::SaveSettingsL |
|
402 // |
|
403 // ---------------------------------------------------------------------------- |
|
404 // |
|
405 void CIAUpdateSettingDialog::SaveSettingsL() |
|
406 { |
|
407 iList->StoreSettingsL(); // from CAknSettingItemList |
|
408 |
|
409 CRepository* cenrep = CRepository::NewLC( KCRUidIAUpdateSettings ); |
|
410 TInt err = cenrep->StartTransaction( CRepository::EReadWriteTransaction ); |
|
411 User::LeaveIfError( err ); |
|
412 cenrep->CleanupCancelTransactionPushL(); |
|
413 |
|
414 |
|
415 TInt num = iList->Attribute( EAccessPoint ); |
|
416 if ( num == 0 ) |
|
417 { |
|
418 // O means default destination. Let's save it as -1 so that we know later on |
|
419 // whether cenrep really contained the default or just nothing. |
|
420 num = -1; |
|
421 } |
|
422 err = cenrep->Set( KIAUpdateAccessPoint, num ); |
|
423 User::LeaveIfError( err ); |
|
424 |
|
425 num = iList->Attribute( EAutoUpdateCheck ); |
|
426 err = cenrep->Set( KIAUpdateAutoUpdateCheck, num ); |
|
427 User::LeaveIfError( err ); |
|
428 |
|
429 num = iList->Attribute( ERoamingWarning ); |
|
430 err = cenrep->Set( KIAUpdateRoamingWarning, num ); |
|
431 User::LeaveIfError( err ); |
|
432 |
|
433 TUint32 ignore = KErrNone; |
|
434 User::LeaveIfError( cenrep->CommitTransaction( ignore ) ); |
|
435 CleanupStack::PopAndDestroy(); // CleanupCancelTransactionPushL() |
|
436 CleanupStack::PopAndDestroy( cenrep ); |
|
437 } |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 /****************************************************************************** |
|
444 * class CIAUpdateSettingItemList |
|
445 ******************************************************************************/ |
|
446 |
|
447 |
|
448 // ----------------------------------------------------------------------------- |
|
449 // CIAUpdateSettingItemList::CreateSettingItemL |
|
450 // |
|
451 // ----------------------------------------------------------------------------- |
|
452 // |
|
453 CAknSettingItem* CIAUpdateSettingItemList::CreateSettingItemL( TInt aSettingId ) |
|
454 { |
|
455 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateSettingItemList::CreateSettingItemL begin"); |
|
456 CRepository* cenrep = CRepository::NewLC( KCRUidIAUpdateSettings ); |
|
457 CAknSettingItem* item = NULL; |
|
458 |
|
459 switch ( aSettingId ) |
|
460 { |
|
461 case EIAUpdateSettingAccessPoint: |
|
462 { |
|
463 User::LeaveIfError( cenrep->Get( KIAUpdateAccessPoint, iAccessPoint ) ); |
|
464 IAUPDATE_TRACE_1("[IAUPDATE] CIAUpdateSettingItemList::CreateSettingItemL iAccessPoint: %d", iAccessPoint); |
|
465 if ( iAccessPoint == -1 ) |
|
466 { |
|
467 // -1 was just our private representation in cenrep of the default destination |
|
468 // Let's handle it as it was 0 |
|
469 iAccessPoint = 0; |
|
470 } |
|
471 item = CIAUpdateAccessPointSettingItem::NewL( aSettingId, iAccessPoint ); |
|
472 break; |
|
473 } |
|
474 |
|
475 case EIAUpdateSettingAutoUpdateCheck: |
|
476 { |
|
477 User::LeaveIfError( cenrep->Get( KIAUpdateAutoUpdateCheck, iAutoUpdateCheck ) ); |
|
478 item = new (ELeave) CAknEnumeratedTextPopupSettingItem |
|
479 ( aSettingId, iAutoUpdateCheck ); |
|
480 break; |
|
481 } |
|
482 |
|
483 case EIAUpdateSettingRoamingWarning: |
|
484 { |
|
485 User::LeaveIfError( cenrep->Get( KIAUpdateRoamingWarning, iRoamingWarning ) ); |
|
486 item = new (ELeave) CAknBinaryPopupSettingItem |
|
487 ( aSettingId, iRoamingWarning ); |
|
488 break; |
|
489 } |
|
490 |
|
491 default: |
|
492 { |
|
493 item = new (ELeave) CAknSettingItem( aSettingId ); |
|
494 break; |
|
495 } |
|
496 } |
|
497 CleanupStack::PopAndDestroy( cenrep ); |
|
498 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateSettingItemList::CreateSettingItemL end"); |
|
499 return item; |
|
500 } |
|
501 |
|
502 |
|
503 // ----------------------------------------------------------------------------- |
|
504 // CIAUpdateSettingItemList::LoadSettingsL |
|
505 // |
|
506 // ----------------------------------------------------------------------------- |
|
507 // |
|
508 void CIAUpdateSettingItemList::LoadSettingsL() |
|
509 { |
|
510 CAknSettingItemList::LoadSettingsL(); |
|
511 } |
|
512 |
|
513 |
|
514 // ----------------------------------------------------------------------------- |
|
515 // CIAUpdateSettingItemList::EditItemL |
|
516 // |
|
517 // ----------------------------------------------------------------------------- |
|
518 // |
|
519 void CIAUpdateSettingItemList::EditItemL( TInt aIndex, TBool aCalledFromMenu ) |
|
520 { |
|
521 CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu ); |
|
522 } |
|
523 |
|
524 // ----------------------------------------------------------------------------- |
|
525 // CIAUpdateSettingItemList::SetAttribute |
|
526 // |
|
527 // ----------------------------------------------------------------------------- |
|
528 // |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // CIAUpdateSettingItemList::Attribute |
|
532 // |
|
533 // ----------------------------------------------------------------------------- |
|
534 // |
|
535 TInt CIAUpdateSettingItemList::Attribute( TInt aKey ) |
|
536 { |
|
537 TInt ret = KErrNotFound; |
|
538 |
|
539 switch ( aKey ) |
|
540 { |
|
541 case CIAUpdateSettingDialog::EAccessPoint: |
|
542 { |
|
543 ret = iAccessPoint; |
|
544 break; |
|
545 } |
|
546 case CIAUpdateSettingDialog::EAutoUpdateCheck: |
|
547 { |
|
548 ret = iAutoUpdateCheck; |
|
549 break; |
|
550 } |
|
551 case CIAUpdateSettingDialog::ERoamingWarning: |
|
552 { |
|
553 ret = iRoamingWarning; |
|
554 break; |
|
555 } |
|
556 default: |
|
557 { |
|
558 IAUpdateDialogUtil::Panic( KErrNotSupported ); |
|
559 break; |
|
560 } |
|
561 } |
|
562 |
|
563 return ret; |
|
564 } |
|
565 |
|
566 |
|
567 // ----------------------------------------------------------------------------- |
|
568 // CIAUpdateSettingItemList::CheckSettings |
|
569 // |
|
570 // ----------------------------------------------------------------------------- |
|
571 // |
|
572 void CIAUpdateSettingItemList::CheckSettings() |
|
573 { |
|
574 if ( iAutoUpdateCheck != EIAUpdateSettingValueDisable && |
|
575 iAutoUpdateCheck != EIAUpdateSettingValueDisableWhenRoaming && |
|
576 iAutoUpdateCheck != EIAUpdateSettingValueEnable ) |
|
577 { |
|
578 iAutoUpdateCheck = EIAUpdateSettingValueEnable; |
|
579 } |
|
580 |
|
581 if ( iRoamingWarning != EIAUpdateSettingValueOff && |
|
582 iRoamingWarning != EIAUpdateSettingValueOn ) |
|
583 { |
|
584 iRoamingWarning = EIAUpdateSettingValueOn; |
|
585 } |
|
586 } |
|
587 |
|
588 |
|
589 |
|
590 /****************************************************************************** |
|
591 * class CIAUpdateAccessPointSettingItem |
|
592 ******************************************************************************/ |
|
593 |
|
594 // ----------------------------------------------------------------------------- |
|
595 // CIAUpdateAccessPointSettingItem::NewL |
|
596 // |
|
597 // ----------------------------------------------------------------------------- |
|
598 // |
|
599 CIAUpdateAccessPointSettingItem* CIAUpdateAccessPointSettingItem::NewL( |
|
600 TInt aSettingId, TInt& aAccessPointId ) |
|
601 { |
|
602 CIAUpdateAccessPointSettingItem* item = |
|
603 new (ELeave) CIAUpdateAccessPointSettingItem( aSettingId, aAccessPointId ); |
|
604 CleanupStack::PushL(item); |
|
605 item->ConstructL(); |
|
606 CleanupStack::Pop(item); |
|
607 return item; |
|
608 } |
|
609 |
|
610 // ----------------------------------------------------------------------------- |
|
611 // CIAUpdateAccessPointSettingItem::CIAUpdateAccessPointSettingItem |
|
612 // |
|
613 // ----------------------------------------------------------------------------- |
|
614 // |
|
615 CIAUpdateAccessPointSettingItem::CIAUpdateAccessPointSettingItem( |
|
616 TInt aSettingId, TInt& aAccessPointId ) |
|
617 : CAknSettingItem( aSettingId ), |
|
618 iAccessPointId ( aAccessPointId ) |
|
619 { |
|
620 } |
|
621 |
|
622 |
|
623 // ----------------------------------------------------------------------------- |
|
624 // CIAUpdateAccessPointSettingItem::~CIAUpdateAccessPointSettingItem |
|
625 // |
|
626 // ----------------------------------------------------------------------------- |
|
627 // |
|
628 CIAUpdateAccessPointSettingItem::~CIAUpdateAccessPointSettingItem() |
|
629 { |
|
630 delete iSettingText; |
|
631 delete iApHandler; |
|
632 } |
|
633 |
|
634 |
|
635 // ----------------------------------------------------------------------------- |
|
636 // CIAUpdateAccessPointSettingItem::ConstructL |
|
637 // |
|
638 // ----------------------------------------------------------------------------- |
|
639 // |
|
640 void CIAUpdateAccessPointSettingItem::ConstructL() |
|
641 { |
|
642 iApHandler = CIAUpdateAccessPointHandler::NewL(); |
|
643 |
|
644 if ( iAccessPointId == 0 ) |
|
645 { |
|
646 iApHandler->GetDefaultConnectionLabelL( iSettingText ); |
|
647 } |
|
648 else |
|
649 { |
|
650 TRAPD( err, iApHandler->GetApNameL( iAccessPointId, iSettingText ) ); |
|
651 if ( err == KErrNotFound ) |
|
652 { // destination stored by IAD may be removed |
|
653 iAccessPointId = 0; |
|
654 iApHandler->GetDefaultConnectionLabelL( iSettingText ); |
|
655 } |
|
656 else |
|
657 { |
|
658 User::LeaveIfError( err ); |
|
659 } |
|
660 } |
|
661 } |
|
662 |
|
663 |
|
664 // ----------------------------------------------------------------------------- |
|
665 // CIAUpdateAccessPointSettingItem::EditItemL |
|
666 // |
|
667 // ----------------------------------------------------------------------------- |
|
668 // |
|
669 void CIAUpdateAccessPointSettingItem::EditItemL( TBool /*aCalledFromMenu*/ ) |
|
670 { |
|
671 EditAccessPointItemL(); |
|
672 } |
|
673 |
|
674 |
|
675 // ----------------------------------------------------------------------------- |
|
676 // CIAUpdateAccessPointSettingItem::SettingTextL |
|
677 // |
|
678 // ----------------------------------------------------------------------------- |
|
679 // |
|
680 const TDesC& CIAUpdateAccessPointSettingItem::SettingTextL() |
|
681 { |
|
682 if ( !iSettingText ) |
|
683 { |
|
684 return CAknSettingItem::SettingTextL(); |
|
685 } |
|
686 else if ( iSettingText->Length() == 0 ) |
|
687 { |
|
688 return CAknSettingItem::SettingTextL(); |
|
689 } |
|
690 |
|
691 return *iSettingText; |
|
692 } |
|
693 |
|
694 |
|
695 //------------------------------------------------------------------------------ |
|
696 // CIAUpdateAccessPointSettingItem::EditAccessPointItemL |
|
697 // |
|
698 //------------------------------------------------------------------------------ |
|
699 // |
|
700 TBool CIAUpdateAccessPointSettingItem::EditAccessPointItemL() |
|
701 { |
|
702 TInt itemUid = iAccessPointId; |
|
703 |
|
704 TInt ret = KErrNone; |
|
705 |
|
706 delete iSettingText; |
|
707 iSettingText = NULL; |
|
708 TRAPD( err, ret = iApHandler->ShowApSelectDialogL( itemUid, iSettingText ) ); |
|
709 |
|
710 if ( err != KErrNone ) |
|
711 { |
|
712 iAccessPointId = KErrNotFound; |
|
713 UpdateListBoxTextL(); // from CAknSettingItem |
|
714 return EFalse; |
|
715 } |
|
716 |
|
717 if ( ret == CIAUpdateAccessPointHandler::EDialogSelect ) |
|
718 { |
|
719 iAccessPointId = itemUid; |
|
720 UpdateListBoxTextL(); // from CAknSettingItem |
|
721 return ETrue; |
|
722 } |
|
723 |
|
724 return EFalse; |
|
725 } |
|
726 |
|
727 |
|
728 // End of File |