summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-14 05:20:18 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-14 05:20:18 (GMT)
commit706ec225ece7d732615917cef2dd000de95690ce (patch)
tree606adee753903374191a1a6dbe767406f8916e86
parent2fa342ba2ad6f9b60a1e836067bca6183dffd39a (diff)
Fix Bug 340435 - Printing HTML e-mail w/external references incorrectly adds warning message to top of print-out
FIXED-IN: 5.4.0 BUG: 340435
-rw-r--r--CMakeLists.txt2
-rw-r--r--messageviewer/src/messagepartthemes/default/defaultrenderer.cpp3
-rw-r--r--messageviewer/src/messagepartthemes/default/templates/htmlmessagepart.html2
-rw-r--r--messageviewer/src/viewer/objecttreeemptysource.cpp5
-rw-r--r--messageviewer/src/viewer/objecttreeemptysource.h1
-rw-r--r--messageviewer/src/viewer/objecttreeviewersource.cpp5
-rw-r--r--messageviewer/src/viewer/objecttreeviewersource.h1
-rw-r--r--mimetreeparser/autotests/setupenv.h3
-rw-r--r--mimetreeparser/src/interfaces/objecttreesource.h2
9 files changed, 21 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 947e19f..e678b02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
-set(PIM_VERSION "5.3.73")
+set(PIM_VERSION "5.3.74")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.40")
diff --git a/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp b/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
index 36250c8..90d99f0 100644
--- a/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
+++ b/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
@@ -886,9 +886,10 @@ public:
auto preferredMode = mp->source()->preferredMode();
bool isHtmlPreferred = (preferredMode == Util::Html) || (preferredMode == Util::MultipartHtml);
+ const bool isPrinting = mp->source()->isPrinting();
block.setProperty("htmlMail", isHtmlPreferred);
block.setProperty("loadExternal", mp->source()->htmlLoadExternal());
-
+ block.setProperty("isPrinting", isPrinting);
{
QString extraHead;
QString bodyText = processHtml(mp->mBodyHTML, extraHead);
diff --git a/messageviewer/src/messagepartthemes/default/templates/htmlmessagepart.html b/messageviewer/src/messagepartthemes/default/templates/htmlmessagepart.html
index 0bf6df4..1ed9f2f 100644
--- a/messageviewer/src/messagepartthemes/default/templates/htmlmessagepart.html
+++ b/messageviewer/src/messagepartthemes/default/templates/htmlmessagepart.html
@@ -1,4 +1,4 @@
-{% if not block.htmlMail or not block.loadExternal and block.containsExternalReferences %}
+{% if not block.htmlMail or not block.loadExternal and block.containsExternalReferences and not block.isPrinting %}
<div class="htmlWarn">
{% if not block.htmlMail %}
{% i18n_var "<b>Note:</b> This is an HTML message. For security reasons, only the raw HTML code is shown. If you trust the sender of this message then you can activate formatted HTML display for this message <a href='kmail:showHTML'>by clicking here</a>." as msg %}
diff --git a/messageviewer/src/viewer/objecttreeemptysource.cpp b/messageviewer/src/viewer/objecttreeemptysource.cpp
index 0b1e185..6daccac 100644
--- a/messageviewer/src/viewer/objecttreeemptysource.cpp
+++ b/messageviewer/src/viewer/objecttreeemptysource.cpp
@@ -144,6 +144,11 @@ const MimeTreeParser::BodyPartFormatterBaseFactory *EmptySource::bodyPartFormatt
return bodyPartFormatterBaseFactoryInstance();
}
+bool EmptySource::isPrinting() const
+{
+ return false;
+}
+
MimeTreeParser::Interface::MessagePartRendererPtr EmptySource::messagePartTheme(MimeTreeParser::Interface::MessagePart::Ptr msgPart)
{
return MimeTreeParser::Interface::MessagePartRenderer::Ptr(new DefaultRenderer(msgPart, cssHelper()));
diff --git a/messageviewer/src/viewer/objecttreeemptysource.h b/messageviewer/src/viewer/objecttreeemptysource.h
index 45bfced..05e0241 100644
--- a/messageviewer/src/viewer/objecttreeemptysource.h
+++ b/messageviewer/src/viewer/objecttreeemptysource.h
@@ -54,6 +54,7 @@ public:
bool showExpandQuotesMark() const Q_DECL_OVERRIDE;
const MimeTreeParser::BodyPartFormatterBaseFactory *bodyPartFormatterFactory() Q_DECL_OVERRIDE;
MimeTreeParser::Interface::MessagePartRendererPtr messagePartTheme(MimeTreeParser::Interface::MessagePartPtr msgPart) Q_DECL_OVERRIDE;
+ bool isPrinting() const Q_DECL_OVERRIDE;
private:
EmptySourcePrivate *const d;
};
diff --git a/messageviewer/src/viewer/objecttreeviewersource.cpp b/messageviewer/src/viewer/objecttreeviewersource.cpp
index ee43876..1404e57 100644
--- a/messageviewer/src/viewer/objecttreeviewersource.cpp
+++ b/messageviewer/src/viewer/objecttreeviewersource.cpp
@@ -127,6 +127,11 @@ const MimeTreeParser::BodyPartFormatterBaseFactory *MailViewerSource::bodyPartFo
return bodyPartFormatterBaseFactoryInstance();
}
+bool MailViewerSource::isPrinting() const
+{
+ return mViewer->mPrinting;
+}
+
MimeTreeParser::Interface::MessagePartRendererPtr MailViewerSource::messagePartTheme(MimeTreeParser::Interface::MessagePart::Ptr msgPart)
{
return MimeTreeParser::Interface::MessagePartRenderer::Ptr(new DefaultRenderer(msgPart, mViewer->cssHelper()));
diff --git a/messageviewer/src/viewer/objecttreeviewersource.h b/messageviewer/src/viewer/objecttreeviewersource.h
index 1ef25bb..d045137 100644
--- a/messageviewer/src/viewer/objecttreeviewersource.h
+++ b/messageviewer/src/viewer/objecttreeviewersource.h
@@ -52,6 +52,7 @@ public:
bool showExpandQuotesMark() const Q_DECL_OVERRIDE;
const MimeTreeParser::BodyPartFormatterBaseFactory *bodyPartFormatterFactory() Q_DECL_OVERRIDE;
MimeTreeParser::Interface::MessagePartRendererPtr messagePartTheme(MimeTreeParser::Interface::MessagePartPtr msgPart) Q_DECL_OVERRIDE;
+ bool isPrinting() const Q_DECL_OVERRIDE;
private:
ViewerPrivate *mViewer;
};
diff --git a/mimetreeparser/autotests/setupenv.h b/mimetreeparser/autotests/setupenv.h
index 4bb81a6..21e7b19 100644
--- a/mimetreeparser/autotests/setupenv.h
+++ b/mimetreeparser/autotests/setupenv.h
@@ -154,6 +154,9 @@ public:
Q_UNUSED(msgPart);
return Interface::MessagePartRenderer::Ptr();
}
+ bool isPrinting() const Q_DECL_OVERRIDE {
+ return false;
+ }
private:
MimeTreeParser::HtmlWriter *mWriter;
QString mAttachmentStrategy;
diff --git a/mimetreeparser/src/interfaces/objecttreesource.h b/mimetreeparser/src/interfaces/objecttreesource.h
index efcf786..f7584ef 100644
--- a/mimetreeparser/src/interfaces/objecttreesource.h
+++ b/mimetreeparser/src/interfaces/objecttreesource.h
@@ -102,6 +102,8 @@ public:
virtual const BodyPartFormatterBaseFactory *bodyPartFormatterFactory() = 0;
virtual MessagePartRendererPtr messagePartTheme(MessagePartPtr msgPart) = 0;
+
+ virtual bool isPrinting() const = 0;
};
}
}