diff options
author | Don Sanders <don.sanders@nokia.com> | 2011-06-09 19:29:10 +0300 |
---|---|---|
committer | Don Sanders <don.sanders@nokia.com> | 2011-06-09 19:29:10 +0300 |
commit | 67d096d95cb47d773e91b852db47fc605446596c (patch) | |
tree | 52df3837184f8ab6aa0640c0f2d25647de75e5f6 | |
parent | 93b66ab93171bb20754ba08ea964e904a5966a95 (diff) |
Fix NB#263850 Preview of the message shown with junk characters/links
if message has Inlined image
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | src/libraries/qmfclient/qmailmessage.cpp | 9 |
2 files changed, 7 insertions, 3 deletions
@@ -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("<(.)[^>]*>")); |