Dont use system icon for clear search field icon

Fixes #413
This commit is contained in:
Jonas Kvinge 2020-04-27 00:24:49 +02:00
parent 2732536d6e
commit 627a2ef6dd
2 changed files with 11 additions and 8 deletions

View File

@ -69,15 +69,17 @@ QIcon IconLoader::Load(const QString &name, const int size) {
if (IconMapper::iconmapper_.contains(name)) { if (IconMapper::iconmapper_.contains(name)) {
icon_prop = IconMapper::iconmapper_[name]; icon_prop = IconMapper::iconmapper_[name];
} }
ret = QIcon::fromTheme(name); if (icon_prop.allow_system_icon) {
if (ret.isNull()) { ret = QIcon::fromTheme(name);
for (QString alt_name : icon_prop.names) { if (ret.isNull()) {
ret = QIcon::fromTheme(alt_name); for (QString alt_name : icon_prop.names) {
if (!ret.isNull()) break; 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; if (!ret.isNull()) return ret;
qLog(Warning) << "Couldn't load icon" << name << "from system theme icons.";
} }
if (custom_icons_) { if (custom_icons_) {

View File

@ -26,10 +26,11 @@ namespace IconMapper {
struct IconProperties { struct IconProperties {
explicit IconProperties() : min_size(0), max_size(0) {} 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; QStringList names;
int min_size; int min_size;
int max_size; int max_size;
bool allow_system_icon;
}; };
static const QMap<QString, IconProperties> iconmapper_ = { static const QMap<QString, IconProperties> iconmapper_ = {
@ -61,7 +62,7 @@ static const QMap<QString, IconProperties> iconmapper_ = {
{ "document-search", { {}, 0, 0 } }, { "document-search", { {}, 0, 0 } },
{ "download", { {"applications-internet", "network-workgroup"}, 0, 0 } }, { "download", { {"applications-internet", "network-workgroup"}, 0, 0 } },
{ "edit-clear-list", { {}, 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-copy", { {}, 0, 0 } },
{ "edit-delete", { {}, 0, 0 } }, { "edit-delete", { {}, 0, 0 } },
{ "edit-find", { {}, 0, 0 } }, { "edit-find", { {}, 0, 0 } },