From 6a3251272907242d52031dcbe932d06ee5a12ed2 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 12 Feb 2026 10:38:33 -0600 Subject: [PATCH] fix: mime-type icons on Windows (#8443) (#8456) * fix: mime-type icons on Windows * fixup! fix: mime-type icons on Windows use file_icon_ as the fallback icon do not mark the temp string as translatable --------- Co-authored-by: Mike Gelfand --- qt/IconCache.cc | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/qt/IconCache.cc b/qt/IconCache.cc index 480dcd544..e8f6df926 100644 --- a/qt/IconCache.cc +++ b/qt/IconCache.cc @@ -84,21 +84,10 @@ QIcon IconCache::getMimeTypeIcon(QString const& mime_type_name, bool multifile) if (!multifile) { - QMimeDatabase const mime_db; + static auto const mime_db = QMimeDatabase{}; auto const type = mime_db.mimeTypeForName(mime_type_name); - icon = getThemeIcon(type.iconName()); - - if (icon.isNull()) - { - icon = getThemeIcon(type.genericIconName()); - } - - if (icon.isNull()) - { - icon = file_icon_; - } - - return icon; + auto const filename = QStringLiteral("filename.%1").arg(type.preferredSuffix()); + return guessMimeIcon(filename, file_icon_); } auto const mime_icon = getMimeTypeIcon(mime_type_name, false);