FreestyleEmailUiHtmlViewerContainer.cpp File Reference

const TLitC< sizeof(L"cid:")/2 > KContentIdPrefix

const TLitC< sizeof(L"cid:")/2 >KContentIdPrefix[static]

const TLitC< sizeof(L"c:")/2 > KCDrive

const TLitC< sizeof(L"c:")/2 >KCDrive[static]

const TLitC< sizeof(L"HtmlFile\\")/2 > KHtmlPath

const TLitC< sizeof(L"HtmlFile\\")/2 >KHtmlPath[static]

const TLitC< sizeof(L"temp\\")/2 > KTempHtmlPath

const TLitC< sizeof(L"temp\\")/2 >KTempHtmlPath[static]

const TLitC< sizeof(L"*")/2 KAllFiles

const TLitC< sizeof(L"*")/2KAllFiles[static]

const TLitC< sizeof(L"header.html")/2 > KHeaderHtmlFile

const TLitC< sizeof(L"header.html")/2 >KHeaderHtmlFile[static]

const TLitC< sizeof(L"body.html")/2 > KBodyHtmlFile

const TLitC< sizeof(L"body.html")/2 >KBodyHtmlFile[static]

const TLitC< sizeof(L"email.html")/2 > KMessageHtmlFile

const TLitC< sizeof(L"email.html")/2 >KMessageHtmlFile[static]

const TLitC< sizeof(L"email_rtl.html")/2 > KMessageHtmlRTLFile

const TLitC< sizeof(L"email_rtl.html")/2 >KMessageHtmlRTLFile[static]

const TLitC< sizeof(L"z:")/2 > KZDrive

const TLitC< sizeof(L"z:")/2 >KZDrive[static]

const TLitC< sizeof(L"html.flag")/2 > KHtmlFlagFile

const TLitC< sizeof(L"html.flag")/2 >KHtmlFlagFile[static]

const TLitC< sizeof(L"/")/2 > KURLSlash

const TLitC< sizeof(L"/")/2 >KURLSlash[static]

KMaxCharsToSearch(200)

const TIntKMaxCharsToSearch(200)

Parameters

200

const TLitC8< sizeof("<html")> KStartTag={sizeof("<html")-1,"<html"};const static TLitC8< sizeof("<head>")> KHeadTag={sizeof("<head>")-1,"<head>"};const static TLitC8< sizeof("<html><head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=")> KHtmlHeader1={sizeof("<html><head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=")-1,"<html><head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset="};const static TLitC8< sizeof("\"/></head><body>\xD\xA")> KHtmlHeader2={sizeof("\"/></head><body>\xD\xA")-1,"\"/></head><body>\xD\xA"};const static TLitC8< sizeof("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%S\">\n")> KHtmlHeader3={sizeof("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%S\">\n")-1,"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%S\">\n"};const static TLitC8< sizeof("\xD\xA</body></html>\xD\xA")> KHtmlEndTags={sizeof("\xD\xA</body></html>\xD\xA")-1,"\xD\xA</body></html>\xD\xA"};const static TLitC8< sizeof("charset")> KCharsetTag8={sizeof("charset")-1,"charset"};const static TLitC< sizeof(L"charset")/2 > KCharsetTag={sizeof(L"charset")/2-1, L"charset"};const static TLitC8< sizeof("<HTML><BODY></BODY></HTML>")> KHTMLEmptyContent={sizeof("<HTML><BODY></BODY></HTML>")-1,"<HTML><BODY></BODY></HTML>"};const static TLitC< sizeof(L"data:0")/2 > KHTMLDataScheme={sizeof(L"data:0")/2-1, L"data:0"};const static TLitC8< sizeof("<br>")> KHtmlLineBreak={sizeof("<br>")-1,"<br>"};const static TLitC8< sizeof("<br>\xD\xA")> KHtmlLineBreakCRLF={sizeof("<br>\xD\xA")-1,"<br>\xD\xA"};const static TLitC8< sizeof("&lt;")> KHtmlLessThan={sizeof("&lt;")-1,"&lt;"};const static TLitC8< sizeof("&gt;")> KHtmlGreaterThan={sizeof("&gt;")-1,"&gt;"};const static TLitC8< sizeof("&amp;")> KHtmlAmpersand={sizeof("&amp;")-1,"&amp;"};const static TLitC8< sizeof("&quot;")> KHtmlQuotation={sizeof("&quot;")-1,"&quot;"};const static TLitC8< sizeof("<a href=\"%S\">")> KHtmlLinkTag={sizeof("<a href=\"%S\">")-1,"<a href=\"%S\">"};const static TLitC8< sizeof("<a href=\"%S%S\">")> KHtmlLinkTagWWW={sizeof("<a href=\"%S%S\">")-1,"<a href=\"%S%S\">"};const static TLitC8< sizeof("</a>")> KHtmlLinkEndTag={sizeof("</a>")-1,"</a>"};const static TLitC< sizeof(L"body")/2 > KURLTypeBody={sizeof(L"body")/2-1, L"body"};const static TLitC< sizeof(L"cmail:const static TLitC<sizeof(L"cmail:const static TLitC< sizeof(L"cmail:const static TLitC<sizeof(L"cmail:const TText8 KGreaterThan=0x3e;const TText8 KLessThan=0x3c;const TText8 KAmpersand=0x26;const TText8 KQuotation=0x22;const TText8 KCharacterSpace=0x20;const TText8 KSOH=0x01;const TText8 KCR=0x0d;const TText8 KLF=0x0a;const TText8 KHT=0x09;const TReal KOverlayButtonMarginX=0.01;const TReal KOverlayButtonMarginY=0.01;const TReal KOverlayButtonSizeP=0.15;const TReal KOverlayButtonSizeLs=0.20;const TInt KStatusIndicatorHeight=50;const TInt KStatusIndicatorXMargin=50;CEUiHtmlViewerSettingsKeyListener::CEUiHtmlViewerSettingsKeyListener(MObserver &aObserver, TUint32 aKey):CActive(EPriorityStandard), iObserver(aObserver), iKey(aKey){CActiveScheduler::Add(this);StartListening();}CEUiHtmlViewerSettingsKeyListener::~CEUiHtmlViewerSettingsKeyListener(){Cancel();}void CEUiHtmlViewerSettingsKeyListener::StartListening(){SetActive();iObserver.Repository().NotifyRequest(iKey, iStatus);}void CEUiHtmlViewerSettingsKeyListener::RunL(){iObserver.KeyValueChangedL(iKey);StartListening();}void CEUiHtmlViewerSettingsKeyListener::DoCancel(){iObserver.Repository().NotifyCancel(iKey);}CEUiHtmlViewerSettings *CEUiHtmlViewerSettings::NewL(MObserver &aObserver){CEUiHtmlViewerSettings *self=new(ELeave) CEUiHtmlViewerSettings(aObserver);CleanupStack::PushL(self);self->ConstructL();CleanupStack::Pop();return self;}CEUiHtmlViewerSettings::~CEUiHtmlViewerSettings(){iKeyListeners.ResetAndDestroy();delete iRepository;}CEUiHtmlViewerSettings::CEUiHtmlViewerSettings(MObserver &aObserver):iObserver(aObserver){}void CEUiHtmlViewerSettings::ConstructL(){iRepository=CRepository::NewL(KFreestyleEmailCenRep);AddKeyListenerL(KFreestyleEmailDownloadHTMLImages);}void CEUiHtmlViewerSettings::AddKeyListenerL(TUint32 aKey){CEUiHtmlViewerSettingsKeyListener *listener=new(ELeave) CEUiHtmlViewerSettingsKeyListener(*this, aKey);CleanupStack::PushL(listener);iKeyListeners.AppendL(listener);CleanupStack::Pop();UpdateValue(aKey);}void CEUiHtmlViewerSettings::UpdateValue(TUint32 aKey){TInt value;iRepository->Get(aKey, value);switch(aKey){case KFreestyleEmailDownloadHTMLImages:iFlags.Assign(aKey, value==0);break;default:iFlags.Assign(aKey, value);break;}}void CEUiHtmlViewerSettings::KeyValueChangedL(TUint32 aKey){UpdateValue(aKey);iObserver.ViewerSettingsChangedL(aKey);}CRepository &CEUiHtmlViewerSettings::Repository(){return *iRepository;}TBool CEUiHtmlViewerSettings::AutoLoadImages() const {return iFlags.IsSet(EAutoLoadImages);}CFsEmailUiHtmlViewerContainer *CFsEmailUiHtmlViewerContainer::NewL(CFreestyleEmailUiAppUi &aAppUi, CFsEmailUiHtmlViewerView &aView){;CFsEmailUiHtmlViewerContainer *self=new(ELeave) CFsEmailUiHtmlViewerContainer(aAppUi, aView);CleanupStack::PushL(self);self->ConstructL();CleanupStack::Pop(self);return self;}CFsEmailUiHtmlViewerContainer::CFsEmailUiHtmlViewerContainer(CFreestyleEmailUiAppUi &aAppUi, CFsEmailUiHtmlViewerView &aView):iAppUi(aAppUi), iView(aView), iFs(iCoeEnv->FsSession()), iFirstTime(ETrue){;}CFsEmailUiHtmlViewerContainer::~CFsEmailUiHtmlViewerContainer(){;delete iViewerSettings;if(iObservingDownload &&iAppUi.DownloadInfoMediator()){iAppUi.DownloadInfoMediator()->StopObserving(this);}iFile.Close();iLinkContents.Close();iMessageParts.Close();delete iEventHandler;delete iBrCtlInterface;iConnection.Close();iSocketServer.Close();delete iStatusIndicator;delete iOverlayControlNext;delete iOverlayControlPrev;}void CFsEmailUiHtmlViewerContainer::PrepareForExit(){;HideDownloadStatus();if(iObservingDownload &&iAppUi.DownloadInfoMediator()){iAppUi.DownloadInfoMediator()->StopObserving(this);iObservingDownload=EFalse;}delete iBrCtlInterface;iBrCtlInterface=0;iConnection.Close();iSocketServer.Close();}void CFsEmailUiHtmlViewerContainer::PrepareForMessageNavigation(){;ResetContent();}void CFsEmailUiHtmlViewerContainer::ConstructL(){;iViewerSettings=CEUiHtmlViewerSettings::NewL(*this);SetHtmlFolderPathL();BaflUtils::EnsurePathExistsL(iFs, iHtmlFolderPath);SetTempHtmlFolderPath();BaflUtils::EnsurePathExistsL(iFs, iTempHtmlFolderPath);SetHTMLResourceFlagFullName();EnsureHTMLResourceL();CreateWindowL();SetRect(iView.ContainerRect());TUint brCtlCapabilities=TBrCtlDefs::ECapabilityClientResolveEmbeddedURL|TBrCtlDefs::ECapabilityDisplayScrollBar|TBrCtlDefs::ECapabilityClientNotifyURL|TBrCtlDefs::ECapabilityLoadHttpFw|TBrCtlDefs::ECapabilityCursorNavigation|TBrCtlDefs::ECapabilityPinchZoom;TRect rect(TPoint(), Size());iBrCtlInterface=CreateBrowserControlL(this, rect, brCtlCapabilities, TBrCtlDefs::ECommandIdBase, 0, this, this, 0, 0, this, 0);iBrCtlInterface- SetBrowserSettingL

const TLitC8< sizeof("<html")> KStartTag={sizeof("<html")-1,"<html"};const static TLitC8< sizeof("<head>")> KHeadTag={sizeof("<head>")-1,"<head>"};const static TLitC8< sizeof("<html><head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=")> KHtmlHeader1={sizeof("<html><head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=")-1,"<html><head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset="};const static TLitC8< sizeof("\"/></head><body>\xD\xA")> KHtmlHeader2={sizeof("\"/></head><body>\xD\xA")-1,"\"/></head><body>\xD\xA"};const static TLitC8< sizeof("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%S\">\n")> KHtmlHeader3={sizeof("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%S\">\n")-1,"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%S\">\n"};const static TLitC8< sizeof("\xD\xA</body></html>\xD\xA")> KHtmlEndTags={sizeof("\xD\xA</body></html>\xD\xA")-1,"\xD\xA</body></html>\xD\xA"};const static TLitC8< sizeof("charset")> KCharsetTag8={sizeof("charset")-1,"charset"};const static TLitC< sizeof(L"charset")/2 > KCharsetTag={sizeof(L"charset")/2-1, L"charset"};const static TLitC8< sizeof("<HTML><BODY></BODY></HTML>")> KHTMLEmptyContent={sizeof("<HTML><BODY></BODY></HTML>")-1,"<HTML><BODY></BODY></HTML>"};const static TLitC< sizeof(L"data:0")/2 > KHTMLDataScheme={sizeof(L"data:0")/2-1, L"data:0"};const static TLitC8< sizeof("<br>")> KHtmlLineBreak={sizeof("<br>")-1,"<br>"};const static TLitC8< sizeof("<br>\xD\xA")> KHtmlLineBreakCRLF={sizeof("<br>\xD\xA")-1,"<br>\xD\xA"};const static TLitC8< sizeof("&lt;")> KHtmlLessThan={sizeof("&lt;")-1,"&lt;"};const static TLitC8< sizeof("&gt;")> KHtmlGreaterThan={sizeof("&gt;")-1,"&gt;"};const static TLitC8< sizeof("&amp;")> KHtmlAmpersand={sizeof("&amp;")-1,"&amp;"};const static TLitC8< sizeof("&quot;")> KHtmlQuotation={sizeof("&quot;")-1,"&quot;"};const static TLitC8< sizeof("<a href=\"%S\">")> KHtmlLinkTag={sizeof("<a href=\"%S\">")-1,"<a href=\"%S\">"};const static TLitC8< sizeof("<a href=\"%S%S\">")> KHtmlLinkTagWWW={sizeof("<a href=\"%S%S\">")-1,"<a href=\"%S%S\">"};const static TLitC8< sizeof("</a>")> KHtmlLinkEndTag={sizeof("</a>")-1,"</a>"};const static TLitC< sizeof(L"body")/2 > KURLTypeBody={sizeof(L"body")/2-1, L"body"};const static TLitC< sizeof(L"cmail:const static TLitC<sizeof(L"cmail:const static TLitC< sizeof(L"cmail:const static TLitC<sizeof(L"cmail:const TText8 KGreaterThan=0x3e;const TText8 KLessThan=0x3c;const TText8 KAmpersand=0x26;const TText8 KQuotation=0x22;const TText8 KCharacterSpace=0x20;const TText8 KSOH=0x01;const TText8 KCR=0x0d;const TText8 KLF=0x0a;const TText8 KHT=0x09;const TReal KOverlayButtonMarginX=0.01;const TReal KOverlayButtonMarginY=0.01;const TReal KOverlayButtonSizeP=0.15;const TReal KOverlayButtonSizeLs=0.20;const TInt KStatusIndicatorHeight=50;const TInt KStatusIndicatorXMargin=50;CEUiHtmlViewerSettingsKeyListener::CEUiHtmlViewerSettingsKeyListener(MObserver &aObserver, TUint32 aKey):CActive(EPriorityStandard), iObserver(aObserver), iKey(aKey){CActiveScheduler::Add(this);StartListening();}CEUiHtmlViewerSettingsKeyListener::~CEUiHtmlViewerSettingsKeyListener(){Cancel();}void CEUiHtmlViewerSettingsKeyListener::StartListening(){SetActive();iObserver.Repository().NotifyRequest(iKey, iStatus);}void CEUiHtmlViewerSettingsKeyListener::RunL(){iObserver.KeyValueChangedL(iKey);StartListening();}void CEUiHtmlViewerSettingsKeyListener::DoCancel(){iObserver.Repository().NotifyCancel(iKey);}CEUiHtmlViewerSettings *CEUiHtmlViewerSettings::NewL(MObserver &aObserver){CEUiHtmlViewerSettings *self=new(ELeave) CEUiHtmlViewerSettings(aObserver);CleanupStack::PushL(self);self->ConstructL();CleanupStack::Pop();return self;}CEUiHtmlViewerSettings::~CEUiHtmlViewerSettings(){iKeyListeners.ResetAndDestroy();delete iRepository;}CEUiHtmlViewerSettings::CEUiHtmlViewerSettings(MObserver &aObserver):iObserver(aObserver){}void CEUiHtmlViewerSettings::ConstructL(){iRepository=CRepository::NewL(KFreestyleEmailCenRep);AddKeyListenerL(KFreestyleEmailDownloadHTMLImages);}void CEUiHtmlViewerSettings::AddKeyListenerL(TUint32 aKey){CEUiHtmlViewerSettingsKeyListener *listener=new(ELeave) CEUiHtmlViewerSettingsKeyListener(*this, aKey);CleanupStack::PushL(listener);iKeyListeners.AppendL(listener);CleanupStack::Pop();UpdateValue(aKey);}void CEUiHtmlViewerSettings::UpdateValue(TUint32 aKey){TInt value;iRepository->Get(aKey, value);switch(aKey){case KFreestyleEmailDownloadHTMLImages:iFlags.Assign(aKey, value==0);break;default:iFlags.Assign(aKey, value);break;}}void CEUiHtmlViewerSettings::KeyValueChangedL(TUint32 aKey){UpdateValue(aKey);iObserver.ViewerSettingsChangedL(aKey);}CRepository &CEUiHtmlViewerSettings::Repository(){return *iRepository;}TBool CEUiHtmlViewerSettings::AutoLoadImages() const {return iFlags.IsSet(EAutoLoadImages);}CFsEmailUiHtmlViewerContainer *CFsEmailUiHtmlViewerContainer::NewL(CFreestyleEmailUiAppUi &aAppUi, CFsEmailUiHtmlViewerView &aView){;CFsEmailUiHtmlViewerContainer *self=new(ELeave) CFsEmailUiHtmlViewerContainer(aAppUi, aView);CleanupStack::PushL(self);self->ConstructL();CleanupStack::Pop(self);return self;}CFsEmailUiHtmlViewerContainer::CFsEmailUiHtmlViewerContainer(CFreestyleEmailUiAppUi &aAppUi, CFsEmailUiHtmlViewerView &aView):iAppUi(aAppUi), iView(aView), iFs(iCoeEnv->FsSession()), iFirstTime(ETrue){;}CFsEmailUiHtmlViewerContainer::~CFsEmailUiHtmlViewerContainer(){;delete iViewerSettings;if(iObservingDownload &&iAppUi.DownloadInfoMediator()){iAppUi.DownloadInfoMediator()->StopObserving(this);}iFile.Close();iLinkContents.Close();iMessageParts.Close();delete iEventHandler;delete iBrCtlInterface;iConnection.Close();iSocketServer.Close();delete iStatusIndicator;delete iOverlayControlNext;delete iOverlayControlPrev;}void CFsEmailUiHtmlViewerContainer::PrepareForExit(){;HideDownloadStatus();if(iObservingDownload &&iAppUi.DownloadInfoMediator()){iAppUi.DownloadInfoMediator()->StopObserving(this);iObservingDownload=EFalse;}delete iBrCtlInterface;iBrCtlInterface=0;iConnection.Close();iSocketServer.Close();}void CFsEmailUiHtmlViewerContainer::PrepareForMessageNavigation(){;ResetContent();}void CFsEmailUiHtmlViewerContainer::ConstructL(){;iViewerSettings=CEUiHtmlViewerSettings::NewL(*this);SetHtmlFolderPathL();BaflUtils::EnsurePathExistsL(iFs, iHtmlFolderPath);SetTempHtmlFolderPath();BaflUtils::EnsurePathExistsL(iFs, iTempHtmlFolderPath);SetHTMLResourceFlagFullName();EnsureHTMLResourceL();CreateWindowL();SetRect(iView.ContainerRect());TUint brCtlCapabilities=TBrCtlDefs::ECapabilityClientResolveEmbeddedURL|TBrCtlDefs::ECapabilityDisplayScrollBar|TBrCtlDefs::ECapabilityClientNotifyURL|TBrCtlDefs::ECapabilityLoadHttpFw|TBrCtlDefs::ECapabilityCursorNavigation|TBrCtlDefs::ECapabilityPinchZoom;TRect rect(TPoint(), Size());iBrCtlInterface=CreateBrowserControlL(this, rect, brCtlCapabilities, TBrCtlDefs::ECommandIdBase, 0, this, this, 0, 0, this, 0);iBrCtlInterface-SetBrowserSettingL[static]

SetBrowserSettingL(TBrCtlDefs::ESettingsAutoLoadImages, iViewerSettings->)

iBrCtlInterfaceSetBrowserSettingL(TBrCtlDefs::ESettingsAutoLoadImages,
iViewerSettings->AutoLoadImages
)

Parameters

TBrCtlDefs::ESettingsAutoLoadImages
iViewerSettings-> AutoLoadImages

SetBrowserSettingL(TBrCtlDefs::ESettingsPageOverview, EFalse)

iBrCtlInterfaceSetBrowserSettingL(TBrCtlDefs::ESettingsPageOverview,
EFalse
)

Parameters

TBrCtlDefs::ESettingsPageOverview
EFalse

SetBrowserSettingL(TBrCtlDefs::ESettingsTextWrapEnabled, ETrue)

iBrCtlInterfaceSetBrowserSettingL(TBrCtlDefs::ESettingsTextWrapEnabled,
ETrue
)

Parameters

TBrCtlDefs::ESettingsTextWrapEnabled
ETrue

SetBrowserSettingL(TBrCtlDefs::ESettingsFontSize, TBrCtlDefs::EFontSizeLevelLarger)

iBrCtlInterfaceSetBrowserSettingL(TBrCtlDefs::ESettingsFontSize,
TBrCtlDefs::EFontSizeLevelLarger
)

Parameters

TBrCtlDefs::ESettingsFontSize
TBrCtlDefs::EFontSizeLevelLarger

iEventHandler

iEventHandler

TRect nextButtonRect

TRect nextButtonRect

iOverlayControlNext

iOverlayControlNext

TRect prevButtonRect

TRect prevButtonRect

iOverlayControlPrev

iOverlayControlPrev

iScrollPosition

iScrollPosition

iAttachmentDownloadImageHandle

iAttachmentDownloadImageHandle

iTouchFeedBack

iTouchFeedBack

EnableFeedbackForControl(this, ETrue)

iTouchFeedBack EnableFeedbackForControl(this,
ETrue
)

Parameters

this
ETrue

ActivateL()

ActivateL()