From 627a2ef6ddd52c2489d4243b8545c9e9fc9b2af9 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Mon, 27 Apr 2020 00:24:49 +0200 Subject: [PATCH] Dont use system icon for clear search field icon Fixes #413 --- src/core/iconloader.cpp | 14 ++++++++------ src/core/iconmapper.h | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/core/iconloader.cpp b/src/core/iconloader.cpp index e1dbd7137..1f4cf3dc6 100644 --- a/src/core/iconloader.cpp +++ b/src/core/iconloader.cpp @@ -69,15 +69,17 @@ QIcon IconLoader::Load(const QString &name, const int size) { if (IconMapper::iconmapper_.contains(name)) { icon_prop = IconMapper::iconmapper_[name]; } - ret = QIcon::fromTheme(name); - if (ret.isNull()) { - for (QString alt_name : icon_prop.names) { - ret = QIcon::fromTheme(alt_name); - if (!ret.isNull()) break; + if (icon_prop.allow_system_icon) { + ret = QIcon::fromTheme(name); + if (ret.isNull()) { + for (QString alt_name : icon_prop.names) { + ret = QIcon::fromTheme(alt_name); + if (!ret.isNull()) break; + } } + if (ret.isNull()) qLog(Warning) << "Couldn't load icon" << name << "from system theme icons."; } if (!ret.isNull()) return ret; - qLog(Warning) << "Couldn't load icon" << name << "from system theme icons."; } if (custom_icons_) { diff --git a/src/core/iconmapper.h b/src/core/iconmapper.h index e1aa8db61..3bbf74819 100644 --- a/src/core/iconmapper.h +++ b/src/core/iconmapper.h @@ -26,10 +26,11 @@ namespace IconMapper { struct IconProperties { explicit IconProperties() : min_size(0), max_size(0) {} - IconProperties(const QStringList &_names, const int _min_size, const int _max_size) : names(_names), min_size(_min_size), max_size(_max_size) {} + IconProperties(const QStringList &_names, const int _min_size, const int _max_size, const bool _allow_system_icon = true) : names(_names), min_size(_min_size), max_size(_max_size), allow_system_icon(_allow_system_icon) {} QStringList names; int min_size; int max_size; + bool allow_system_icon; }; static const QMap iconmapper_ = { @@ -61,7 +62,7 @@ static const QMap iconmapper_ = { { "document-search", { {}, 0, 0 } }, { "download", { {"applications-internet", "network-workgroup"}, 0, 0 } }, { "edit-clear-list", { {}, 0, 0 } }, - { "edit-clear-locationbar-ltr", { {}, 0, 0 } }, + { "edit-clear-locationbar-ltr", { {}, 0, 0, false } }, { "edit-copy", { {}, 0, 0 } }, { "edit-delete", { {}, 0, 0 } }, { "edit-find", { {}, 0, 0 } },