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