|
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 /** |
|
103 * Sets the value of iIsAccessPointDefined based on whether the |
|
104 * access point is preconfigured for a server |
|
105 * @param[in] aEnabled - Value to be set for the variable iIsAccessPointDefined |
|
106 */ |
|
107 void SetAccessPointEnabled(TBool aEnabled); |
|
108 public: // from MSuplServerEditorObserver |
|
109 |
|
110 /* |
|
111 * Changes IAP value in AP field |
|
112 */ |
|
113 void UpdateIapL( const TDesC& aIapName ); |
|
114 |
|
115 |
|
116 protected: // From CAknForm |
|
117 |
|
118 /** |
|
119 * Inherited from CCoeControl |
|
120 */ |
|
121 |
|
122 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
123 TEventCode aType ); |
|
124 |
|
125 /** |
|
126 * Handles a dialog button press for the specified dialog button. |
|
127 * |
|
128 * @param aButtonId |
|
129 * @return ETrue if OK to exit, EFalse to keep the dialog active |
|
130 */ |
|
131 TBool OkToExitL(TInt aButtonId); |
|
132 |
|
133 /** |
|
134 * SaveFormDataL deals with the occasion of a change from |
|
135 * edit->view mode and the user wishes to save the changes. |
|
136 * |
|
137 * @return ETrue if the editable state can be left, EFalse otherwise |
|
138 */ |
|
139 TBool SaveFormDataL(); |
|
140 |
|
141 private: // From CEikDialog |
|
142 |
|
143 /** |
|
144 * PreLayoutDynInitL initialises the dialog's controls before the dialog |
|
145 * is sized and layed out. |
|
146 */ |
|
147 void PreLayoutDynInitL(); |
|
148 |
|
149 /** |
|
150 * PostLayoutDynInitL initialises the dialog's controls after the dialog |
|
151 * has been sized but before it has been activated. |
|
152 */ |
|
153 void PostLayoutDynInitL(); |
|
154 |
|
155 /** |
|
156 * Selects desired line on startup |
|
157 */ |
|
158 void SetInitialCurrentLine(); |
|
159 |
|
160 |
|
161 /** Handles layout switch */ |
|
162 void HandleResourceChange( TInt aType ); |
|
163 |
|
164 void HandleControlStateChangeL( TInt aControlId ); |
|
165 |
|
166 void LineChangedL(TInt aControlId ); |
|
167 |
|
168 private: |
|
169 |
|
170 enum TErrorInForm |
|
171 { |
|
172 ENoErrors |
|
173 }; |
|
174 |
|
175 /** Constructor |
|
176 * |
|
177 */ |
|
178 CLocSUPLServerEditor( |
|
179 TBool aIsEditable, |
|
180 CLocSUPLSettingsUiEngine& aEngine, |
|
181 TInt64 aSlpId |
|
182 ); |
|
183 |
|
184 void ConstructL(); |
|
185 |
|
186 private: // new functions |
|
187 /** |
|
188 * Change title pane text |
|
189 */ |
|
190 void ChangeTitlePaneTextL( TDesC& aText ); |
|
191 |
|
192 /** |
|
193 * Load intial data values |
|
194 */ |
|
195 void LoadFormValuesFromDataL(); |
|
196 |
|
197 /* |
|
198 * It checks if server details are empty in editor. |
|
199 * |
|
200 * @ret true if event is empty else false. |
|
201 */ |
|
202 TBool IsEmptyServerL(); |
|
203 /* |
|
204 * toggles the txt |
|
205 */ |
|
206 void SetUsageinHomeNetworkL( 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 * Determines whether the access point is preconfigured for the server |
|
288 */ |
|
289 TBool iIsAccessPointDefined; |
|
290 }; |
|
291 |
|
292 #endif // __LOCSUPLSERVER_EDITOR_H__ |
|
293 |