locationsystemui/locationsysui/locsuplsettingsui/inc/locsuplservereditor.h
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     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:  supl server editor
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __LOCSUPLSERVER_EDITOR_H__
       
    20 #define __LOCSUPLSERVER_EDITOR_H__
       
    21 
       
    22 
       
    23 #include <AknForm.h>
       
    24 #include <ConeResLoader.h>
       
    25 
       
    26 const TInt KMaxUsageTextSize = 5;
       
    27 _LIT(KNoUsageInHomeNetork, "No");
       
    28 
       
    29 class CAknTitlePane;
       
    30 class CLocSUPLSettingsUiEngine;
       
    31 
       
    32 class MSuplServerEditorObserver
       
    33 	{
       
    34 public:
       
    35 	
       
    36 	virtual void UpdateIapL( const TDesC& aIapName ) = 0;
       
    37 	};
       
    38 
       
    39 
       
    40 
       
    41 /**
       
    42 *  A dialog that makes it possible to edit certain fields of a supl server.
       
    43 */
       
    44 class CLocSUPLServerEditor : 
       
    45     public CAknForm, public MSuplServerEditorObserver
       
    46     {
       
    47     public: // Constructors and destructor
       
    48 
       
    49         /**
       
    50  		* Static Two phase contructor that instantiates the CLocSUPLServerEditor
       
    51 		* 
       
    52         */
       
    53         static CLocSUPLServerEditor* NewL( 
       
    54         					TBool aIsEditable,
       
    55                             CLocSUPLSettingsUiEngine&       aEngine,
       
    56         					TInt64 aSlpId
       
    57 		);
       
    58 
       
    59         /**
       
    60  		* Static Two phase contructor that instantiates the CLocSUPLServerEditor
       
    61 		* 
       
    62         */
       
    63         static CLocSUPLServerEditor* NewLC( 
       
    64         					TBool aIsEditable,
       
    65                             CLocSUPLSettingsUiEngine&       aEngine,
       
    66         					TInt64 aSlpId
       
    67 		);
       
    68 
       
    69         /**
       
    70         * Destructor.
       
    71         */
       
    72         ~CLocSUPLServerEditor();
       
    73 
       
    74     public: // From CAknDialog
       
    75 
       
    76         /**
       
    77         * DynInitMenuPaneL initializes the menu pane before it is displayed.
       
    78         *
       
    79         * @param aResourceId a resource ID indetifying the menu bar containing
       
    80         * the menu pane to be initialized.
       
    81         * @param aMenuPane the menu pane to initialize.
       
    82         */
       
    83         void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
       
    84 
       
    85         /**
       
    86         * Processes user commands.
       
    87         *
       
    88         * @param aCommandId id of the command to respond to
       
    89         */
       
    90         void ProcessCommandL(TInt aCommandId);
       
    91         
       
    92         /**
       
    93          * 
       
    94          * 
       
    95          */
       
    96         void HandleDialogPageEventL( TInt aEventID );
       
    97         /*
       
    98          * Executes the Dialog
       
    99          */
       
   100         TInt ExecuteLD();
       
   101 	
       
   102 	public: // from MSuplServerEditorObserver
       
   103 	
       
   104 	    /*
       
   105          * Changes IAP value in AP field
       
   106          */
       
   107 		void UpdateIapL( const TDesC& aIapName );
       
   108 
       
   109 	
       
   110     protected: // From CAknForm
       
   111 
       
   112      /**
       
   113        * Inherited from CCoeControl
       
   114        */				    
       
   115         
       
   116 		TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   117 		                                             TEventCode aType );
       
   118 		                                             
       
   119         /**
       
   120         * Handles a dialog button press for the specified dialog button.
       
   121         *
       
   122         * @param aButtonId
       
   123         * @return ETrue if OK to exit, EFalse to keep the dialog active
       
   124         */
       
   125         TBool OkToExitL(TInt aButtonId);
       
   126 
       
   127         /**
       
   128         * SaveFormDataL deals with the occasion of a change from
       
   129         * edit->view mode and the user wishes to save the changes.
       
   130         *
       
   131         * @return ETrue if the editable state can be left, EFalse otherwise
       
   132         */
       
   133         TBool SaveFormDataL();
       
   134         
       
   135     private: // From CEikDialog
       
   136 
       
   137         /**
       
   138         * PreLayoutDynInitL initialises the dialog's controls before the dialog
       
   139         * is sized and layed out.
       
   140         */
       
   141         void PreLayoutDynInitL();
       
   142 
       
   143         /**
       
   144         * PostLayoutDynInitL initialises the dialog's controls after the dialog
       
   145         * has been sized but before it has been activated.
       
   146         */
       
   147         void PostLayoutDynInitL();
       
   148 
       
   149         /**
       
   150         * Selects desired line on startup
       
   151         */
       
   152         void SetInitialCurrentLine();
       
   153 
       
   154        
       
   155         /** Handles layout switch */
       
   156         void HandleResourceChange( TInt aType );
       
   157 
       
   158 		void HandleControlStateChangeL( TInt aControlId );
       
   159  
       
   160 		void LineChangedL(TInt aControlId );
       
   161 		
       
   162  	private:
       
   163 
       
   164         enum TErrorInForm
       
   165             {
       
   166             ENoErrors
       
   167             };
       
   168 
       
   169         /** Constructor
       
   170          *
       
   171          */
       
   172         CLocSUPLServerEditor( 
       
   173         					TBool aIsEditable,
       
   174                             CLocSUPLSettingsUiEngine&       aEngine,
       
   175         					TInt64 aSlpId
       
   176 		);
       
   177 
       
   178         void ConstructL();
       
   179 
       
   180 	private: // new functions
       
   181         /**
       
   182          * Change title pane text
       
   183          */
       
   184 		void ChangeTitlePaneTextL( TDesC& aText );
       
   185 		
       
   186         /**
       
   187          * Load intial data values
       
   188          */
       
   189         void LoadFormValuesFromDataL();
       
   190 
       
   191 		/*
       
   192 		 * It checks if server details are empty in editor.
       
   193 		 * 
       
   194 		 * @ret true if event is empty else false.
       
   195 		 */
       
   196 		TBool IsEmptyServerL();
       
   197 
       
   198 		/*
       
   199 		 * it toggles value of popup field
       
   200 		 */        
       
   201 		void TogglePopupFieldControlL( TInt aControlId );
       
   202 		
       
   203 		/*
       
   204 		 * toggles the txt
       
   205 		 */
       
   206 		void SetUsageinHomeNetwork( TBool aOnOff );
       
   207 
       
   208 		/*
       
   209 		 * it changes the MSK caption 
       
   210 		 */        
       
   211 		void HandleMSKCaptionL();
       
   212 
       
   213 		/*
       
   214 		 * Confirmation query note for delete operation
       
   215 		 */        
       
   216 		TInt DeleteConfirmationQueryL();
       
   217 
       
   218 		/*
       
   219 		 * Shows Validation Info note for server address entry 
       
   220 		 */        
       
   221 		void ShowServerValidationInfoNoteL( TInt aResourceId );
       
   222 		
       
   223 		/*
       
   224 		 * Sets the cursor position to end at server address field in editor
       
   225 		 */        
       
   226 		void SetCursorToEndL();
       
   227 		
       
   228 
       
   229     private: // Data
       
   230 
       
   231         //! The title pane that is dynamically updated
       
   232         CAknTitlePane* 				iTitlePane;
       
   233 
       
   234         //! The original title that the title pane displayed before modified
       
   235         HBufC* 						iOriginalTitle;
       
   236 
       
   237        	/*
       
   238          * Mode in which editor is opened. It can be either view or edit mode.
       
   239          */   
       
   240        	TBool                    	iIsEditMode;
       
   241       
       
   242        	/*
       
   243          * Mode in which editor is opened. It can be either view or edit mode.
       
   244          */      
       
   245       	TBool 						iIsNewServer;
       
   246       	
       
   247 	   	/*
       
   248 	     *  help context object
       
   249    	     */
       
   250        	TCoeHelpContext         	iHelpContext;  
       
   251 
       
   252 		/*
       
   253 		 * Reference to the SUPL Settings engine
       
   254 		 */
       
   255 	    CLocSUPLSettingsUiEngine&	iEngine;	
       
   256 	    
       
   257 	    /**
       
   258          * SUPL Servers SLP ID to get and set the server attributes.
       
   259          * Owns.
       
   260          */
       
   261         TInt64						iSlpId;
       
   262         
       
   263 	    /**
       
   264          * SUPL Server Address 
       
   265          * Owns.
       
   266          */
       
   267 	    HBufC* 						iServerAddress;
       
   268 	    
       
   269 	    /**
       
   270          * SUPL Server Access point
       
   271          * Owns.
       
   272          */
       
   273 	    HBufC* 						iIap;
       
   274 	    
       
   275 	    /**
       
   276          * SUPL Server usage in home network
       
   277          * Owns.
       
   278          */
       
   279 	    TBool 						iUsageInHomeNw;
       
   280 	    
       
   281 	    /**
       
   282 	    	* It determines if form is modified by user
       
   283 	    	*/	    
       
   284 	    TBool							iIsModified;
       
   285     };
       
   286 
       
   287 #endif // __LOCSUPLSERVER_EDITOR_H__
       
   288