|
1 /* |
|
2 * Copyright (c) 2005-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: Freestyle Email header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef FSSETTINGSSYNCLIST_H |
|
21 #define FSSETTINGSSYNCLIST_H |
|
22 |
|
23 // SYSTEM INCLUDES |
|
24 #include <coecntrl.h> |
|
25 #include <e32cmn.h> |
|
26 //<cmail> |
|
27 #include "MFSMailRequestObserver.h" |
|
28 //</cmail> |
|
29 #include <AknWaitDialog.h> |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CFSMailClient; |
|
33 class CAknSingleGraphicStyleListBox; |
|
34 class CEikTextListBox; |
|
35 class TFSMailMsgId; |
|
36 class CFSMailBox; |
|
37 class CFreestyleEmailUiAppUi; |
|
38 |
|
39 typedef CAknSingleGraphicStyleListBox CSettingsListType; |
|
40 |
|
41 /** |
|
42 * Container class for CFsEmailSettingsList |
|
43 * |
|
44 * @class CFsEmailSettingsList |
|
45 */ |
|
46 class CFsEmailSettingsList : |
|
47 public CCoeControl, |
|
48 public MEikListBoxObserver, |
|
49 public MFSMailRequestObserver, |
|
50 public MProgressDialogCallback |
|
51 { |
|
52 public: |
|
53 // constructors and destructor |
|
54 static CFsEmailSettingsList* NewL( |
|
55 const TRect& aRect, |
|
56 const CCoeControl* aParent, |
|
57 CFreestyleEmailUiAppUi& aAppUi, |
|
58 CFSMailClient& aMailClient, |
|
59 CFsEmailSettingsListView& aView ); |
|
60 |
|
61 static CFsEmailSettingsList* NewLC( |
|
62 const TRect& aRect, |
|
63 const CCoeControl* aParent, |
|
64 CFreestyleEmailUiAppUi& aAppUi, |
|
65 CFSMailClient& aMailClient, |
|
66 CFsEmailSettingsListView& aView ); |
|
67 |
|
68 virtual ~CFsEmailSettingsList(); |
|
69 |
|
70 public: |
|
71 // from base class CCoeControl |
|
72 TInt CountComponentControls() const; |
|
73 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
74 |
|
75 TKeyResponse OfferKeyEventL( |
|
76 const TKeyEvent& aKeyEvent, |
|
77 TEventCode aType ); |
|
78 |
|
79 void HandleResourceChange( TInt aType ); |
|
80 void AddAccountL(); |
|
81 void RemoveAccountL(); |
|
82 void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); |
|
83 TBool PIMSyncItemVisible(); |
|
84 |
|
85 public: |
|
86 CSettingsListType* ListBox(); |
|
87 |
|
88 static HBufC* CreateListBoxItemLC( |
|
89 const TDesC& aMainText ); |
|
90 |
|
91 static HBufC* CreateListBoxItemLC( |
|
92 const TDesC& aMainText, |
|
93 TInt aIconNum ); |
|
94 |
|
95 // insert needed icons to list box |
|
96 void SetupListBoxIconsL(); |
|
97 |
|
98 /** |
|
99 * Fills list with mailbox names given by fs mail client |
|
100 */ |
|
101 void CreateAccountListL(); |
|
102 |
|
103 /** |
|
104 * Displays mailbox create query if needed |
|
105 */ |
|
106 void DisplayCreateMailboxNoteIfNeededL(); |
|
107 |
|
108 /** |
|
109 * Fills list with captions given by settings plugin |
|
110 */ |
|
111 void CreatePluginSubviewListL( const TUid& aPluginId ); |
|
112 |
|
113 /** |
|
114 * Fills list with captions given by settings plugin |
|
115 */ |
|
116 void CreatePluginPIMListL( const TUid& aPluginId ); |
|
117 |
|
118 /** |
|
119 * Sets specific mailbox protocol icon by given id |
|
120 */ |
|
121 void ProtocolBrandingIconL( TFSMailMsgId aMailBoxId ); |
|
122 |
|
123 // list content commands |
|
124 void ClearListL(); |
|
125 void AppendItemL( TDesC& aListItem ); |
|
126 TInt Count(); |
|
127 |
|
128 /** |
|
129 * list content will be drawn with captions |
|
130 * received from settings plugin or |
|
131 * mailboxes received from mailclient |
|
132 * |
|
133 * returns True if captions list |
|
134 * return False if mailbox list |
|
135 */ |
|
136 TBool Get2ndLevelListIndicator(); |
|
137 |
|
138 // handle user navigation |
|
139 void HandleUserSelectionsL(); |
|
140 |
|
141 /** |
|
142 * Retuns specific mailbox by given index |
|
143 * Ownership tranferred |
|
144 */ |
|
145 CFSMailBox* GetMailboxByIndexLC( const TInt& aIndex ) const; |
|
146 |
|
147 // get count of mailboxes in fs mailclient |
|
148 TInt GetMailboxCountL() const; |
|
149 |
|
150 /** |
|
151 * Retuns specific mailbox by given id |
|
152 * Ownership tranferred or NULL |
|
153 */ |
|
154 CFSMailBox* GetMailBoxByIdL( const TUint& aMailboxId ) const; |
|
155 |
|
156 // set account info member data from selected mailbox |
|
157 void SetSelectedAccountInfo( const TFSMailMsgId& aAccountInfo ); |
|
158 |
|
159 // set private settings plugin Uid to given value |
|
160 void SetPluginSettingsUid( const TUid& aPluginId ); |
|
161 |
|
162 // activate selected sub view from plugin |
|
163 void ActivateMailSettingsPluginSubViewL( TInt aSubViewId ); |
|
164 |
|
165 // open dialog with PIM service items |
|
166 void OpenPIMServiceDialogL(); |
|
167 |
|
168 /** |
|
169 * returns needed settings plugin instance from view stack |
|
170 * or creates new one add it to view stack and return pointer |
|
171 * Ownership is not transferred |
|
172 */ |
|
173 CESMailSettingsPlugin* GetSettingsPluginL( TUid aUid ); |
|
174 |
|
175 // set subview list index to given value |
|
176 void SetSelectedSubListIndex( TInt aIndex ); |
|
177 |
|
178 // set main list index in parent |
|
179 void SetSelectedMainListIndex( TInt aIndex ); |
|
180 |
|
181 // get main list index from parent |
|
182 TInt GetSelectedMainListIndex() const; |
|
183 |
|
184 // This sets the flag that informs that we are in the personal information management subview |
|
185 void SetPimListActivation(TBool aActivation); |
|
186 |
|
187 // Creates and passes ownership of title pane text appropriate for the current view |
|
188 HBufC* CreateTitlePaneTextLC() const; |
|
189 |
|
190 void GoToTop(); |
|
191 void GoToBottom(); |
|
192 |
|
193 void PageUp(); |
|
194 void PageDown(); |
|
195 |
|
196 public: |
|
197 enum TControls |
|
198 { |
|
199 EListBox, |
|
200 ELastControl |
|
201 }; |
|
202 enum TListBoxImages |
|
203 { |
|
204 EListBoxFirstUserImageIndex |
|
205 }; |
|
206 |
|
207 protected: |
|
208 // from base class CCoeControl |
|
209 void SizeChanged(); |
|
210 |
|
211 protected: // from MProgressDialogCallback |
|
212 void DialogDismissedL( TInt aButtonId ); |
|
213 |
|
214 private: |
|
215 // from base class CCoeControl |
|
216 void Draw( const TRect& aRect ) const; |
|
217 |
|
218 private: |
|
219 void ConstructL( |
|
220 const TRect& aRect, |
|
221 const CCoeControl* aParent); |
|
222 |
|
223 CFsEmailSettingsList(CFreestyleEmailUiAppUi& aAppUi, CFSMailClient& aMailClient, CFsEmailSettingsListView& aView ); |
|
224 void HandleListBoxEventL( CEikListBox *aListBox, TListBoxEvent aEventType ); |
|
225 void InitializeControlsL(); |
|
226 void LayoutControls(); |
|
227 void LoadAccountsToListL(); |
|
228 void SetDefaultPIMAccountL(); |
|
229 TPtrC GetMailBoxNameL( const CFSMailBox& aMailBox ) const; |
|
230 |
|
231 private: |
|
232 enum TFsEmailSettingsSubViewType |
|
233 { |
|
234 EFsEmailSettingsMainListView, |
|
235 EFsEmailSettingsMailboxView, |
|
236 EFsEmailSettingsPimView |
|
237 }; |
|
238 TFsEmailSettingsSubViewType iCurrentSubView; |
|
239 |
|
240 CSettingsListType* iListBox; |
|
241 CFreestyleEmailUiAppUi& iAppUi; |
|
242 CCoeControl* iFocusControl; |
|
243 CFSMailClient& iMailClient; |
|
244 TFSMailMsgId iSelectedAccountInfo; |
|
245 TUid iSelectedPluginSettings; |
|
246 TInt iPIMSyncMailboxIndex; |
|
247 TBool iPIMListActivation; |
|
248 TBool iPIMServiceSettingsSelection; |
|
249 CAknWaitDialog* iWaitDialog; |
|
250 TInt iMailboxCount; |
|
251 TInt iDeleteMailboxId; |
|
252 TInt iDeletedIndex; |
|
253 TInt iPIMSyncCount; |
|
254 TInt iSelectedSubListIndex; |
|
255 CFsEmailSettingsListView& iView; |
|
256 // it is used to properly handle taps |
|
257 // first tap highlights an item on the settings list, second tap selects the item |
|
258 TInt iPrevSelected; |
|
259 }; |
|
260 |
|
261 #endif // FSSETTINGSSYNCLIST_H |