|
1 /* |
|
2 * Copyright (c) 2007-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: FreestyleEmailUi message details visualiser definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __FREESTYLEEMAILUI_MSGDETAILSVISUALISER_H__ |
|
21 #define __FREESTYLEEMAILUI_MSGDETAILSVISUALISER_H__ |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 //<cmail> |
|
27 #include "fstreelistconstants.h" |
|
28 #include "fstreelistobserver.h" |
|
29 #include "fsccontactactionmenudefines.h" |
|
30 //</cmail> |
|
31 |
|
32 #include "FreestyleEmailUiViewBase.h" |
|
33 #include "FreestyleEmailUiConstants.h" |
|
34 #include "FreestyleEmailUiContactHandlerObserver.h" |
|
35 |
|
36 #include "mfsmailrequestobserver.h" |
|
37 #include <AknProgressDialog.h> |
|
38 // forward declarations |
|
39 class CFSEmailUiMsgDetailsControl; |
|
40 class CFSEmailUiMsgDetailsModel; |
|
41 class CFreestyleEmailUiAppUi; |
|
42 class CFreestyleEmailUiTextureManager; |
|
43 class CFSMailMessage; |
|
44 class CFSMailAddress; |
|
45 |
|
46 class MFsTreeItemVisualizer; |
|
47 class CFsTreeVisualizerBase; |
|
48 class CFsTreeList; |
|
49 class CFsTreePlainOneLineNodeData; |
|
50 class CFsTreePlainOneLineItemData; |
|
51 class CFsTreePlainTwoLineItemData; |
|
52 class CFsTreePlainOneLineNodeVisualizer; |
|
53 class CFsTreePlainOneLineItemVisualizer; |
|
54 class CFsTreePlainTwoLineItemVisualizer; |
|
55 class MFSMailRequestObserver; //<cmail> |
|
56 class MProgressDialogCallback; //<cmail> |
|
57 class CAknWaitDialog; //<cmail> |
|
58 |
|
59 // <cmail> Touch |
|
60 class CFSEmailUiMsgDetailsVisualiser : public CFsEmailUiViewBase, |
|
61 public MFSEmailUiContactHandlerObserver, |
|
62 public MFsTreeListObserver, |
|
63 public MFsActionMenuPositionGiver, |
|
64 public MFSMailRequestObserver, |
|
65 public MProgressDialogCallback |
|
66 // </cmail> |
|
67 { |
|
68 |
|
69 public: // Construction and destruction |
|
70 /** |
|
71 * Destructor |
|
72 */ |
|
73 ~CFSEmailUiMsgDetailsVisualiser(); |
|
74 void PrepareForExit(); |
|
75 |
|
76 /** |
|
77 * Two phase constructors |
|
78 * |
|
79 * @param aEnv Alfred environmet |
|
80 * @param aControlGroup control group |
|
81 * @param aAppUi Application main UI class |
|
82 * @return Pointer to newly created object |
|
83 */ |
|
84 static CFSEmailUiMsgDetailsVisualiser* NewL( CAlfEnv& aEnv, |
|
85 CAlfControlGroup& aControlGroup, |
|
86 CFreestyleEmailUiAppUi& aAppUi ); |
|
87 static CFSEmailUiMsgDetailsVisualiser* NewLC( CAlfEnv& aEnv, |
|
88 CAlfControlGroup& aControlGroup, |
|
89 CFreestyleEmailUiAppUi& aAppUi ); |
|
90 public: // From base class CAknView |
|
91 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
92 |
|
93 void HandleCommandL( TInt aCommand ); |
|
94 |
|
95 TUid Id() const; |
|
96 |
|
97 public: // Own public member functions |
|
98 |
|
99 /** |
|
100 * Dynamic switch handling |
|
101 */ |
|
102 void HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType ); |
|
103 void SetMskL(); |
|
104 /** |
|
105 * Event handling forwarded from control |
|
106 * |
|
107 * @param aEvent Event forwarded from control |
|
108 * @return ETrue if event was consumed, otherwise EFalse |
|
109 */ |
|
110 TBool OfferEventL( const TAlfEvent& aEvent ); |
|
111 |
|
112 public: // From MFSEmailUiContactHandlerObserver |
|
113 |
|
114 void OperationCompleteL( TContactHandlerCmd aCmd, |
|
115 const RPointerArray<CFSEmailUiClsItem>& aContacts ); |
|
116 void OperationErrorL( TContactHandlerCmd, TInt aError ); |
|
117 |
|
118 // <cmail> Touch |
|
119 public: // From MFsTreeListObserver |
|
120 |
|
121 void TreeListEventL( const TFsTreeListEvent aEvent, |
|
122 const TFsTreeItemId aId, |
|
123 const TPoint& aPoint ); |
|
124 |
|
125 // From MFsActionMenuPositionGiver |
|
126 TPoint ActionMenuPosition(); |
|
127 // </cmail> |
|
128 |
|
129 // <cmail> |
|
130 public: |
|
131 /** |
|
132 * MFSMailRequestObserver interface implementation |
|
133 */ |
|
134 void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); |
|
135 |
|
136 /** |
|
137 * MProgressDialogCallback interface implementation |
|
138 */ |
|
139 void DialogDismissedL( TInt aButtonId); |
|
140 |
|
141 private: |
|
142 /// data related to fetching message structure |
|
143 TInt iCurrentStructureFetchRequestId; |
|
144 TBool iFetchingMessageStructure; |
|
145 TBool iAsyncProcessComplete; |
|
146 TInt iWaitNoteId; |
|
147 /// Wait note stuff |
|
148 CAknWaitDialog* iWaitDialog; |
|
149 TBool iDialogNotDismissed; |
|
150 |
|
151 /** |
|
152 * Update our message pointer and saves its status |
|
153 */ |
|
154 void UpdateMessagePtrL( TFSMailMsgId aNewMailboxId, |
|
155 TFSMailMsgId aNewFolderId, |
|
156 TFSMailMsgId aNewMessageId ); |
|
157 |
|
158 /** |
|
159 * Fetching the Message Structure. It is necessary for POP protocol in order to read recipients |
|
160 */ |
|
161 void StartFetchingMessageStructureL( CFSMailMessage* aMsg ); |
|
162 |
|
163 /** |
|
164 * Cancel fetching of the message structureCancel fetching of the message structure |
|
165 */ |
|
166 void CancelFetching(); |
|
167 // </cmail> |
|
168 // <cmail> Toolbar |
|
169 private: // from |
|
170 |
|
171 /** |
|
172 * @see CFsEmailUiViewBase::ChildDoActivateL |
|
173 */ |
|
174 void ChildDoActivateL( const TVwsViewId& aPrevViewId, |
|
175 TUid aCustomMessageId, |
|
176 const TDesC8& aCustomMessage ); |
|
177 // </cmail> Toolbar |
|
178 void ChildDoDeactivate(); |
|
179 void GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const; |
|
180 |
|
181 private: |
|
182 /** |
|
183 * Constructors |
|
184 */ |
|
185 CFSEmailUiMsgDetailsVisualiser( CAlfEnv& aEnv, CFreestyleEmailUiAppUi& aAppUi, CAlfControlGroup& aControlGroup ); |
|
186 void ConstructL(); |
|
187 |
|
188 /** |
|
189 * Sets title pane text |
|
190 * |
|
191 * @param aViewStarted ETrue when starting view (title set to "Message/Meeting details") |
|
192 * EFalse when closing view (title set back to previous) |
|
193 */ |
|
194 void ChangeTitleBarTextL( TBool aViewStarted ); |
|
195 |
|
196 /** |
|
197 * Delete contents from list and model |
|
198 */ |
|
199 void ClearMsgDetailsModelL(); |
|
200 |
|
201 /** |
|
202 * Update contents to list and model |
|
203 */ |
|
204 void UpdateMsgDetailsModelL(); |
|
205 |
|
206 /** |
|
207 * Updates variables that specify the list size |
|
208 */ |
|
209 void UpdateListSizeAttributes(); |
|
210 |
|
211 /** |
|
212 * Append specified email fields to list |
|
213 */ |
|
214 void AppendFromLinesL(); |
|
215 void AppendSubjectLinesL(); |
|
216 void AppendToLinesL(); |
|
217 void AppendCcLinesL(); |
|
218 void AppendBccLinesL(); |
|
219 void AppendSizeLinesL(); |
|
220 void AppendSentLinesL(); |
|
221 void AppendPriorityLinesL(); |
|
222 void AppendMessageTypeLinesL(); |
|
223 |
|
224 /** |
|
225 * Actual creation of the list items and nodes |
|
226 * |
|
227 * @param aItemDataBuff List item data |
|
228 * @param aItemData Pointer to item data object |
|
229 * @param aItemVisualizer/aNodeVisualizer Pointer to item/node visualizer |
|
230 */ |
|
231 void CreateOneLinePlainItemLC2( const TDesC& aItemDataBuff, |
|
232 CFsTreePlainOneLineItemData* &aItemData, |
|
233 CFsTreePlainOneLineItemVisualizer* &aItemVisualizer ); |
|
234 void CreateTwoLinePlainItemLC2( const TDesC& aPrimaryDataBuff, |
|
235 const TDesC& aSecondaryDataBuff, |
|
236 CFsTreePlainTwoLineItemData* &aItemData, |
|
237 CFsTreePlainTwoLineItemVisualizer* &aItemVisualizer ); |
|
238 void SetItemVisualizerCommonProperties( MFsTreeItemVisualizer& aItemVisualizer ); |
|
239 |
|
240 void CreatePlainNodeLC2( const TDesC& aItemDataBuff, |
|
241 CFsTreePlainOneLineNodeData* &aItemData, |
|
242 CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer ); |
|
243 void SetNodeVisualizerProperties( MFsTreeItemVisualizer& aItemVisualizer ); |
|
244 void SetChildVisualizersProperties( TFsTreeItemId aNodeId ); |
|
245 |
|
246 /** |
|
247 * Append heading line to list as a node |
|
248 * |
|
249 * @param aResourceId Resource id for the heading text |
|
250 * @return List item id of the created node |
|
251 */ |
|
252 TFsTreeItemId AppendHeadingToListL( TInt aResourceId ); |
|
253 |
|
254 /** |
|
255 * Append item to list under the specified node |
|
256 * |
|
257 * @param aItemData/aPrimaryDataBuff/aSecondaryDataBuff List item data |
|
258 * @param aParentNode Parent node in list |
|
259 * @return List item id of the created item |
|
260 */ |
|
261 TFsTreeItemId AppendOneLineItemToListL( const TDesC& aItemData, |
|
262 TFsTreeItemId aParentNode ); |
|
263 TFsTreeItemId AppendTwoLineItemToListL( const TDesC& aPrimaryDataBuff, |
|
264 const TDesC& aSecondaryDataBuff, |
|
265 TFsTreeItemId aParentNode, |
|
266 TBool aItemHasActionMenu = EFalse ); |
|
267 TFsTreeItemId AppendDateTimeItemToListL( const TDesC& aPrimaryDataBuff, |
|
268 const TDesC& aSecondaryDataBuff, |
|
269 const TDesC& aDateTimeDataBuff, |
|
270 TFsTreeItemId aParentNode ); |
|
271 /** |
|
272 * Get display name and email address information from the address data |
|
273 * |
|
274 * @param aAddressData Mail address data where the information is got |
|
275 * @param aDisplayName On return holds the display name |
|
276 * @param aEmailAddress On return holds the email address |
|
277 * @return EFalse if both display name and email address are empty, otherwise ETrue |
|
278 */ |
|
279 TBool GetDisplayNameAndEmailAddressL( CFSMailAddress* aAddressData, |
|
280 TDesC* &aDisplayName, |
|
281 TDesC* &aEmailAddress ); |
|
282 |
|
283 /** |
|
284 * Collapse all nodes except the specified one |
|
285 * |
|
286 * @param aExcludedNode Node that is not collapsed |
|
287 */ |
|
288 void CollapseNodesExceptL( TFsTreeItemId aExcludedNode ); |
|
289 |
|
290 // Action menu handling |
|
291 void LaunchActionMenuL(); |
|
292 void HandleActionMenuCommandL( TActionMenuCustomItemId itemId ); |
|
293 |
|
294 // Action menu action handling, use UI utility class |
|
295 TBool SendEmailToFocusedItemL() const; // Return value tells wheter operation succeeded or not |
|
296 void CallToFocusedItemL(); |
|
297 void CreateMessageToFocusedItemL() const; |
|
298 void LaunchRemoteLookupForFocusedItemL() const; |
|
299 void AddFocusedItemToContactsL() const; |
|
300 void ShowContactDetailsForFocusedItemL() const; |
|
301 void CopyFocusedItemToClipboardL() const; |
|
302 |
|
303 // Shortuct handling of collpase/expand all toggle and go to first/last |
|
304 void ShortcutCollapseExpandAllToggleL(); |
|
305 void GoToTopL(); |
|
306 void GoToBottomL(); |
|
307 |
|
308 // Tells wheter the action menu should be shown for the currently focused list item |
|
309 TBool HasFocusedItemActionMenu() const; |
|
310 |
|
311 /** |
|
312 * Get email of address of the focused list item |
|
313 * |
|
314 * @return Pointer to email address if found, NULL if not found |
|
315 */ |
|
316 CFSMailAddress* GetEmailAddressForFocusedItem() const; |
|
317 TDesC* GetEmailAddressForFocusedItemAsTDes() const; |
|
318 |
|
319 // Recursive function to get item's root level parent |
|
320 TFsTreeItemId GetRootParent( const TFsTreeItemId aItemId ) const; |
|
321 |
|
322 // Tell wheter all nodes are currently collpased/expanded |
|
323 TBool AllNodesCollapsed() const; |
|
324 TBool AllNodesExpanded( TFsTreeItemId aParentNodeId = KFsTreeRootID ) const; |
|
325 |
|
326 // First start function. |
|
327 void DoFirstStartL(); |
|
328 |
|
329 private: |
|
330 enum TExpandCollapseMode |
|
331 { |
|
332 EExpandAll = 0, |
|
333 ECollapseAllExceptTo, |
|
334 ECollapseAllExceptCc, |
|
335 ECollapseAllExceptBcc |
|
336 }; |
|
337 |
|
338 private: |
|
339 // Pointers to ALF related objects |
|
340 CAlfEnv& iEnv; |
|
341 CAlfLayout* iParentLayout; |
|
342 |
|
343 // Pointers to mail framework related objects |
|
344 CFSMailMessage* iViewedMsg; |
|
345 |
|
346 // Pointers to own control and model objects |
|
347 CFSEmailUiMsgDetailsControl* iControl; // Not owned, owned by ALF env |
|
348 CFSEmailUiMsgDetailsModel* iModel; // Owned |
|
349 |
|
350 // Lists screen rect and node heights |
|
351 TRect iScreenRect; |
|
352 TInt iListNodeHeight; |
|
353 |
|
354 // Nodes that can be focused at startup |
|
355 TFsTreeItemId iToNodeId; |
|
356 TFsTreeItemId iCcNodeId; |
|
357 TFsTreeItemId iBccNodeId; |
|
358 |
|
359 // All nodes |
|
360 RArray<TFsTreeItemId> iNodeIds; |
|
361 |
|
362 // Pointer to the tree list component visualizer. |
|
363 CFsTreeVisualizerBase* iTreeVisualizer; |
|
364 |
|
365 // Pointer to the tree list component, owned. |
|
366 CFsTreeList* iTreeList; |
|
367 |
|
368 // Previous view uid |
|
369 TUid iPreviousViewUid; |
|
370 |
|
371 // Previous title bar text, restored when returning from this view |
|
372 HBufC* iPreviousTitleText; |
|
373 |
|
374 // Pointers to "error texts" shown in list |
|
375 TDesC* iNoDisplayNameAvailableText; |
|
376 TDesC* iNoEmailAddressAvailableText; |
|
377 |
|
378 TBool iFirstViewActivation; |
|
379 TBool iFirstStartCompleted; |
|
380 |
|
381 // When this flag is set, list (scroll bar) refresh is allowed when |
|
382 // inserting new items to list |
|
383 TBool iAllowListRefreshInInsert; |
|
384 |
|
385 // Flags for expand/collapse mode and when to expand + highlight next node |
|
386 TExpandCollapseMode iExpandCollapseMode; |
|
387 TBool iExpandAndHighlightNextNode; |
|
388 |
|
389 TBool iRCLSupported; |
|
390 |
|
391 // <cmail> video call |
|
392 // Flag for making video call |
|
393 TBool iVideoCall; |
|
394 // </cmail> |
|
395 }; |
|
396 |
|
397 |
|
398 #endif //__FREESTYLEEMAILUI_MSGDETAILSVISUALISER_H__ |