summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDon Sanders <don.sanders@nokia.com>2011-06-09 19:29:10 +0300
committerDon Sanders <don.sanders@nokia.com>2011-06-09 19:29:10 +0300
commit67d096d95cb47d773e91b852db47fc605446596c (patch)
tree52df3837184f8ab6aa0640c0f2d25647de75e5f6
parent93b66ab93171bb20754ba08ea964e904a5966a95 (diff)
Fix NB#263850 Preview of the message shown with junk characters/links
if message has Inlined image
-rw-r--r--CHANGES1
-rw-r--r--src/libraries/qmfclient/qmailmessage.cpp9
2 files changed, 7 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 638e30d6..5e5d97ff 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,7 @@ Latest Changes
201123
* Fixes: NB#261810 Random crashes observed upon tapping send in reply/forward editor
+ * Fixes: NB#263850 Preview of the message shown with junk characters/links if message has Inlined image
201122
* Fixes: NB#259331 Does not show new emails immediately
diff --git a/src/libraries/qmfclient/qmailmessage.cpp b/src/libraries/qmfclient/qmailmessage.cpp
index 10c8ce28..e83e0d09 100644
--- a/src/libraries/qmfclient/qmailmessage.cpp
+++ b/src/libraries/qmfclient/qmailmessage.cpp
@@ -8232,11 +8232,14 @@ void QMailMessage::refreshPreview()
QMailMessagePartContainer *part;
+ // TODO: don't load entire body into memory
+ // TODO: parse html correctly, e.g. closing brackets in quotes in tags
+
if ((part = findPlainTextContainer()) && part->hasBody()) {
- metaDataImpl()->setPreview(part->body().data().left(maxPreviewLength));
+ QString plaintext(part->body().data());
+ plaintext.remove(QRegExp("\\[(image|cid):[^\\]]*\\]", Qt::CaseInsensitive));
+ metaDataImpl()->setPreview(plaintext);
} else if ((part = findHtmlContainer()) && part->hasBody()) {
- // TODO: this properly..
- // TODO: don't load entire body into memory
QString markup = part->body().data();
markup.remove(QRegExp("<\\s*(style|head|form|script)[^<]*<\\s*/\\s*\\1\\s*>", Qt::CaseInsensitive));
markup.remove(QRegExp("<(.)[^>]*>"));