[kde-doc-english] [trojita] src/Gui: GUI: use a fallback MIME icon if the exact one cannot be found

Jan Kundrát jkt at flaska.net
Wed Aug 21 05:42:12 UTC 2013


Git commit 2258f9759ce3fd34dc88d81ebbbd5e3db18eb67a by Jan Kundrát.
Committed on 19/08/2013 at 18:32.
Pushed by jkt into branch 'master'.

GUI: use a fallback MIME icon if the exact one cannot be found

This is even described in the QMimeType's docs -- not sure how come that I
missed this when implementing this the first time.

REVIEW: 112166

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

http://commits.kde.org/trojita/2258f9759ce3fd34dc88d81ebbbd5e3db18eb67a

diff --git a/src/Gui/AttachmentView.cpp b/src/Gui/AttachmentView.cpp
index f7259b4..987727c 100644
--- a/src/Gui/AttachmentView.cpp
+++ b/src/Gui/AttachmentView.cpp
@@ -73,7 +73,9 @@ 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(), loadIcon(QLatin1String("mail-attachment")));
+        QIcon icon = QIcon::fromTheme(mimeType.iconName(),
+                                      QIcon::fromTheme(mimeType.genericIconName(), loadIcon(QLatin1String("mail-attachment")))
+                                      );
         lbl->setPixmap(icon.pixmap(iconSize));
     } else {
         lbl->setPixmap(loadIcon(QLatin1String("mail-attachment")).pixmap(iconSize));



More information about the kde-doc-english mailing list