locationsystemui/locationsysui/locsuplsettingsui/src/locsuplsettingsuiengine.cpp
branchRCL_3
changeset 55 ea98413ce11f
parent 49 10852b179f64
equal deleted inserted replaced
49:10852b179f64 55:ea98413ce11f
    49 #include "locsuplsettingsuiengobserver.h"
    49 #include "locsuplsettingsuiengobserver.h"
    50 #include "locsuplsettingsadapter.h"
    50 #include "locsuplsettingsadapter.h"
    51 #include "locsuplservereditor.h"
    51 #include "locsuplservereditor.h"
    52 #include "locsuplsessioneditor.h"
    52 #include "locsuplsessioneditor.h"
    53 #include "locsupldebug.h"
    53 #include "locsupldebug.h"
       
    54 #include "locsettingsuiclient.h"   // For the Launch parameter values
    54 
    55 
    55 // Constants
    56 // Constants
    56 const TInt KMaxBufferLength 		= 0x100;
    57 const TInt KMaxBufferLength 		= 0x100;
    57 const TInt KNoofUsageSettings 		= 4;
    58 const TInt KNoofUsageSettings 		= 4;
    58 
    59 
    61 // C++ default constructor.
    62 // C++ default constructor.
    62 // ---------------------------------------------------------------------------
    63 // ---------------------------------------------------------------------------
    63 //
    64 //
    64 CLocSUPLSettingsUiEngine::CLocSUPLSettingsUiEngine( 
    65 CLocSUPLSettingsUiEngine::CLocSUPLSettingsUiEngine( 
    65                             MLocSUPLSettingsUiEngObserver&      aObserver )
    66                             MLocSUPLSettingsUiEngObserver&      aObserver )
    66 	: 	iObserver( aObserver ),
    67 	: CActive( EPriorityStandard ), 
       
    68 	iObserver( aObserver ),
    67 	iConversionBufferPtr( NULL, 0 ),
    69 	iConversionBufferPtr( NULL, 0 ),
    68 	iEditorDlg(NULL),
    70 	iSettingsBufferPtr( NULL, 0 ),
       
    71 	iConnectionMgmtQuery( NULL ),
       
    72 	iCurrentSlpId( -1 ),
       
    73 	iEditorObserver( NULL ),
    69 	iTempAP(-1)
    74 	iTempAP(-1)
    70 	{
    75 	{
    71 	// No implementation
    76 	// No implementation
    72 	}
    77 	}
    73 
    78 
    77 // ---------------------------------------------------------------------------	
    82 // ---------------------------------------------------------------------------	
    78 //
    83 //
    79 CLocSUPLSettingsUiEngine::~CLocSUPLSettingsUiEngine()	
    84 CLocSUPLSettingsUiEngine::~CLocSUPLSettingsUiEngine()	
    80     {
    85     {
    81 	DEBUG( + CLocSUPLSettingsUiEngine::~CLocSUPLSettingsUiEngine );	
    86 	DEBUG( + CLocSUPLSettingsUiEngine::~CLocSUPLSettingsUiEngine );	
    82     
    87     Cancel(); 
       
    88     
       
    89     // Delete the Confirmation query
       
    90     delete iConfirmQuery;
       
    91     iConfirmQuery = NULL;
       
    92     
       
    93     // Delete the ConnectionMgmt query
       
    94     delete iConnectionMgmtQuery;
       
    95     iConnectionMgmtQuery = NULL;
    83     
    96     
    84 	delete iSUPLSettingsAdapter;
    97 	delete iSUPLSettingsAdapter;
    85 	iSUPLSettingsAdapter = NULL;	
    98 	iSUPLSettingsAdapter = NULL;	
    86 	
    99 	
    87 	// Delete the Conversion buffers
   100 	// Delete the Conversion buffers
    88 	delete iConversionBuffer;
   101 	delete iConversionBuffer;
    89 	iConversionBuffer = NULL;
   102 	iConversionBuffer = NULL;
    90 	
   103 	
       
   104 	delete iSettingsBuffer;
       
   105 	iSettingsBuffer = NULL;
    91 	
   106 	
    92 	// Delete the Error handling utilities
   107 	// Delete the Error handling utilities
    93 	delete iTextResolver;
   108 	delete iTextResolver;
    94 	iTextResolver = NULL;
   109 	iTextResolver = NULL;
    95 	DEBUG( - CLocSUPLSettingsUiEngine::~CLocSUPLSettingsUiEngine );	
   110 	DEBUG( - CLocSUPLSettingsUiEngine::~CLocSUPLSettingsUiEngine );	
   140 	DEBUG( + CLocSUPLSettingsUiEngine::ConstructL );	
   155 	DEBUG( + CLocSUPLSettingsUiEngine::ConstructL );	
   141     // Allocate the conversion buffers
   156     // Allocate the conversion buffers
   142     iConversionBuffer = HBufC16::NewL( KMaxBufferLength );
   157     iConversionBuffer = HBufC16::NewL( KMaxBufferLength );
   143     iConversionBufferPtr.Set( iConversionBuffer->Des() );
   158     iConversionBufferPtr.Set( iConversionBuffer->Des() );
   144     
   159     
       
   160     iSettingsBuffer = HBufC::NewL( KMaxBufferLength );
       
   161     iSettingsBufferPtr.Set( iSettingsBuffer->Des());
   145     
   162     
   146     iTextResolver = CTextResolver::NewL( *( CCoeEnv::Static() ) );
   163     iTextResolver = CTextResolver::NewL( *( CCoeEnv::Static() ) );
   147     
   164     
   148     // Create the SUPL Settings API adapter. 
   165     // Create the SUPL Settings API adapter. 
   149     iSUPLSettingsAdapter = CLocSUPLSettingsAdapter::NewL( *this ); 
   166     iSUPLSettingsAdapter = CLocSUPLSettingsAdapter::NewL( *this ); 
   150     
   167     
       
   168     CActiveScheduler::Add( this );
   151 	DEBUG( - CLocSUPLSettingsUiEngine::ConstructL );	
   169 	DEBUG( - CLocSUPLSettingsUiEngine::ConstructL );	
   152      
   170      
   153 	}
   171 	}
   154 
   172 
   155 // ---------------------------------------------------------------------------	
   173 // ---------------------------------------------------------------------------	
   163 	DEBUG( + CLocSUPLSettingsUiEngine::Initalize );	
   181 	DEBUG( + CLocSUPLSettingsUiEngine::Initalize );	
   164     iSUPLSettingsAdapter->Initialize();
   182     iSUPLSettingsAdapter->Initialize();
   165 	DEBUG( - CLocSUPLSettingsUiEngine::Initalize );	
   183 	DEBUG( - CLocSUPLSettingsUiEngine::Initalize );	
   166     }
   184     }
   167             
   185             
   168 
   186 void CLocSUPLSettingsUiEngine::SelectConnectionL()
   169 
   187     {
       
   188 	DEBUG( + CLocSUPLSettingsUiEngine::SelectConnectionL );	
       
   189     if( iDialogActive || IsActive() || iConfirmQuery || iConnectionMgmtQuery )
       
   190         {
       
   191         User::Leave( KErrInUse );
       
   192         }
       
   193     
       
   194     // set the Launch type
       
   195     iLaunchParams = ELocSUPLIAPSelection;
       
   196         
       
   197     // In the case of a framework launching SUPL UI, the user is ignorant 
       
   198     // of the action. Hence, a confirmation dialog is popped up to intimate
       
   199     // the user that he needs to configure SUPL settings.
       
   200     
       
   201     iConfirmQuery = CAknGlobalConfirmationQuery::NewL();
       
   202 
       
   203     CAknSDData* secondaryData = CAknSDData::NewL( KCatUidLocationSuplSettingsUi,
       
   204                                                   ECmdSuplSettingsMissing,
       
   205                                                   KNullDesC8 );
       
   206  
       
   207     // Send the Confirmation query information to the Secondary display
       
   208     // The ownership of 'secondaryData' is taken up by the Global confirmation query
       
   209     iConfirmQuery->SetSecondaryDisplayData( secondaryData );
       
   210      
       
   211     // Load the SUPL IAP confirmation query prompt text from the resource file
       
   212 	HBufC* promptText = StringLoader::LoadL( R_LOC_SUPL_IAP_QUERY );
       
   213 		
       
   214 	// Display the Confirmation query.  
       
   215     iConfirmQuery->ShowConfirmationQueryL( iStatus,
       
   216                                            *promptText,
       
   217                                            R_AVKON_SOFTKEYS_YES_NO__YES,
       
   218                                            R_QGN_NOTE_QUERY_ANIM );
       
   219                                                
       
   220     SetActive();  
       
   221     delete promptText; //    
       
   222     promptText = NULL;
       
   223 	DEBUG( - CLocSUPLSettingsUiEngine::SelectConnectionL );	
       
   224     }
       
   225 
       
   226 // ---------------------------------------------------------------------------
       
   227 // void CLocSUPLSettingsUiEngine::LaunchApConfiguratorL
       
   228 // Launches the Access Point Configurator dialog
       
   229 //
       
   230 // ---------------------------------------------------------------------------
       
   231 //
       
   232 void CLocSUPLSettingsUiEngine::LaunchApConfiguratorL( TInt64 aSlpId, 
       
   233 		MSuplServerEditorObserver* aEditorObserver )
       
   234     {     
       
   235 	DEBUG( + CLocSUPLSettingsUiEngine::LaunchApConfiguratorL );	
       
   236 	iCurrentSlpId =  aSlpId;
       
   237 	iEditorObserver = aEditorObserver;
       
   238 
       
   239     if( iDialogActive )
       
   240         {
       
   241         User::Leave( KErrInUse );
       
   242         }
       
   243         
       
   244     // Zeroing the Temporary buffers so that it doesn't contain any
       
   245     // left over value from the previous access
       
   246     iSettingsBufferPtr.Zero();
       
   247     
       
   248     // Obtain the UID for the selected Access point so that the configurator
       
   249     // can be highlighted
       
   250     TUint32 highlightUid( 0 );
       
   251     
       
   252     // if AP value is NULL, or zero, no temp AP, all previous changes have been frozen.
       
   253     TInt32 tempAP = GetTempAPValue();
       
   254     if ( tempAP == -1)
       
   255         {
       
   256         // Obtain the Server address value from the SUPL settings
       
   257         // API. If the value is set then it has to be shown to the user
       
   258         // as the existing value when he tries to configure the UI
       
   259         TRAP_IGNORE( iSUPLSettingsAdapter->GetIapNameL( iCurrentSlpId, iSettingsBufferPtr ) );
       
   260      
       
   261         TRAPD( error, highlightUid = ConvertIAPNameToIdL( iSettingsBufferPtr ) ); 
       
   262         
       
   263         if( error == KErrNotFound )
       
   264             {
       
   265             highlightUid = 0;
       
   266             }
       
   267         }
       
   268     else
       
   269         {
       
   270         highlightUid = tempAP;
       
   271         }
       
   272     
       
   273  	iConnectionMgmtQuery =  CCmApplicationSettingsUi::NewL();
       
   274  	
       
   275  	iDialogActive = ETrue;
       
   276     TBool ret = EFalse;
       
   277     TCmSettingSelection selectionUid;
       
   278     selectionUid.iId = highlightUid;
       
   279     selectionUid.iResult = CMManager::EConnectionMethod ;
       
   280     TBearerFilterArray filter;
       
   281 	CleanupClosePushL( filter );
       
   282 	
       
   283 	// Need access points for bearer type CSD and Packet data only
       
   284 	filter.AppendL( KUidCSDBearerType );
       
   285 	filter.AppendL( KUidPacketDataBearerType );
       
   286 
       
   287 	// Run CCmApplicationSettingsUi dialog only for Access points (Connection methods)
       
   288 	// selectionUid contains UID to be highlighted, on return it will contain UID of selected CM
       
   289     TRAPD( error, ret = 
       
   290     	iConnectionMgmtQuery->RunApplicationSettingsL( 
       
   291     			selectionUid , CMManager::EShowConnectionMethods, filter 
       
   292     ) ); // | CMManager::EShowAlwaysAsk
       
   293     
       
   294     iDialogActive = EFalse;  
       
   295     if( error == CMManager::KErrConnectionNotFound )
       
   296         {
       
   297         // No AP defined, Show Note                
       
   298         TRAP_IGNORE( ShowNoteL(); )
       
   299         //User::Leave( error );    
       
   300         }   
       
   301     CleanupStack::PopAndDestroy( &filter );   
       
   302     delete iConnectionMgmtQuery;
       
   303     iConnectionMgmtQuery = NULL;  
       
   304     
       
   305     if( ret )
       
   306         {
       
   307         SetTempAPValue(selectionUid.iId);
       
   308         RCmManager cmManager;
       
   309 		cmManager.OpenLC();
       
   310 	
       
   311 		RArray< TUint32 > cmArray;
       
   312 		HBufC* cmName = NULL;
       
   313 		RCmConnectionMethod method;
       
   314 		// Get all the CMs into cmArray
       
   315 		cmManager.ConnectionMethodL( cmArray, ETrue, EFalse );
       
   316 		CleanupClosePushL( cmArray );
       
   317 		
       
   318 		// Get name of selected CM
       
   319 		TInt count = cmArray.Count();
       
   320 		for ( TInt i = 0; i < count; i++ )
       
   321 		    {
       
   322 		    if (selectionUid.iId == cmArray[i] )
       
   323 		    	{
       
   324 		    	method = cmManager.ConnectionMethodL( cmArray[i] );
       
   325 		    	CleanupClosePushL( method );
       
   326 		    	cmName = method.GetStringAttributeL( CMManager::ECmName );
       
   327 		    	CleanupStack::PushL( cmName );
       
   328 		    	iSettingsBufferPtr.Copy( cmName->Des() );
       
   329 		    	CleanupStack::PopAndDestroy( cmName );
       
   330 		    	CleanupStack::PopAndDestroy( &method );
       
   331 		    	break;
       
   332 		    	}		    
       
   333 		    }
       
   334 		CleanupStack::PopAndDestroy( &cmArray );    
       
   335     	CleanupStack::PopAndDestroy( &cmManager );          	
       
   336 
       
   337 		if( iEditorObserver )
       
   338 	       	{
       
   339 	       	iEditorObserver->UpdateIapL( iSettingsBufferPtr );		       	
       
   340 	       	}
       
   341         }
       
   342            
       
   343 	DEBUG( - CLocSUPLSettingsUiEngine::LaunchApConfiguratorL );	
       
   344     }  
       
   345 
       
   346 // ---------------------------------------------------------------------------
       
   347 // void CLocSUPLSettingsUiEngine::LaunchSuplUsageConfiguratorL
       
   348 // Launches the SUPL Usage Configurator
       
   349 //
       
   350 // ---------------------------------------------------------------------------    
       
   351 //
       
   352 void CLocSUPLSettingsUiEngine::LaunchSuplUsageConfiguratorL()
       
   353     {
       
   354 	DEBUG( + CLocSUPLSettingsUiEngine::LaunchSuplUsageConfiguratorL );	
       
   355     if( iDialogActive )
       
   356         {
       
   357         User::Leave( KErrInUse );
       
   358         }
       
   359         
       
   360     // Allocate the descriptor array for Text settings for System
       
   361     // of measurement
       
   362     CDesCArrayFlat* items = new( ELeave ) CDesCArrayFlat( KNoofUsageSettings );
       
   363     CleanupStack::PushL( items );
       
   364 
       
   365     // Allocate all the Settings usage string
       
   366     
       
   367     // Append the radio-button list items
       
   368     items->AppendL( iSUPLSettingsAdapter->Automatic() );
       
   369     items->AppendL( iSUPLSettingsAdapter->AutomaticAtHome() );
       
   370     items->AppendL( iSUPLSettingsAdapter->AlwaysAsk() );
       
   371     items->AppendL( iSUPLSettingsAdapter->Disable() );
       
   372       
       
   373     // Obtain the current value for SUPL settings usage
       
   374     // This would be used for setting the default value for 
       
   375     // the text settings page               
       
   376     TInt currentSettings = iSUPLSettingsAdapter->GetSuplUsageIndex();
       
   377         
       
   378     CAknRadioButtonSettingPage* dlg = 
       
   379                         new ( ELeave )CAknRadioButtonSettingPage( R_LOC_SUPLUSAGE_SETTINGS,
       
   380                                                                   currentSettings, 
       
   381                                                                   items );
       
   382     // Settings Outstanding flag is marked True to enable dismissal incase
       
   383     // of a Cancel event                                                                  
       
   384     iDialogActive = ETrue;                                                                  
       
   385     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   386         {
       
   387         CLocSUPLSettingsAdapter::TLocSuplUsage newValue = 
       
   388                     static_cast<CLocSUPLSettingsAdapter::TLocSuplUsage>( currentSettings );
       
   389                     
       
   390         iSUPLSettingsAdapter->SetSuplUsageL( newValue );
       
   391         }
       
   392     
       
   393     iDialogActive = EFalse;           
       
   394     
       
   395     // Free the items resource
       
   396     CleanupStack::PopAndDestroy( items );   
       
   397 	DEBUG( - CLocSUPLSettingsUiEngine::LaunchSuplUsageConfiguratorL );	
       
   398     }
       
   399 
       
   400 // ---------------------------------------------------------------------------
       
   401 // void CLocSUPLSettingsUiEngine::LaunchIAPDialogL
       
   402 // Launches the IAP Dialog
       
   403 //
       
   404 // ---------------------------------------------------------------------------    
       
   405 //
       
   406 void CLocSUPLSettingsUiEngine::LaunchIAPDialogL( )
       
   407     {
       
   408 	DEBUG( + CLocSUPLSettingsUiEngine::LaunchIAPDialogL );	
       
   409     if( iDialogActive || IsActive() || iConfirmQuery || iConnectionMgmtQuery )
       
   410         {
       
   411         User::Leave( KErrInUse );
       
   412         }
       
   413     
       
   414     // set the Launch type
       
   415     iLaunchParams = ELocSuplIAPDialog;
       
   416      
       
   417     // Self complete
       
   418     SetActive();
       
   419     TRequestStatus* status = &iStatus;
       
   420     User::RequestComplete(status, KErrNone);
       
   421         
       
   422 	DEBUG( - CLocSUPLSettingsUiEngine::LaunchIAPDialogL );	
       
   423     }
   170     
   424     
   171 // ---------------------------------------------------------------------------
   425 // ---------------------------------------------------------------------------
   172 // void CLocSUPLSettingsUiEngine::Close
   426 // void CLocSUPLSettingsUiEngine::Close
   173 // Closes the running Settings UI prematurely.
   427 // Closes the running Settings UI prematurely.
   174 // ---------------------------------------------------------------------------
   428 // ---------------------------------------------------------------------------
   175 //
   429 //
   176 void CLocSUPLSettingsUiEngine::Close()
   430 void CLocSUPLSettingsUiEngine::Close()
   177     {
   431     {
   178 	DEBUG( + CLocSUPLSettingsUiEngine::Close );	
   432 	DEBUG( + CLocSUPLSettingsUiEngine::Close );	
       
   433     Cancel();   
   179     
   434     
   180     // Cancel the Initalization request. This call Cancels if there is an 
   435     // Cancel the Initalization request. This call Cancels if there is an 
   181     // outstanding request. If not, does nothing
   436     // outstanding request. If not, does nothing
   182     iSUPLSettingsAdapter->CancelInitialize();
   437     iSUPLSettingsAdapter->CancelInitialize();
   183      
   438      
       
   439     // If any of the dialogs are active then issue a cancel event on the 
       
   440     // dialogs
       
   441     if( iDialogActive )
       
   442         {
       
   443         TKeyEvent   keyEvent;
       
   444         keyEvent.iCode          = EKeyCBA2;
       
   445         keyEvent.iScanCode      = EStdKeyDevice1;         
       
   446         keyEvent.iModifiers     = EAllModifiers;
       
   447         keyEvent.iRepeats       = 0;
       
   448         CCoeEnv* cCoeEnv = CCoeEnv::Static();
       
   449         
       
   450         // Simulate a Cancel event on the running dialogs. The Simulated event
       
   451         // is for the Left Soft Key.
       
   452         // Ignore the error incase of a leave
       
   453         
       
   454         TRAP_IGNORE( cCoeEnv->SimulateKeyEventL( keyEvent, EEventKey ) );
       
   455         }      
   184 	DEBUG( - CLocSUPLSettingsUiEngine::Close );	
   456 	DEBUG( - CLocSUPLSettingsUiEngine::Close );	
   185     }
   457     }
   186 
   458 
       
   459 // ---------------------------------------------------------------------------
       
   460 // TPtr16 CLocSUPLSettingsAdapter::GetSuplUsage
       
   461 // ---------------------------------------------------------------------------
       
   462 //  
       
   463 TPtr16 CLocSUPLSettingsUiEngine::GetSuplUsageL()
       
   464     {
       
   465 	DEBUG( + CLocSUPLSettingsUiEngine::GetSuplUsageL );	
       
   466     // Zeroing the Temporary buffers so that it doesn't contain any
       
   467     // left over value from the previous access
       
   468     iSettingsBufferPtr.Zero();
       
   469     iConversionBufferPtr.Zero();
       
   470     
       
   471     // Obtain the Settings values from the SUPL settings API
       
   472     iSUPLSettingsAdapter->GetSuplUsageL( iSettingsBufferPtr );
       
   473     iConversionBufferPtr.Copy( iSettingsBufferPtr );
       
   474 	DEBUG( - CLocSUPLSettingsUiEngine::GetSuplUsageL );	
       
   475     return iConversionBufferPtr;
       
   476     }
       
   477     
       
   478 // ---------------------------------------------------------------------------
       
   479 // TInt CLocSUPLSettingsAdapter::GetSuplUsage
       
   480 // ---------------------------------------------------------------------------
       
   481 //
       
   482 TInt CLocSUPLSettingsUiEngine::GetSuplUsage()
       
   483     {
       
   484     return iSUPLSettingsAdapter->GetSuplUsage();
       
   485     }
   187             				
   486             				
   188 // ---------------------------------------------------------------------------
   487 // ---------------------------------------------------------------------------
   189 // void CLocSUPLSettingsUiEngine::HandleSuplSettingsChangeL
   488 // void CLocSUPLSettingsUiEngine::HandleSuplSettingsChangeL
   190 // Inherited from MLocSUPLSettingsAdapterObserver
   489 // Inherited from MLocSUPLSettingsAdapterObserver
   191 // 
   490 // 
   199         static_cast< MLocSUPLSettingsUiEngObserver::TSettingsEventType >( aEvent ) );		
   498         static_cast< MLocSUPLSettingsUiEngObserver::TSettingsEventType >( aEvent ) );		
   200 	DEBUG( - CLocSUPLSettingsUiEngine::HandleSuplSettingsChangeL );	
   499 	DEBUG( - CLocSUPLSettingsUiEngine::HandleSuplSettingsChangeL );	
   201     }
   500     }
   202                                        
   501                                        
   203 // ---------------------------------------------------------------------------
   502 // ---------------------------------------------------------------------------
       
   503 // void CLocSUPLSettingsUiEngine::RunL()
       
   504 //
       
   505 // ---------------------------------------------------------------------------
       
   506 //
       
   507 void CLocSUPLSettingsUiEngine::RunL()
       
   508     {    
       
   509 	DEBUG( + CLocSUPLSettingsUiEngine::RunL );	
       
   510     // If the Confirmation query is present then we have to Pop up the 
       
   511     // IAP Selection dialog based on User Action
       
   512     if( iConfirmQuery && iLaunchParams == ELocSUPLIAPSelection )
       
   513         {        
       
   514         // Incase there has been a response from the User then the Key pressed
       
   515         // is present in the iStatus variable 
       
   516         if( EAknSoftkeyYes == iStatus.Int() )
       
   517             {
       
   518 	        iObserver.HandleSettingsEventL( 
       
   519 	                MLocSUPLSettingsUiEngObserver::EIAPSelectionComplete );                       
       
   520             }
       
   521         else
       
   522             {
       
   523             iObserver.HandleSettingsEventL( 
       
   524                     MLocSUPLSettingsUiEngObserver::EIAPSelectionCancelled );
       
   525             }
       
   526         
       
   527         // Destroy the IAP confirmation query handle    
       
   528         delete iConfirmQuery;
       
   529         iConfirmQuery = NULL;
       
   530         }
       
   531     else if( iLaunchParams == ELocSuplIAPDialog )    // Launch IAP Dialog
       
   532         {
       
   533         // Launch Access Point dialog to get the access point
       
   534         TRAPD(err, LaunchApConfiguratorL(KErrNotFound, NULL) );
       
   535         
       
   536         // Update the Access points for all the Slp whose AP is missing.
       
   537         if( KErrNone == err )
       
   538             TRAP(err, UpdateMissingIAPL( iSettingsBufferPtr ) );
       
   539             
       
   540         // Incase of any errors.
       
   541         if( KErrNone == err )
       
   542             {
       
   543 	        iObserver.HandleSettingsEventL( 
       
   544 	                MLocSUPLSettingsUiEngObserver::EIAPSelectionComplete );                       
       
   545             }
       
   546         else
       
   547             {
       
   548             iObserver.HandleSettingsEventL( 
       
   549                     MLocSUPLSettingsUiEngObserver::EIAPSelectionCancelled );
       
   550             }
       
   551         }
       
   552      else
       
   553         {
       
   554           iObserver.HandleSettingsEventL( 
       
   555                       MLocSUPLSettingsUiEngObserver::EIAPSelectionCancelled );
       
   556         }
       
   557         
       
   558 	DEBUG( - CLocSUPLSettingsUiEngine::RunL );	
       
   559     }
       
   560 
       
   561 // ---------------------------------------------------------------------------
       
   562 // void CLocSUPLSettingsUiEngine::DoCancel()
       
   563 //
       
   564 // ---------------------------------------------------------------------------
       
   565 //    
       
   566 void CLocSUPLSettingsUiEngine::DoCancel()    
       
   567     {
       
   568 	DEBUG( + CLocSUPLSettingsUiEngine::DoCancel );	
       
   569     if( iConfirmQuery )
       
   570         {
       
   571         // If the confirmation query is running Cancel the query
       
   572         iConfirmQuery->CancelConfirmationQuery();
       
   573         
       
   574         delete iConfirmQuery;
       
   575         iConfirmQuery = NULL;
       
   576         
       
   577         }
       
   578         
       
   579     if( iConnectionMgmtQuery )
       
   580         {
       
   581         delete iConnectionMgmtQuery;
       
   582         iConnectionMgmtQuery = NULL;
       
   583         }
       
   584         
       
   585 	DEBUG( - CLocSUPLSettingsUiEngine::DoCancel );	
       
   586     }
       
   587     
       
   588 // ---------------------------------------------------------------------------
   204 // void CLocSUPLSettingsUiEngine::GenerateHslpAddressFromImsi()
   589 // void CLocSUPLSettingsUiEngine::GenerateHslpAddressFromImsi()
   205 //
   590 //
   206 // ---------------------------------------------------------------------------
   591 // ---------------------------------------------------------------------------
   207 //    
   592 //    
   208 void CLocSUPLSettingsUiEngine::GenerateHslpAddressFromImsi(TDes& aIMSIAddress)    
   593 void CLocSUPLSettingsUiEngine::GenerateHslpAddressFromImsi(TDes& aIMSIAddress)    
   210 	DEBUG( + CLocSUPLSettingsUiEngine::DoCancel );	
   595 	DEBUG( + CLocSUPLSettingsUiEngine::DoCancel );	
   211   iSUPLSettingsAdapter->GenerateHslpAddressFromImsi(aIMSIAddress);
   596   iSUPLSettingsAdapter->GenerateHslpAddressFromImsi(aIMSIAddress);
   212 	DEBUG( - CLocSUPLSettingsUiEngine::DoCancel );	
   597 	DEBUG( - CLocSUPLSettingsUiEngine::DoCancel );	
   213     }
   598     }
   214 
   599 
       
   600 // ---------------------------------------------------------------------------
       
   601 // void CLocSUPLSettingsUiEngine::UpdateMissingIAPL()
       
   602 // Updates Access point for ALL SLPs which do not have AP defined.
       
   603 // 
       
   604 // ---------------------------------------------------------------------------
       
   605 //
       
   606 void CLocSUPLSettingsUiEngine::UpdateMissingIAPL(const TDesC& aAccessPoint )
       
   607     {
       
   608     // return if there is no access point in aAccessPoint
       
   609     if( aAccessPoint.Length() <=0 )
       
   610         return;
       
   611         
       
   612     RPointerArray<CServerParams> serverParamValues;
       
   613     CleanupClosePushL( serverParamValues );
       
   614     
       
   615     GetAllSlpL( serverParamValues );
       
   616     
       
   617     HBufC* hslpAddr = HBufC::NewLC( KMaxHSLPAddrLen );    
       
   618     HBufC* iapName 	= HBufC::NewLC( KMaxIAPLen );
       
   619     TInt64 slpId;
       
   620     TBool enabledFlag, simChangeFlag, usageInHomeNwFlag, editFlag;    
       
   621     
       
   622     TInt count = serverParamValues.Count();
       
   623     for( TInt i=0; i<count; i++ )
       
   624 	    {
       
   625 	    // Zero the buffer contents
       
   626 	    hslpAddr->Des().Zero();
       
   627 	    iapName->Des().Zero();
       
   628         
       
   629 	    // Get Server detils
       
   630         TInt errParams = serverParamValues[i]->Get(
       
   631         							slpId, 
       
   632         							hslpAddr->Des(), 
       
   633         							iapName->Des(), 
       
   634         							enabledFlag, 
       
   635         							simChangeFlag, 
       
   636         							usageInHomeNwFlag, 
       
   637         							editFlag
       
   638         						);
       
   639         				
       
   640         // Update IAP name if it is not present.		
       
   641         if( errParams == KErrNone && iapName->Length() <= 0 )
       
   642             {
       
   643             SetIapNameL( slpId, aAccessPoint );
       
   644             }
       
   645 	    }
       
   646     
       
   647     CleanupStack::PopAndDestroy(2); // hslpAddr, iapName
       
   648     CleanupStack::PopAndDestroy( &serverParamValues ); // serverParamValues
       
   649     }
   215 
   650 
   216 // ---------------------------------------------------------------------------
   651 // ---------------------------------------------------------------------------
   217 // TUint CLocSUPLSettingsUiEngine::ConvertIAPNameToIdL()
   652 // TUint CLocSUPLSettingsUiEngine::ConvertIAPNameToIdL()
   218 // Obtains the index UID corresponding to the Access point name
   653 // Obtains the index UID corresponding to the Access point name
   219 // 
   654 // 
   287     CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote;
   722     CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote;
   288     TRAP_IGNORE( errorNote->ExecuteLD( buffer ) );
   723     TRAP_IGNORE( errorNote->ExecuteLD( buffer ) );
   289 	DEBUG( - CLocSUPLSettingsUiEngine::DisplayErrorL );	
   724 	DEBUG( - CLocSUPLSettingsUiEngine::DisplayErrorL );	
   290     }
   725     }
   291     
   726     
       
   727 // ---------------------------------------------------------------------------
       
   728 // void CLocSUPLSettingsUiEngine::ShowNoteL()
       
   729 // Displays No access point defined note
       
   730 //
       
   731 // @param None
       
   732 // ---------------------------------------------------------------------------
       
   733 //
       
   734 TInt CLocSUPLSettingsUiEngine::ShowNoteL()
       
   735     {
       
   736 	DEBUG( + CLocSUPLSettingsUiEngine::ShowNoteL );	
       
   737     // Show Info Note "No Access Points Defined"       
       
   738     HBufC* tmp = StringLoader::LoadL( R_LOC_NO_AP_DEFINED );
       
   739     CleanupStack::PushL( tmp );    
       
   740     CAknNoteDialog* dlg =
       
   741         new ( ELeave ) CAknNoteDialog
       
   742                 (
       
   743                  REINTERPRET_CAST( CEikDialog**, &dlg ),
       
   744                  CAknNoteDialog::ENoTone,
       
   745                  CAknNoteDialog::EShortTimeout
       
   746                 );
       
   747     dlg->PrepareLC( R_GENERAL_NOTE );  
       
   748     dlg->SetTextL( *tmp );
       
   749     TInt retval = dlg->RunLD();
       
   750     CleanupStack::PopAndDestroy( tmp );  // temp    
       
   751 	DEBUG( - CLocSUPLSettingsUiEngine::ShowNoteL );	
       
   752     return retval;
       
   753     }
   292 
   754 
   293 // ---------------------------------------------------------------------------
   755 // ---------------------------------------------------------------------------
   294 // void CLocSUPLSettingsUiEngine::EditServerL()
   756 // void CLocSUPLSettingsUiEngine::EditServerL()
   295 // Displays No access point defined note
   757 // Displays No access point defined note
   296 //
   758 //
   298 // @param aSlpId
   760 // @param aSlpId
   299 // ---------------------------------------------------------------------------
   761 // ---------------------------------------------------------------------------
   300 //
   762 //
   301 void CLocSUPLSettingsUiEngine::EditServerL( TBool iIsEditable, TInt64 aSlpId )
   763 void CLocSUPLSettingsUiEngine::EditServerL( TBool iIsEditable, TInt64 aSlpId )
   302     {
   764     {
   303     DEBUG( + CLocSUPLSettingsUiEngine::EditServerL );
   765 	DEBUG( + CLocSUPLSettingsUiEngine::EditServerL );		
   304     if (iEditorDlg)
   766 	if( iEditorDlg )
   305         {
   767 		{		
   306         delete iEditorDlg;
   768 		delete iEditorDlg;
   307         iEditorDlg = NULL;
   769 		iEditorDlg = NULL;
   308         }
   770 		}
   309     iEditorDlg = CLocSUPLServerEditor::NewL(iIsEditable, *this, aSlpId);
   771     iEditorDlg = CLocSUPLServerEditor::NewL( iIsEditable, *this, aSlpId );
   310     if (aSlpId > 0)
       
   311         {
       
   312         CServerParams *params = CServerParams::NewL();
       
   313         CleanupStack::PushL(params);
       
   314         GetSlpInfoFromIdL(aSlpId, params);
       
   315 
       
   316         HBufC* hslpAddr = HBufC::NewLC(KMaxHSLPAddrLen);
       
   317         HBufC* iapName = HBufC::NewLC(KMaxIAPLen);
       
   318         TInt64 slpId;
       
   319         TBool enabledFlag, simChangeFlag, usageInHomeNwFlag, editFlag;
       
   320 
       
   321         TInt errParams = params->Get(slpId, hslpAddr->Des(), iapName->Des(),
       
   322                 enabledFlag, simChangeFlag, usageInHomeNwFlag, editFlag);
       
   323         if (iapName->Length() > 0)
       
   324             {
       
   325             iEditorDlg->SetAccessPointEnabled(ETrue);
       
   326             }
       
   327 
       
   328         CleanupStack::PopAndDestroy(3, params);
       
   329         }
       
   330     
       
   331     TInt error = iEditorDlg->ExecuteLD();
   772     TInt error = iEditorDlg->ExecuteLD();
   332     if (EEikCmdExit == error)
   773     if ( EEikCmdExit == error )
   333         {
   774         {
   334         ((CAknViewAppUi*) CEikonEnv::Static()->EikAppUi())->HandleCommandL(
   775         ( ( CAknViewAppUi* ) CEikonEnv::Static()->EikAppUi())->HandleCommandL( EEikCmdExit );
   335                 EEikCmdExit);
   776         }        
   336         }
   777     iEditorDlg = NULL;                     	
   337     iEditorDlg = NULL;
   778     
   338 
   779 	DEBUG( - CLocSUPLSettingsUiEngine::EditServerL );	
   339     DEBUG( - CLocSUPLSettingsUiEngine::EditServerL );
       
   340     }
   780     }
   341     
   781     
   342 // ---------------------------------------------------------------------------
   782 // ---------------------------------------------------------------------------
   343 // void CLocSUPLSettingsUiEngine::SlpCount()
   783 // void CLocSUPLSettingsUiEngine::SlpCount()
   344 // returns total no of slp entries
   784 // returns total no of slp entries