summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <[email protected]>2017-09-29 20:51:56 +0200
committerVolker Krause <[email protected]>2017-09-30 10:33:31 +0200
commite0046cfbebdf6fbb6c025141b381a6baa4e02839 (patch)
tree155ec6998d8232bf3783335c300cabe1b61d87b5
parentf84084b6874592d4f452031161dd008783795572 (diff)
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.
-rw-r--r--messageviewer/src/messagepartthemes/default/defaultrenderer.cpp8
-rw-r--r--messageviewer/src/messagepartthemes/default/defaultrenderer.h3
-rw-r--r--messageviewer/src/messagepartthemes/default/defaultrenderer_p.h3
-rw-r--r--messageviewer/src/viewer/objecttreeemptysource.cpp4
-rw-r--r--messageviewer/src/viewer/objecttreeviewersource.cpp5
5 files changed, 12 insertions, 11 deletions
diff --git a/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp b/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
index d38972d..62d8051 100644
--- a/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
+++ b/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
@@ -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()))
{
}
diff --git a/messageviewer/src/messagepartthemes/default/defaultrenderer.h b/messageviewer/src/messagepartthemes/default/defaultrenderer.h
index a5d2604..6541d87 100644
--- a/messageviewer/src/messagepartthemes/default/defaultrenderer.h
+++ b/messageviewer/src/messagepartthemes/default/defaultrenderer.h
@@ -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;
diff --git a/messageviewer/src/messagepartthemes/default/defaultrenderer_p.h b/messageviewer/src/messagepartthemes/default/defaultrenderer_p.h
index ba0a2b4..fab7829 100644
--- a/messageviewer/src/messagepartthemes/default/defaultrenderer_p.h
+++ b/messageviewer/src/messagepartthemes/default/defaultrenderer_p.h
@@ -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();
diff --git a/messageviewer/src/viewer/objecttreeemptysource.cpp b/messageviewer/src/viewer/objecttreeemptysource.cpp
index 464d137..86bcf80 100644
--- a/messageviewer/src/viewer/objecttreeemptysource.cpp
+++ b/messageviewer/src/viewer/objecttreeemptysource.cpp
@@ -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()));
}
diff --git a/messageviewer/src/viewer/objecttreeviewersource.cpp b/messageviewer/src/viewer/objecttreeviewersource.cpp
index fb6af88..a8b3d51 100644
--- a/messageviewer/src/viewer/objecttreeviewersource.cpp
+++ b/messageviewer/src/viewer/objecttreeviewersource.cpp
@@ -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()));
}