[kde-doc-english] [trojita] src/Gui: GUI: show our own icon when displaying attached messages

Jan Kundrát jkt at flaska.net
Wed Dec 4 16:05:31 UTC 2013


Git commit 7b2a34f0655869d5cd0d9495a5c754dc79be71fa by Jan Kundrát.
Committed on 27/11/2013 at 18:19.
Pushed by jkt into branch 'master'.

GUI: show our own icon when displaying attached messages

See the comment within the code for motivation behind this.

M  +12   -3    src/Gui/AttachmentView.cpp

http://commits.kde.org/trojita/7b2a34f0655869d5cd0d9495a5c754dc79be71fa

diff --git a/src/Gui/AttachmentView.cpp b/src/Gui/AttachmentView.cpp
index 21f6c26..ab2fbfa 100644
--- a/src/Gui/AttachmentView.cpp
+++ b/src/Gui/AttachmentView.cpp
@@ -114,9 +114,18 @@ AttachmentView::AttachmentView(QWidget *parent, Imap::Network::MsgPartNetAccessM
     QMimeType mimeType = QMimeDatabase().mimeTypeForName(mimeDescription);
     if (mimeType.isValid() && !mimeType.isDefault()) {
         mimeDescription = mimeType.comment();
-        QIcon icon = QIcon::fromTheme(mimeType.iconName(),
-                                      QIcon::fromTheme(mimeType.genericIconName(), loadIcon(QLatin1String("mail-attachment")))
-                                      );
+        QIcon icon;
+        if (rawMime == QLatin1String("message/rfc822")) {
+            // Special case for plain e-mail messages. Motivation for this is that most of the OSes ship these icons
+            // with a pixmap which shows something like a sheet of paper as the background. I find it rather dumb
+            // to do this in the context of a MUA where attached messages are pretty common, which is why this special
+            // case is in place. Comments welcome.
+            icon = loadIcon(QLatin1String("trojita"));
+        } else {
+            icon = QIcon::fromTheme(mimeType.iconName(),
+                                    QIcon::fromTheme(mimeType.genericIconName(), loadIcon(QLatin1String("mail-attachment")))
+                                    );
+        }
         m_icon->setIcon(icon);
     } else {
         m_icon->setIcon(loadIcon(QLatin1String("mail-attachment")));



More information about the kde-doc-english mailing list