emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h
changeset 2 5253a20d2a1e
parent 1 12c456ceeff2
child 3 a4d6f1ea0416
equal deleted inserted replaced
1:12c456ceeff2 2:5253a20d2a1e
    24 #include <coecntrl.h>
    24 #include <coecntrl.h>
    25 #include <BrCtlSpecialLoadObserver.h>
    25 #include <BrCtlSpecialLoadObserver.h>
    26 #include <BrCtlLinkResolver.h>
    26 #include <BrCtlLinkResolver.h>
    27 
    27 
    28 #include "FreestyleEmailDownloadInformationMediator.h"
    28 #include "FreestyleEmailDownloadInformationMediator.h"
       
    29 #include "OverlayControl.h"
    29 
    30 
    30 class CFSMailMessage;
    31 class CFSMailMessage;
    31 class CFreestyleEmailUiAppUi;
    32 class CFreestyleEmailUiAppUi;
    32 class CFreestyleMessageHeaderURLEventHandler;
    33 class CFreestyleMessageHeaderURLEventHandler;
    33 
    34 
    36  */
    37  */
    37 class CFsEmailUiHtmlViewerContainer : public CCoeControl,
    38 class CFsEmailUiHtmlViewerContainer : public CCoeControl,
    38                                       public MBrCtlSpecialLoadObserver,
    39                                       public MBrCtlSpecialLoadObserver,
    39                                       public MBrCtlLinkResolver,
    40                                       public MBrCtlLinkResolver,
    40                                       public MBrCtlSoftkeysObserver,
    41                                       public MBrCtlSoftkeysObserver,
    41                                       public MFSEmailDownloadInformationObserver
    42                                       public MFSEmailDownloadInformationObserver,
       
    43                                       public MOverlayControlObserver,
       
    44                                       public MBrCtlWindowObserver
    42     {
    45     {
    43 public:
    46 public:
    44 
    47 
    45     /** Two-phased constructor. */
    48     /** Two-phased constructor. */
    46     static CFsEmailUiHtmlViewerContainer* NewL( CFreestyleEmailUiAppUi& aAppUi,
    49     static CFsEmailUiHtmlViewerContainer* NewL( CFreestyleEmailUiAppUi& aAppUi,
    50 
    53 
    51     CBrCtlInterface* BrowserControlIf();
    54     CBrCtlInterface* BrowserControlIf();
    52     void LoadContentFromFileL( const TDesC& aFileName );
    55     void LoadContentFromFileL( const TDesC& aFileName );
    53     void LoadContentFromFileL( RFile& aFile );
    56     void LoadContentFromFileL( RFile& aFile );
    54     void LoadContentFromUrlL( const TDesC& aUrl );
    57     void LoadContentFromUrlL( const TDesC& aUrl );
    55     void LoadContentFromMailMessageL( CFSMailMessage* aMailMessage );
    58     void LoadContentFromMailMessageL( CFSMailMessage* aMailMessage, TBool aResetScrollPos=ETrue );
    56     void ResetContent();
    59     void ResetContent();
    57     void CancelFetch();
    60     void CancelFetch();
    58     void ClearCacheAndLoadEmptyContent();
    61     void ClearCacheAndLoadEmptyContent();
    59     // <cmail>
    62     // <cmail>
    60     void PrepareForExit();
    63     void PrepareForExit();
    66     TInt CountComponentControls() const;
    69     TInt CountComponentControls() const;
    67     void Draw( const TRect& aRect ) const;
    70     void Draw( const TRect& aRect ) const;
    68     void SizeChanged();
    71     void SizeChanged();
    69     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
    72     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
    70     void HandleResourceChange(TInt aType);
    73     void HandleResourceChange(TInt aType);
       
    74     void MakeVisible( TBool aVisible );
    71 
    75 
    72 // from base class MBrCtlSpecialLoadObserver
    76 // from base class MBrCtlSpecialLoadObserver
    73 
    77 
    74     void NetworkConnectionNeededL( TInt* aConnectionPtr, TInt* aSockSvrHandle,
    78     void NetworkConnectionNeededL( TInt* aConnectionPtr, TInt* aSockSvrHandle,
    75         TBool* aNewConn, TApBearerType* aBearerType );
    79         TBool* aNewConn, TApBearerType* aBearerType );
    92 // from base class MBrCtlSoftkeysObserver
    96 // from base class MBrCtlSoftkeysObserver
    93 
    97 
    94     void UpdateSoftkeyL( TBrCtlKeySoftkey aKeySoftkey, const TDesC& aLabel,
    98     void UpdateSoftkeyL( TBrCtlKeySoftkey aKeySoftkey, const TDesC& aLabel,
    95         TUint32 aCommandId, TBrCtlSoftkeyChangeReason aBrCtlSoftkeyChangeReason );
    99         TUint32 aCommandId, TBrCtlSoftkeyChangeReason aBrCtlSoftkeyChangeReason );
    96     void StopObserving();
   100     void StopObserving();
       
   101     
       
   102 // from MOverlayControlObserver
       
   103     void HandleOverlayPointerEventL( COverlayControl* aControl, const TPointerEvent& aEvent );
       
   104 
       
   105     /*
       
   106      * Reloads the header of the opened mail.
       
   107      */
       
   108     void RefreshCurrentMailHeader();
       
   109     /** Handles asynchronous reload of page for case when orientation
       
   110      * changed
       
   111      */
       
   112     void ReloadPageL();
    97 private:
   113 private:
    98 
   114 
    99     // Second phase constructor.
   115     // Second phase constructor.
   100     void ConstructL();
   116     void ConstructL();
   101     // C++ constructor.
   117     // C++ constructor.
   125         MBrCtlLinkContent& aEmbeddedLinkContent );
   141         MBrCtlLinkContent& aEmbeddedLinkContent );
   126     // Downloads and return attachment content via MBrCtlLinkContent interface
   142     // Downloads and return attachment content via MBrCtlLinkContent interface
   127     void DownloadAttachmentL( CFSMailMessagePart& aAttachment,
   143     void DownloadAttachmentL( CFSMailMessagePart& aAttachment,
   128         MBrCtlLinkContent& aEmbeddedLinkContent );
   144         MBrCtlLinkContent& aEmbeddedLinkContent );
   129     
   145     
       
   146     // Get area for overlay button
       
   147     TRect OverlayButtonRect( TBool aLeft );
       
   148     
       
   149     // Update overlay button position and visibility
       
   150     void UpdateOverlayButtons( TBool aVisible );
       
   151     
   130     void SetHTMLResourceFlagFullName();
   152     void SetHTMLResourceFlagFullName();
   131     void EnableHTMLResourceFlagL();
   153     void EnableHTMLResourceFlagL();
   132     TBool HTMLResourceFlagEnabled();
   154     TBool HTMLResourceFlagEnabled();
   133     void CopyHTMLResourceL();
   155     void CopyHTMLResourceL();
   134     // Ensure all resource files (eg. images) required by HTML display to be ready in C:\[private]\HtmlFile
   156     // Ensure all resource files (eg. images) required by HTML display to be ready in C:\[private]\HtmlFile
   137     void CopyFileToHtmlFileL( const TDesC8& aBuffer,
   159     void CopyFileToHtmlFileL( const TDesC8& aBuffer,
   138             const TDesC& aFileName, CFSMailMessagePart& aHtmlBodyPart );
   160             const TDesC& aFileName, CFSMailMessagePart& aHtmlBodyPart );
   139     void ConvertToHTML( const TDesC8& aContent,
   161     void ConvertToHTML( const TDesC8& aContent,
   140             const TDesC& aFileName, CFSMailMessagePart& aHtmlBodyPart );
   162             const TDesC& aFileName, CFSMailMessagePart& aHtmlBodyPart );
   141     HBufC8* GetCharacterSetL( CFSMailMessagePart& aHtmlBodyPart );
   163     HBufC8* GetCharacterSetL( CFSMailMessagePart& aHtmlBodyPart );
   142     
   164     TBool IsMessageBodyURL(const TDesC& aUrl);
       
   165 	void CreateHyperlinksFromUrlsL( CBufBase& aSource );
       
   166     //Returns ETrue of clicking on a link requires a browser to be launched
       
   167     TBool NeedToLaunchBrowserL( const TDesC& aUrl );
       
   168     //Launch the browser as a standalone app
       
   169     void LaunchBrowserL( const TDesC& aUrl );
       
   170     
       
   171     //from MBrCtlWindowObserver    
       
   172     CBrCtlInterface* OpenWindowL( TDesC& aUrl, TDesC* aTargetName, 
       
   173                                   TBool aUserInitiated, TAny* aReserved );
       
   174     CBrCtlInterface* FindWindowL( const TDesC& aTargetName ) const;  
       
   175     void HandleWindowCommandL( const TDesC& aTargetName, TBrCtlWindowCommand aCommand ); 
       
   176        
   143 
   177 
   144 private: // data
   178 private: // data
   145 
   179 
   146     // Reference to AppUi.
   180     // Reference to AppUi.
   147     CFreestyleEmailUiAppUi& iAppUi;
   181     CFreestyleEmailUiAppUi& iAppUi;
   168     RPointerArray<MBrCtlLinkContent> iLinkContents;
   202     RPointerArray<MBrCtlLinkContent> iLinkContents;
   169     // Message parts being downloaded as embedded link content.
   203     // Message parts being downloaded as embedded link content.
   170     RArray<TPartData> iMessageParts;
   204     RArray<TPartData> iMessageParts;
   171     CFreestyleMessageHeaderURLEventHandler* iEventHandler;
   205     CFreestyleMessageHeaderURLEventHandler* iEventHandler;
   172     TBool iObservingDownload;
   206     TBool iObservingDownload;
       
   207     TInt iScrollPosition;
       
   208     COverlayControl* iOverlayControlNext;
       
   209     COverlayControl* iOverlayControlPrev;
   173     };
   210     };
   174 
   211 
   175 
   212 
   176 #endif // __FREESTYLEEMAILUI_HTML_VIEWER_CONTAINER_H__
   213 #endif // __FREESTYLEEMAILUI_HTML_VIEWER_CONTAINER_H__