diff options
| author | Don Sanders <don.sanders@nokia.com> | 2010-07-16 14:24:38 +1000 |
|---|---|---|
| committer | Don Sanders <don.sanders@nokia.com> | 2010-07-16 14:24:38 +1000 |
| commit | 9cf272375afe1057bf67a43ca7a10678e105b85a (patch) | |
| tree | 6e9714c68f793d1995b7528a373e75e2b8c2ca1e /examples/qtmail/plugins | |
| parent | 740e515c2602bd9c5c789c3b668e0090a30fd9e9 (diff) | |
Allow user to download complete mail for messages with an empty body.
An empty body may indicate a problem such as an IMAP server being unable
to parse the mail and returning a bad bodystructure.
Diffstat (limited to 'examples/qtmail/plugins')
| -rw-r--r-- | examples/qtmail/plugins/viewers/generic/browserwidget.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/qtmail/plugins/viewers/generic/browserwidget.cpp b/examples/qtmail/plugins/viewers/generic/browserwidget.cpp index 4157d8d8..9e7b29bc 100644 --- a/examples/qtmail/plugins/viewers/generic/browserwidget.cpp +++ b/examples/qtmail/plugins/viewers/generic/browserwidget.cpp @@ -856,7 +856,8 @@ void BrowserWidget::displayHtml(const QMailMessage* mail) // Assume this is appropriately formatted for display bodyText = mail->body().data(); } else { - bodyText = formatText( mail->body().data() ); + QString data(mail->body().data()); + bodyText = formatText(data); if (!mail->contentAvailable()) { QString trailer = @@ -875,6 +876,12 @@ void BrowserWidget::displayHtml(const QMailMessage* mail) trailer = replaceLast(trailer, "DOWNLOAD_TEXT", tr("Retrieve more data")); bodyText += trailer; + } else if (data.isEmpty()) { + // Possibly a badly formatted mail, give user option to completely download + qWarning() << "Mail with empty body detected"; + QString trailer = "<br><a href=\"download\">DOWNLOAD_TEXT</a>"; + trailer = replaceLast(trailer, "DOWNLOAD_TEXT", tr("Retrieve complete mail")); + bodyText += trailer; } } } |
