|
1 /* |
|
2 * Copyright (c) 2005 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: Dialog to edit profile setting |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef ASPPROFILEDIALOG_H |
|
21 #define ASPPROFILEDIALOG_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include "AspDialogUtil.h" |
|
27 |
|
28 #include <e32base.h> |
|
29 #include <aknlists.h> |
|
30 #include <AknDialog.h> |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 |
|
39 /** |
|
40 * CAspProfileDialog |
|
41 * |
|
42 * CAspProfileDialog is used for editing sync connection data. |
|
43 */ |
|
44 NONSHARABLE_CLASS (CAspProfileDialog) : public CAknDialog, public MEikListBoxObserver |
|
45 { |
|
46 public: |
|
47 |
|
48 |
|
49 public: |
|
50 /** |
|
51 * Launches dialog. |
|
52 * @param aParam Class that contains dialog parameters. |
|
53 * @return Completion code. |
|
54 */ |
|
55 static TBool ShowDialogL(const TAspParam& aParam); |
|
56 |
|
57 public:// Constructors and destructor |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 */ |
|
62 static CAspProfileDialog* NewL(const TAspParam& aParam); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CAspProfileDialog(); |
|
68 |
|
69 private: |
|
70 |
|
71 /** |
|
72 * C++ default constructor. |
|
73 */ |
|
74 CAspProfileDialog(const TAspParam& aParam); |
|
75 |
|
76 /** |
|
77 * By default Symbian OS constructor is private. |
|
78 */ |
|
79 void ConstructL(); |
|
80 |
|
81 private: |
|
82 /** |
|
83 * From MEikListBoxObserver, called by framework. |
|
84 * @param aListBox. |
|
85 * @param aEventType. |
|
86 * @return None |
|
87 */ |
|
88 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
89 |
|
90 /** |
|
91 * From the base class. |
|
92 * Called by framework before the dialog is shown. |
|
93 * @param None |
|
94 * @return None |
|
95 */ |
|
96 void PreLayoutDynInitL(); |
|
97 |
|
98 /** |
|
99 * From the base class. |
|
100 * Called by framework before exiting the dialog. |
|
101 * @param aButtonId Button id. |
|
102 * @return ETrue to exit\ EFalse to not to exit. |
|
103 */ |
|
104 TBool OkToExitL(TInt aButtonId); |
|
105 |
|
106 /** |
|
107 * From the base class. |
|
108 * Called by framework for key event handling. |
|
109 * @param aKeyEvent. |
|
110 * @param aType. |
|
111 * @return Return code. |
|
112 */ |
|
113 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
114 |
|
115 /** |
|
116 * From the base class. |
|
117 * Called by framework when dialog is activated. |
|
118 * @param None. |
|
119 * @return None. |
|
120 */ |
|
121 void ActivateL(); |
|
122 |
|
123 /** |
|
124 * Method to get context sensitive help topic. |
|
125 * @param aContext Help topic to open. |
|
126 * @return None. |
|
127 */ |
|
128 void GetHelpContext(TCoeHelpContext& aContext) const; |
|
129 |
|
130 /** |
|
131 * From the base class. |
|
132 * Called by framework before menu is shown. |
|
133 * @param aResourceId Menu resource id. |
|
134 * @param aMenuPane Pointer to the menu. |
|
135 * @return None. |
|
136 */ |
|
137 void DynInitMenuPaneL(TInt aResourceID, CEikMenuPane* aMenuPane); |
|
138 |
|
139 /** |
|
140 * From the base class. |
|
141 * Handles menu events. |
|
142 * @param aCommandId Command id. |
|
143 * @return None. |
|
144 */ |
|
145 void ProcessCommandL(TInt aCommandId); |
|
146 |
|
147 /** |
|
148 * From base class. |
|
149 * Called when UI layout changes. |
|
150 * @param aType. |
|
151 * @return None. |
|
152 */ |
|
153 void HandleResourceChange(TInt aType); |
|
154 |
|
155 private: |
|
156 /** |
|
157 * Handles setting item editing. |
|
158 * @param None. |
|
159 * @return None. |
|
160 */ |
|
161 void HandleOKL(); |
|
162 |
|
163 /** |
|
164 * Set setting list icons. |
|
165 * @param None. |
|
166 * @return None. |
|
167 */ |
|
168 void SetIconsL(); |
|
169 |
|
170 |
|
171 public: // common editors |
|
172 |
|
173 /** |
|
174 * Shows editor for text type setting. |
|
175 * @param aItem Setting item data. |
|
176 * @return Return code. |
|
177 */ |
|
178 TBool EditSettingItemTextL(CAspListItemData& aItem); |
|
179 |
|
180 /** |
|
181 * Shows editor for number type setting. |
|
182 * @param aItem Setting item data. |
|
183 * @return Return code. |
|
184 */ |
|
185 static TBool EditSettingItemNumberL(CAspListItemData& aItem); |
|
186 |
|
187 /** |
|
188 * Shows editor for secret type setting. |
|
189 * @param aItem Setting item data. |
|
190 * @return Return code. |
|
191 */ |
|
192 static TBool EditSettingItemSecretL(CAspListItemData& aItem); |
|
193 |
|
194 /** |
|
195 * Shows editor for list type setting. |
|
196 * @param aItem Setting item data. |
|
197 * @return Return code. |
|
198 */ |
|
199 static TBool EditSettingItemListL(CAspListItemData& aItem); |
|
200 /** |
|
201 * Checks whether MSK label and menu command are correct for the context |
|
202 * @param aKeyEvent |
|
203 * @return None. |
|
204 */ |
|
205 void CheckContentSettingL(const TKeyEvent& aKeyEvent); |
|
206 /** |
|
207 * Checks whether MSK label and menu command are correct for the context |
|
208 * @param None |
|
209 * @return None. |
|
210 */ |
|
211 void CheckContentSettingL(); |
|
212 /** |
|
213 * Utility function, updates dialog cba. |
|
214 * @param aResourceId. |
|
215 * @return None. |
|
216 */ |
|
217 void UpdateCbaL(TInt aResourceId); |
|
218 |
|
219 /** |
|
220 * Utility function, updates menu bar. |
|
221 * @param aResource. |
|
222 * @return None. |
|
223 */ |
|
224 |
|
225 void UpdateMenuL(TInt aResource); |
|
226 |
|
227 private: |
|
228 |
|
229 /** |
|
230 * Handles setting item editing. |
|
231 * @param aItem Setting item data. |
|
232 * @return Return code. |
|
233 */ |
|
234 TBool EditSettingItemL(CAspListItemData& aItem); |
|
235 |
|
236 /** |
|
237 * Change Yes/No setting in place without showing editor. |
|
238 * @param aItem Setting item data. |
|
239 * @return Return code. |
|
240 */ |
|
241 TBool EditSettingItemYesNoL(CAspListItemData& aItem); |
|
242 |
|
243 /** |
|
244 * Shows editor for bearer type setting. |
|
245 * @param aItem Setting item data. |
|
246 * @return Return code. |
|
247 */ |
|
248 TBool EditSettingItemBearerListL(CAspListItemData& aItem); |
|
249 |
|
250 /** |
|
251 * Shows editor for protocol version setting. |
|
252 * @param aItem Setting item data. |
|
253 * @return Return code. |
|
254 */ |
|
255 TBool EditSettingItemProtocolListL(CAspListItemData& aItem); |
|
256 |
|
257 /** |
|
258 * Shows editor for text type setting. |
|
259 * @param aItem Setting item data. |
|
260 * @return Return code. |
|
261 */ |
|
262 TBool EditSettingItemHostAddressL(CAspListItemData& aItem); |
|
263 |
|
264 /** |
|
265 * Shows dialog for access point selection. |
|
266 * @param aItem Setting item data. |
|
267 * @return Return code. |
|
268 */ |
|
269 TBool EditSettingItemAccessPointL(CAspListItemData& aItem); |
|
270 |
|
271 /** |
|
272 * Opens content dialog. |
|
273 * @param None. |
|
274 * @return Return code. |
|
275 */ |
|
276 TInt EditSettingItemSyncContentL(CAspListItemData& aItem); |
|
277 |
|
278 /** |
|
279 * Set the MSK empty. |
|
280 * @param None. |
|
281 * @return None. |
|
282 */ |
|
283 void SetEmptyMiddleSoftKeyLabelL(); |
|
284 |
|
285 private: |
|
286 |
|
287 /** |
|
288 * Checks that all mandatory data is found. |
|
289 * @param None. |
|
290 * @return Return code. |
|
291 */ |
|
292 TInt CheckMandatoryFields(); |
|
293 |
|
294 /** |
|
295 * Checks that all mandatory data is found. |
|
296 * @param aListItem. |
|
297 * @return Return code. |
|
298 */ |
|
299 TBool CheckMandatoryContentFields(CAspListItemData* aListItem); |
|
300 |
|
301 /** |
|
302 * Checks that server id is unique. |
|
303 * @param None. |
|
304 * @return Return code. |
|
305 */ |
|
306 TInt CheckUniqueServerId(); |
|
307 |
|
308 /** |
|
309 * Saves profile. |
|
310 * @param None. |
|
311 * @return Return code. |
|
312 */ |
|
313 void SaveSettingsL(); |
|
314 |
|
315 /** |
|
316 * Check setting values before dialog close. |
|
317 * @param aButtonId Button id. |
|
318 * @return ETrue to exit\ EFalse to not to exit. |
|
319 */ |
|
320 TBool CheckSettingValuesL(TInt aButtonId); |
|
321 |
|
322 /** |
|
323 * Check setting values before dialog close. |
|
324 * @param aButtonId Button id. |
|
325 * @return ETrue to exit\ EFalse to not to exit. |
|
326 */ |
|
327 TBool CheckSettingValues(TInt aButtonId); |
|
328 |
|
329 /** |
|
330 * Check if the profile is selected for auto sync ,and if selected check for mandatory settings |
|
331 * @return None |
|
332 */ |
|
333 void CheckAutoSyncSetttigsL(); |
|
334 |
|
335 private: |
|
336 /** |
|
337 * Create one CNSmlDSProfileData for each setting. |
|
338 * @param None. |
|
339 * @return None. |
|
340 */ |
|
341 void CreateSettingsListL(); |
|
342 |
|
343 /** |
|
344 * Initalizes setting item needed for listbox handling. |
|
345 * @param aItem. |
|
346 * @return None. |
|
347 */ |
|
348 void InitSettingItemL(CAspListItemData* aItem); |
|
349 |
|
350 /** |
|
351 * Add settings titles into listbox. |
|
352 * @param aListBox. |
|
353 * @param aItemList List of setting items. |
|
354 * @return None. |
|
355 */ |
|
356 void UpdateListBoxL(CEikTextListBox* aListBox, CAspSettingList* aItemList); |
|
357 |
|
358 /** |
|
359 * Adds one setting item into item list. |
|
360 * @param aItemId Item id. |
|
361 * @param aHeaders Array of item headers. |
|
362 * @return None. |
|
363 */ |
|
364 void AddItemL(TInt aItemId, CDesCArray* aHeaders); |
|
365 |
|
366 /** |
|
367 * Adds one setting item into item list. |
|
368 * @param aItemId Item id. |
|
369 * @param aResourceId. |
|
370 * @return None. |
|
371 */ |
|
372 void AddItemL(TInt aItemId, TInt aResourceId); |
|
373 |
|
374 /** |
|
375 * Set setting item visibility (normal/readonly/hidden). |
|
376 * @param None. |
|
377 * @return None. |
|
378 */ |
|
379 void SetVisibilityL(); |
|
380 |
|
381 /** |
|
382 * Set all settings to read-only state. |
|
383 * @param None. |
|
384 * @return None. |
|
385 */ |
|
386 void SetAllReadOnly(); |
|
387 |
|
388 |
|
389 /** |
|
390 * Adds sync contents into item list. |
|
391 * @param None. |
|
392 * @return None. |
|
393 */ |
|
394 void AddContentItemsL(); |
|
395 |
|
396 private: |
|
397 |
|
398 /** |
|
399 * Creates icon. |
|
400 * @param aId. |
|
401 * @param aFileName. |
|
402 * @param aFileIndex. |
|
403 * @param aFileMaskIndex. |
|
404 * @return Created icon. |
|
405 */ |
|
406 CGulIcon* IconL(TAknsItemID aId, const TDesC& aFileName, TInt aFileIndex, TInt aFileMaskIndex); |
|
407 |
|
408 /** |
|
409 * Returns setting item with listbox position aIndex. |
|
410 * @param aIndex Listbox index. |
|
411 * @return Pointer to setting item. |
|
412 */ |
|
413 CAspListItemData* GetItemForIndex(TInt aIndex); |
|
414 |
|
415 /** |
|
416 * Returns setting item with id aItemId. |
|
417 * @param aItemId Item id. |
|
418 * @return Pointer to setting item. |
|
419 */ |
|
420 CAspListItemData* Item(TInt aItemId); |
|
421 |
|
422 /** |
|
423 * Returns listbox. |
|
424 * @param None. |
|
425 * @return Pointer to listbox. |
|
426 */ |
|
427 CAknSettingStyleListBox* ListBox(); |
|
428 |
|
429 /** |
|
430 * Returns profile. |
|
431 * @param None. |
|
432 * @return Pointer to sync profile. |
|
433 */ |
|
434 //CAspProfile* Profile(); |
|
435 |
|
436 |
|
437 private: |
|
438 // setting list |
|
439 CAknSettingStyleListBox* iSettingListBox; |
|
440 |
|
441 // list of setting items |
|
442 CAspSettingList *iSettingList; |
|
443 |
|
444 // list that contains all contents (applications) |
|
445 //CAspContentList* iContentList; |
|
446 |
|
447 // profile data |
|
448 CAspProfile* iProfile; |
|
449 |
|
450 // sync session |
|
451 RSyncMLSession* iSyncSession; |
|
452 |
|
453 // for title and icon handling |
|
454 CStatusPaneHandler* iStatusPaneHandler; |
|
455 |
|
456 // resource handler |
|
457 CAspResHandler* iResHandler; |
|
458 |
|
459 // dialog edit mode |
|
460 TInt iEditMode; |
|
461 |
|
462 // for bearer type list construction |
|
463 CAspBearerHandler* iBearerHandler; |
|
464 |
|
465 // for access point selection |
|
466 CAspAccessPointHandler* iApHandler; |
|
467 |
|
468 // long buffer for string handling |
|
469 TBuf<KBufSize255> iBuf; |
|
470 |
|
471 // list that contains all contents (applications) |
|
472 CAspContentList* iContentList; |
|
473 |
|
474 // list that contains all profiles |
|
475 CAspProfileList* iProfileList; |
|
476 |
|
477 // id of the calling application |
|
478 TInt iApplicationId; |
|
479 |
|
480 // is setting database in read only state |
|
481 TBool iSettingEnforcement; |
|
482 // profile's server id |
|
483 TBuf<KAspMaxServerIdLength> iOldServerId; |
|
484 // id of current cba resource |
|
485 TInt iCommandSetId; |
|
486 // is MSK empty |
|
487 TBool iMSKEmpty; |
|
488 }; |
|
489 |
|
490 |
|
491 #endif // ASPPROFILEDIALOG_H |
|
492 |
|
493 // End of File |