iaupdate/IAD/ui/src/iaupdatesettingdialog.cpp
changeset 29 26b6f0522fd8
parent 25 98b66e4fb0be
child 30 398876c4ffa7
child 33 8110bf1194d1
equal deleted inserted replaced
25:98b66e4fb0be 29:26b6f0522fd8
     1 /*
       
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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     TUint32 ignore = KErrNone;
       
   430     User::LeaveIfError( cenrep->CommitTransaction( ignore ) );
       
   431     CleanupStack::PopAndDestroy(); // CleanupCancelTransactionPushL()
       
   432     CleanupStack::PopAndDestroy( cenrep );
       
   433 	}
       
   434 	
       
   435 	
       
   436 
       
   437 
       
   438 
       
   439 /******************************************************************************
       
   440  * class CIAUpdateSettingItemList
       
   441  ******************************************************************************/
       
   442 
       
   443 
       
   444 // -----------------------------------------------------------------------------
       
   445 // CIAUpdateSettingItemList::CreateSettingItemL
       
   446 // 
       
   447 // -----------------------------------------------------------------------------
       
   448 //
       
   449 CAknSettingItem* CIAUpdateSettingItemList::CreateSettingItemL( TInt aSettingId )
       
   450     {
       
   451     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateSettingItemList::CreateSettingItemL begin");
       
   452     CRepository* cenrep = CRepository::NewLC( KCRUidIAUpdateSettings );
       
   453     CAknSettingItem* item = NULL;
       
   454     
       
   455     switch ( aSettingId )
       
   456         {
       
   457         case EIAUpdateSettingAccessPoint:
       
   458             {
       
   459             User::LeaveIfError( cenrep->Get( KIAUpdateAccessPoint, iAccessPoint ) );
       
   460             IAUPDATE_TRACE_1("[IAUPDATE] CIAUpdateSettingItemList::CreateSettingItemL iAccessPoint: %d", iAccessPoint);
       
   461             if ( iAccessPoint == -1 )
       
   462                 {
       
   463                 // -1 was just our private representation in cenrep of the default destination  
       
   464                 // Let's handle it as it was 0
       
   465                 iAccessPoint = 0;
       
   466                 }
       
   467             item = CIAUpdateAccessPointSettingItem::NewL( aSettingId, iAccessPoint );
       
   468             break;
       
   469             }
       
   470 
       
   471         case EIAUpdateSettingAutoUpdateCheck:
       
   472             {
       
   473             User::LeaveIfError( cenrep->Get( KIAUpdateAutoUpdateCheck, iAutoUpdateCheck ) );
       
   474             item = new (ELeave) CAknEnumeratedTextPopupSettingItem
       
   475                                ( aSettingId, iAutoUpdateCheck );
       
   476             break;
       
   477             }
       
   478 
       
   479         default:
       
   480             {
       
   481             item = new (ELeave) CAknSettingItem( aSettingId );
       
   482             break;
       
   483             }
       
   484         }
       
   485     CleanupStack::PopAndDestroy( cenrep ); 
       
   486     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateSettingItemList::CreateSettingItemL end");
       
   487     return item;
       
   488     }
       
   489 
       
   490 
       
   491 // -----------------------------------------------------------------------------
       
   492 // CIAUpdateSettingItemList::LoadSettingsL
       
   493 // 
       
   494 // -----------------------------------------------------------------------------
       
   495 //
       
   496 void CIAUpdateSettingItemList::LoadSettingsL()
       
   497     {
       
   498     CAknSettingItemList::LoadSettingsL();
       
   499     }
       
   500 
       
   501 
       
   502 // -----------------------------------------------------------------------------
       
   503 // CIAUpdateSettingItemList::EditItemL
       
   504 // 
       
   505 // -----------------------------------------------------------------------------
       
   506 //
       
   507 void CIAUpdateSettingItemList::EditItemL( TInt aIndex, TBool aCalledFromMenu )
       
   508     {
       
   509     CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu );
       
   510     }
       
   511 
       
   512 // -----------------------------------------------------------------------------
       
   513 // CIAUpdateSettingItemList::SetAttribute
       
   514 // 
       
   515 // -----------------------------------------------------------------------------
       
   516 //
       
   517 
       
   518 // -----------------------------------------------------------------------------
       
   519 // CIAUpdateSettingItemList::Attribute
       
   520 // 
       
   521 // -----------------------------------------------------------------------------
       
   522 //
       
   523 TInt CIAUpdateSettingItemList::Attribute( TInt aKey )
       
   524     {
       
   525     TInt ret = KErrNotFound;
       
   526     
       
   527     switch ( aKey )
       
   528         {
       
   529         case CIAUpdateSettingDialog::EAccessPoint:
       
   530             {
       
   531             ret = iAccessPoint;
       
   532             break;
       
   533             }
       
   534         case CIAUpdateSettingDialog::EAutoUpdateCheck:
       
   535             {
       
   536             ret = iAutoUpdateCheck;
       
   537             break;
       
   538             }
       
   539         default:
       
   540             {
       
   541             IAUpdateDialogUtil::Panic( KErrNotSupported );
       
   542             break;
       
   543             }
       
   544         }
       
   545         
       
   546     return ret;
       
   547     }
       
   548 
       
   549 
       
   550 // -----------------------------------------------------------------------------
       
   551 // CIAUpdateSettingItemList::CheckSettings
       
   552 // 
       
   553 // -----------------------------------------------------------------------------
       
   554 //
       
   555 void CIAUpdateSettingItemList::CheckSettings()
       
   556     {
       
   557     if ( iAutoUpdateCheck != EIAUpdateSettingValueDisable &&
       
   558          iAutoUpdateCheck != EIAUpdateSettingValueDisableWhenRoaming &&
       
   559          iAutoUpdateCheck != EIAUpdateSettingValueEnable )
       
   560         {
       
   561         iAutoUpdateCheck = EIAUpdateSettingValueEnable;
       
   562         }
       
   563     }
       
   564 
       
   565 
       
   566 
       
   567 /******************************************************************************
       
   568  * class CIAUpdateAccessPointSettingItem
       
   569  ******************************************************************************/
       
   570 
       
   571 // -----------------------------------------------------------------------------
       
   572 // CIAUpdateAccessPointSettingItem::NewL
       
   573 //
       
   574 // -----------------------------------------------------------------------------
       
   575 //
       
   576 CIAUpdateAccessPointSettingItem* CIAUpdateAccessPointSettingItem::NewL(
       
   577                    TInt aSettingId, TInt& aAccessPointId )
       
   578     {
       
   579     CIAUpdateAccessPointSettingItem* item = 
       
   580     new (ELeave) CIAUpdateAccessPointSettingItem( aSettingId, aAccessPointId );
       
   581     CleanupStack::PushL(item);
       
   582     item->ConstructL();
       
   583     CleanupStack::Pop(item);
       
   584     return item;
       
   585 	}
       
   586 
       
   587 // -----------------------------------------------------------------------------
       
   588 // CIAUpdateAccessPointSettingItem::CIAUpdateAccessPointSettingItem
       
   589 //
       
   590 // -----------------------------------------------------------------------------
       
   591 //
       
   592 CIAUpdateAccessPointSettingItem::CIAUpdateAccessPointSettingItem( 
       
   593                                  TInt aSettingId, TInt& aAccessPointId )
       
   594 :   CAknSettingItem( aSettingId ), 
       
   595     iAccessPointId ( aAccessPointId )
       
   596     {
       
   597     }
       
   598 
       
   599 
       
   600 // -----------------------------------------------------------------------------
       
   601 // CIAUpdateAccessPointSettingItem::~CIAUpdateAccessPointSettingItem
       
   602 // 
       
   603 // -----------------------------------------------------------------------------
       
   604 //
       
   605 CIAUpdateAccessPointSettingItem::~CIAUpdateAccessPointSettingItem()
       
   606     {
       
   607     delete iSettingText;
       
   608     delete iApHandler;
       
   609     }
       
   610 
       
   611 
       
   612 // -----------------------------------------------------------------------------
       
   613 // CIAUpdateAccessPointSettingItem::ConstructL
       
   614 //
       
   615 // -----------------------------------------------------------------------------
       
   616 //
       
   617 void CIAUpdateAccessPointSettingItem::ConstructL()
       
   618     {
       
   619     iApHandler = CIAUpdateAccessPointHandler::NewL();
       
   620      
       
   621     if ( iAccessPointId == 0 )
       
   622         {
       
   623     	iApHandler->GetDefaultConnectionLabelL( iSettingText );
       
   624         }
       
   625     else
       
   626         {
       
   627         TRAPD( err, iApHandler->GetApNameL( iAccessPointId, iSettingText ) );
       
   628         if ( err == KErrNotFound )
       
   629             { // destination stored by IAD may be removed
       
   630             iAccessPointId = 0;
       
   631             iApHandler->GetDefaultConnectionLabelL( iSettingText );
       
   632             }
       
   633         else
       
   634             {
       
   635             User::LeaveIfError( err );
       
   636             }
       
   637         }
       
   638     } 
       
   639 
       
   640 
       
   641 // -----------------------------------------------------------------------------
       
   642 // CIAUpdateAccessPointSettingItem::EditItemL
       
   643 // 
       
   644 // -----------------------------------------------------------------------------
       
   645 //
       
   646 void CIAUpdateAccessPointSettingItem::EditItemL( TBool /*aCalledFromMenu*/ )
       
   647     {
       
   648     EditAccessPointItemL();
       
   649     }
       
   650 
       
   651 
       
   652 // -----------------------------------------------------------------------------
       
   653 // CIAUpdateAccessPointSettingItem::SettingTextL
       
   654 // 
       
   655 // -----------------------------------------------------------------------------
       
   656 //
       
   657 const TDesC& CIAUpdateAccessPointSettingItem::SettingTextL()
       
   658     {
       
   659     if ( !iSettingText )
       
   660         {
       
   661     	return CAknSettingItem::SettingTextL();
       
   662         }
       
   663     else if ( iSettingText->Length() == 0 )
       
   664         {
       
   665         return CAknSettingItem::SettingTextL();
       
   666         }
       
   667         
       
   668     return *iSettingText;
       
   669     }
       
   670 
       
   671 
       
   672 //------------------------------------------------------------------------------
       
   673 // CIAUpdateAccessPointSettingItem::EditAccessPointItemL
       
   674 //
       
   675 //------------------------------------------------------------------------------
       
   676 //	
       
   677 TBool CIAUpdateAccessPointSettingItem::EditAccessPointItemL()
       
   678     {
       
   679 	TInt itemUid = iAccessPointId;
       
   680 	
       
   681 	TInt ret = KErrNone;
       
   682 	
       
   683 	delete iSettingText;
       
   684 	iSettingText = NULL;
       
   685 	TRAPD( err, ret = iApHandler->ShowApSelectDialogL( itemUid, iSettingText ) );
       
   686 	
       
   687 	if ( err != KErrNone )
       
   688 	    {
       
   689 	    iAccessPointId = KErrNotFound;
       
   690 	    UpdateListBoxTextL(); // from CAknSettingItem
       
   691 	    return EFalse;
       
   692 	    }
       
   693 	
       
   694 	if ( ret == CIAUpdateAccessPointHandler::EDialogSelect )
       
   695 		{
       
   696 		iAccessPointId = itemUid;
       
   697  	    UpdateListBoxTextL(); // from CAknSettingItem
       
   698 	    return ETrue;
       
   699 		}
       
   700 		
       
   701 	return EFalse;
       
   702     }
       
   703 
       
   704 	
       
   705 //  End of File