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: FreestyleEmailUi mail viewer visualiser definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __FREESTYLEEMAILUI_MAILVIEWERVISUALISER_H__ |
|
20 #define __FREESTYLEEMAILUI_MAILVIEWERVISUALISER_H__ |
|
21 |
|
22 // SYSTEM INCLUDE FILES |
|
23 #include <e32base.h> |
|
24 #include <finditemengine.h> |
|
25 #include <AknNaviDecoratorObserver.h> |
|
26 //<cmail> |
|
27 #include "fstextviewerobserver.h" |
|
28 //#include <aknwaitnotewrapper.h> |
|
29 #include <cstack.h> |
|
30 #include <AknProgressDialog.h> |
|
31 //</cmail> |
|
32 //<cmail> |
|
33 #include "mfsmailrequestobserver.h" |
|
34 #include "mesmricalviewercallback.h" |
|
35 #include "mesmricalviewerobserver.h" |
|
36 //</cmail> |
|
37 |
|
38 // INTERNAL INCLUDE FILES |
|
39 #include "FreestyleEmailUiViewBase.h" |
|
40 #include "FreestyleEmailUiListVisualiser.h" |
|
41 #include "FreestyleEmailDownloadInformationMediator.h" |
|
42 #include "FreestyleEmailUiConstants.h" |
|
43 #include "FreestyleEmailUiControlBarCallback.h" |
|
44 #include "FreestyleEmailUiUtilities.h" |
|
45 #include "FreestyleEmailUiContactHandlerObserver.h" |
|
46 #include "FreestyleEmailUiMailViewerRichText.h" |
|
47 |
|
48 // FORWARD DECLARATIONS |
|
49 class CFSMailMessage; |
|
50 class CFreestyleEmailUiAppUi; |
|
51 class CFsTextViewer; |
|
52 class CFsTextViewerWatermark; |
|
53 class CFsSmileyDictionary; |
|
54 class CFreestyleEmailUiMailViewerControl; |
|
55 class CAiwServiceHandler; |
|
56 class CBrowserLauncher; |
|
57 class CFSEmailUiStatusIndicator; |
|
58 class CFlagSelectionGlobalNoteHandler; |
|
59 class CAknGlobalListQuery; |
|
60 class CAknGlobalNote; |
|
61 class CAknWaitDialog; //<cmail> |
|
62 class CAknNavigationDecorator; |
|
63 |
|
64 // list of different types of action menus to be shown. |
|
65 enum TActionMenuType |
|
66 { |
|
67 ENoActionMenuFocused = 0, |
|
68 EFocusOnNumberWithinMessage, |
|
69 EFocusOnHyperLinkWithinMessage, |
|
70 EFocusOnNameInAddressField, |
|
71 EFocusOnEMailInBodyText, |
|
72 EFocusOnAttachmentName, |
|
73 EFocusOnAttachmentsText |
|
74 }; |
|
75 |
|
76 |
|
77 /** |
|
78 * CFSEmailUiMailViewerVisualiser implements message viewer view. |
|
79 * It uses FS Generic TV component, which displays rich text with hotspots. |
|
80 * View contains hotspot related action menu handling and many options menu |
|
81 */ |
|
82 class CFSEmailUiMailViewerVisualiser : public CFsEmailUiViewBase, |
|
83 public MFsTextViewerObserver, |
|
84 public MFSEmailDownloadInformationObserver, |
|
85 public MFSMailRequestObserver, |
|
86 public MFSEmailUiFolderListCallback, |
|
87 public MProgressDialogCallback, //cmail |
|
88 public MFSEmailUiGenericTimerCallback, |
|
89 public MFSEmailUiContactHandlerObserver, |
|
90 public MESMRIcalViewerCallback, |
|
91 public MESMRIcalViewerObserver, |
|
92 public MAknNaviDecoratorObserver |
|
93 { |
|
94 public: // construction and destruction |
|
95 static CFSEmailUiMailViewerVisualiser* NewL( CAlfEnv& aEnv, CFreestyleEmailUiAppUi& aAppUi, CAlfControlGroup& aMailViewerControlGroup ); |
|
96 static CFSEmailUiMailViewerVisualiser* NewLC( CAlfEnv& aEnv, CFreestyleEmailUiAppUi& aAppUi, CAlfControlGroup& aMailViewerControlGroup ); |
|
97 ~CFSEmailUiMailViewerVisualiser(); |
|
98 void PrepareForExit(); |
|
99 |
|
100 public: // methods |
|
101 CAlfControl* ViewerControl(); |
|
102 void SetMskL(); |
|
103 // Event handling forwarded from control |
|
104 TBool OfferEventL( const TAlfEvent& aEvent ); |
|
105 |
|
106 // Handle accept/decline/tentative/remove commands given for meeting request message directly from list UI. |
|
107 void HandleMrCommandL( TInt aCommandId, TFSMailMsgId aMailboxId, TFSMailMsgId aFolderId, TFSMailMsgId aMessageId ); |
|
108 |
|
109 void CompletePendingMrCommand(); |
|
110 void CancelPendingMrCommandL(); |
|
111 |
|
112 // Helper funcitons to get viewed message ID and Folder id |
|
113 TFSMailMsgId ViewedMessageFolderId(); |
|
114 TFSMailMsgId ViewedMessageId(); |
|
115 |
|
116 // Called from global flag selection dialog |
|
117 void FlagselectionCompleteL( TInt aSelection ); |
|
118 |
|
119 void HandleMailBoxEventL( TFSMailEvent aEvent, TFSMailMsgId aMailbox, |
|
120 TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
121 |
|
122 public: // from CFsEmailUiViewBase |
|
123 void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); |
|
124 void HandleCommandL( TInt aCommand ); |
|
125 |
|
126 TUid Id() const; |
|
127 |
|
128 void HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType ); |
|
129 void HandleDynamicVariantSwitchOnBackgroundL( CFsEmailUiViewBase::TDynamicSwitchType aType ); |
|
130 void HandleForegroundEventL(); |
|
131 |
|
132 protected: // from CFsEmailUiViewBase |
|
133 /*void DoDoActivateL( const TVwsViewId& aPrevViewId, |
|
134 TUid aCustomMessageId, |
|
135 const TDesC8& aCustomMessage );*/ |
|
136 void ChildDoDeactivate(); |
|
137 void ActivateControlGroup( TInt aDelay = 0 ); |
|
138 void GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const; |
|
139 void NavigateBackL(); |
|
140 |
|
141 public: // from MFsTextViewerObserver |
|
142 void HandleTextViewerEventL( TFsTextViewerEvent aEvent ); |
|
143 |
|
144 public : // from MFSEmailDownloadInformationObserver |
|
145 void RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart ); |
|
146 |
|
147 public : // for MFSMailRequestObserver |
|
148 void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); |
|
149 |
|
150 public: // from MFSEmailUiFolderListCallback |
|
151 void FolderSelectedL( TFSMailMsgId aSelectedFolderId, |
|
152 TFSEmailUiCtrlBarResponse aResponse ); |
|
153 |
|
154 public: // from MAknBackgroundProcess |
|
155 //<cmail> we are using different wait note |
|
156 //void StepL(); |
|
157 //TBool IsProcessDone() const; |
|
158 //void ProcessFinished(); |
|
159 //void DialogDismissedL( TInt /*aButtonId*/ ); |
|
160 //TInt CycleError( TInt aError ); |
|
161 |
|
162 // from MProgressDialogCallback |
|
163 void DialogDismissedL( TInt aButtonId); |
|
164 //</cmail> |
|
165 |
|
166 public: // from MFSEmailUiGenericTimerCallback |
|
167 void TimerEventL( CFSEmailUiGenericTimer* aTriggeredTimer ); |
|
168 |
|
169 public: // from MFSEmailUiContactHandlerObserver |
|
170 void OperationCompleteL( TContactHandlerCmd aCmd, |
|
171 const RPointerArray<CFSEmailUiClsItem>& aContacts ); |
|
172 void OperationErrorL( TContactHandlerCmd, TInt aError ); |
|
173 |
|
174 public: // from MESMRIcalViewerCallback |
|
175 void ProcessAsyncCommandL( TESMRIcalViewerOperationType aCommandId, const CFSMailMessage& aMessage, MESMRIcalViewerObserver* aObserver = NULL ); |
|
176 void ProcessSyncCommandL( TESMRIcalViewerOperationType aCommandId, const CFSMailMessage& aMessage ); |
|
177 TBool CanProcessCommand( TESMRIcalViewerOperationType aCommandId ) const; |
|
178 |
|
179 public: // from MESMRIcalViewerObserver |
|
180 void OperationCompleted( TIcalViewerOperationResult aResult ); |
|
181 void OperationError( TIcalViewerOperationResult aResult ); |
|
182 |
|
183 public: // from MAknNaviDecoratorObserver |
|
184 |
|
185 /** |
|
186 * Called by navigationDecorator if navi arrows (left/right) have been pressed |
|
187 * @aParam aEventID specifies a tapping of either left or right arrow |
|
188 */ |
|
189 void HandleNaviDecoratorEventL( TInt aEventID ); |
|
190 |
|
191 // <cmail> Toolbar |
|
192 private: // from |
|
193 |
|
194 /** |
|
195 * @see CFsEmailUiViewBase::ChildDoActivateL |
|
196 */ |
|
197 void ChildDoActivateL( const TVwsViewId& aPrevViewId, |
|
198 TUid aCustomMessageId, |
|
199 const TDesC8& aCustomMessage ); |
|
200 |
|
201 /** |
|
202 * @see CFsEmailUiViewBase::OfferToolbarEventL |
|
203 */ |
|
204 void OfferToolbarEventL( TInt aCommand ); |
|
205 |
|
206 /** |
|
207 * @see CFsEmailUiViewBase::ToolbarResourceId |
|
208 */ |
|
209 TInt ToolbarResourceId() const; |
|
210 // </cmail> Toolbar |
|
211 |
|
212 private: // methods |
|
213 |
|
214 // Class constructing |
|
215 CFSEmailUiMailViewerVisualiser( CAlfEnv& aEnv, CFreestyleEmailUiAppUi& aAppUi, |
|
216 CAlfControlGroup& aMailViewerControlGroup ); |
|
217 void ConstructL(); |
|
218 |
|
219 // Constructing & refreshing the view |
|
220 void AddBackgroundPicturesL(); |
|
221 void ClearMailViewer(); |
|
222 void UpdateMailViewerL(); |
|
223 void RefreshL( TBool aFirstStart = EFalse ); |
|
224 // Callback function to encapsulate actions which are deferred form RefreshL() to |
|
225 // make it complete faster |
|
226 static TInt DoPostRefresh( TAny* aSelfPtr ); |
|
227 void PostRefreshL(); |
|
228 void SetActionButtonIconAndHighLight(); |
|
229 void CheckMessageStructureL(); |
|
230 void UpdateDownloadIndicatorL( TFSProgress::TFSProgressStatus aStatus = TFSProgress::EFSStatus_Waiting ); |
|
231 |
|
232 // Update our message pointer and change observed message |
|
233 void UpdateMessagePtrL( TFSMailMsgId aNewMailbox, TFSMailMsgId aNewFolder, TFSMailMsgId aNewMessage ); |
|
234 void UpdateMessagePtr( CFSMailMessage* aNewMessagePtr ); |
|
235 |
|
236 // Message stack handling. Ownership of message is transferred when succesful. |
|
237 void PushMessageL( CFSMailMessage* aMessage, TBool aIsEmbedded ); |
|
238 CFSMailMessage* PopMessage(); |
|
239 void EraseMessageStack(); |
|
240 // Html viewer opening |
|
241 void LaunchHtmlViewerL(); |
|
242 |
|
243 // Changing message states |
|
244 void SetMessageFollowupFlagL(); |
|
245 void ChangeMsgReadStatusL( TBool aRead, TBool aCmdFromMrui ); |
|
246 |
|
247 // For deleting current mail |
|
248 // Return value indicating whether message was deleted |
|
249 TBool DeleteMailL( CFSMailMessage& aMessagePtr, TBool aReturnPreviousView, TBool aDisableNote = EFalse ); |
|
250 |
|
251 // Options menu dimm checking |
|
252 TBool ShowActionsMenuInOptionsL() const; |
|
253 TBool ShowDownloadManagerMenuInOptions() const; |
|
254 TBool ShowNextMessageMenuInOptions() const; |
|
255 TBool ShowPreviousMessageMenuInOptions() const; |
|
256 void ShowNextMessageL(); |
|
257 void ShowPreviousMessageL(); |
|
258 |
|
259 // Action menu lauching and selection handling |
|
260 void LaunchActionMenuL(); |
|
261 void CreateActionMenuItemsL( TActionMenuType aActionMenuType ); |
|
262 void HandleActionMenuCommandL( TActionMenuCustomItemId aSelectedActionMenuItem, TActionMenuType aActionMenuType ); |
|
263 |
|
264 |
|
265 // Action menu command handling |
|
266 void OpenLinkInIntranetL( TBool aMenuSelection = ETrue ); |
|
267 void OpenHotSpotUrlInBrowserL( CFindItemEngine::SFoundItem& aHotSpot ); |
|
268 void CallToBodyHotSpotNumberL( CFindItemEngine::SFoundItem& aHotSpot ); |
|
269 void ComposeMailL(); |
|
270 void WriteEmailToHotSpotAddressL( CFindItemEngine::SFoundItem& aHotSpot ); |
|
271 |
|
272 void OpenContactDetailsL(); |
|
273 |
|
274 void LaunchRemoteLookupL( const TDesC& aHotspotText ) const; |
|
275 void AddToBookmarksL( const CFindItemEngine::SFoundItem& aBodyHotspotData ) const; |
|
276 |
|
277 void CallHotSpotAddressL(); |
|
278 void CreateMessageL() const; |
|
279 |
|
280 TBool IsCopyToClipBoardAvailableL() const; |
|
281 void CopyCurrentHotspotToClipBoardL() const; |
|
282 |
|
283 // Attachment handling |
|
284 TBool ShowOpenAttachmentOptionL(); |
|
285 TBool ShowSaveAttachmentOptionL(); |
|
286 TBool ShowDownloadOptionL(); |
|
287 TBool ShowMskDownloadOptionL(); |
|
288 TBool ShowCancelDownloadOption(); |
|
289 void OpenAttachmentL(); |
|
290 void OpenAttachmentsViewL(); |
|
291 void StartDowloadingAttachmentsL(); |
|
292 void CancelDowloadingAttachmentsL(); |
|
293 void SaveAllAttachmentsL(); |
|
294 void RemoveFetchedAttachmentL(); |
|
295 |
|
296 // Helper method for creating Part data needed when calling to download mediator |
|
297 TPartData MailData(); |
|
298 |
|
299 // Content fecthing |
|
300 |
|
301 // list of different types of content |
|
302 enum TFetchedContentType |
|
303 { |
|
304 EMessagePlainTextBodyPart = 0, |
|
305 EMessageHtmlBodyPart, |
|
306 EMessageStructure |
|
307 }; |
|
308 TBool StartFetchingBodyAfterOpeningL() const; |
|
309 TBool MessageStructureKnown( CFSMailMessage& aMsg ) const; |
|
310 TBool MessagePartFullyFetchedL( TFetchedContentType aFetchedContentType ) const; |
|
311 void StartFetchingMessagePartL( CFSMailMessage& aMessagePtr, |
|
312 TFetchedContentType aFetchedContentType ); |
|
313 void StartFetchingMessageStructureL( CFSMailMessage& aMsg ); |
|
314 void StartWaitedFetchingL( TFetchedContentType aFetchedContentType ); |
|
315 void StartFetchingRemaininBodyLinesIfAtBottomL(); |
|
316 void CancelFetchings(); |
|
317 |
|
318 void SaveEmailAsContactL( const TDesC& aEmailAddress ); |
|
319 void SavePhoneNumberAsContactL( const TDesC& aPhoneNumber ); |
|
320 |
|
321 void SetMailboxNameToStatusPaneL(); |
|
322 |
|
323 TInt ResolveBodyTextSchemaUrlTypeL( CFindItemEngine::SFoundItem aHotSpot ); |
|
324 |
|
325 void SetActionMenuIconVisbilityL(); |
|
326 |
|
327 void SendEventToAppUiL( TFSMailEvent aEventType ); |
|
328 |
|
329 void DoFirstStartL(); |
|
330 |
|
331 /** |
|
332 * Initiates the hotspot action, if currently focused header hotspot has |
|
333 * some direct hotspot action defined (not opening action menu). Returns |
|
334 * ETrue if direct action specified (and initiated) for the focused |
|
335 * hotspot, otherwise EFalse. |
|
336 */ |
|
337 TBool HandleHeaderHotspotActionL( TViewerHeadingHotspotType aHotspotType ); |
|
338 |
|
339 /** |
|
340 * Handles updating of navigation pane content |
|
341 * (navi arrows + priority and followup icons) |
|
342 * |
|
343 * @param aForESMR Whether the navi pane update is for meeting |
|
344 * request or not. |
|
345 */ |
|
346 void UpdateNaviPaneL( TBool aForESMR = EFalse ); |
|
347 |
|
348 /** |
|
349 * Sets mailviewer's navipane to background |
|
350 */ |
|
351 void HideNaviPane(); |
|
352 |
|
353 private: // Methods for moving message |
|
354 |
|
355 // Start moving current visible message to different folder |
|
356 // Return EFalse if moving is not a supported function |
|
357 TBool OpenFolderListForMessageMovingL(); |
|
358 |
|
359 // Message is moved and viewer is closed asynchronously after selecting a folder |
|
360 // from the move to folder dialog. This is necessary because view swithching is asynchronous. |
|
361 static TInt MoveToFolderAndExitL( TAny* aMailViewerVisualiser ); |
|
362 |
|
363 private: // data for moving message to different folder action |
|
364 |
|
365 TBool iMoveToFolderOngoing; |
|
366 TBool iMovingMeetingRequest; |
|
367 CAsyncCallBack* iAsyncCallback; |
|
368 TFSMailMsgId iMoveDestinationFolder; |
|
369 |
|
370 private: // data related to fetching |
|
371 |
|
372 TBool iFetchingMessageStructure; |
|
373 TInt iCurrentStructureFetchRequestId; |
|
374 |
|
375 TBool iFetchingPlainTextMessageBody; |
|
376 TInt iCurrentPlainTextBodyFetchRequestId; |
|
377 |
|
378 TBool iFetchingHtmlMessageBody; |
|
379 TInt iCurrentHtmlBodyFetchRequestId; |
|
380 |
|
381 TFetchedContentType iStartAsyncFetchType; |
|
382 |
|
383 // Wait note stuff |
|
384 //<cmail> |
|
385 //CAknWaitNoteWrapper* iAsyncWaitNote; |
|
386 CAknWaitDialog* iWaitDialog; |
|
387 CAknWaitDialog* iWaitDialogOpening; |
|
388 TBool iDialogNotDismissed; |
|
389 //</cmail> |
|
390 TBool iFetchingAlready; |
|
391 TBool iAsyncProcessComplete; |
|
392 |
|
393 private: // data for fetching timer |
|
394 |
|
395 CFSEmailUiGenericTimer* iFetchingAnimationTimer; |
|
396 |
|
397 private: // other class data |
|
398 |
|
399 // Handle to ALF environment |
|
400 CAlfEnv& iEnv; |
|
401 |
|
402 // Stack of open messages. Messages are owned by this stack. |
|
403 CStack<CFSMailMessage, ETrue>* iOpenMessages; |
|
404 // Stack of embedded messages. Message are NOT owned by this stack. Similar to iOpenMessages |
|
405 // but has NULL pointer in slots which correspond non-embedded messages. |
|
406 CStack<CFSMailMessage, EFalse>* iEmbeddedMessages; |
|
407 // Mail message pointer, changes always in do activate |
|
408 CFSMailMessage* iMessage; |
|
409 |
|
410 // Mail box where the iMessage object is. |
|
411 CFSMailBox* iMailBox; |
|
412 |
|
413 // AlfControl for capturing right and left navigation key events |
|
414 CFreestyleEmailUiMailViewerControl* iControl; |
|
415 |
|
416 // Text viewer and control object |
|
417 CFsTextViewer* iTextViewer; |
|
418 |
|
419 // Pointer to TV component control |
|
420 CAlfControl* iTextViewerControl; // not owned |
|
421 |
|
422 // Rich text for the view. |
|
423 CFSEmailUiMailViewerRichText* iViewerRichText; |
|
424 |
|
425 // Basic smileys for the |
|
426 CFsSmileyDictionary* iSmDictionary; |
|
427 |
|
428 // For opening the intranet app |
|
429 CAiwServiceHandler* iIBServiceHandler; |
|
430 |
|
431 // Boolean to indicate that layout has changed while some other view was active |
|
432 TBool iLayoutChangedWhileNotActive; |
|
433 |
|
434 // Temporary mail address for opening editor |
|
435 CFSMailAddress* iNewMailTempAddress; |
|
436 |
|
437 // Meeting request observer stuff. |
|
438 // Pointer to observer to inform, not owned. |
|
439 MESMRIcalViewerObserver* iMrObserverToInform; |
|
440 MESMRIcalViewerObserver::TIcalViewerOperationResult iOpResult; |
|
441 TBool iMrUiActive; |
|
442 |
|
443 // Flag to indicate that we are moving into next or previous message |
|
444 TBool iNextOrPevMessageSelected; |
|
445 |
|
446 CAlfControlGroup* iDownloadProgressControlGroup; // owned by AlfEnv |
|
447 CFSEmailUiStatusIndicator* iDownloadProgressIndicator; |
|
448 |
|
449 // Flag selection handler active object for global note |
|
450 CFlagSelectionGlobalNoteHandler* iFlagSelectionHanler; |
|
451 |
|
452 TBool iFirstStartCompleted; |
|
453 TBool iShowMskDownloadOption; |
|
454 |
|
455 // Flag to indicate we are viewing an embedded message. Many UI options need to be hidden in that case. |
|
456 TBool iEmbeddedMessageMode; |
|
457 |
|
458 //<cmail> |
|
459 // Message pointer to a deleted mail from Mrui |
|
460 TFSMailMsgId iDeletedMessageFromMrui; |
|
461 //</cmail> |
|
462 }; |
|
463 |
|
464 |
|
465 //////////////////////////////////////// |
|
466 // FLAG selection dialog global note handler |
|
467 ///////////////////////////////////////// |
|
468 class CFlagSelectionGlobalNoteHandler : public CActive |
|
469 { |
|
470 public: // Constructors and destructor |
|
471 static CFlagSelectionGlobalNoteHandler* NewL( CFSEmailUiMailViewerVisualiser& aViewerVisualiser ); |
|
472 virtual ~CFlagSelectionGlobalNoteHandler(); |
|
473 void Cancel(); |
|
474 void LaunchFlagListQueryDialogL(); |
|
475 |
|
476 private: |
|
477 |
|
478 void RunL(); |
|
479 void DoCancel(); |
|
480 TInt RunError( TInt aError ); |
|
481 |
|
482 private: |
|
483 CFlagSelectionGlobalNoteHandler( CFSEmailUiMailViewerVisualiser& aVoIPDialogObserver ); |
|
484 |
|
485 |
|
486 private: |
|
487 CFSEmailUiMailViewerVisualiser& iViewerVisualiser; |
|
488 CAknGlobalListQuery* iGlobalFlagQuery; |
|
489 HBufC* iPrompt; |
|
490 TInt iSelection; |
|
491 }; |
|
492 |
|
493 |
|
494 #endif //__FREESTYLEEMAILUI_MAILVIEWERVISUALISER_H__ |
|
495 |
|
496 |
|