|
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: Scheduled sync UI |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef ASPSCHEDULEDIALOG_H |
|
21 #define ASPSCHEDULEDIALOG_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 // FORWARD DECLARATIONS |
|
34 |
|
35 class CAspSchedule; |
|
36 class CAspProfileWizard; |
|
37 |
|
38 |
|
39 // CLASS DECLARATION |
|
40 /** |
|
41 * MAuotSyncEditorPageObserver |
|
42 * |
|
43 * Observer interface function. |
|
44 */ |
|
45 |
|
46 NONSHARABLE_CLASS (MAutoSyncEditorPageObserver) |
|
47 { |
|
48 |
|
49 public: |
|
50 /** |
|
51 * Editor page call this when editor is about to close. |
|
52 * @param aText Editor text. |
|
53 * @return ETrue if input is ok, EFalse otherwise. |
|
54 */ |
|
55 virtual TBool CheckValidityL() = 0; |
|
56 |
|
57 /** |
|
58 *Return the index of email item in provider list |
|
59 */ |
|
60 virtual TInt EmailIndex() = 0; |
|
61 |
|
62 }; |
|
63 |
|
64 |
|
65 /** |
|
66 * TAutoSyncSettingPageParam |
|
67 * |
|
68 * This class is used as general parameter type. |
|
69 */ |
|
70 NONSHARABLE_CLASS (TAutoSyncSettingPageParam) |
|
71 { |
|
72 public: |
|
73 TInt iCommandId; |
|
74 TBuf<KBufSize> iPageText; |
|
75 MAutoSyncEditorPageObserver* iObserver; |
|
76 TInt iSettingType; |
|
77 }; |
|
78 |
|
79 |
|
80 /** |
|
81 * CAspAutoCheckBoxSettingPage |
|
82 * |
|
83 * Setting page that returns command button id. |
|
84 */ |
|
85 NONSHARABLE_CLASS (CAutoSyncCheckBoxSettingPage) : public CAknCheckBoxSettingPage,public MEikListBoxObserver |
|
86 { |
|
87 public: |
|
88 CAutoSyncCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray, TAutoSyncSettingPageParam& aParam); |
|
89 |
|
90 ~CAutoSyncCheckBoxSettingPage(); |
|
91 |
|
92 public: |
|
93 |
|
94 void UpdateCbaL(TInt aResourceId); |
|
95 void DynamicInitL(); |
|
96 |
|
97 protected: // From CCoeControl |
|
98 void ProcessCommandL(TInt aCommandId); |
|
99 |
|
100 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
101 //from MEikListBoxObserver for touch event handling |
|
102 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
103 |
|
104 private: |
|
105 TAutoSyncSettingPageParam& iParam; |
|
106 TInt iSelectionCount; |
|
107 CSelectionItemList* iSelectionItemList; |
|
108 |
|
109 }; |
|
110 |
|
111 |
|
112 |
|
113 /** |
|
114 * CAspScheduleDialog |
|
115 * |
|
116 * CAspScheduleDialog is used for editing sync connection data. |
|
117 */ |
|
118 NONSHARABLE_CLASS (CAspScheduleDialog) : public CAknDialog, public MEikListBoxObserver, |
|
119 public MAutoSyncEditorPageObserver |
|
120 { |
|
121 private: |
|
122 |
|
123 enum TRepositoryKey |
|
124 { |
|
125 EKeySyncFrequency = 2, |
|
126 EKeyPeakSyncInterval, |
|
127 EKeyOffPeakSyncInterval |
|
128 }; |
|
129 |
|
130 |
|
131 public: |
|
132 /** |
|
133 * Launches dialog. |
|
134 * @param aParam Class that contains dialog parameters. |
|
135 * @return Completion code. |
|
136 */ |
|
137 static TBool ShowDialogL(const TAspParam& aParam); |
|
138 |
|
139 public:// Constructors and destructor |
|
140 |
|
141 /** |
|
142 * Two-phased constructor. |
|
143 */ |
|
144 static CAspScheduleDialog* NewL(const TAspParam& aParam); |
|
145 |
|
146 /** |
|
147 * Destructor. |
|
148 */ |
|
149 virtual ~CAspScheduleDialog(); |
|
150 |
|
151 private: |
|
152 |
|
153 /** |
|
154 * C++ default constructor. |
|
155 */ |
|
156 CAspScheduleDialog(const TAspParam& aParam); |
|
157 |
|
158 /** |
|
159 * By default Symbian OS constructor is private. |
|
160 */ |
|
161 void ConstructL(); |
|
162 |
|
163 private: |
|
164 /** |
|
165 * From MEikListBoxObserver, called by framework. |
|
166 * @param aListBox. |
|
167 * @param aEventType. |
|
168 * @return None |
|
169 */ |
|
170 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
171 |
|
172 /** |
|
173 * From the base class. |
|
174 * Called by framework before the dialog is shown. |
|
175 * @param None |
|
176 * @return None |
|
177 */ |
|
178 void PreLayoutDynInitL(); |
|
179 |
|
180 /** |
|
181 * From the base class. |
|
182 * Called by framework before exiting the dialog. |
|
183 * @param aButtonId Button id. |
|
184 * @return ETrue to exit\ EFalse to not to exit. |
|
185 */ |
|
186 TBool OkToExitL(TInt aButtonId); |
|
187 |
|
188 /** |
|
189 * From the base class. |
|
190 * Called by framework for key event handling. |
|
191 * @param aKeyEvent. |
|
192 * @param aType. |
|
193 * @return Return code. |
|
194 */ |
|
195 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
196 |
|
197 /** |
|
198 * From the base class. |
|
199 * Called by framework when dialog is activated. |
|
200 * @param None. |
|
201 * @return None. |
|
202 */ |
|
203 void ActivateL(); |
|
204 |
|
205 /** |
|
206 * Method to get context sensitive help topic. |
|
207 * @param aContext Help topic to open. |
|
208 * @return None. |
|
209 */ |
|
210 void GetHelpContext(TCoeHelpContext& aContext) const; |
|
211 |
|
212 /** |
|
213 * From the base class. |
|
214 * Called by framework before menu is shown. |
|
215 * @param aResourceId Menu resource id. |
|
216 * @param aMenuPane Pointer to the menu. |
|
217 * @return None. |
|
218 */ |
|
219 void DynInitMenuPaneL(TInt aResourceID, CEikMenuPane* aMenuPane); |
|
220 |
|
221 /** |
|
222 * From the base class. |
|
223 * Handles menu events. |
|
224 * @param aCommandId Command id. |
|
225 * @return None. |
|
226 */ |
|
227 void ProcessCommandL(TInt aCommandId); |
|
228 |
|
229 /** |
|
230 * From base class. |
|
231 * Called when UI layout changes. |
|
232 * @param aType. |
|
233 * @return None. |
|
234 */ |
|
235 void HandleResourceChange(TInt aType); |
|
236 |
|
237 /** |
|
238 * From TAutoSyncSettingPageParam |
|
239 * Checks validity content selected |
|
240 * @param None |
|
241 * @return ETrue/EFalse. |
|
242 */ |
|
243 |
|
244 TBool CheckValidityL(); |
|
245 |
|
246 TInt EmailIndex(); |
|
247 |
|
248 /** |
|
249 * Checks remote databse settings for the profile |
|
250 * @param None |
|
251 * @return None. |
|
252 */ |
|
253 |
|
254 void CheckMandatoryDataL(); |
|
255 |
|
256 /** |
|
257 * Checks remote databse settings for the profile |
|
258 * @param None |
|
259 * @return ETrue/EFalse. |
|
260 */ |
|
261 TBool CheckBearerType(); |
|
262 |
|
263 |
|
264 |
|
265 private: |
|
266 /** |
|
267 * Handles setting item editing. |
|
268 * @param None. |
|
269 * @return None. |
|
270 */ |
|
271 void HandleOKL(); |
|
272 |
|
273 /** |
|
274 * Set setting list icons. |
|
275 * @param None. |
|
276 * @return None. |
|
277 */ |
|
278 void SetIconsL(); |
|
279 |
|
280 |
|
281 public: // common editors |
|
282 |
|
283 /** |
|
284 * Shows editor for text type setting. |
|
285 * @param aItem Setting item data. |
|
286 * @return Return code. |
|
287 */ |
|
288 TBool EditSettingItemTextL(CAspListItemData& aItem); |
|
289 |
|
290 /** |
|
291 * Shows editor for number type setting. |
|
292 * @param aItem Setting item data. |
|
293 * @return Return code. |
|
294 */ |
|
295 TBool EditSettingItemNumberL(CAspListItemData& aItem); |
|
296 |
|
297 /** |
|
298 * Shows editor for list type setting. |
|
299 * @param aItem Setting item data. |
|
300 * @return Return code. |
|
301 */ |
|
302 //TBool EditSettingItemListL(CAspListItemData& aItem); |
|
303 |
|
304 private: |
|
305 |
|
306 /** |
|
307 * Handles setting item editing. |
|
308 * @param aItem Setting item data. |
|
309 * @return Return code. |
|
310 */ |
|
311 TBool EditSettingItemL(CAspListItemData& aItem); |
|
312 |
|
313 /** |
|
314 * Change Yes/No setting in place without showing editor. |
|
315 * @param aItem Setting item data. |
|
316 * @return Return code. |
|
317 */ |
|
318 TBool EditSettingItemYesNoL(CAspListItemData& aItem); |
|
319 |
|
320 /** |
|
321 * Shows editor for profile setting. |
|
322 * @param aItem Setting item data. |
|
323 * @return Return code. |
|
324 */ |
|
325 TBool EditSettingItemProfileL(CAspListItemData& aItem); |
|
326 |
|
327 /** |
|
328 * Shows editor for content setting. |
|
329 * @param aItem Setting item data. |
|
330 * @return Return code. |
|
331 */ |
|
332 TBool EditSettingItemContentL(CAspListItemData& aItem); |
|
333 |
|
334 /** |
|
335 * Shows setting editor. |
|
336 * @param aItem Setting item data. |
|
337 * @return Return code. |
|
338 */ |
|
339 TBool EditSettingItemWeekdaysL(CAspListItemData& aItem); |
|
340 |
|
341 /** |
|
342 * Shows setting editor. |
|
343 * @param aItem Setting item data. |
|
344 * @return Return code. |
|
345 */ |
|
346 TBool EditSettingItemTimeL(CAspListItemData& aItem); |
|
347 |
|
348 /** |
|
349 * Shows editor for peak schedule selection |
|
350 * @param aItem Setting item data. |
|
351 * @return Return code. |
|
352 */ |
|
353 TBool EditSettingItemPeakScheduleL(CAspListItemData& aItem); |
|
354 |
|
355 /** |
|
356 * Shows editor for off-peak schedule selection |
|
357 * @param aItem Setting item data. |
|
358 * @return Return code. |
|
359 */ |
|
360 TBool EditSettingItemOffPeakScheduleL(CAspListItemData& aItem); |
|
361 |
|
362 /** |
|
363 * Shows editor for sync frequency selection |
|
364 * @param aItem Setting item data. |
|
365 * @return Return code. |
|
366 */ |
|
367 |
|
368 TBool EditSettingItemSyncFrequencyL(CAspListItemData& aItem); |
|
369 |
|
370 |
|
371 private: |
|
372 |
|
373 /** |
|
374 * Checks that all mandatory data is found. |
|
375 * @param None. |
|
376 * @return Return code. |
|
377 */ |
|
378 TInt CheckMandatoryFields(); |
|
379 |
|
380 /** |
|
381 * Saves profile. |
|
382 * @param None. |
|
383 * @return None. |
|
384 */ |
|
385 void SaveSettingsL(); |
|
386 |
|
387 private: |
|
388 /** |
|
389 * Create one CNSmlDSProfileData for each setting. |
|
390 * @param None. |
|
391 * @return None. |
|
392 */ |
|
393 void CreateSettingsListL(); |
|
394 |
|
395 /** |
|
396 * Initalizes setting item needed for listbox handling. |
|
397 * @param aItem. |
|
398 * @return None. |
|
399 */ |
|
400 void InitSettingItemL(CAspListItemData* aItem); |
|
401 |
|
402 /** |
|
403 * Add settings titles into listbox. |
|
404 * @param aListBox. |
|
405 * @param aItemList List of setting items. |
|
406 * @return None. |
|
407 */ |
|
408 void UpdateListBoxL(CEikTextListBox* aListBox, CAspSettingList* aItemList); |
|
409 |
|
410 /** |
|
411 * Adds one setting item into item list. |
|
412 * @param aItemId Item id. |
|
413 * @param aHeaders Array of item headers. |
|
414 * @return None. |
|
415 */ |
|
416 void AddItemL(TInt aItemId, TInt aResourceId); |
|
417 |
|
418 /** |
|
419 * Set setting item visibility (normal/readonly/hidden). |
|
420 * @param None. |
|
421 * @return None. |
|
422 */ |
|
423 void SetVisibility(); |
|
424 |
|
425 /** |
|
426 * Set all settings to read-only state. |
|
427 * @param None. |
|
428 * @return None. |
|
429 */ |
|
430 void SetAllReadOnly(); |
|
431 |
|
432 |
|
433 private: |
|
434 |
|
435 /** |
|
436 * Creates icon. |
|
437 * @param aId. |
|
438 * @param aFileName. |
|
439 * @param aFileIndex. |
|
440 * @param aFileMaskIndex. |
|
441 * @return Created icon. |
|
442 */ |
|
443 CGulIcon* IconL(TAknsItemID aId, const TDesC& aFileName, TInt aFileIndex, TInt aFileMaskIndex); |
|
444 |
|
445 /** |
|
446 * Returns setting item with listbox position aIndex. |
|
447 * @param aIndex Listbox index. |
|
448 * @return Pointer to setting item. |
|
449 */ |
|
450 CAspListItemData* GetItemForIndex(TInt aIndex); |
|
451 |
|
452 /** |
|
453 * Returns setting item with id aItemId. |
|
454 * @param aItemId Item id. |
|
455 * @return Pointer to setting item. |
|
456 */ |
|
457 CAspListItemData* Item(TInt aItemId); |
|
458 |
|
459 /** |
|
460 * Get profile name. |
|
461 * @param aProfileId. |
|
462 * @param aText. |
|
463 * @return None. |
|
464 */ |
|
465 void GetProfileName(TInt& aProfileId, TDes& aText); |
|
466 |
|
467 /** |
|
468 * Get content name. |
|
469 * @param aProfileId. |
|
470 * @param aText. |
|
471 * @return None. |
|
472 */ |
|
473 //void GetContentName(TDes& aText); |
|
474 |
|
475 /** |
|
476 * Get day name. |
|
477 * @param aProfileId. |
|
478 * @param aText. |
|
479 * @return None. |
|
480 */ |
|
481 void GetWeekdayNameL(TDes& aText); |
|
482 |
|
483 /** |
|
484 * Update content list from schedule settings. |
|
485 * @param None. |
|
486 * @return None. |
|
487 */ |
|
488 //void GetContentSelectionL(); |
|
489 |
|
490 /** |
|
491 * Get content list from sync profile. |
|
492 * @param aList. |
|
493 * @return None. |
|
494 */ |
|
495 //void GetContentSelection2L(CSelectionItemList* aList); |
|
496 |
|
497 /** |
|
498 * Write selected contents into schedule settings. |
|
499 * @param None. |
|
500 * @return None. |
|
501 */ |
|
502 //void SetContentSelectionL(); |
|
503 |
|
504 /** |
|
505 * Construct CSelectionItemList. |
|
506 * @param aList. |
|
507 * @return None. |
|
508 */ |
|
509 void GetWeekdaySelectionL(CSelectionItemList* aList); |
|
510 |
|
511 /** |
|
512 * Construct CSelectionItemList. |
|
513 * @param aList. |
|
514 * @return None. |
|
515 */ |
|
516 void SetWeekdaySelectionL(CSelectionItemList* aList); |
|
517 |
|
518 /** |
|
519 * Set default day selection |
|
520 * @param None |
|
521 * @return None. |
|
522 */ |
|
523 void SetDefaultdaySelectionL(); |
|
524 /** |
|
525 * Construct time text. |
|
526 * @param aText. |
|
527 * @param aTime. |
|
528 * @return None. |
|
529 */ |
|
530 void GetTimeTextL(TDes& aText, TTime aTime); |
|
531 |
|
532 |
|
533 /** |
|
534 *Get content name |
|
535 * @param aText. |
|
536 * @return None. |
|
537 */ |
|
538 void GetContentsNameL(TDes& aText); |
|
539 |
|
540 /** |
|
541 *Get content selection |
|
542 * @param aList |
|
543 * @return None. |
|
544 */ |
|
545 void GetContentSelectionL(CSelectionItemList* aList); |
|
546 |
|
547 /** |
|
548 *Set content selection |
|
549 * @param aList. |
|
550 * @return None. |
|
551 */ |
|
552 void SetContentSelectionL(CSelectionItemList* aList); |
|
553 |
|
554 CDesCArray* GetSyncFrequencyListLC(); |
|
555 void GetSyncFrequencyValueL(TInt schedule, TDes& aBuf); |
|
556 TInt SyncFrequencyL(const TDesC& aBuf); |
|
557 TInt GetSyncFrequencyPositionL(CDesCArray* arr, TInt aInterval); |
|
558 |
|
559 /** |
|
560 *Check if the profile has access point selected |
|
561 * @param aProfileId |
|
562 * @return None. |
|
563 */ |
|
564 void CheckAccessPointSelectionL(TInt aProfileId); |
|
565 |
|
566 /** |
|
567 *Get list of peak schedule intervals |
|
568 * @return CDesCArray* |
|
569 */ |
|
570 CDesCArray* GetPeakScheduleListLC(); |
|
571 |
|
572 /** |
|
573 *Get list of peak schedule intervals |
|
574 * @return CDesCArray* |
|
575 */ |
|
576 CDesCArray* GetOffPeakScheduleListLC(); |
|
577 |
|
578 /** |
|
579 *Get time interval string corresponding to a schedule no |
|
580 * @return CDesCArray* |
|
581 */ |
|
582 void GetPeakScheduleValueL(TInt schedule, TDes& aBuf); |
|
583 void GetOffPeakScheduleValueL(TInt schedule, TDes& aBuf); |
|
584 |
|
585 /** |
|
586 *Get time interval value for the string |
|
587 * @return CDesCArray* |
|
588 */ |
|
589 TInt PeakScheduleL(const TDesC& aBuf); |
|
590 TInt OffPeakScheduleL(const TDesC& aBuf); |
|
591 |
|
592 /** |
|
593 *Position of selected interval in the list |
|
594 * @return CDesCArray* |
|
595 */ |
|
596 TInt GetPeakPositionL(CDesCArray* arr, TInt aInterval); |
|
597 TInt GetOffPeakPositionL(CDesCArray* arr, TInt aInterval); |
|
598 |
|
599 /** |
|
600 *Show auto sync info |
|
601 * @return CDesCArray* |
|
602 */ |
|
603 void ShowAutoSyncInfoL(); |
|
604 |
|
605 /** |
|
606 *Set default content selection |
|
607 * |
|
608 */ |
|
609 void SetDefaultContentL(); |
|
610 |
|
611 /** |
|
612 *Read cenrep for operator configured sync interval values |
|
613 * |
|
614 */ |
|
615 void ReadRepositoryL(TInt aKey, TInt& aValue); |
|
616 |
|
617 /** |
|
618 *Create content list |
|
619 * |
|
620 */ |
|
621 void CreateContentListL(); |
|
622 |
|
623 /** |
|
624 *Check if time definition is valid. |
|
625 * |
|
626 */ |
|
627 TBool CheckPeakTime(); |
|
628 |
|
629 private: |
|
630 // setting list |
|
631 CAknSettingStyleListBox* iSettingListBox; |
|
632 |
|
633 // list of setting items |
|
634 CAspSettingList *iSettingList; |
|
635 |
|
636 // list that contains all contents (applications) |
|
637 CAspContentList* iContentList; |
|
638 |
|
639 // sync session |
|
640 RSyncMLSession* iSyncSession; |
|
641 |
|
642 // for title and icon handling |
|
643 CStatusPaneHandler* iStatusPaneHandler; |
|
644 |
|
645 // resource handler |
|
646 CAspResHandler* iResHandler; |
|
647 |
|
648 // dialog edit mode |
|
649 TInt iEditMode; |
|
650 |
|
651 // long buffer for string handling |
|
652 TBuf<KBufSize255> iBuf; |
|
653 |
|
654 // list that contains all profiles |
|
655 CAspProfileList* iProfileList; |
|
656 |
|
657 // for storing auto sync settings |
|
658 CAspSchedule* iSchedule; |
|
659 |
|
660 // profile data |
|
661 CAspProfile* iProfile; |
|
662 |
|
663 // id of the calling application |
|
664 TInt iApplicationId; |
|
665 |
|
666 // weekday names |
|
667 CDesCArray* iWeekdayList; |
|
668 |
|
669 // have settings changed |
|
670 TBool iSettingChanged; |
|
671 |
|
672 // Content names |
|
673 CDesCArray* iContentsList; |
|
674 |
|
675 TBool iDoCleanUp; |
|
676 |
|
677 // is setting database in read only state |
|
678 TBool iSettingEnforcement; |
|
679 |
|
680 |
|
681 }; |
|
682 |
|
683 |
|
684 #endif // ASPSCHEDULEDIALOG_H |
|
685 |
|
686 // End of File |