emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h
changeset 0 8466d47a6819
child 1 12c456ceeff2
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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:  CFsEmailUiHtmlViewerView class definition
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __FREESTYLEEMAILUI_HTML_VIEWER_VIEW_H__
       
    21 #define __FREESTYLEEMAILUI_HTML_VIEWER_VIEW_H__
       
    22 
       
    23 #include <cstack.h>
       
    24 #include "MFSMailRequestObserver.h"
       
    25 #include "mesmricalviewercallback.h"
       
    26 #include "mesmricalviewerobserver.h"
       
    27 #include "FreestyleEmailUiViewBase.h"
       
    28 #include "FreestyleEmailUiConstants.h"
       
    29 #include "FreestyleEmailUiContactHandlerObserver.h"
       
    30 #include "FreestyleEmailUiAttachmentsListModel.h"
       
    31 #include <AknWaitDialog.h>
       
    32 #include <AknNaviDecoratorObserver.h>
       
    33 #include "FreestyleEmailDownloadInformationMediator.h"
       
    34 #include "FreestyleEmailUiControlBarCallback.h"
       
    35 
       
    36 class CFSMailMessage;
       
    37 class CFreestyleEmailUiAppUi;
       
    38 class CFsEmailUiHtmlViewerContainer;
       
    39 class CFreestyleMessageHeaderURL;
       
    40 class CFreestyleAttachmentDownloadProgressBar;
       
    41 class CAknWaitDialog; //<cmail>
       
    42 class CFlagSelectionNoteHandler;
       
    43 class CAknGlobalListQuery;
       
    44 class CAknGlobalNote;
       
    45 /**
       
    46  * Html viewer view.
       
    47  */
       
    48 class CFsEmailUiHtmlViewerView : public CFsEmailUiViewBase,
       
    49         public MFSEmailUiContactHandlerObserver,
       
    50         public MFSEmailUiAttachmentsStatusObserver,
       
    51         public MFSEmailDownloadInformationObserver,
       
    52         public MFSMailRequestObserver,
       
    53         public MProgressDialogCallback,
       
    54 		public MFSEmailUiFolderListCallback,
       
    55 		public MESMRIcalViewerCallback,
       
    56     	public MESMRIcalViewerObserver,
       
    57 		public MAknNaviDecoratorObserver
       
    58     {
       
    59 public:
       
    60 
       
    61     /** Two-phased constructor. */
       
    62     static CFsEmailUiHtmlViewerView* NewL( CAlfEnv& aEnv, 
       
    63                                            CFreestyleEmailUiAppUi& aAppUi,
       
    64                                            CAlfControlGroup& aControlGroup );
       
    65 
       
    66     /** Destructor. */
       
    67     ~CFsEmailUiHtmlViewerView();
       
    68 
       
    69 public:  // from CAknView
       
    70 
       
    71     /**
       
    72     * Id
       
    73     * @return Id Uid value
       
    74     */
       
    75     TUid Id() const;
       
    76 
       
    77     /**
       
    78     * HandleCommandL
       
    79     * From CAknView, takes care of command handling.
       
    80     * @param aCommand Command to be handled
       
    81     */
       
    82     void HandleCommandL( TInt aCommand );
       
    83     
       
    84     // Handle accept/decline/tentative/remove commands given for meeting request message directly from list UI.
       
    85 	  void HandleMrCommandL( TInt aCommandId, TFSMailMsgId aMailboxId, TFSMailMsgId aFolderId, TFSMailMsgId aMessageId );
       
    86     
       
    87 		void CompletePendingMrCommand();
       
    88 		void CancelPendingMrCommandL();
       
    89     /**
       
    90     * ChildDoDeactivate
       
    91     * From CFsEmailUiViewBase, deactivate the AknView
       
    92     * Remove the container class instance from the App UI's stack and
       
    93     * deletes the instance
       
    94     */
       
    95     void ChildDoDeactivate();
       
    96 
       
    97     /**
       
    98     * DoExitL
       
    99     * Handler called when exiting the view.
       
   100     */
       
   101     void DoExitL();
       
   102 
       
   103     void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   104 
       
   105     void SetMskL();
       
   106     void PrepareForExit();
       
   107 public : // for MFSMailRequestObserver
       
   108     void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
       
   109 public: 
       
   110     // from MProgressDialogCallback
       
   111     void DialogDismissedL( TInt aButtonId);
       
   112     
       
   113     CFSMailMessage* CurrentMessage();
       
   114     CFSEmailUiAttachmentsListModel* CurrentAttachmentsListModel();
       
   115 
       
   116 public: 
       
   117     void HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType );
       
   118     void HandleMailBoxEventL( TFSMailEvent aEvent,
       
   119                               TFSMailMsgId aMailbox, TAny* aParam1, TAny* /*aParam2*/, TAny* /*aParam3*/ );
       
   120     
       
   121     void HandleEmailAddressCommandL( TInt aCommand, const TDesC& aEmailAddress ); 
       
   122     
       
   123     void DownloadAttachmentL( const TAttachmentData& aAttachment );
       
   124     void DownloadAllAttachmentsL();
       
   125     void CancelAttachmentL( const TAttachmentData& aAttachment );    
       
   126     void OpenAttachmentL( const TAttachmentData& aAttachment );
       
   127     void SaveAttachmentL( const TAttachmentData& aAttachment );
       
   128     void SaveAllAttachmentsL();
       
   129     void RemoveAttachmentContentL( const TAttachmentData& aAttachment );
       
   130     void OpenAttachmentsListViewL();
       
   131     TBool IsEmbeddedMsgView();
       
   132     TBool IsEmbeddedMsgSavingAllowed();
       
   133     // Helper funcitons to get viewed message ID and Folder id
       
   134     TFSMailMsgId ViewedMessageFolderId();
       
   135     TFSMailMsgId ViewedMessageId(); 
       
   136     
       
   137     TBool GetAsyncFetchStatus();
       
   138 public: // from MFSEmailUiContactHandlerObserver
       
   139     void OperationCompleteL( TContactHandlerCmd aCmd,
       
   140                              const RPointerArray<CFSEmailUiClsItem>& aContacts );
       
   141     void OperationErrorL( TContactHandlerCmd, TInt aError );
       
   142     TBool IsRemoteLookupSupportedL();
       
   143 
       
   144 public : // from MFSEmailDownloadInformationObserver
       
   145     void RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart );
       
   146     
       
   147 public: // from MFSEmailUiAttachmentsStatusObserver
       
   148     void DownloadStatusChangedL( TInt aIndex );
       
   149     
       
   150 public: // from MESMRIcalViewerCallback
       
   151     void ProcessAsyncCommandL( TESMRIcalViewerOperationType aCommandId,	const CFSMailMessage& aMessage, MESMRIcalViewerObserver* aObserver = NULL );   
       
   152 	  void ProcessSyncCommandL( TESMRIcalViewerOperationType aCommandId, const CFSMailMessage& aMessage );   
       
   153     TBool CanProcessCommand( TESMRIcalViewerOperationType aCommandId  ) const;  
       
   154      
       
   155 public: // from MESMRIcalViewerObserver
       
   156     void OperationCompleted( TIcalViewerOperationResult aResult );        
       
   157     void OperationError( TIcalViewerOperationResult aResult );
       
   158 	
       
   159 public: // from MAknNaviDecoratorObserver
       
   160     
       
   161     /**
       
   162      * Called by navigationDecorator if navi arrows (left/right) have been pressed
       
   163      * @aParam aEventID specifies a tapping of either left or right arrow
       
   164      */
       
   165     void HandleNaviDecoratorEventL( TInt aEventID );
       
   166 private: // from
       
   167     /**
       
   168      * @see CFsEmailUiViewBase::ChildDoActivateL
       
   169      */
       
   170     void ChildDoActivateL( const TVwsViewId& aPrevViewId,
       
   171                            TUid aCustomMessageId,
       
   172                            const TDesC8& aCustomMessage );
       
   173 
       
   174     /**
       
   175      * @see CFsEmailUiViewBase::ToolbarResourceId
       
   176      */
       
   177     TInt ToolbarResourceId() const;
       
   178     
       
   179     /**
       
   180      * @see CFsEmailUiViewBase::GetInitiallyDimmedItemsL
       
   181      */
       
   182     virtual void GetInitiallyDimmedItemsL( const TInt aResourceId,
       
   183                 RArray<TInt>& aDimmedItems ) const;
       
   184 
       
   185     /**
       
   186      * @see CFsEmailUiViewBase::OfferToolbarEventL
       
   187      */
       
   188     void OfferToolbarEventL( TInt aCommand );
       
   189   
       
   190     /**
       
   191      * @see CFsEmailUiViewBase::NavigateBackL
       
   192      */ 
       
   193     void NavigateBackL();
       
   194 private: // New functions
       
   195     // list of different types of content
       
   196     enum TFetchedType
       
   197         {
       
   198         EMessagePlainTextBodyPart = 0,
       
   199         EMessageHtmlBodyPart,
       
   200         EMessageStructure
       
   201         };
       
   202     void ClearMailViewer();
       
   203     void LoadContentFromFileL( const TDesC& aFileName );
       
   204     void LoadContentFromFileL( RFile& aFile );
       
   205     void LoadContentFromUrlL( const TDesC& aUrl );
       
   206     void LoadContentFromMailMessageL( CFSMailMessage* aMailMessage );
       
   207     void DeleteMailL();
       
   208     void HideContainer();
       
   209     void ShowContainerL();
       
   210     void DynInitZoomMenuL( CEikMenuPane* aMenuPane );
       
   211     TInt ZoomLevelIndexL();
       
   212     void SetZoomLevelIndexL( TInt aIndex );
       
   213     void SaveEmailAsContactL(
       
   214         const TDesC& aEmailAddress );
       
   215     //new functions for support of HTML viewer
       
   216     void CallAdressL( const TDesC& aEmailAddress, TBool aVideoCall );
       
   217     void OpenContactDetailsL( const TDesC& aEmailAddress );
       
   218     void LaunchRemoteLookupL( const TDesC& aEmailAddress );
       
   219     void CreateMessageL( const TDesC& aEmailAddress );
       
   220     
       
   221     void UpdateDownloadIndicatorL( const TPartData& aPart, 
       
   222                                    const TFSProgress& aEvent );
       
   223     //fetching related API
       
   224     TBool MessagePartFullyFetchedL( TFetchedType aFetchedContentType ) const;
       
   225     void StartFetchingMessagePartL( CFSMailMessage& aMessagePtr,
       
   226                                                 TFetchedType aFetchedContentType );
       
   227     void UpdateMessagePtrL( TFSMailMsgId aNewMailboxId,
       
   228                                                             TFSMailMsgId aNewFolderId,
       
   229                                                             TFSMailMsgId aNewMessageId );
       
   230     void CancelFetchings();
       
   231     void StartFetchingMessageStructureL( CFSMailMessage& aMsg );
       
   232     TBool MessageStructureKnown( CFSMailMessage& aMsg ) const;
       
   233     void StartWaitedFetchingL( TFetchedType aFetchedContentType );
       
   234     // Message stack handling. Ownership of message is transferred when succesful.
       
   235     void PushMessageL( CFSMailMessage* aMessage, TBool aIsEmbedded );
       
   236     CFSMailMessage* PopMessage();
       
   237     void EraseMessageStack();
       
   238     TBool OpenFolderListForMessageMovingL();
       
   239     void ShowPreviousMessageL();
       
   240     TBool ShowPreviousMessageMenuInOptions() const;
       
   241     void ShowNextMessageL();
       
   242     TBool ShowNextMessageMenuInOptions() const;
       
   243     void ChangeMsgReadStatusL(TBool aRead, TBool aCmdFromMrui );
       
   244     void SetMessageFollowupFlagL();
       
   245     void SendEventToAppUiL( TFSMailEvent aEventType );
       
   246     // Message is moved and viewer is closed asynchronously after selecting a folder
       
   247       // from the move to folder dialog. This is necessary because view swithching is asynchronous.
       
   248     static TInt MoveToFolderAndExitL( TAny* aMailViewerVisualiser );
       
   249     void FolderSelectedL( TFSMailMsgId aSelectedFolderId,
       
   250                           TFSEmailUiCtrlBarResponse aResponse ); 
       
   251     
       
   252     void UpdateNaviPaneL( TBool aForESMR = EFalse );
       
   253     void HideNaviPane();
       
   254     TBool IsOpenedInMRViewerL();
       
   255 private: // Constructors
       
   256     
       
   257     void ConstructL();
       
   258     CFsEmailUiHtmlViewerView( CAlfEnv& aEnv, 
       
   259                               CFreestyleEmailUiAppUi& aAppUi, 
       
   260                               CAlfControlGroup& aControlGroup );
       
   261 
       
   262 private:
       
   263     CAlfEnv& iEnv;
       
   264     CFsEmailUiHtmlViewerContainer* iContainer;
       
   265     CFSMailMessage* iMessage;
       
   266     THtmlViewerActivationData iActivationData;
       
   267     CFSEmailUiAttachmentsListModel* iAttachmentsListModel;
       
   268     CFreestyleAttachmentDownloadProgressBar* iProgressBar;
       
   269 
       
   270     // Stack of open messages. Messages are owned by this stack. 
       
   271     CStack<CFSMailMessage, ETrue>* iOpenMessages;
       
   272     // Stack of embedded messages. Message are NOT owned by this stack. Similar to iOpenMessages
       
   273     // but has NULL pointer in slots which correspond non-embedded messages.
       
   274     CStack<CFSMailMessage, EFalse>* iEmbeddedMessages;
       
   275     TBool iCreateNewMsgFromEmbeddedMsg;
       
   276         
       
   277     // <cmail>
       
   278     // Temporary mail address for opening editor
       
   279     CFSMailAddress* iNewMailTempAddress;
       
   280     // </cmail>
       
   281     CFSMailBox* iMailBox;
       
   282 private: // data for moving message to different folder action
       
   283     TBool iFetchingMessageStructure;
       
   284     TInt iCurrentStructureFetchRequestId;
       
   285 
       
   286     TBool iFetchingPlainTextMessageBody;
       
   287     TInt iCurrentPlainTextBodyFetchRequestId;
       
   288 
       
   289     TBool iFetchingHtmlMessageBody;
       
   290     TInt iCurrentHtmlBodyFetchRequestId;
       
   291 
       
   292     TFetchedType iStartAsyncFetchType;
       
   293 
       
   294     // Wait note stuff
       
   295     //<cmail>
       
   296     //CAknWaitNoteWrapper* iAsyncWaitNote;
       
   297     CAknWaitDialog* iWaitDialog;
       
   298     CAknWaitDialog* iWaitDialogOpening;
       
   299     TBool iDialogNotDismissed;
       
   300     //</cmail>
       
   301     TBool iFetchingAlready;
       
   302     TBool iAsyncProcessComplete;
       
   303     CActiveSchedulerWait iWait;
       
   304 	TBool iMoveToFolderOngoing;
       
   305     TBool iMovingMeetingRequest;
       
   306     CAsyncCallBack* iAsyncCallback;
       
   307     
       
   308     TFSMailMsgId iMoveDestinationFolder;  
       
   309     	// Meeting request observer stuff.
       
   310 		// Pointer to observer to inform, not owned.
       
   311 		MESMRIcalViewerObserver* iMrObserverToInform;
       
   312 		MESMRIcalViewerObserver::TIcalViewerOperationResult iOpResult;
       
   313 		TBool iMrUiActive;
       
   314 	  //<cmail>
       
   315     // Message pointer to a deleted mail from Mrui
       
   316     TFSMailMsgId iDeletedMessageFromMrui;
       
   317     // Flag selection handler active object for global note
       
   318     CFlagSelectionNoteHandler* iFlagSelectionHandler;  
       
   319     TBool iNextOrPrevMessageSelected;
       
   320     };
       
   321 
       
   322 ////////////////////////////////////////
       
   323 // FLAG selection dialog global note handler
       
   324 /////////////////////////////////////////
       
   325 class CFlagSelectionNoteHandler : public CActive
       
   326     {
       
   327     public:  // Constructors and destructor
       
   328         static CFlagSelectionNoteHandler* NewL( CFsEmailUiHtmlViewerView& aViewerVisualiser );
       
   329         virtual ~CFlagSelectionNoteHandler();
       
   330         void Cancel();       
       
   331         void LaunchFlagListQueryDialogL();       
       
   332             
       
   333     private: 
       
   334     
       
   335         void RunL();       
       
   336         void DoCancel();       
       
   337         TInt RunError( TInt aError );
       
   338         
       
   339     private:
       
   340         CFlagSelectionNoteHandler(  CFsEmailUiHtmlViewerView& aVoIPDialogObserver );
       
   341 
       
   342         
       
   343     private:      
       
   344         CFsEmailUiHtmlViewerView& iViewerView;
       
   345         CAknGlobalListQuery* iGlobalFlagQuery;
       
   346         HBufC* iPrompt;
       
   347         TInt iSelection;
       
   348     };
       
   349 
       
   350 
       
   351 #endif // __FREESTYLEEMAILUI_HTML_VIEW_H__