[kde-doc-english] [trojita] src/Gui: GUI: display the List-Post header

Jan Kundrát jkt at flaska.net
Thu Jan 3 11:58:42 UTC 2013


Git commit a55fe45b2932e5c4168e9ed7cf44c17b35e7d692 by Jan Kundrát.
Committed on 03/01/2013 at 12:25.
Pushed by jkt into branch 'master'.

GUI: display the List-Post header

M  +26   -0    src/Gui/MessageView.cpp

http://commits.kde.org/trojita/a55fe45b2932e5c4168e9ed7cf44c17b35e7d692

diff --git a/src/Gui/MessageView.cpp b/src/Gui/MessageView.cpp
index d4d6576..3d611bd 100644
--- a/src/Gui/MessageView.cpp
+++ b/src/Gui/MessageView.cpp
@@ -309,6 +309,32 @@ QString MessageView::headerText()
         res += tr("<b>Sender:</b> %1<br/>").arg(Imap::Message::MailAddress::prettyList(e.sender, Imap::Message::MailAddress::FORMAT_CLICKABLE));
     if (!e.replyTo.isEmpty() && e.replyTo != e.from)
         res += tr("<b>Reply-To:</b> %1<br/>").arg(Imap::Message::MailAddress::prettyList(e.replyTo, Imap::Message::MailAddress::FORMAT_CLICKABLE));
+    QVariantList headerListPost = message.data(Imap::Mailbox::RoleMessageHeaderListPost).toList();
+    if (!headerListPost.isEmpty()) {
+        QStringList buf;
+        Q_FOREACH(const QVariant &item, headerListPost) {
+            const QString scheme = item.toUrl().scheme().toLower();
+            if (scheme == QLatin1String("http") || scheme == QLatin1String("https") || scheme == QLatin1String("mailto")) {
+                QString target = item.toUrl().toString();
+                QString caption = item.toUrl().toString(scheme == QLatin1String("mailto") ? QUrl::RemoveScheme : QUrl::None);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+                target = Qt::escape(target);
+                caption = Qt::escape(caption);
+#else
+                target = target.toHtmlEscaped();
+                caption = caption.toHtmlEscaped();
+#endif
+                buf << tr("<a href=\"%1\">%2</a>").arg(target, caption);
+            } else {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+                buf << Qt::escape(item.toUrl().toString());
+#else
+                buf << item.toUrl().toString().toHtmlEscaped();
+#endif
+            }
+        }
+        res += tr("<b>List-Post:</b> %1<br/>").arg(buf.join(tr(", ")));
+    }
     if (!e.to.isEmpty())
         res += tr("<b>To:</b> %1<br/>").arg(Imap::Message::MailAddress::prettyList(e.to, Imap::Message::MailAddress::FORMAT_CLICKABLE));
     if (!e.cc.isEmpty())



More information about the kde-doc-english mailing list