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