diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-02-22 22:13:13 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-02-22 22:13:13 +0100 |
commit | d39aebdce936f251e37c6bdbaed6b8fe38165362 (patch) | |
tree | 3d86929197c12ed15fb876a26d06b2f1e2a2aa75 /framework/mail/stringhtmlwriter.cpp | |
parent | fd2fd7a60694166f7a6589a2f16866de9b3dd707 (diff) | |
download | kube-d39aebdce936f251e37c6bdbaed6b8fe38165362.tar.gz kube-d39aebdce936f251e37c6bdbaed6b8fe38165362.zip |
Replace cid references with to the extracted file.
Diffstat (limited to 'framework/mail/stringhtmlwriter.cpp')
-rw-r--r-- | framework/mail/stringhtmlwriter.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/framework/mail/stringhtmlwriter.cpp b/framework/mail/stringhtmlwriter.cpp index 2c84dc6f..df108946 100644 --- a/framework/mail/stringhtmlwriter.cpp +++ b/framework/mail/stringhtmlwriter.cpp | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include <QDebug> | 34 | #include <QDebug> |
35 | #include <QTextStream> | 35 | #include <QTextStream> |
36 | #include <QUrl> | ||
36 | 37 | ||
37 | StringHtmlWriter::StringHtmlWriter() | 38 | StringHtmlWriter::StringHtmlWriter() |
38 | : MessageViewer::HtmlWriter() | 39 | : MessageViewer::HtmlWriter() |
@@ -70,6 +71,7 @@ void StringHtmlWriter::end() | |||
70 | insertExtraHead(); | 71 | insertExtraHead(); |
71 | mExtraHead.clear(); | 72 | mExtraHead.clear(); |
72 | } | 73 | } |
74 | resolveCidUrls(); | ||
73 | mState = Ended; | 75 | mState = Ended; |
74 | } | 76 | } |
75 | 77 | ||
@@ -106,7 +108,16 @@ void StringHtmlWriter::flush() | |||
106 | void StringHtmlWriter::embedPart(const QByteArray &contentId, const QString &url) | 108 | void StringHtmlWriter::embedPart(const QByteArray &contentId, const QString &url) |
107 | { | 109 | { |
108 | write("<!-- embedPart(contentID=" + contentId + ", url=" + url + ") -->\n"); | 110 | write("<!-- embedPart(contentID=" + contentId + ", url=" + url + ") -->\n"); |
111 | mEmbeddedPartMap.insert(contentId, url); | ||
109 | } | 112 | } |
113 | |||
114 | void StringHtmlWriter::resolveCidUrls() | ||
115 | { | ||
116 | for (const auto &cid : mEmbeddedPartMap.keys()) { | ||
117 | mHtml.replace(QString("src=\"cid:%1\"").arg(QString(cid)), QString("src=\"%1\"").arg(mEmbeddedPartMap.value(cid).toString())); | ||
118 | } | ||
119 | } | ||
120 | |||
110 | void StringHtmlWriter::extraHead(const QString &extraHead) | 121 | void StringHtmlWriter::extraHead(const QString &extraHead) |
111 | { | 122 | { |
112 | if (mState != Ended) { | 123 | if (mState != Ended) { |