|
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: Main view setting dialog |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ASPSETTINGDIALOG_H |
|
20 #define ASPSETTINGDIALOG_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <eikdialg.h> |
|
26 #include <eiklbo.h> |
|
27 #include <aknlists.h> |
|
28 #include <AknDialog.h> |
|
29 #include <aknnavi.h> |
|
30 #include <AknInfoPopupNoteController.h> // CAknInfoPopupNoteController |
|
31 |
|
32 #include "AspDefines.h" |
|
33 #include "AspDialogUtil.h" |
|
34 #include "AspResHandler.h" |
|
35 #include "AspDbNotifier.h" |
|
36 #include "AspSyncHandler.h" |
|
37 |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 |
|
41 // CONSTANTS |
|
42 |
|
43 const TInt KSettingDialogPopupDisplayTime = 3*1000; |
|
44 |
|
45 |
|
46 |
|
47 // CLASS DECLARATION |
|
48 |
|
49 /** |
|
50 * CAspSettingDialog |
|
51 * |
|
52 * This is sync app main dialog. |
|
53 */ |
|
54 NONSHARABLE_CLASS (CAspSettingDialog) : public CAknDialog, public MEikListBoxObserver, |
|
55 public MAspDbEventHandler, public MAspSyncObserver |
|
56 { |
|
57 |
|
58 enum TAspSettingDialogIconIndex |
|
59 { |
|
60 EIconIndexHTTP = 0, |
|
61 EIconIndexBT = 1, |
|
62 EIconIndexUSB = 2, |
|
63 EIconIndexIrda = 3, |
|
64 EIconIndexSyncOff = 4, |
|
65 EIconIndexMultipleContent = 5 |
|
66 }; |
|
67 |
|
68 public: |
|
69 |
|
70 /** |
|
71 * Launches setting dialog. |
|
72 * @param aParam Class that contains dialog parameters. |
|
73 * @return Return code. |
|
74 */ |
|
75 static TBool ShowDialogL(TAspParam& aParam); |
|
76 |
|
77 public:// Constructors and destructor |
|
78 |
|
79 /** |
|
80 * Two-phased constructor. |
|
81 */ |
|
82 static CAspSettingDialog* NewL(TAspParam& aParam); |
|
83 |
|
84 /** |
|
85 * Destructor. |
|
86 */ |
|
87 virtual ~CAspSettingDialog(); |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * C++ default constructor. |
|
93 */ |
|
94 CAspSettingDialog(TAspParam& aParam); |
|
95 |
|
96 /** |
|
97 * By default Symbian OS constructor is private. |
|
98 */ |
|
99 void ConstructL(); |
|
100 |
|
101 private: |
|
102 |
|
103 /** |
|
104 * Called by framework before the dialog is shown. |
|
105 * @param None |
|
106 * @return None |
|
107 */ |
|
108 void PostLayoutDynInitL(); |
|
109 |
|
110 /** |
|
111 * Called by framework after the dialog is shown. |
|
112 * @param None |
|
113 * @return None |
|
114 */ |
|
115 void PreLayoutDynInitL(); |
|
116 |
|
117 /** |
|
118 * Handles menu events. |
|
119 * @param aCommandId Command id. |
|
120 * @return None. |
|
121 */ |
|
122 void ProcessCommandL(TInt aCommandId); |
|
123 |
|
124 /** |
|
125 * Handles menu events, ProcessCommandL calls this. |
|
126 * @param aCommandId Command id. |
|
127 * @return None. |
|
128 */ |
|
129 void DoProcessCommandL(TInt aCommandId); |
|
130 |
|
131 /** |
|
132 * From the base class. |
|
133 * Called by framework for key event handling. |
|
134 * @param aKeyEvent. |
|
135 * @param TEventCode. |
|
136 * @return Return code. |
|
137 */ |
|
138 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
139 |
|
140 /** |
|
141 * From the base class. |
|
142 * Called by framework before exiting the dialog. |
|
143 * @param Button id. |
|
144 * @return ETrue to exit\ EFalse to not to exit. |
|
145 */ |
|
146 TBool OkToExitL(TInt aButtonId); |
|
147 |
|
148 /** |
|
149 * From the base class. |
|
150 * Called by framework before menu is shown. |
|
151 * @param aResourceId Menu resource id. |
|
152 * @param aMenuPane Pointer to the menu. |
|
153 * @return None. |
|
154 */ |
|
155 void DynInitMenuPaneL(TInt aResourceID, CEikMenuPane* aMenuPane); |
|
156 |
|
157 /** |
|
158 * From the base class. |
|
159 * Called when dialog is activated. |
|
160 * @return None. |
|
161 */ |
|
162 void ActivateL(); |
|
163 |
|
164 /** |
|
165 * Method to get context sensitive help topic. |
|
166 * @param aContext Help topic to open. |
|
167 * @return None. |
|
168 */ |
|
169 void GetHelpContext(TCoeHelpContext& aContext) const; |
|
170 |
|
171 /** |
|
172 * Called when display resolution changes. |
|
173 * @param aType. |
|
174 * @return None. |
|
175 */ |
|
176 void HandleResourceChange(TInt aType); |
|
177 |
|
178 /** |
|
179 * Sets settings dialog icons. |
|
180 * @param None. |
|
181 * @return None. |
|
182 */ |
|
183 void SetIconsL(); |
|
184 |
|
185 |
|
186 private: // from MEikListBoxObserver |
|
187 /** |
|
188 * From MEikListBoxObserver, called by framework. |
|
189 * @param aListBox. |
|
190 * @param aEventType. |
|
191 * @return None |
|
192 */ |
|
193 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
194 |
|
195 private: // from MAspDbEventHandler |
|
196 /** |
|
197 * From MAspDbEventHandler |
|
198 * @param aStatus EClose, EUnlock, ECommit, ERollback, or ERecover (d32dbms.h). |
|
199 * @return None. |
|
200 */ |
|
201 void HandleDbEventL(TAspDbEvent aEvent); |
|
202 |
|
203 private: // from MAspActiveCallerObserver |
|
204 /** |
|
205 * From MAspActiveCallerObserver |
|
206 * Called when CAspActiveCaller completes. |
|
207 * @param aCallId. |
|
208 * @return None. |
|
209 */ |
|
210 void HandleActiveCallL(TInt aCallId); |
|
211 |
|
212 private: // from MAspSyncObserver |
|
213 /** |
|
214 * From MAspSyncObserver |
|
215 * Called when synchronization completes. |
|
216 * @param aError. |
|
217 * @param aInfo1. |
|
218 * @return None. |
|
219 */ |
|
220 void HandleSyncEventL(TInt aError, TInt aInfo1); |
|
221 |
|
222 |
|
223 private: |
|
224 |
|
225 |
|
226 /** |
|
227 * Handles setting item editing. |
|
228 * @param None. |
|
229 * @return None. |
|
230 */ |
|
231 void HandleOKL(); |
|
232 |
|
233 /** |
|
234 * Creates icon. |
|
235 * @param aId. |
|
236 * @param aFileName. |
|
237 * @param aFileIndex. |
|
238 * @param aFileMaskIndex. |
|
239 * @return Created icon. |
|
240 */ |
|
241 CGulIcon* IconL(TAknsItemID aId, const TDesC& aFileName, TInt aFileIndex, TInt aFileMaskIndex); |
|
242 |
|
243 /** |
|
244 * Creates set type profile. |
|
245 * @param None. |
|
246 * @return None. |
|
247 */ |
|
248 void CreateProfileL(); |
|
249 |
|
250 /** |
|
251 * Creates application type profile. |
|
252 * @param None. |
|
253 * @return None. |
|
254 */ |
|
255 void CreateAppProfileL(); |
|
256 |
|
257 /** |
|
258 * Creates application type profile for sync app. |
|
259 * @param None. |
|
260 * @return None. |
|
261 */ |
|
262 TBool CreateAppProfileFromSyncAppL(); |
|
263 |
|
264 /** |
|
265 * Changes active profile. |
|
266 * @param None. |
|
267 * @return None. |
|
268 */ |
|
269 void ChangeProfileL(); |
|
270 |
|
271 /** |
|
272 * Shows profile dialog. |
|
273 * @param aEditMode. |
|
274 * @param aFocus |
|
275 * @return None. |
|
276 */ |
|
277 void EditProfileL(TInt aEditMode ,TInt aFocus); |
|
278 |
|
279 /** |
|
280 * Shows profile dialog. |
|
281 * @param TInt aEditMode. |
|
282 * @param TInt aFocus. |
|
283 * @return None. |
|
284 */ |
|
285 void DoEditProfileL(TInt aEditMode ,TInt aFocus); |
|
286 |
|
287 /** |
|
288 * Syncs selected profile. |
|
289 * @param None. |
|
290 * @return None. |
|
291 */ |
|
292 void SyncProfileL(); |
|
293 |
|
294 /** |
|
295 * Syncs selected profile. |
|
296 * @param None. |
|
297 * @return None. |
|
298 */ |
|
299 void CopyFromServerL(); |
|
300 |
|
301 /** |
|
302 * Syncs selected profile. |
|
303 * @param aSyncType. |
|
304 * @return None. |
|
305 */ |
|
306 void DoSyncProfileL(TInt aSyncType); |
|
307 |
|
308 /** |
|
309 * Shows context menu. |
|
310 * @param aResource. |
|
311 * @return None. |
|
312 */ |
|
313 void ShowContextMenuL(TInt aResource); |
|
314 |
|
315 /** |
|
316 * Initialilzes context menu. |
|
317 * @param aMenuPane. |
|
318 * @return None. |
|
319 */ |
|
320 void InitContextMenuL(CEikMenuPane* aMenuPane); |
|
321 |
|
322 /** |
|
323 * Initialilzes options menu. |
|
324 * @param aMenuPane. |
|
325 * @return None. |
|
326 */ |
|
327 void InitOptionsMenuL(CEikMenuPane* aMenuPane); |
|
328 |
|
329 /** |
|
330 * Deletes sync profile. |
|
331 * @param None. |
|
332 * @return None. |
|
333 */ |
|
334 void DeleteProfileL(); |
|
335 |
|
336 /** |
|
337 * Shows log dialog. |
|
338 * @param None. |
|
339 * @return None. |
|
340 */ |
|
341 void ShowLogDialogL(); |
|
342 |
|
343 /** |
|
344 * Shows auto sync dialog. |
|
345 * @param None. |
|
346 * @return None. |
|
347 */ |
|
348 void ShowAutoSyncDialogL(); |
|
349 |
|
350 /** |
|
351 * Shows popup info note about current profile. |
|
352 * @param None. |
|
353 * @return None. |
|
354 */ |
|
355 void ShowCurrentProfileInfoL(); |
|
356 |
|
357 /** |
|
358 * Shows popup info note about current profile. |
|
359 * @param None. |
|
360 * @return None. |
|
361 */ |
|
362 void ShowCurrentProfileInfo(); |
|
363 |
|
364 /** |
|
365 * Shows popup info note about current profile. |
|
366 * @param aProfileId. |
|
367 * @return Boolean. |
|
368 */ |
|
369 TBool ShowAutoSyncProfileInfoL(); |
|
370 |
|
371 /** |
|
372 * Shows popup info note about current profile. |
|
373 * @param aProfileId. |
|
374 * @return Boolean. |
|
375 */ |
|
376 TBool ShowAutoSyncProfileInfo(); |
|
377 /** |
|
378 * Update the MSK Label |
|
379 * @param aCommandId command id. |
|
380 * @param aResourceId resource id . |
|
381 */ |
|
382 void UpdateMiddleSoftKeyLabelL(TInt aCommandId,TInt aResourceId); |
|
383 |
|
384 void ShowAutoSyncLog(TAny* /*aAny*/); |
|
385 |
|
386 private: |
|
387 |
|
388 /** |
|
389 * Utility function. |
|
390 * @param None. |
|
391 * @return Dialog listbox. |
|
392 */ |
|
393 CAknDoubleLargeStyleListBox* ListBox(); |
|
394 |
|
395 /** |
|
396 * Utility function. |
|
397 * @param None. |
|
398 * @return None |
|
399 * To toggle Syncmlmail checkbox in profile settings |
|
400 */ |
|
401 void CancelMailBoxForEnterL(); |
|
402 |
|
403 /** |
|
404 * Utility function. |
|
405 * @param None. |
|
406 * @return Sync handler. |
|
407 */ |
|
408 TBool SyncRunning(); |
|
409 |
|
410 /** |
|
411 * Utility function. |
|
412 * @param aProfileId. |
|
413 * @return Profile's listbox index. |
|
414 */ |
|
415 TInt ProfileIndex(TInt aProfileId); |
|
416 |
|
417 /** |
|
418 * Utility function, sets listbox current item. |
|
419 * @param None. |
|
420 * @return None. |
|
421 */ |
|
422 void SetCurrentIndex(); |
|
423 |
|
424 /** |
|
425 * Utility function, stores listbox current item. |
|
426 * @param aIndex. |
|
427 * @return Selected item index. |
|
428 */ |
|
429 void SetCurrentIndex(TInt aIndex); |
|
430 |
|
431 /** |
|
432 * Utility function, gets listbox current item. |
|
433 * @param None. |
|
434 * @return Current index. |
|
435 */ |
|
436 TInt CurrentIndex(); |
|
437 |
|
438 /** |
|
439 * Utility function, updates dialog cba. |
|
440 * @param aResourceId. |
|
441 * @return None. |
|
442 */ |
|
443 void UpdateCbaL(TInt aResourceId); |
|
444 |
|
445 /** |
|
446 * Sets currrent profile. |
|
447 * @param aProfileId. |
|
448 * @return None. |
|
449 */ |
|
450 void DoSetCurrentProfileL(TInt aProfileId); |
|
451 |
|
452 /** |
|
453 * Sets currrent profile. |
|
454 * @param None. |
|
455 * @return None. |
|
456 */ |
|
457 void SetCurrentProfileL(); |
|
458 |
|
459 /** |
|
460 * Utility function. |
|
461 * @param None. |
|
462 * @return Selected profile. |
|
463 */ |
|
464 TAspProfileItem& CurrentProfileL(); |
|
465 |
|
466 /** |
|
467 * Utility function. |
|
468 * @param None. |
|
469 * @return ETrue if current profile exists, EFalse otherwise. |
|
470 */ |
|
471 TBool HasCurrentProfile(); |
|
472 |
|
473 /** |
|
474 * Utility function. |
|
475 * @param aProfileId. |
|
476 * @return ETrue if current profile has id aProfileId, EFalse otherwise. |
|
477 */ |
|
478 TBool IsCurrentProfile(TInt aProfileId); |
|
479 |
|
480 /** |
|
481 * Save current profile. |
|
482 * @param None. |
|
483 * @return None. |
|
484 */ |
|
485 void DoSaveCurrentProfileL(); |
|
486 |
|
487 /** |
|
488 * Save current profile. |
|
489 * @param None. |
|
490 * @return None. |
|
491 */ |
|
492 TInt SaveCurrentProfile(); |
|
493 |
|
494 /** |
|
495 * Update content selection. |
|
496 * @param None. |
|
497 * @return None. |
|
498 */ |
|
499 void UpdateContentSelectionL(); |
|
500 |
|
501 /** |
|
502 * Update profile name. |
|
503 * @param None. |
|
504 * @return None. |
|
505 */ |
|
506 void UpdateProfileNameL(); |
|
507 |
|
508 /** |
|
509 * Check profile mandatory data |
|
510 * @param None. |
|
511 * @return Return code. |
|
512 */ |
|
513 TInt CheckMandatoryDataL(); |
|
514 |
|
515 /** |
|
516 * Check profile mandatory data |
|
517 * @param None. |
|
518 * @return Return code. |
|
519 */ |
|
520 TInt DoCheckMandatoryDataL(); |
|
521 |
|
522 /** |
|
523 * Update navi pane text. |
|
524 * @param aText. |
|
525 * @return None. |
|
526 */ |
|
527 void UpdateNavipaneL(const TDesC& aText); |
|
528 |
|
529 /** |
|
530 * Show popup note. |
|
531 * @param aText. |
|
532 * @return None. |
|
533 */ |
|
534 void ShowPopupNoteL(const TDesC& aText); |
|
535 |
|
536 /** |
|
537 * Cancels checkbox select/unselect. |
|
538 * @param None. |
|
539 * @return None. |
|
540 */ |
|
541 void CancelCheckboxEventL(); |
|
542 |
|
543 /** |
|
544 * Cancels checkbox select/unselect. |
|
545 * @param None. |
|
546 * @return None. |
|
547 */ |
|
548 void CancelCheckboxEvent(); |
|
549 |
|
550 /** |
|
551 * Checks whether email content can be selected. |
|
552 * @param None. |
|
553 * @return EFalse if selection is not possible. |
|
554 */ |
|
555 TBool CheckEmailSelectionL(); |
|
556 |
|
557 /** |
|
558 * Checks whether email content can be selected. |
|
559 * @param None. |
|
560 * @return EFalse if selection is not possible. |
|
561 */ |
|
562 TBool CheckEmailSelection(); |
|
563 |
|
564 public: |
|
565 |
|
566 /** |
|
567 * Updates listbox items. |
|
568 * @param aUpdateProfileList. |
|
569 * @return None. |
|
570 */ |
|
571 void UpdateListBoxL(); |
|
572 |
|
573 |
|
574 /** |
|
575 * Sets currrent profile. |
|
576 * @param aProfileId. |
|
577 * @return None. |
|
578 */ |
|
579 void SetCurrentProfile(TInt aProfileId); |
|
580 |
|
581 /** |
|
582 * Delete Auto sync history |
|
583 * @param None. |
|
584 * @return None. |
|
585 */ |
|
586 void DeleteAutoSyncHistory(); |
|
587 |
|
588 #ifdef RD_DSUI_TIMEDSYNC |
|
589 |
|
590 void SetNextProfileL(); |
|
591 void SetPreviousProfileL(); |
|
592 void UpdateTabsL(); |
|
593 |
|
594 #endif |
|
595 void UpdateMarkMenuItem(CEikMenuPane* aMenuPane); |
|
596 void SaveSelectionL(); |
|
597 |
|
598 |
|
599 |
|
600 /** |
|
601 * Checks whether the profile is already opened in another application. |
|
602 * @param aProfileId. |
|
603 * @return ETrue if profile locked ,else EFalse. |
|
604 */ |
|
605 TBool IsProfileLockedL(TInt aProfileId); |
|
606 |
|
607 |
|
608 /** |
|
609 * Checks whether sync is ongoing for a profile |
|
610 * @param aProfileId. |
|
611 * @return ETrue if sync ongoing ,else EFalse. |
|
612 */ |
|
613 TBool IsSyncOnGoingL(TInt aProfileId); |
|
614 |
|
615 #ifdef _DEBUG |
|
616 private: |
|
617 void TestL(); |
|
618 void LogDatabaseEvent(TAspDbEvent aEvent); |
|
619 #endif |
|
620 |
|
621 |
|
622 |
|
623 private: |
|
624 // list that contains all contents (applications) |
|
625 CAspContentList* iContentList; |
|
626 |
|
627 // id of the calling application |
|
628 TInt iApplicationId; |
|
629 |
|
630 // id of the dialog mode |
|
631 TInt iDialogMode; |
|
632 |
|
633 // profile list (from CNSmlDSSettings) |
|
634 CAspProfileList* iProfileList; |
|
635 |
|
636 // list of profiles |
|
637 CAknDoubleLargeStyleListBox* iSettingListBox; |
|
638 |
|
639 // for title and icon handling |
|
640 CStatusPaneHandler* iStatusPaneHandler; |
|
641 |
|
642 // for hiding tabs |
|
643 CAknNavigationControlContainer* iNaviPane; |
|
644 |
|
645 // resource handler |
|
646 CAspResHandler* iResHandler; |
|
647 |
|
648 // for getting settings database notifications |
|
649 CAspDbNotifier* iDbNotifier; |
|
650 |
|
651 // currently selected listbox item |
|
652 TInt iCurrentListBoxIndex; |
|
653 |
|
654 // performs sync operation, uses CNSmlAppEngine |
|
655 CAspSyncHandler* iSyncHandler; |
|
656 |
|
657 // session with sync server |
|
658 RSyncMLSession* iSyncSession; |
|
659 |
|
660 // is setting database in read only state |
|
661 TBool iSettingEnforcement; |
|
662 |
|
663 // long buffer for string handling |
|
664 TBuf<KBufSize255> iBuf; |
|
665 |
|
666 // currently open profile id |
|
667 TInt iCurrentProfileId; |
|
668 |
|
669 // current profile name |
|
670 TBuf<KAspMaxProfileNameLength> iCurrentProfileName; |
|
671 |
|
672 // popup note |
|
673 CAknInfoPopupNoteController* iPopupNote; |
|
674 |
|
675 // for bearer type list construction |
|
676 CAspBearerHandler* iBearerHandler; |
|
677 |
|
678 // to know whether autosyncdialog is active or not |
|
679 TBool iAutoSyncDialog; |
|
680 |
|
681 #ifdef RD_DSUI_TIMEDSYNC |
|
682 // Tab group owned by the navigation decorator. |
|
683 CAspTabbedNaviPaneHandler* iTabHandler; |
|
684 |
|
685 //Set if any profile is edited or profile count changed |
|
686 TBool iUpdateTabGroup; |
|
687 #endif |
|
688 |
|
689 |
|
690 }; |
|
691 |
|
692 |
|
693 #endif // ASPSETTINGDIALOG_H |
|
694 |
|
695 // End of File |