summaryrefslogtreecommitdiffstats
path: root/examples/qtmail/plugins/viewers/generic/browserwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qtmail/plugins/viewers/generic/browserwidget.cpp')
-rw-r--r--examples/qtmail/plugins/viewers/generic/browserwidget.cpp9
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;
}
}
}