Commit e0046cfb authored by Volker Krause's avatar Volker Krause

Explicitly pass the HtmlWriter to the renderer

Like it or not, it's used in there. Passing it explicitly rather than
sneaking it in hidden inside MessagePart makes that obvious.
parent f84084b6
......@@ -365,9 +365,9 @@ public:
MimeTreeParser::HtmlWriter *mBaseWriter = nullptr;
};
DefaultRendererPrivate::DefaultRendererPrivate(const Interface::MessagePart::Ptr &msgPart, CSSHelperBase *cssHelper, const MessagePartRendererFactory *rendererFactory)
DefaultRendererPrivate::DefaultRendererPrivate(const Interface::MessagePart::Ptr &msgPart, CSSHelperBase *cssHelper, HtmlWriter *writer, const MessagePartRendererFactory *rendererFactory)
: mMsgPart(msgPart)
, mOldWriter(msgPart->htmlWriter())
, mOldWriter(writer)
, mCSSHelper(cssHelper)
, mRendererFactory(rendererFactory)
{
......@@ -1082,8 +1082,8 @@ QString DefaultRendererPrivate::renderFactory(const Interface::MessagePart::Ptr
return QString();
}
DefaultRenderer::DefaultRenderer(const MimeTreeParser::Interface::MessagePart::Ptr &msgPart, CSSHelperBase *cssHelper)
: d(new MimeTreeParser::DefaultRendererPrivate(msgPart, cssHelper, MessagePartRendererFactory::instance()))
DefaultRenderer::DefaultRenderer(const MimeTreeParser::Interface::MessagePart::Ptr &msgPart, CSSHelperBase *cssHelper, MimeTreeParser::HtmlWriter *writer)
: d(new MimeTreeParser::DefaultRendererPrivate(msgPart, cssHelper, writer, MessagePartRendererFactory::instance()))
{
}
......
......@@ -26,6 +26,7 @@
namespace MimeTreeParser {
class DefaultRendererPrivate;
class HtmlWriter;
namespace Interface {
class MessagePart;
typedef QSharedPointer<MessagePart> MessagePartPtr;
......@@ -38,7 +39,7 @@ class CSSHelperBase;
class DefaultRenderer : public MimeTreeParser::Interface::MessagePartRenderer
{
public:
DefaultRenderer(const MimeTreeParser::Interface::MessagePartPtr &msgPart, CSSHelperBase *cssHelder);
DefaultRenderer(const MimeTreeParser::Interface::MessagePartPtr &msgPart, CSSHelperBase *cssHelder, MimeTreeParser::HtmlWriter *writer);
~DefaultRenderer();
QString html() const override;
......
......@@ -32,13 +32,14 @@ class PartRendered;
namespace MessageViewer {
class MessagePartRendererFactory;
class CSSHelperBase;
class HtmlWriter;
}
namespace MimeTreeParser {
class DefaultRendererPrivate
{
public:
DefaultRendererPrivate(const Interface::MessagePart::Ptr &msgPart, CSSHelperBase *cssHelper, const MessagePartRendererFactory *rendererFactory);
DefaultRendererPrivate(const Interface::MessagePart::Ptr &msgPart, CSSHelperBase *cssHelper, HtmlWriter *writer, const MessagePartRendererFactory *rendererFactory);
~DefaultRendererPrivate();
QString alignText();
......
......@@ -144,6 +144,6 @@ bool EmptySource::isPrinting() const
MimeTreeParser::Interface::MessagePartRendererPtr EmptySource::messagePartTheme(
MimeTreeParser::Interface::MessagePart::Ptr msgPart)
{
return MimeTreeParser::Interface::MessagePartRenderer::Ptr(new DefaultRenderer(msgPart,
cssHelper()));
return MimeTreeParser::Interface::MessagePartRenderer::Ptr(
new DefaultRenderer(msgPart, cssHelper(), htmlWriter()));
}
......@@ -132,7 +132,6 @@ bool MailViewerSource::isPrinting() const
MimeTreeParser::Interface::MessagePartRendererPtr MailViewerSource::messagePartTheme(
MimeTreeParser::Interface::MessagePart::Ptr msgPart)
{
return MimeTreeParser::Interface::MessagePartRenderer::Ptr(new DefaultRenderer(msgPart,
mViewer->
cssHelper()));
return MimeTreeParser::Interface::MessagePartRenderer::Ptr(
new DefaultRenderer(msgPart, mViewer->cssHelper(), mViewer->htmlWriter()));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment