|
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: Editing content settings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ASPCONTENTDIALOG_H |
|
20 #define ASPCONTENTDIALOG_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <eiklbo.h> |
|
26 #include <aknlists.h> |
|
27 #include <aknnavide.h> |
|
28 #include <AknDialog.h> |
|
29 |
|
30 #include <CAknCommonDialogsBase.h> // TCommonDialogType |
|
31 |
|
32 #include "AspDialogUtil.h" |
|
33 |
|
34 |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 |
|
39 /** |
|
40 * CAspContentDialog |
|
41 * |
|
42 * Content dialog is used to edit sync content (sync task) data. |
|
43 */ |
|
44 NONSHARABLE_CLASS (CAspContentDialog) : public CAknDialog, public MEikListBoxObserver |
|
45 { |
|
46 public: |
|
47 /** |
|
48 * Launches content dialog. |
|
49 * @param aParam Class that contains dialog parameters. |
|
50 * @return Completion code. |
|
51 */ |
|
52 static TBool ShowDialogL(TAspParam& aParam); |
|
53 |
|
54 private: |
|
55 |
|
56 /** |
|
57 * C++ default constructor. |
|
58 * @param aParam Class that contains dialog parameters. |
|
59 * @return None. |
|
60 */ |
|
61 CAspContentDialog(TAspParam& aParam); |
|
62 |
|
63 |
|
64 /** |
|
65 * Two-phased constructor. |
|
66 * @param aParam Class that contains dialog parameters. |
|
67 */ |
|
68 static CAspContentDialog* NewL(TAspParam& aParam); |
|
69 |
|
70 /** |
|
71 * By default Symbian 2nd phase constructor is private. |
|
72 */ |
|
73 void ConstructL(); |
|
74 |
|
75 /** |
|
76 * Destructor. |
|
77 */ |
|
78 virtual ~CAspContentDialog(); |
|
79 |
|
80 /** |
|
81 * Check if the MSK label is correct for the context |
|
82 * @param aKeyEvent Key code. |
|
83 */ |
|
84 void CheckContentSettingL(const TKeyEvent& aKeyEvent); |
|
85 |
|
86 /** |
|
87 * Update the MSK Label |
|
88 * @param aCommandId command id. |
|
89 * @param aResourceId resource id . |
|
90 */ |
|
91 void UpdateMiddleSoftKeyLabelL(TInt aCommandId,TInt aResourceId); |
|
92 |
|
93 |
|
94 private: |
|
95 |
|
96 /** |
|
97 * From the base class. |
|
98 * Called when dialog is activated. |
|
99 * @return None. |
|
100 */ |
|
101 void ActivateL(); |
|
102 |
|
103 /** |
|
104 * From the base class. |
|
105 * Handles key presses. |
|
106 * @param aKeyEvent Key code. |
|
107 * @param aType Key type. |
|
108 * @return Result code. |
|
109 */ |
|
110 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
111 |
|
112 |
|
113 /** |
|
114 * From the base class. |
|
115 * Handles menu events. |
|
116 * @param aCommandId Command id. |
|
117 * @return None. |
|
118 */ |
|
119 virtual void ProcessCommandL(TInt aCommandId); |
|
120 |
|
121 /** |
|
122 * From the base class |
|
123 * Called by framework before menu is shown. |
|
124 * @param aResourceId Menu resource id. |
|
125 * @param aMenuPane Pointer to the menu. |
|
126 * @return None. |
|
127 */ |
|
128 void DynInitMenuPaneL(TInt aResourceID, CEikMenuPane* aMenuPane); |
|
129 |
|
130 /** |
|
131 * Handle content parameter editing. |
|
132 * @return None. |
|
133 */ |
|
134 void HandleOKL(); |
|
135 |
|
136 /** |
|
137 * Method to get context sensitive help topic. |
|
138 * @param aContext Help topic to open. |
|
139 * @return None. |
|
140 */ |
|
141 void GetHelpContext(TCoeHelpContext& aContext) const; |
|
142 |
|
143 /** |
|
144 * From the base class. |
|
145 * Called by framework before exiting the dialog. |
|
146 * @param aButtonId Id of the pressed button |
|
147 * @return ETrue to exit\ EFalse to not to exit. |
|
148 */ |
|
149 TBool OkToExitL(TInt aButtonId); |
|
150 |
|
151 /** |
|
152 * From the base class. |
|
153 * Called by framework before the dialog is shown. |
|
154 * @return None. |
|
155 */ |
|
156 void PreLayoutDynInitL(); |
|
157 |
|
158 /** |
|
159 * From MEikListBoxObserver. |
|
160 * Handle listbox events. |
|
161 * @param aListBox Pointer to used listbox. |
|
162 * @param aEventType Event type. |
|
163 * @return None. |
|
164 */ |
|
165 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
166 |
|
167 /** |
|
168 * From base class. |
|
169 * Called when UI layout changes. |
|
170 * @param aType. |
|
171 * @return None. |
|
172 */ |
|
173 void HandleResourceChange(TInt aType); |
|
174 |
|
175 /** |
|
176 * Set setting list icons. |
|
177 * @param None. |
|
178 * @return None. |
|
179 */ |
|
180 void SetIconsL(); |
|
181 |
|
182 |
|
183 private: |
|
184 |
|
185 /** |
|
186 * Check that mandatory fields are set |
|
187 * @return Index of the invalid mandatory item. |
|
188 */ |
|
189 TInt CheckMandatoryFields(); |
|
190 |
|
191 /** |
|
192 * Save content parameters into profile. |
|
193 * @return None. |
|
194 */ |
|
195 void SaveSettingsL(); |
|
196 |
|
197 /** |
|
198 * Set filter type setting visibility. |
|
199 * @param None. |
|
200 * @return None. |
|
201 */ |
|
202 void SetFilterVisibility(TInt aVisibility); |
|
203 |
|
204 private: |
|
205 |
|
206 /** |
|
207 * Add settings titles into listbox. |
|
208 * @param aListBox. |
|
209 * @param aItemList List of setting items. |
|
210 * @return None. |
|
211 */ |
|
212 void UpdateListBoxL(CEikTextListBox* aListBox, CAspSettingList* aItemList); |
|
213 |
|
214 /** |
|
215 * Create one CAspListItemData for each setting. |
|
216 * @param None. |
|
217 * @return None. |
|
218 */ |
|
219 void CreateSettingsListL(); |
|
220 |
|
221 /** |
|
222 * Adds one setting item into item list. |
|
223 * @param aItemId Item id. |
|
224 * @param aResourceId. |
|
225 * @return None. |
|
226 */ |
|
227 void AddItemL(TInt aItemId, TInt aResourceId); |
|
228 |
|
229 /** |
|
230 * Adds one setting item into item list. |
|
231 * @param aDataProviderId. |
|
232 * @return None. |
|
233 */ |
|
234 void AddRemoteDatabaseL(TInt aDataProviderId); |
|
235 |
|
236 /** |
|
237 * Initalizes setting item needed for listbox handling. |
|
238 * @param aItem. |
|
239 * @return None. |
|
240 */ |
|
241 void InitSettingItemL(CAspListItemData* aItem); |
|
242 |
|
243 |
|
244 private: |
|
245 |
|
246 /** |
|
247 * Handles setting item editing. |
|
248 * @param aItem Setting item data. |
|
249 * @return Return code. |
|
250 */ |
|
251 TBool EditSettingItemL(CAspListItemData& aItem); |
|
252 |
|
253 /** |
|
254 * Change Yes/No value without showing edit dialog. |
|
255 * @param aItem Setting item data. |
|
256 * @return Return code. |
|
257 */ |
|
258 TBool EditSettingItemYesNoL(CAspListItemData& aItem); |
|
259 |
|
260 /** |
|
261 * Shows editor for text type setting. |
|
262 * @param aItem Setting item data. |
|
263 * @return Return code. |
|
264 */ |
|
265 TBool EditSettingItemTextL(CAspListItemData& aItem); |
|
266 |
|
267 /** |
|
268 * Shows editor for list type setting. |
|
269 * @param aItem Setting item data. |
|
270 * @return Return code. |
|
271 */ |
|
272 TBool EditSettingItemLocalDatabaseL(CAspListItemData& aItem); |
|
273 |
|
274 /** |
|
275 * Shows editor for list type setting. |
|
276 * @param aItem Setting item data. |
|
277 * @return Return code. |
|
278 */ |
|
279 static TBool EditSettingItemListL(CAspListItemData& aItem); |
|
280 |
|
281 |
|
282 private: |
|
283 /** |
|
284 * Utility function. |
|
285 * @param aIndex Listbox index. |
|
286 * @return setting item with listbox position aIndex. |
|
287 */ |
|
288 CAspListItemData* GetItemForIndex(TInt aIndex); |
|
289 |
|
290 /** |
|
291 * Utility function. |
|
292 * @param aItemId Item id. |
|
293 * @return Pointer to setting item. |
|
294 */ |
|
295 CAspListItemData* Item(TInt aItemId); |
|
296 |
|
297 /** |
|
298 * Finds out sync data provider type. |
|
299 * @param None. |
|
300 * @return Data provider type. |
|
301 */ |
|
302 TInt DataProviderType() const; |
|
303 |
|
304 /** |
|
305 * Set setting item visibility (normal/readonly/hidden). |
|
306 * @param None. |
|
307 * @return None. |
|
308 */ |
|
309 void SetVisibility(); |
|
310 |
|
311 /** |
|
312 * Set all settings to read-only state. |
|
313 * @param None. |
|
314 * @return None. |
|
315 */ |
|
316 void SetAllReadOnly(); |
|
317 |
|
318 /** |
|
319 * Read sync profile task data. |
|
320 * @param None. |
|
321 * @return None. |
|
322 */ |
|
323 void InitTaskDataL(); |
|
324 |
|
325 /** |
|
326 * Creates icon. |
|
327 * @param aId. |
|
328 * @param aFileName. |
|
329 * @param aFileIndex. |
|
330 * @param aFileMaskIndex. |
|
331 * @return Created icon. |
|
332 */ |
|
333 CGulIcon* IconL(TAknsItemID aId, const TDesC& aFileName, TInt aFileIndex, TInt aFileMaskIndex); |
|
334 |
|
335 |
|
336 private: |
|
337 // id of the calling application |
|
338 TInt iApplicationId; |
|
339 |
|
340 // list box for setting items |
|
341 CAknSettingStyleListBox* iListBox; |
|
342 |
|
343 // setting items |
|
344 CAspSettingList *iSettingList; |
|
345 |
|
346 // list that contains all contents (applications) |
|
347 CAspContentList* iContentList; |
|
348 |
|
349 // for title and icon handling |
|
350 CStatusPaneHandler* iStatusPaneHandler; |
|
351 |
|
352 // session with sync server |
|
353 RSyncMLSession* iSyncSession; |
|
354 |
|
355 // sync profile |
|
356 CAspProfile* iProfile; |
|
357 |
|
358 // long buffer for string handling |
|
359 TBuf<KBufSize255> iBuf; |
|
360 |
|
361 // is setting database in read only state |
|
362 TBool iSettingEnforcement; |
|
363 |
|
364 // has user changed sync content local or remote datastore |
|
365 TBool iDataStoreChanged; |
|
366 |
|
367 |
|
368 private: |
|
369 |
|
370 // dialog parameters |
|
371 TAspParam* iDialogParam; |
|
372 |
|
373 // sync data provider |
|
374 TInt iDataProviderId; |
|
375 |
|
376 // is content included in sync |
|
377 TBool iTaskEnabled; |
|
378 |
|
379 // sync type |
|
380 TInt iSyncDirection; |
|
381 |
|
382 // needed for finding out whether user changed db name |
|
383 TBuf<KBufSize> iLocalDatabase; |
|
384 |
|
385 // needed for finding out whether user changed db name |
|
386 TBuf<KBufSize> iRemoteDatabase; |
|
387 |
|
388 // names of all available local data stores |
|
389 CDesCArray* iLocalDataStores; |
|
390 //is MSK Empty |
|
391 TBool iMskEmpty; |
|
392 }; |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 #endif // ASPCONTENTDIALOG_H |
|
398 |
|
399 // End of File |