diff options
-rw-r--r-- | framework/mail/stringhtmlwriter.cpp | 11 | ||||
-rw-r--r-- | framework/mail/stringhtmlwriter.h | 2 |
2 files changed, 13 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) { |
diff --git a/framework/mail/stringhtmlwriter.h b/framework/mail/stringhtmlwriter.h index 0805d027..fa0a7aa5 100644 --- a/framework/mail/stringhtmlwriter.h +++ b/framework/mail/stringhtmlwriter.h | |||
@@ -55,6 +55,7 @@ public: | |||
55 | QString html() const; | 55 | QString html() const; |
56 | private: | 56 | private: |
57 | void insertExtraHead(); | 57 | void insertExtraHead(); |
58 | void resolveCidUrls(); | ||
58 | 59 | ||
59 | QString mHtml; | 60 | QString mHtml; |
60 | QString mExtraHead; | 61 | QString mExtraHead; |
@@ -63,6 +64,7 @@ private: | |||
63 | Queued, | 64 | Queued, |
64 | Ended | 65 | Ended |
65 | } mState; | 66 | } mState; |
67 | QMap<QByteArray, QUrl> mEmbeddedPartMap; | ||
66 | }; | 68 | }; |
67 | 69 | ||
68 | #endif // __MESSAGEVIEWER_FILEHTMLWRITER_H__ | 70 | #endif // __MESSAGEVIEWER_FILEHTMLWRITER_H__ |