|
1 /* |
|
2 * Copyright (c) 2007 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: Folder list array. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef IPSSETUIFOLDERSUBSCRIPTION_H |
|
20 #define IPSSETUIFOLDERSUBSCRIPTION_H |
|
21 |
|
22 #include <msvstd.h> // TMsvId |
|
23 #include <AknForm.h> // CAknDialog |
|
24 #include <eiklbo.h> // MEikListBoxObserver |
|
25 #include <AknWaitNoteWrapper.h> |
|
26 |
|
27 /** |
|
28 * Enumeration for folder icon indexes. |
|
29 */ |
|
30 enum TIpsSetUiFolderIconIndexes |
|
31 { |
|
32 EIpsSetUiFolderSingleUnsubbed = 0, |
|
33 EIpsSetUiFolderSingleSubbed, |
|
34 EIpsSetUiFolderSingleSubbedNew, |
|
35 EIpsSetUiFolderSubfoldersUnsubbed, |
|
36 EIpsSetUiFolderSubfoldersSubbed, |
|
37 EIpsSetUiFolderSubfoldersSubbedNew, |
|
38 EIpsSetUiFolderUnsubbedNew, |
|
39 EIpsSetUiFolderSubfoldersUnsubbedNew, |
|
40 }; |
|
41 |
|
42 class CBaseMtmUiData; |
|
43 class CBaseMtmUi; |
|
44 class CIpsSetUiFolderListArray; |
|
45 class CIpsSetUiCtrlSoftkey; |
|
46 class CClientMtmRegistry; |
|
47 class CGulIcon; |
|
48 class CAknTitlePane; |
|
49 //<cmail> |
|
50 class CAknWaitDialog; |
|
51 class CSubscriptionDialogActiveHelper; |
|
52 //</cmail> |
|
53 |
|
54 |
|
55 /** |
|
56 * Folder subscription dialog class |
|
57 * |
|
58 * @lib IpsSosSettings.lib |
|
59 * @since FS v1.0 |
|
60 */ |
|
61 class CIpsSetUiSubscriptionDialog : |
|
62 public CAknDialog, |
|
63 public MEikListBoxObserver, |
|
64 public MProgressDialogCallback, //<cmail> |
|
65 public MMsvSessionObserver |
|
66 { |
|
67 public: |
|
68 |
|
69 //<cmail> |
|
70 /** |
|
71 * CIpsSetUiSubscriptionDialog keeps it's state using these enum values |
|
72 */ |
|
73 enum TSubsDialogState { EIdle, ESingleOperation, EMultipleStart, |
|
74 EMultipleSubscribe, EMultipleUnsubscribe }; |
|
75 //</cmail> |
|
76 |
|
77 /** |
|
78 * NewL() |
|
79 * @param TMsvId |
|
80 * @param CMsvSession& |
|
81 * @return CIpsSetUiSubscriptionDialog* |
|
82 */ |
|
83 static CIpsSetUiSubscriptionDialog* NewL( |
|
84 TUint64& aFlags, |
|
85 TMsvId aServiceId, |
|
86 CMsvSession& aSession, |
|
87 CAknTitlePane& aTitlePane, |
|
88 const TDesC& aTitlePaneText ); |
|
89 |
|
90 ~CIpsSetUiSubscriptionDialog(); |
|
91 |
|
92 |
|
93 /** |
|
94 * From MMsvSessionObserver |
|
95 * HandleSessionEventL |
|
96 * @param TMsvSessionEvent, event id |
|
97 * @param TAny* |
|
98 * @param TAny* |
|
99 * @param TAny* |
|
100 */ |
|
101 virtual void HandleSessionEventL( |
|
102 TMsvSessionEvent aEvent, |
|
103 TAny* aArg1, |
|
104 TAny* aArg2, |
|
105 TAny* aArg3 ); |
|
106 |
|
107 /** |
|
108 * SynchronisEIpsSetUiFoldersL() |
|
109 */ |
|
110 void SynchronisEIpsSetUiFoldersL(); |
|
111 |
|
112 /** |
|
113 * DisplayFinalProgressDialog() |
|
114 * To deal with final progress from suboperations |
|
115 * @param CMsvOperation& |
|
116 */ |
|
117 void DisplayFinalProgressDialog( |
|
118 CMsvOperation& aCompletedOperation) const; |
|
119 |
|
120 /** |
|
121 * from CCoeControl |
|
122 * OfferKeyEventL() |
|
123 * @param TKeyEvent&, key event |
|
124 * @param TEventCode |
|
125 * @return TKeyResponse |
|
126 */ |
|
127 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
128 |
|
129 |
|
130 /** |
|
131 * From CAknDialog |
|
132 * DynInitMenuPaneL() |
|
133 * @param TInt, resource id |
|
134 * @param CEikMenuPane* |
|
135 */ |
|
136 virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) ; |
|
137 |
|
138 /** |
|
139 * From CAknDialog |
|
140 * ProcessCommandL() |
|
141 * @param TInt, command id |
|
142 */ |
|
143 virtual void ProcessCommandL( TInt aCommandId ); |
|
144 |
|
145 //<cmail> |
|
146 /** |
|
147 * This method is called by CSubscriptionDialogActiveHelper, when async |
|
148 * operation is completed |
|
149 * @param TInt, error id |
|
150 */ |
|
151 void HandleAsyncRequestCompletedL( TInt aErrorId ); |
|
152 |
|
153 /** |
|
154 * from MProgressDialogCallback |
|
155 */ |
|
156 void DialogDismissedL( TInt aButtonId ); |
|
157 //</cmail> |
|
158 |
|
159 |
|
160 protected: |
|
161 |
|
162 /** |
|
163 * From MEikListBoxObserver |
|
164 * @param CEikListBox* |
|
165 * @param TListBoxEvent |
|
166 */ |
|
167 virtual void HandleListBoxEventL( |
|
168 CEikListBox* aListBox, |
|
169 TListBoxEvent aEventType ); |
|
170 |
|
171 /** |
|
172 * HandleSubscriptionL() |
|
173 * @param TInt type of subscription, either subscribed or unsubscribed |
|
174 * @param CMsvEntrySelection&, selection to subscribe |
|
175 */ |
|
176 void HandleSubscriptionL( TInt aSubType, CMsvEntrySelection& aSelection ); |
|
177 |
|
178 /** |
|
179 * CheckAreAllFoldersIncludedL() |
|
180 * Checks if all subfolders are either subscribed of unsubscribed |
|
181 * @param TInt, type of subscription, either subscribed or unsubscribed |
|
182 * @param CMsvEntrySelection*, selection to check |
|
183 * @return TBool, ETrue if all subfolders have same subscription state |
|
184 */ |
|
185 TBool CheckAreAllFoldersIncludedL( TInt aSubType, CMsvEntrySelection* sel ); |
|
186 |
|
187 private: |
|
188 |
|
189 /** |
|
190 * PreLayoutDynInitL() |
|
191 */ |
|
192 virtual void PreLayoutDynInitL(); |
|
193 |
|
194 /** |
|
195 * PostLayoutDynInitL() |
|
196 */ |
|
197 virtual void PostLayoutDynInitL(); |
|
198 |
|
199 /** |
|
200 * OkToExitL() |
|
201 * @param TInt |
|
202 * @return TBool |
|
203 */ |
|
204 virtual TBool OkToExitL(TInt aButtonId); |
|
205 |
|
206 /** |
|
207 * C++ constructor |
|
208 * @param TMsvId, mailbox id |
|
209 * @param CMsvSession& session reference |
|
210 */ |
|
211 CIpsSetUiSubscriptionDialog( |
|
212 TUint64& aFlags, |
|
213 TMsvId aServiceId, |
|
214 CMsvSession& aSession, |
|
215 CAknTitlePane& aTitlePane ); |
|
216 |
|
217 /** |
|
218 * ConstructL() |
|
219 */ |
|
220 void ConstructL( const TDesC& aTitlePaneText ); |
|
221 |
|
222 /** |
|
223 * CreateOperationL() |
|
224 * @param TInt, button id |
|
225 */ |
|
226 void CreateOperationL(TInt aButtonId); |
|
227 |
|
228 /** |
|
229 * ContextHasChildFolders() |
|
230 * @return TBool, ETrue if has children |
|
231 */ |
|
232 TBool ContextHasChildFolders() const; |
|
233 |
|
234 /** |
|
235 * GetMtmUiL() |
|
236 */ |
|
237 void GetMtmUiL(); |
|
238 |
|
239 |
|
240 /** |
|
241 * AppendIconsL() |
|
242 * Appends icons to icon array |
|
243 * @param TFileName&: Bitmap filename with path |
|
244 * @param CArrayPtrFlat<CGulIcon>*: icon array where bitmap is append |
|
245 */ |
|
246 void AppendIconsL( |
|
247 TFileName& aFileName, |
|
248 CArrayPtrFlat<CGulIcon>* aIcons); |
|
249 |
|
250 /** |
|
251 * CurrentFolder() |
|
252 * @return TMsvId, id of current folder |
|
253 */ |
|
254 TMsvId CurrentFolder(); |
|
255 |
|
256 /** |
|
257 * HandleRefreshL |
|
258 */ |
|
259 void HandleRefreshL(); |
|
260 |
|
261 /** |
|
262 * LaunchHelpL() |
|
263 * Launches help |
|
264 */ |
|
265 void LaunchHelpL( const TDesC& aContext ); |
|
266 |
|
267 /** |
|
268 * From CCoeControl, returns help context |
|
269 * @param TCoeHelpContext&, help context |
|
270 */ |
|
271 void GetHelpContext(TCoeHelpContext& aContext) const; |
|
272 |
|
273 /** |
|
274 * returns correct resource string for MSK |
|
275 * @return MSK label |
|
276 */ |
|
277 TInt GetResourceForMiddlekey(); |
|
278 |
|
279 /** |
|
280 * Solves which label should be shown in MSK |
|
281 * @return state of MSK (Open/Subscribe/Unsubscribe/empty) |
|
282 */ |
|
283 TInt CheckMSKState(); |
|
284 |
|
285 //<cmail> |
|
286 /** |
|
287 * cancels all async requests |
|
288 */ |
|
289 void CancelAllAsyncRequests(); |
|
290 |
|
291 /** |
|
292 * Shows a waitnote |
|
293 */ |
|
294 void ShowWaitNoteL(); |
|
295 //</cmail> |
|
296 |
|
297 private: |
|
298 |
|
299 /** |
|
300 * Flags to control dialog. Mainly for exiting the dialog. |
|
301 */ |
|
302 TUint64& iFlags; |
|
303 |
|
304 /** |
|
305 * MTM registry object. |
|
306 * Owned. |
|
307 */ |
|
308 CClientMtmRegistry* iMtmRegistry; |
|
309 |
|
310 /** |
|
311 * Current service Id. |
|
312 */ |
|
313 TMsvId iServiceId; |
|
314 |
|
315 /** |
|
316 * Message server session. |
|
317 */ |
|
318 CMsvSession& iSession; |
|
319 |
|
320 /** |
|
321 * Current folder entry. |
|
322 * Owned. |
|
323 */ |
|
324 CMsvEntry* iContextEntry; |
|
325 |
|
326 /** |
|
327 * Base MTM object. |
|
328 * Owned. |
|
329 */ |
|
330 CBaseMtm* iBaseMtm; |
|
331 |
|
332 /** |
|
333 * Container for folders. |
|
334 * Owned. |
|
335 */ |
|
336 CIpsSetUiFolderListArray* iFolderListArray; |
|
337 |
|
338 /** |
|
339 * Softkey control. |
|
340 * Pwned. |
|
341 */ |
|
342 CIpsSetUiCtrlSoftkey* iSoftkeys; |
|
343 |
|
344 /** |
|
345 * Commonly used ordering. |
|
346 */ |
|
347 TMsvSelectionOrdering iOrdering; |
|
348 |
|
349 /** |
|
350 * Currently open folder. |
|
351 */ |
|
352 TMsvId iOpenedFolderId; |
|
353 |
|
354 /** |
|
355 * Previous folder subscription. |
|
356 */ |
|
357 TInt iPreviousSubscriptionRID; |
|
358 |
|
359 /** |
|
360 * Previously opened folder. |
|
361 */ |
|
362 TInt iPreviousFolderOpenRID; |
|
363 |
|
364 |
|
365 /** |
|
366 * Previous view title pane text |
|
367 */ |
|
368 HBufC* iOldTitlePaneText; |
|
369 |
|
370 /** |
|
371 * title pane control |
|
372 */ |
|
373 CAknTitlePane& iTitlePane; |
|
374 |
|
375 /** |
|
376 * wait note for folder list refresh |
|
377 */ |
|
378 //<cmail> |
|
379 CAknWaitDialog* iAsyncWaitNote; |
|
380 |
|
381 /** |
|
382 * Owned. Only one operation can be active at a time |
|
383 */ |
|
384 CSubscriptionDialogActiveHelper* iAsyncHelper; |
|
385 |
|
386 /** |
|
387 * Current state of this object (which request is going on, if any) |
|
388 */ |
|
389 CIpsSetUiSubscriptionDialog::TSubsDialogState iState; |
|
390 |
|
391 /** |
|
392 * True if fetch dialog is already dismissed, no need to call ProcessFinishedL |
|
393 */ |
|
394 TBool iFetchDialogDismissed; |
|
395 |
|
396 /** |
|
397 * List of selected folder entries for subcribe/unsubscribe |
|
398 */ |
|
399 CMsvEntrySelection* iEntrySelection; |
|
400 |
|
401 /** |
|
402 * Multiple commands to iBaseMtm are called during this active cycle |
|
403 * with KIMAP4MTMStartBatch |
|
404 */ |
|
405 TBool iMultipleStarted; |
|
406 |
|
407 /** |
|
408 * Original count in iEntrySelection when batch subscribe/unsubscribe command |
|
409 * was started |
|
410 */ |
|
411 TInt iCount; |
|
412 //</cmail> |
|
413 |
|
414 }; |
|
415 |
|
416 //<cmail> |
|
417 /** |
|
418 * This class is used by CIpsSetUiSubscriptionDialog for waiting its async tasks. |
|
419 * CIpsSetUiSubscriptionDialog can't be made active because of multiple times CBase |
|
420 * inheritance problems |
|
421 */ |
|
422 class CSubscriptionDialogActiveHelper : public CActive |
|
423 { |
|
424 public: // public functions |
|
425 |
|
426 /** |
|
427 * Constructor |
|
428 */ |
|
429 CSubscriptionDialogActiveHelper(CIpsSetUiSubscriptionDialog* aSubscriptionDialog); |
|
430 |
|
431 /** |
|
432 * Destructor |
|
433 */ |
|
434 ~CSubscriptionDialogActiveHelper( ); |
|
435 |
|
436 /** |
|
437 * Active object start |
|
438 */ |
|
439 void Start(CMsvOperation* aMsvOperation); |
|
440 |
|
441 private: // private functions |
|
442 |
|
443 /** |
|
444 * Active object RunL |
|
445 */ |
|
446 void RunL(); |
|
447 |
|
448 /** |
|
449 * Active object DoCancel |
|
450 */ |
|
451 void DoCancel(); |
|
452 |
|
453 /** |
|
454 * pointer to CIpsSetUiSubscriptionDialog doesnt own |
|
455 */ |
|
456 CIpsSetUiSubscriptionDialog* iSubscriptionDialog; |
|
457 |
|
458 /** |
|
459 * pointer to monitored operation, Owned |
|
460 */ |
|
461 CMsvOperation* iMsvOperation; |
|
462 |
|
463 }; |
|
464 //</cmail> |
|
465 |
|
466 #endif // IPSSETUIFOLDERSUBSCRIPTION_H |