locationsystemui/locationsysui/locsuplsettingsui/src/locsuplservereditor.cpp
changeset 0 667063e416a2
child 4 42de37ce7ce4
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 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:  Implements the CLocSUPLServerEditor class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <aknappui.h>
       
    21 #include <AknIconArray.h>       // Icon Array
       
    22 #include <aknlocationed.h>
       
    23 #include <aknlistquerydialog.h>
       
    24 #include <AknPopupFieldText.h> 
       
    25 #include <aknnotewrappers.h>
       
    26 #include <AknsUtils.h>
       
    27 #include <AknsSkinInstance.h>
       
    28 #include <aknselectionlist.h>
       
    29 #include <akntitle.h>       	// CAknTitlePane
       
    30 #include <AknWaitDialog.h> 
       
    31 #include <aknuniteditor.h> 
       
    32 #include <avkon.rsg>
       
    33 #include <avkon.hrh>
       
    34 #include <e32math.h>
       
    35 #include <eikapp.h>
       
    36 #include <eikaufty.h>
       
    37 #include <eikcapc.h>
       
    38 #include <eikedwin.h>
       
    39 #include <eikenv.h>
       
    40 #include <eikmenup.h>
       
    41 #include <eikmenub.h>
       
    42 #include <eikserverapp.h>
       
    43 #include <eikspane.h>       	// Status pane
       
    44 #include <barsread.h>           // For TResourceReader
       
    45 #include <bautils.h> 
       
    46 #include <data_caging_path_literals.hrh>
       
    47 #include <gulicon.h>            // Gul Icon
       
    48 #include <StringLoader.h>
       
    49 
       
    50 #include <epos_csuplsettingsconstants.h>
       
    51 #include <epos_csuplsettingparams.h>
       
    52 
       
    53 #include <locsuplsettingsui.rsg>
       
    54 #include "locsuplsettings.hrh"
       
    55 #include "locsuplservereditor.h"
       
    56 #include "locsuplsettingsuiengine.h"
       
    57 #include "locsupldebug.h"
       
    58 
       
    59 // ============================ LOCAL FUNCTIONS ===============================
       
    60 
       
    61 // ============================ MEMBER FUNCTIONS ===============================
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CLocSUPLServerEditor::CLocSUPLServerEditor()
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 CLocSUPLServerEditor::CLocSUPLServerEditor( 
       
    68         					TBool aIsEditable,
       
    69                             CLocSUPLSettingsUiEngine&       aEngine,
       
    70         					TInt64 aSlpId
       
    71 		):iIsEditMode( aIsEditable ), iEngine( aEngine ), iSlpId( aSlpId )
       
    72     {
       
    73     if( aIsEditable )
       
    74     	{
       
    75     	iIsNewServer = ETrue;
       
    76     	iSlpId = NULL;
       
    77     	}    	
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CLocSUPLServerEditor::ConstructL()
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 void CLocSUPLServerEditor::ConstructL()
       
    85     {
       
    86 	DEBUG( + CLocSUPLServerEditor::ConstructL );
       
    87     CAknForm::ConstructL( R_SUPLSERVER_EDITOR_MENU_BAR );
       
    88 
       
    89     // Save original title
       
    90     CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
       
    91     iTitlePane = ( CAknTitlePane* ) statusPane->ControlL(
       
    92         TUid::Uid( EEikStatusPaneUidTitle ) );
       
    93     iOriginalTitle = iTitlePane->Text()->AllocL();
       
    94     
       
    95     // Allocate memory for Server address buffer & Access point buffer
       
    96 	iServerAddress = HBufC16::NewL( KMaxHSLPAddrLen ); 
       
    97 	iIap = HBufC16::NewL( KMaxIAPLen );   
       
    98 	
       
    99 	DEBUG( - CLocSUPLServerEditor::ConstructL );
       
   100     }
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 // CLocSUPLServerEditor::NewL()
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 CLocSUPLServerEditor* CLocSUPLServerEditor::NewL( 
       
   107         					TBool aIsEditable,
       
   108                             CLocSUPLSettingsUiEngine&       aEngine,
       
   109         					TInt64 aSlpId
       
   110 		)
       
   111 	{	
       
   112     CLocSUPLServerEditor* self = NewLC( aIsEditable, aEngine, aSlpId );
       
   113 	CleanupStack::Pop( self );
       
   114 	return self;
       
   115 	}
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // CLocSUPLServerEditor::NewLC()
       
   119 // -----------------------------------------------------------------------------
       
   120 //
       
   121 CLocSUPLServerEditor* CLocSUPLServerEditor::NewLC( 
       
   122         					TBool aIsEditable,
       
   123                             CLocSUPLSettingsUiEngine&       aEngine,
       
   124         					TInt64 aSlpId
       
   125 		)
       
   126     {
       
   127     CLocSUPLServerEditor* self = new ( ELeave ) 
       
   128     			CLocSUPLServerEditor( aIsEditable, aEngine, aSlpId );
       
   129     CleanupStack::PushL( self );
       
   130     self->ConstructL();
       
   131     return self;
       
   132     }
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // CLocSUPLServerEditor::~CLocSUPLServerEditor()
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 CLocSUPLServerEditor::~CLocSUPLServerEditor()
       
   139     {
       
   140 	DEBUG( + CLocSUPLServerEditor::~CLocSUPLServerEditor );
       
   141     // Restore title pane. Ownership of iTitlePane transferred.
       
   142     if ( iTitlePane && iOriginalTitle )
       
   143         {
       
   144         iTitlePane->SetText( iOriginalTitle );
       
   145         }
       
   146 	delete iServerAddress;	
       
   147 	iServerAddress = NULL;
       
   148 	
       
   149 	delete iIap;
       
   150 	iIap = NULL;
       
   151 	DEBUG( - CLocSUPLServerEditor::~CLocSUPLServerEditor );	
       
   152     }
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 // CLocSUPLServerEditor::DynInitMenuPaneL()
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 void CLocSUPLServerEditor::DynInitMenuPaneL(
       
   159     TInt aResourceId,
       
   160     CEikMenuPane* aMenuPane )
       
   161     {
       
   162 	DEBUG( + CLocSUPLServerEditor::DynInitMenuPaneL );
       
   163     CAknForm::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   164 
       
   165     if ( aResourceId == R_AVKON_FORM_MENUPANE )
       
   166         {
       
   167         // We do not want to allow the user to modify our Form therefore
       
   168         // Disable the Label, Add, Delete, and Save Field
       
   169         aMenuPane->SetItemDimmed( EAknFormCmdLabel, ETrue );
       
   170         aMenuPane->SetItemDimmed( EAknFormCmdAdd, 	ETrue );
       
   171 		aMenuPane->SetItemDimmed( EAknFormCmdDelete,ETrue );
       
   172         aMenuPane->SetItemDimmed( EAknFormCmdSave, 	ETrue );
       
   173 		
       
   174         if( IsEditable() )
       
   175 	        {
       
   176         	aMenuPane->SetItemDimmed( EAknFormCmdEdit, 			ETrue );
       
   177         	aMenuPane->SetItemDimmed( ELocServerEditorDisable, 	ETrue );
       
   178         	aMenuPane->SetItemDimmed( ELocServerEditorEnable, 	ETrue );	        
       
   179        		aMenuPane->SetItemDimmed( ELocServerEditorDelete, 	ETrue );		       			    	
       
   180         				
       
   181 			switch( IdOfFocusControl() )
       
   182 				{
       
   183 				case ELocSuplServerIdServerAddr:
       
   184 					{
       
   185 					aMenuPane->SetItemDimmed( ELocServerEditorDefine, 	ETrue );
       
   186 		       		aMenuPane->SetItemDimmed( ELocServerEditorChange, 	ETrue );   
       
   187 					break;
       
   188 					}
       
   189 				case ELocSuplServerIdAccessPoint:
       
   190 					{
       
   191 			       	TInt isIapChanged = EFalse;
       
   192 			        CEikEdwin* apSelector = 
       
   193 			        			static_cast < CEikEdwin* > ( ControlOrNull( IdOfFocusControl() ) );           
       
   194 			        if( apSelector )
       
   195 			            {  
       
   196 			            if( iIap->Length() > 0 ) 
       
   197 			            	isIapChanged = ETrue;
       
   198 			            } 
       
   199 			            
       
   200 			       	if( isIapChanged )
       
   201 			       		{
       
   202 			       		aMenuPane->SetItemDimmed( ELocServerEditorDefine, 	ETrue );
       
   203 			       		}
       
   204 			       	else
       
   205 			       		{
       
   206 			       		aMenuPane->SetItemDimmed( ELocServerEditorChange, 	ETrue );		       		
       
   207 			       		}				
       
   208 					break;
       
   209 					}
       
   210 				case ELocSuplServerIdUsageInHomeNw:
       
   211 					{
       
   212 					aMenuPane->SetItemDimmed( ELocServerEditorDefine, 		ETrue );
       
   213 					
       
   214 		        	TBool editableFlag = ETrue;
       
   215 		        	if( iSlpId )
       
   216 		        		TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) );        				        	
       
   217 		        	if( editableFlag == EFalse )					
       
   218 						aMenuPane->SetItemDimmed( ELocServerEditorChange, 	ETrue );
       
   219 		        	
       
   220 					break;
       
   221 					}
       
   222 				default:
       
   223 					break;
       
   224 				}			
       
   225 	        }
       
   226 	    else
       
   227 	    	{
       
   228 			TBool enabledFlag;    
       
   229 			TRAP_IGNORE( iEngine.GetServerEnabledFlagL( iSlpId, enabledFlag ) );
       
   230 			
       
   231 			if( enabledFlag )
       
   232 				aMenuPane->SetItemDimmed( ELocServerEditorEnable, ETrue );
       
   233 			else
       
   234 				aMenuPane->SetItemDimmed( ELocServerEditorDisable, ETrue );
       
   235 			
       
   236 			
       
   237         	TBool editableFlag = ETrue;
       
   238         	if( iSlpId )
       
   239         		TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) );        				        	
       
   240         	if( editableFlag == EFalse )					
       
   241         		{
       
   242 				switch( IdOfFocusControl() )
       
   243 					{
       
   244 					case ELocSuplServerIdServerAddr:
       
   245 					case ELocSuplServerIdUsageInHomeNw:
       
   246 						{
       
   247 						aMenuPane->SetItemDimmed( EAknFormCmdEdit, 	ETrue );
       
   248 						break;					
       
   249 						}
       
   250 					default:
       
   251 						break;
       
   252 					}        		
       
   253         		}
       
   254 
       
   255 			aMenuPane->SetItemDimmed( ELocServerEditorDefine, 	ETrue );
       
   256        		aMenuPane->SetItemDimmed( ELocServerEditorChange, 	ETrue );		       			    	
       
   257        		aMenuPane->SetItemDimmed( ELocServerEditorRemove, 	ETrue );		       			    	
       
   258 	    	}	        
       
   259         }
       
   260 	DEBUG( - CLocSUPLServerEditor::DynInitMenuPaneL );
       
   261     }
       
   262 
       
   263 // -----------------------------------------------------------------------------
       
   264 // CLocSUPLServerEditor::ProcessCommandL()
       
   265 // -----------------------------------------------------------------------------
       
   266 //
       
   267 void CLocSUPLServerEditor::ProcessCommandL( TInt aCommandId )
       
   268 	{
       
   269 	DEBUG1( + CLocSUPLServerEditor::ProcessCommandL aCommandId=%d, aCommandId );
       
   270 	CAknForm::ProcessCommandL( aCommandId );
       
   271 
       
   272 	switch ( aCommandId )
       
   273        	{
       
   274        	case EAknFormCmdEdit:
       
   275        		{
       
   276 			iIsEditMode = ETrue;
       
   277 			SetCursorToEndL();
       
   278    			HandleMSKCaptionL();						
       
   279        		break;
       
   280        		}
       
   281        	case ELocServerEditorDelete:
       
   282        	case ELocServerEditorRemove:
       
   283        		{
       
   284        		if( DeleteConfirmationQueryL() )
       
   285        			{
       
   286        			TRAP_IGNORE( iEngine.RemoveServerL( iSlpId ) );
       
   287         		// Return back to server view
       
   288 	       		TryExitL( EAknSoftkeyBack );
       
   289       			}       			
       
   290        		break;
       
   291        		}
       
   292        	case ELocServerEditorDisable:
       
   293        		{
       
   294        		TRAP_IGNORE( iEngine.SetServerEnabledFlagL( iSlpId, EFalse ) );
       
   295        		break;
       
   296        		}
       
   297        	case ELocServerEditorEnable:
       
   298        		{
       
   299        		TRAP_IGNORE( iEngine.SetServerEnabledFlagL( iSlpId, ETrue ) );
       
   300       		break;
       
   301        		}
       
   302        	case ELocServerEditorDefine:
       
   303        		{
       
   304         	TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) );
       
   305        		break;
       
   306        		}
       
   307        	case ELocServerEditorChange:
       
   308        	case ELocServerEditorMSKChange:       	
       
   309        		{
       
   310 		    if ( IdOfFocusControl() == ELocSuplServerIdAccessPoint )
       
   311 		    	{
       
   312         		TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) );
       
   313 		    	}
       
   314 		    else
       
   315 		    	{
       
   316 		    	if( iIsNewServer )
       
   317 		    		{
       
   318 		    		TogglePopupFieldControlL( IdOfFocusControl() );
       
   319 		    		}
       
   320 		    	else
       
   321 		    		{
       
   322 			    	TBool editableFlag;
       
   323 			    	TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) );
       
   324 			    	if ( editableFlag )
       
   325 			    		TogglePopupFieldControlL( IdOfFocusControl() );		    		
       
   326 		    		}
       
   327 		    	}			    	
       
   328        		break;
       
   329        		}
       
   330        	case EAknCmdHelp:
       
   331        		{
       
   332        		break;
       
   333        		}
       
   334        	case EEikCmdExit:
       
   335        		{
       
   336        		// The Exit is handled by the Application UI
       
   337        		TryExitL( EEikCmdExit );
       
   338        		break;
       
   339        		}
       
   340 		default:
       
   341 			break;
       
   342        	}
       
   343 	DEBUG( - CLocSUPLServerEditor::ProcessCommandL );
       
   344 	}
       
   345 	
       
   346 // ---------------------------------------------------------------------------
       
   347 // Derived from CEikDialog
       
   348 // ---------------------------------------------------------------------------
       
   349 
       
   350 // -----------------------------------------------------------------------------
       
   351 // CLocSUPLServerEditor::HandlePointerEventL
       
   352 // -----------------------------------------------------------------------------
       
   353 //  
       
   354 void CLocSUPLServerEditor::HandlePointerEventL(const TPointerEvent &aPointerEvent)
       
   355 	{	
       
   356     DEBUG( +CLocSUPLServerEditor::HandlePointerEventL );
       
   357     CEikEdwin* serverAddress = static_cast<CEikEdwin*> (ControlOrNull(
       
   358             ELocSuplServerIdServerAddr));
       
   359     CEikEdwin* iapEditor = static_cast<CEikEdwin*> (ControlOrNull(
       
   360             ELocSuplServerIdAccessPoint));
       
   361     CAknPopupFieldText* usageInHomeNWPopupFieldText =
       
   362             (CAknPopupFieldText*) Control(ELocSuplServerIdUsageInHomeNw);
       
   363 
       
   364     if (!IsEditable())
       
   365         {
       
   366         CAknForm::HandlePointerEventL(aPointerEvent);
       
   367     
       
   368         if(aPointerEvent.iType == TPointerEvent::EButton1Up)
       
   369             {
       
   370             // Opens the editor on Single Click on any of the controls. Click on rest of the click does not repond
       
   371             if (iapEditor->Rect().Contains(aPointerEvent.iPosition)
       
   372                     || usageInHomeNWPopupFieldText->Rect().Contains(
       
   373                             aPointerEvent.iPosition)
       
   374                     || serverAddress->Rect().Contains(aPointerEvent.iPosition))
       
   375                 {
       
   376                 ProcessCommandL(EAknFormCmdEdit);
       
   377                 }
       
   378             }
       
   379         }
       
   380     else if (IsEditable())
       
   381         {
       
   382         if (usageInHomeNWPopupFieldText )
       
   383             {
       
   384             if (usageInHomeNWPopupFieldText->Rect().Contains(
       
   385                     aPointerEvent.iPosition) )
       
   386                 {
       
   387                 if( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
   388                     {
       
   389                       TogglePopupFieldControlL(IdOfFocusControl());
       
   390                       if (iIsNewServer)
       
   391                         {
       
   392                         iIsModified = ETrue;
       
   393                         }
       
   394                     } 
       
   395                 return;
       
   396                 }
       
   397             }
       
   398 
       
   399         CAknForm::HandlePointerEventL(aPointerEvent);
       
   400 
       
   401         //check if click is on IAP Editor control
       
   402         if (iapEditor)
       
   403             {
       
   404             if (iapEditor->Rect().Contains(aPointerEvent.iPosition) &&
       
   405                     aPointerEvent.iType == TPointerEvent::EButton1Up )
       
   406                 {
       
   407                 //Launch IAP Dialog
       
   408                 TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) );
       
   409                 return;
       
   410                 }
       
   411             }
       
   412         }
       
   413     DEBUG( - CLocSUPLServerEditor::HandlePointerEventL );
       
   414     }
       
   415 
       
   416         
       
   417 // -----------------------------------------------------------------------------
       
   418 // CLocSUPLServerEditor::OfferKeyEventL
       
   419 // Receives and handles key events
       
   420 // -----------------------------------------------------------------------------
       
   421 //
       
   422 TKeyResponse CLocSUPLServerEditor::OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   423                                              TEventCode aType )
       
   424     {
       
   425 	DEBUG( CLocSUPLServerEditor::OfferKeyEventL );
       
   426 	if ( aType == EEventKey )
       
   427 		{
       
   428 		if( aKeyEvent.iCode == EKeyBackspace && IsEditable() == EFalse )		
       
   429             {
       
   430         	ProcessCommandL( ELocServerEditorDelete );            	
       
   431         	return EKeyWasConsumed;
       
   432             }      
       
   433              
       
   434         if( !iIsNewServer && IsEditable() )
       
   435         	{
       
   436         	// check if current opened server is editable
       
   437         	// if its not editable then return with no action on it.			
       
   438         	TBool editableFlag = ETrue;
       
   439         	if( iSlpId )
       
   440         		TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) );        		
       
   441         	
       
   442         	if( editableFlag == EFalse )
       
   443         		{
       
   444 				if( ( aKeyEvent.iScanCode != EStdKeyUpArrow || aKeyEvent.iScanCode != EStdKeyDownArrow ) 
       
   445 					== EFalse )       		
       
   446 					{
       
   447 					switch( IdOfFocusControl() )
       
   448 						{
       
   449 						case ELocSuplServerIdServerAddr:						
       
   450 						case ELocSuplServerIdUsageInHomeNw:
       
   451 							{
       
   452 							return EKeyWasConsumed;
       
   453 							}						
       
   454 						default:
       
   455 							break;
       
   456 						}
       
   457 					}
       
   458         		}
       
   459         	}
       
   460 
       
   461 		if ( aKeyEvent.iCode == EKeyEnter || aKeyEvent.iScanCode == EStdKeyEnter ) 
       
   462 			{
       
   463 		    if ( !( IsEditable() && IdOfFocusControl() == ELocSuplServerIdServerAddr ) )
       
   464 		    	{
       
   465 				TKeyEvent enterKeyEvent( aKeyEvent );
       
   466 				enterKeyEvent.iCode = EKeyOK;
       
   467 				CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
       
   468 				return cba->OfferKeyEventL( enterKeyEvent, aType );	    	
       
   469 		    	}
       
   470 			}         
       
   471 		}
       
   472     TKeyResponse response= CAknForm::OfferKeyEventL( aKeyEvent, aType );    
       
   473     return response;   
       
   474     }
       
   475     
       
   476 // ---------------------------------------------------------------------------
       
   477 // CLocSUPLServerEditor ::OkToExitL()
       
   478 // ---------------------------------------------------------------------------
       
   479 //
       
   480 TBool CLocSUPLServerEditor::OkToExitL( TInt aButtonId )
       
   481     {
       
   482 	DEBUG1( + CLocSUPLServerEditor::OkToExitL aButtonId=%d, aButtonId );
       
   483     TBool retVal = ETrue;
       
   484     	
       
   485     switch( aButtonId )
       
   486         {
       
   487         case EAknFormCmdEdit: // when MSK is pressed
       
   488             {
       
   489             //Handle MSK operation based on focused line.            
       
   490 		    if( IsEditable() == EFalse )
       
   491 			    {
       
   492             	ProcessCommandL( EAknFormCmdEdit ); 
       
   493             	HandleMSKCaptionL();				
       
   494 				}				
       
   495             //dont close editor            
       
   496             retVal = EFalse;
       
   497             break;
       
   498             }
       
   499         case ELocServerEditorNoCmd:
       
   500         	{
       
   501             //dont close editor            
       
   502             retVal = EFalse;
       
   503         	break;
       
   504         	}
       
   505         case ELocServerEditorMSKDefine:
       
   506         	{
       
   507         	TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) );
       
   508             //dont close editor            
       
   509             retVal = EFalse;
       
   510         	break;
       
   511         	}
       
   512         case ELocServerEditorMSKChange:
       
   513         	{
       
   514         	ProcessCommandL( ELocServerEditorMSKChange );
       
   515             //dont close editor            
       
   516             retVal = EFalse;
       
   517         	break;
       
   518         	}
       
   519         case EAknSoftkeyOptions: //when LSK is pressed
       
   520             {
       
   521             //display menu specific to editor
       
   522             DisplayMenuL();
       
   523             //don't close editor
       
   524             retVal = EFalse;
       
   525             break;
       
   526             }            
       
   527         case EAknSoftkeyBack: 
       
   528         	{
       
   529         	break;
       
   530         	}
       
   531         case EAknSoftkeyDone: // when RSK is pressed in edit mode
       
   532             {
       
   533 			if( SaveFormDataL() )
       
   534 				{
       
   535             	if( iIsNewServer ) 
       
   536             		{
       
   537             		TRAPD( err, iEngine.AddNewServerL(
       
   538             								iServerAddress->Des(),
       
   539             								iIap->Des(),
       
   540             								iUsageInHomeNw ) );
       
   541             		if( err == KErrNone )
       
   542             			{
       
   543             			iIsNewServer = EFalse;	
       
   544             			}
       
   545             		else if( err == KErrAlreadyExists ) 
       
   546             			{
       
   547             			ShowServerValidationInfoNoteL( R_LOC_SERVER_ALREADY_EXIST_INFO_NOTE );
       
   548 						iIsEditMode = ETrue;
       
   549 					    SetEditableL( iIsEditMode );
       
   550 					    SetInitialCurrentLine();	            			
       
   551 						SetCursorToEndL();
       
   552 			            //dont close editor            
       
   553 			            retVal = EFalse;	            		
       
   554             			}
       
   555             		}
       
   556             	else
       
   557             		{ // save the existing slp entry info
       
   558             		if( iSlpId )
       
   559             			{
       
   560             			TRAPD( err, iEngine.SetServerAddressL( 
       
   561             							iSlpId, iServerAddress->Des() ) );
       
   562             			if( err == KErrNone )
       
   563             				{
       
   564             				if( iIap->Length() > 0 )
       
   565 		           				iEngine.SetIapNameL( iSlpId, iIap->Des() );	            			
       
   566 	            			iEngine.SetUsageInHomwNwFlagL( iSlpId, iUsageInHomeNw );  
       
   567 	            			          				
       
   568 		 					iIsEditMode = EFalse;
       
   569 						    SetEditableL( iIsEditMode );						    
       
   570            					}
       
   571             			else if( err == KErrAlreadyExists )
       
   572             				{
       
   573 	            			ShowServerValidationInfoNoteL( R_LOC_SERVER_ALREADY_EXIST_INFO_NOTE );
       
   574 							iIsEditMode = ETrue;
       
   575 						    SetEditableL( iIsEditMode );
       
   576 						    SetInitialCurrentLine();	            			
       
   577 							SetCursorToEndL();
       
   578             				}
       
   579             			}
       
   580 	            	HandleMSKCaptionL();
       
   581 		            //dont close editor            
       
   582 		            retVal = EFalse;	            		
       
   583             		}
       
   584 				}
       
   585 			else
       
   586 				{
       
   587 				//if control's state is changed and manadatory contain is not added then show the popup message
       
   588 				if( iIsModified )
       
   589 				    {
       
   590 				    ShowServerValidationInfoNoteL( R_LOC_SERVER_INFO_NOTE );
       
   591 				    iIsEditMode = ETrue;
       
   592                     SetEditableL( iIsEditMode );                    
       
   593                     SetInitialCurrentLine();                                
       
   594                     SetCursorToEndL();
       
   595                     //dont close editor            
       
   596                     retVal = EFalse;       
       
   597 				    }
       
   598 				else
       
   599 				    {
       
   600 				    retVal = ETrue;
       
   601 				    }			         						
       
   602 				}				
       
   603 			break;
       
   604             }
       
   605         default: // close editor in all other cases
       
   606             {
       
   607             break;
       
   608             }
       
   609         }
       
   610 	DEBUG1( - CLocSUPLServerEditor::OkToExitL retVal=%d, retVal );
       
   611     return retVal;
       
   612     }
       
   613     
       
   614 // -----------------------------------------------------------------------------
       
   615 // CLocSUPLServerEditor::SaveFormDataL()
       
   616 // Deals with the occasion of a change from edit->view mode and the user wishes 
       
   617 // to save the changes.
       
   618 // -----------------------------------------------------------------------------
       
   619 //
       
   620 TBool CLocSUPLServerEditor::SaveFormDataL()
       
   621     {
       
   622 	DEBUG( + CLocSUPLServerEditor::SaveFormDataL );
       
   623     TBool retVal = EFalse;
       
   624     
       
   625     //Retrieve server address text 
       
   626     CEikEdwin* serverAddress = 
       
   627     		static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdServerAddr ) );            
       
   628     if( serverAddress )
       
   629         {                       
       
   630         HBufC* address = serverAddress->GetTextInHBufL();
       
   631         if( address )
       
   632             {            
       
   633             iServerAddress->Des().Copy( address->Des() );
       
   634             }
       
   635         else
       
   636         	iServerAddress->Des().Copy( KNullDesC );
       
   637         delete address;
       
   638         }
       
   639 
       
   640     //Retrieve Access Point 
       
   641     CEikEdwin* accessPoint = 
       
   642     		static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdAccessPoint ) );            
       
   643     if( accessPoint )
       
   644         {                       
       
   645         HBufC* apText = accessPoint->GetTextInHBufL();
       
   646         if( apText )
       
   647             {
       
   648             iIap->Des().Copy( apText->Des() );
       
   649             }
       
   650         delete apText;
       
   651 
       
   652         HBufC* apString = StringLoader::LoadL( R_LOC_SERVER_NONE ); 
       
   653         if( apString->Compare( iIap->Des() ) == 0 ) 
       
   654         	{
       
   655         	iIap->Des().Copy( KNullDesC );
       
   656         	}
       
   657         delete apString;
       
   658        	}
       
   659 	
       
   660 	//Retrieve Usage In Home Nw Field value
       
   661    	CAknPopupFieldText* usageInHomeNWPopupFieldText =
       
   662          	( CAknPopupFieldText* ) Control( ELocSuplServerIdUsageInHomeNw );
       
   663    	if( usageInHomeNWPopupFieldText )
       
   664        	{
       
   665        	if( usageInHomeNWPopupFieldText->CurrentValueIndex() == 0 )
       
   666        		{
       
   667        		iUsageInHomeNw = ETrue;
       
   668        		}
       
   669        	else
       
   670        		{
       
   671         	iUsageInHomeNw = EFalse;      		
       
   672        		}
       
   673        	}
       
   674 
       
   675     if( iServerAddress->Length() > 0 )
       
   676     	{
       
   677     	retVal = ETrue;
       
   678     	}       	       	    
       
   679     	
       
   680 	DEBUG( - CLocSUPLServerEditor::SaveFormDataL );
       
   681     return retVal;
       
   682     }
       
   683 
       
   684 // -----------------------------------------------------------------------------
       
   685 // LocSUPLServerEditor::PreLayoutDynInitL()
       
   686 // Initialises the dialog's controls before the dialog is sized and layed out.
       
   687 // -----------------------------------------------------------------------------
       
   688 //
       
   689 void CLocSUPLServerEditor::PreLayoutDynInitL()
       
   690     {    
       
   691 	DEBUG( + CLocSUPLServerEditor::PreLayoutDynInitL );
       
   692     CAknForm::PreLayoutDynInitL();
       
   693     
       
   694 	DEBUG( - CLocSUPLServerEditor::PreLayoutDynInitL );
       
   695     }
       
   696 
       
   697 // -----------------------------------------------------------------------------
       
   698 // CLocSUPLServerEditor::PostLayoutDynInitL
       
   699 // Initialises the dialog's controls after the dialog
       
   700 // has been sized but before it has been activated.
       
   701 // -----------------------------------------------------------------------------
       
   702 //
       
   703 void CLocSUPLServerEditor::PostLayoutDynInitL()
       
   704     {
       
   705 	DEBUG( + CLocSUPLServerEditor::PostLayoutDynInitL );
       
   706     CAknForm::PostLayoutDynInitL();
       
   707     SetEditableL( iIsEditMode );
       
   708     LoadFormValuesFromDataL();    
       
   709 
       
   710     CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
       
   711     CleanupStack::PushL( cba );
       
   712     if( IsEditable() )
       
   713     	{
       
   714 		cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_DONE );
       
   715     	}
       
   716     else
       
   717     	{
       
   718     	TBool editableFlag = ETrue;   	
       
   719     	if( iSlpId )
       
   720     		TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) );        		    		
       
   721     	    	
       
   722        	if( editableFlag )
       
   723        	    cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_EDIT_BACK );
       
   724        	else
       
   725        		cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_BACK );	
       
   726     	}
       
   727 	CleanupStack::Pop( cba );			    	
       
   728 	
       
   729 	DEBUG( - CLocSUPLServerEditor::PostLayoutDynInitL );
       
   730     }
       
   731     
       
   732 // -----------------------------------------------------------------------------
       
   733 // CLocSUPLServerEditor::LineChangedL()
       
   734 // -----------------------------------------------------------------------------
       
   735 //
       
   736 void CLocSUPLServerEditor::LineChangedL(TInt /*aControlId*/)
       
   737     {
       
   738     HandleMSKCaptionL(); 
       
   739     }
       
   740 
       
   741 // -----------------------------------------------------------------------------
       
   742 // CLocSUPLServerEditor::SetInitialCurrentLine()
       
   743 // Selects desired line on startup
       
   744 // -----------------------------------------------------------------------------
       
   745 //
       
   746 void CLocSUPLServerEditor::SetInitialCurrentLine()
       
   747     {
       
   748     CAknForm::SetInitialCurrentLine();
       
   749 
       
   750 	// set focus to server address field
       
   751 	if ( ControlOrNull( ELocSuplServerIdServerAddr ) )
       
   752 		{
       
   753 		TRAP_IGNORE( TryChangeFocusToL( ELocSuplServerIdServerAddr ) );
       
   754 		}
       
   755     }
       
   756 
       
   757 // -----------------------------------------------------------------------------
       
   758 // CLocSUPLServerEditor::HandleResourceChange()
       
   759 // Handles layout switch
       
   760 // -----------------------------------------------------------------------------
       
   761 //
       
   762 void CLocSUPLServerEditor::HandleResourceChange( TInt aType )
       
   763 	{
       
   764 	if ( aType == KEikDynamicLayoutVariantSwitch )
       
   765 		{
       
   766 		CAknForm::HandleResourceChange( aType );
       
   767 		}
       
   768 	}
       
   769 
       
   770 // -----------------------------------------------------------------------------
       
   771 // CLocSUPLServerEditor::ExecuteLD
       
   772 // Executes the Dialog
       
   773 // -----------------------------------------------------------------------------
       
   774 //
       
   775 TInt CLocSUPLServerEditor::ExecuteLD()
       
   776     {    
       
   777 	return CAknForm::ExecuteLD( R_SUPLSERVER_EDITOR_FORM_DIALOG );    	
       
   778     }
       
   779 
       
   780 // -----------------------------------------------------------------------------
       
   781 // CLocSUPLServerEditor::HandleControlStateChangeL
       
   782 // -----------------------------------------------------------------------------
       
   783 //
       
   784 void CLocSUPLServerEditor::HandleControlStateChangeL( TInt aControlId )
       
   785     {
       
   786 	DEBUG( + CLocSUPLServerEditor::HandleControlStateChangeL );
       
   787 	iIsModified = ETrue;
       
   788 	switch( aControlId )
       
   789 	    {
       
   790 	    case ELocSuplServerIdServerAddr:
       
   791 	        {            
       
   792 	        //Retrieve server address text 
       
   793 	        CEikEdwin* serverAddress = 
       
   794 	        		static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdServerAddr ) );            
       
   795 	        if( serverAddress )
       
   796 	            {                       
       
   797 	            HBufC* address = serverAddress->GetTextInHBufL();
       
   798 	            if( address )
       
   799 	                {
       
   800 	                CleanupStack::PushL( address );	      
       
   801 			        // update the title pane caption
       
   802 	            	ChangeTitlePaneTextL( *address ); 
       
   803 	                CleanupStack::PopAndDestroy( address );
       
   804 	                }
       
   805 	            else
       
   806 	            	{
       
   807 			        // update the title pane caption
       
   808 			        TBuf<1> nullDes;
       
   809 			        nullDes.Copy( KNullDesC );
       
   810 		        	ChangeTitlePaneTextL( nullDes ); 
       
   811 	            	}
       
   812 	            }              
       
   813 	        break;
       
   814 	        } 
       
   815 	    default:
       
   816 	    	break;	        
       
   817 	    }        
       
   818 	DEBUG( - CLocSUPLServerEditor::HandleControlStateChangeL );
       
   819     }
       
   820 
       
   821 // ---------------------------------------------------------------------------
       
   822 // CLocSUPLServerEditor ::LoadFormValuesFromDataL()
       
   823 // Called when the form is  executed and when the user chooses to discard changes
       
   824 // in QuerySaveChangesL (via  DoNotSaveFormDataL).
       
   825 // ---------------------------------------------------------------------------
       
   826 // 
       
   827 void CLocSUPLServerEditor::LoadFormValuesFromDataL()
       
   828     {
       
   829 	DEBUG( + CLocSUPLServerEditor::LoadFormValuesFromDataL );
       
   830    	if( IsEditable() && iIsNewServer ) //if create new server
       
   831        	{
       
   832        	CEikEdwin* apSelector = 
       
   833         			static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdAccessPoint ) );           
       
   834        	if( apSelector )
       
   835             {   
       
   836             HBufC* apString = StringLoader::LoadL( R_LOC_SERVER_NONE );   
       
   837             apSelector->SetTextL( apString );
       
   838             delete apString;
       
   839             } 
       
   840        	apSelector->DrawNow();
       
   841         
       
   842         // update the title pane caption
       
   843        	HBufC* serverTitle = StringLoader::LoadL( R_LOC_SERVER_EDITOR_TITLE ); 
       
   844        	if( serverTitle )
       
   845             {
       
   846         	ChangeTitlePaneTextL( *serverTitle ); 
       
   847             }        
       
   848        	delete serverTitle;
       
   849        	serverTitle=NULL;
       
   850        	}
       
   851      else
       
   852      	{     	
       
   853 	   	CServerParams *params = CServerParams::NewL();
       
   854 	    TRAP_IGNORE( iEngine.GetSlpInfoFromIdL( iSlpId, params ) );
       
   855 	    
       
   856 	    HBufC* hslpAddr = HBufC::NewL( KMaxHSLPAddrLen );    
       
   857 	    HBufC* iapName 	= HBufC::NewL( KMaxIAPLen );
       
   858 	    TInt64 slpId;
       
   859 	    TBool enabledFlag, simChangeFlag, usageInHomeNwFlag, editFlag;    
       
   860 	    
       
   861 	    TInt errParams = params->Get(
       
   862 	    							slpId, 
       
   863 	    							hslpAddr->Des(), 
       
   864 	    							iapName->Des(), 
       
   865 	    							enabledFlag, 
       
   866 	    							simChangeFlag, 
       
   867 	    							usageInHomeNwFlag, 
       
   868 	    							editFlag
       
   869 	    						);
       
   870 	    if ( errParams != KErrNone )
       
   871 	        {
       
   872 	        // Error has occured 
       
   873 	        }  
       
   874      	
       
   875         CEikEdwin* serverAddress = 
       
   876         			static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdServerAddr ) );           
       
   877         if( serverAddress )
       
   878             {   
       
   879             serverAddress->SetTextL( hslpAddr );
       
   880             if( editFlag == EFalse )
       
   881             	serverAddress->SetReadOnly( ETrue );
       
   882         	serverAddress->DrawDeferred();
       
   883         	iServerAddress->Des().Copy( hslpAddr->Des() );
       
   884             } 
       
   885 
       
   886         CEikEdwin* apSelector = 
       
   887         			static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdAccessPoint ) );           
       
   888         if( apSelector )
       
   889             {   
       
   890             if( iapName->Length() > 0 )
       
   891             	{
       
   892             	apSelector->SetTextL( iapName );
       
   893             	}
       
   894             else
       
   895             	{
       
   896 	            HBufC* apString = StringLoader::LoadL( R_LOC_SERVER_NONE ); 
       
   897 	            apSelector->SetTextL( apString );
       
   898             	delete apString;
       
   899             	}
       
   900             	            
       
   901         	apSelector->DrawNow();
       
   902         	iIap->Des().Copy( iapName->Des() );
       
   903             } 
       
   904 
       
   905         CAknPopupFieldText* usageInHNWPopupFieldText = 
       
   906         			( CAknPopupFieldText* ) Control( ELocSuplServerIdUsageInHomeNw );
       
   907         if( usageInHNWPopupFieldText )
       
   908             {  
       
   909             if( usageInHomeNwFlag  )
       
   910             	usageInHNWPopupFieldText->SetCurrentValueIndex( 0 );                  	
       
   911             else
       
   912             	usageInHNWPopupFieldText->SetCurrentValueIndex( 1 );                  	
       
   913             
       
   914             UpdatePageL( ETrue );
       
   915             iUsageInHomeNw = usageInHomeNwFlag;
       
   916             }            
       
   917             
       
   918 	    delete iapName;
       
   919 	    delete hslpAddr;	    
       
   920 	    delete params;
       
   921 
       
   922         // update the title pane caption
       
   923         ChangeTitlePaneTextL( *iServerAddress ); 
       
   924             
       
   925      	}
       
   926 	DEBUG( - CLocSUPLServerEditor::LoadFormValuesFromDataL );
       
   927     }
       
   928     
       
   929 // ---------------------------------------------------------------------------
       
   930 // CLocSUPLServerEditor::ChangeTitlePaneTextL()
       
   931 // Set the Title Text
       
   932 // ---------------------------------------------------------------------------
       
   933 //
       
   934 void CLocSUPLServerEditor::ChangeTitlePaneTextL( TDesC& aText )
       
   935     {
       
   936 	DEBUG( + CLocSUPLServerEditor::ChangeTitlePaneTextL );
       
   937     // Obtain the title from the Status Pane
       
   938     CAknTitlePane* title = static_cast < CAknTitlePane* >( iEikonEnv->AppUiFactory()->
       
   939     	StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   940        
       
   941     // Set the Title's buffer    
       
   942     HBufC* buf = aText.AllocL();
       
   943     title->SetText( buf ); // Takes ownership of buf
       
   944     title->DrawNow();
       
   945 	DEBUG( - CLocSUPLServerEditor::ChangeTitlePaneTextL );
       
   946     }     
       
   947 
       
   948 // ---------------------------------------------------------------------------
       
   949 // CLocSUPLServerEditor::TogglePopupFieldControlL()
       
   950 // it toggles  value of popupfield control
       
   951 // ---------------------------------------------------------------------------
       
   952 //
       
   953 void CLocSUPLServerEditor::TogglePopupFieldControlL( TInt aControlId )
       
   954     {
       
   955 	DEBUG( + CLocSUPLServerEditor::TogglePopupFieldControlL );
       
   956     CAknPopupFieldText* popupFieldText =
       
   957                     		( CAknPopupFieldText* ) Control( aControlId );
       
   958                     		
       
   959 	if( popupFieldText )
       
   960 		{          
       
   961 		if( popupFieldText->CurrentValueIndex() == 0 )
       
   962 		  	popupFieldText->SetCurrentValueIndex( 1 );
       
   963 		else
       
   964 		  	popupFieldText->SetCurrentValueIndex( 0 );    
       
   965 
       
   966 		UpdatePageL( ETrue );
       
   967 		}
       
   968 	DEBUG( - CLocSUPLServerEditor::TogglePopupFieldControlL );
       
   969     }
       
   970  
       
   971 // -----------------------------------------------------------------------------
       
   972 // CLocSUPLServerEditor::HandleMSKCaptionL()
       
   973 // It changes caption of MSK key
       
   974 // -----------------------------------------------------------------------------
       
   975 //
       
   976 void CLocSUPLServerEditor::HandleMSKCaptionL()
       
   977     {
       
   978 	DEBUG( + CLocSUPLServerEditor::HandleMSKCaptionL );
       
   979     CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
       
   980     CleanupStack::PushL( cba );
       
   981     //attribute specific cba
       
   982     if( IsEditable() )
       
   983 	    {
       
   984 		switch ( IdOfFocusControl() )
       
   985 	       	{
       
   986 	       	case ELocSuplServerIdServerAddr:
       
   987 	       		{
       
   988 	       		cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_DONE );
       
   989 	       		break;
       
   990 	       		}
       
   991 	       	case ELocSuplServerIdAccessPoint:
       
   992 		       	{
       
   993 		       	TInt isIapChanged = EFalse;
       
   994 		        CEikEdwin* apSelector = 
       
   995 		        			static_cast < CEikEdwin* > ( ControlOrNull( IdOfFocusControl() ) );           
       
   996 		        if( apSelector && iIap )
       
   997 		            {   
       
   998 		            if( iIap->Length() > 0 )
       
   999 	            		isIapChanged = ETrue;
       
  1000 		            } 
       
  1001 		       	if( isIapChanged )
       
  1002 		       		{
       
  1003 		       		cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_CHANGE_DONE );
       
  1004 		       		}
       
  1005 		       	else
       
  1006 		       		{
       
  1007 		       		cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_DEFINE_DONE );		       		
       
  1008 		       		}
       
  1009 		       	break;	
       
  1010 		       	}
       
  1011 	       	case ELocSuplServerIdUsageInHomeNw:
       
  1012 		       	{
       
  1013    	        	TBool editableFlag = ETrue;
       
  1014 	        	if( iSlpId )
       
  1015 	        		{
       
  1016 	        		TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) );        		
       
  1017 	        		}
       
  1018 		       	if( editableFlag )
       
  1019 	       			cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_CHANGE_DONE );
       
  1020 		       	else
       
  1021 	       			cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_DONE );		       	
       
  1022 	       		break;
       
  1023 		       	}
       
  1024 		 	default:
       
  1025 			 	break;	
       
  1026 	       	}	    	
       
  1027 	    }
       
  1028 	else
       
  1029 		{		
       
  1030     	TBool editableFlag = ETrue;
       
  1031     	TBool changeMSK = ETrue;    	
       
  1032     	
       
  1033     	if( iSlpId )
       
  1034     		TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) );        		    		
       
  1035     	    	
       
  1036        	if( editableFlag == EFalse && ( IdOfFocusControl() == ELocSuplServerIdServerAddr || 
       
  1037        									IdOfFocusControl() == ELocSuplServerIdUsageInHomeNw ) )
       
  1038 			changeMSK = EFalse;       			
       
  1039 
       
  1040        	if( changeMSK )
       
  1041        	    cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_EDIT_BACK );
       
  1042        	else
       
  1043        		cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_BACK );
       
  1044 		}
       
  1045     cba->DrawDeferred();    
       
  1046     CleanupStack::Pop( cba );    
       
  1047 	DEBUG( - CLocSUPLServerEditor::HandleMSKCaptionL );
       
  1048     }
       
  1049 
       
  1050 // -----------------------------------------------------------------------------
       
  1051 // CLocSUPLServerEditor::UpdateIapL()
       
  1052 // It changes IAP value in AP field
       
  1053 // -----------------------------------------------------------------------------
       
  1054 //
       
  1055 void CLocSUPLServerEditor::UpdateIapL( const TDesC& aIapName )
       
  1056 	{
       
  1057 	DEBUG( + CLocSUPLServerEditor::UpdateIapL );
       
  1058 	if( aIapName.Length() > 0 )
       
  1059 		{
       
  1060 		iIap->Des().Copy( aIapName );	
       
  1061 	    CEikEdwin* apSelector = 
       
  1062 	    			static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdAccessPoint ) );           
       
  1063 	    if( apSelector )
       
  1064 	        {   
       
  1065 	        apSelector->SetTextL( iIap );
       
  1066 	        } 	
       
  1067 	    apSelector->DrawNow();
       
  1068 	    HandleMSKCaptionL();
       
  1069         if (iIsNewServer)
       
  1070           {
       
  1071           iIsModified = ETrue;
       
  1072           }
       
  1073 		}
       
  1074 	DEBUG( - CLocSUPLServerEditor::UpdateIapL  );
       
  1075 	}
       
  1076 
       
  1077 // -----------------------------------------------------------------------------
       
  1078 // CLocSUPLServerEditor::DeleteConfirmationQueryL
       
  1079 // Pops the delete confirmation query note
       
  1080 // ----------------------------------------------------------------------------
       
  1081 //
       
  1082 TInt CLocSUPLServerEditor::DeleteConfirmationQueryL()
       
  1083     {    
       
  1084     HBufC* noteText = NULL;    
       
  1085     noteText = StringLoader::LoadL( R_LOC_DETAIL_CONF_DELETE_SERVER );
       
  1086     CAknQueryDialog* query = new( ELeave ) CAknQueryDialog( *noteText );    
       
  1087     TInt ret = query->ExecuteLD( R_LOC_SUPL_DELETE_QUERY );
       
  1088     delete noteText; //noteText    
       
  1089     noteText = NULL;
       
  1090     return ret;
       
  1091     }
       
  1092 
       
  1093 // -----------------------------------------------------------------------------
       
  1094 // CLocSUPLServerEditor::ShowServerValidationInfoNoteL
       
  1095 // Shows Validation Info note for server address entry
       
  1096 // ----------------------------------------------------------------------------
       
  1097 //
       
  1098 void CLocSUPLServerEditor::ShowServerValidationInfoNoteL( TInt aResourceId )
       
  1099 	{
       
  1100 	// Show the information note to add server address before closing
       
  1101     HBufC* noteText = StringLoader::LoadL( aResourceId );
       
  1102     CAknInformationNote* dialog = 
       
  1103         new( ELeave ) CAknInformationNote( R_AKN_INFORMATION_NOTE_WAIT );
       
  1104     dialog->ExecuteLD( *noteText );
       
  1105     delete noteText; //noteText    
       
  1106     noteText = NULL;
       
  1107 	}
       
  1108 
       
  1109 // ----------------------------------------------------------------------------------
       
  1110 // CLocSUPLServerEditor::SetCursorToEndL
       
  1111 // Moves the cursor position at end if focus is on server address field in edit mode
       
  1112 // ----------------------------------------------------------------------------------
       
  1113 //
       
  1114 void CLocSUPLServerEditor::SetCursorToEndL()
       
  1115 	{	
       
  1116 	if ( IdOfFocusControl() == ELocSuplServerIdServerAddr )
       
  1117 		{
       
  1118         CEikEdwin* serverAddress = 
       
  1119         			static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdServerAddr ) );           
       
  1120         if( serverAddress )
       
  1121             {   
       
  1122             HBufC* address = serverAddress->GetTextInHBufL();
       
  1123             if( address )
       
  1124             	{
       
  1125 	            serverAddress->SetCursorPosL( address->Length(), EFalse );         
       
  1126 	        	serverAddress->DrawDeferred();              	
       
  1127             	}
       
  1128         	delete address;     			
       
  1129    			}
       
  1130 		}
       
  1131 	}
       
  1132 
       
  1133 // End of file