diff -r e1b6206813b4 -r f5907b1a1053 emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h --- a/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h Fri Feb 19 22:37:30 2010 +0200 +++ b/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h Fri Mar 12 15:41:14 2010 +0200 @@ -25,15 +25,152 @@ #include #include +#include "FreestyleEmailUiAknStatusIndicator.h" #include "FreestyleEmailDownloadInformationMediator.h" +#include "FreestyleEmailCenRepKeys.h" #include "OverlayControl.h" class CFSMailMessage; class CFreestyleEmailUiAppUi; class CFreestyleMessageHeaderURLEventHandler; -class CFreestyleEmailUiAknStatusIndicator; struct TAttachmentData; +class CFsEmailUiHtmlViewerContainer; +class MTouchFeedback; + +/** + * Single key listener + */ +class CEUiHtmlViewerSettingsKeyListener : public CActive + { +public: + /** + * Observer interface for key value changes + */ + class MObserver + { + public: + /** + * Called when key value changes + */ + virtual void KeyValueChangedL( TUint32 aKey ) = 0; + + /** + * Listener can query repository instance using this method. No need + * to create own repository instance OR to store repository reference. + */ + virtual CRepository& Repository() = 0; + }; +public: + /** + * Constructor + */ + CEUiHtmlViewerSettingsKeyListener( MObserver& aObserver, TUint32 aKey ); + + /** + * Destructor + */ + ~CEUiHtmlViewerSettingsKeyListener(); + +private: + /** + * Start listening value changes + */ + void StartListening(); + +private: // from CActive + /** + * @see CActive::RunL + */ + void RunL(); + + /** + * @see CActive::DoCancel + */ + void DoCancel(); + +private: + /** + * Key observer + */ + MObserver& iObserver; + + /** + * Key id + */ + TUint32 iKey; + }; + + +/** + * HTML viewer settings class. + */ +class CEUiHtmlViewerSettings : public CBase, public CEUiHtmlViewerSettingsKeyListener::MObserver + { + +public: + + /** + * Settings observer interface + */ + class MObserver + { + public: + /** + * Called when a setting value has changed. + */ + virtual void ViewerSettingsChangedL( const TUint32 aKey ) = 0; + }; + +public: + + /** + * Static constructor + */ + static CEUiHtmlViewerSettings* NewL( MObserver& aObserver ); + + /** + * Destructor + */ + ~CEUiHtmlViewerSettings(); + + /** + * Boolean value for auto load image setting + */ + TBool AutoLoadImages() const; + +private: + + CEUiHtmlViewerSettings( MObserver& aObserver ); + void ConstructL(); + void AddKeyListenerL( TUint32 aKey ); + void UpdateValue( TUint32 aKey ); + +private: // from CEUiHtmlViewerSettingsKeyListener::MObserver + + /** + * @see CEUiHtmlViewerSettingsKeyListener::MObserver::KeyValueChangedL + */ + void KeyValueChangedL( TUint32 aKey ); + + /** + * @see CEUiHtmlViewerSettingsKeyListener::MObserver::Repository + */ + CRepository& Repository(); + +private: + + enum TFlag + { + EAutoLoadImages = KFreestyleEmailDownloadHTMLImages + }; + + MObserver& iObserver; + CRepository* iRepository; + TBitFlags iFlags; + RPointerArray iKeyListeners; + }; + /** * Html viewer container. */ @@ -43,7 +180,8 @@ public MBrCtlSoftkeysObserver, public MFSEmailDownloadInformationObserver, public MOverlayControlObserver, - public MBrCtlWindowObserver + public MBrCtlWindowObserver, + public CEUiHtmlViewerSettings::MObserver { public: @@ -58,11 +196,12 @@ void LoadContentFromFileL( RFile& aFile ); void LoadContentFromUrlL( const TDesC& aUrl ); void LoadContentFromMailMessageL( CFSMailMessage* aMailMessage, TBool aResetScrollPos=ETrue ); - void ResetContent(); + void ResetContent(const TBool aDisconnect = EFalse); void CancelFetch(); void ClearCacheAndLoadEmptyContent(); // void PrepareForExit(); + void PrepareForMessageNavigation(); // // from base class CCoeControl @@ -116,8 +255,15 @@ void ShowAttachmentDownloadStatusL( TFSProgress::TFSProgressStatus aProgressStatus, const TAttachmentData& aAttachmentData ); TBool AttachmentDownloadStatusVisible(); void HideDownloadStatus(); - void DisplayStatusIndicatorL(); + void DisplayStatusIndicatorL(TInt aDuration = KStatusIndicatorDefaultDuration); +private: // from CEUiHtmlViewerSettings::MObserver + + /** + * @see CEUiHtmlViewerSettings::MObserver::ViewerSettingsChangedL + */ + void ViewerSettingsChangedL( const TUint32 aKey ); + private: // Second phase constructor. @@ -172,8 +318,8 @@ void ConvertToHTML( const TDesC8& aContent, const TDesC& aFileName, CFSMailMessagePart& aHtmlBodyPart ); HBufC8* GetCharacterSetL( CFSMailMessagePart& aHtmlBodyPart ); - TBool IsMessageBodyURL(const TDesC& aUrl); - void CreateHyperlinksFromUrlsL( CBufBase& aSource ); + TBool IsMessageBodyURLL(const TDesC& aUrl); + void CreateHyperlinksFromUrlsL( CBufBase& aSource ); //Returns ETrue of clicking on a link requires a browser to be launched TBool NeedToLaunchBrowserL( const TDesC& aUrl ); //Launch the browser as a standalone app @@ -186,6 +332,7 @@ void HandleWindowCommandL( const TDesC& aTargetName, TBrCtlWindowCommand aCommand ); TRect CalcAttachmentStatusRect(); + void TouchFeedback(); private: // data @@ -222,6 +369,11 @@ //way to keep track of the current image being displayed by the indicator TInt iAttachmentDownloadImageHandle; CFreestyleEmailUiAknStatusIndicator* iStatusIndicator; + CEUiHtmlViewerSettings* iViewerSettings; + + TBool iHeaderExpanded; + // tactile feed back -- not owned + MTouchFeedback* iTouchFeedBack; };