Fix crash on missing icon

parent 8904948c
......@@ -574,7 +574,7 @@ void Bin::refreshIcons()
for (int i = 0; i < allMenus.count(); i++) {
QMenu *m = allMenus.at(i);
QIcon ic = m->icon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setIcon(newIcon);
}
......@@ -582,7 +582,7 @@ void Bin::refreshIcons()
for (int i = 0; i < allButtons.count(); i++) {
QToolButton *m = allButtons.at(i);
QIcon ic = m->icon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setIcon(newIcon);
}
......
......@@ -170,7 +170,7 @@ void EffectsListView::refreshIcons()
for (int i = 0; i < allMenus.count(); i++) {
QAction *m = allMenus.at(i);
QIcon ic = m->icon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setIcon(newIcon);
}
......@@ -178,7 +178,7 @@ void EffectsListView::refreshIcons()
for (int i = 0; i < allButtons.count(); i++) {
QToolButton *m = allButtons.at(i);
QIcon ic = m->icon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setIcon(newIcon);
}
......
......@@ -104,7 +104,7 @@ void EffectStackView2::refreshIcons()
for (int i = 0; i < allMenus.count(); i++) {
QAction *m = allMenus.at(i);
QIcon ic = m->icon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setIcon(newIcon);
}
......@@ -112,7 +112,7 @@ void EffectStackView2::refreshIcons()
for (int i = 0; i < allButtons.count(); i++) {
QToolButton *m = allButtons.at(i);
QIcon ic = m->icon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setIcon(newIcon);
}
......
......@@ -344,7 +344,7 @@ void Monitor::refreshIcons()
for (int i = 0; i < allMenus.count(); i++) {
QAction *m = allMenus.at(i);
QIcon ic = m->icon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setIcon(newIcon);
}
......@@ -352,11 +352,11 @@ void Monitor::refreshIcons()
for (int i = 0; i < allButtons.count(); i++) {
KDualAction *m = allButtons.at(i);
QIcon ic = m->activeIcon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setActiveIcon(newIcon);
ic = m->inactiveIcon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
newIcon = KoIconUtils::themedIcon(ic.name());
m->setInactiveIcon(newIcon);
}
......
......@@ -425,7 +425,7 @@ void MonitorManager::refreshIcons()
for (int i = 0; i < allMenus.count(); i++) {
QAction *m = allMenus.at(i);
QIcon ic = m->icon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setIcon(newIcon);
}
......
......@@ -83,7 +83,7 @@ void TransitionSettings::refreshIcons()
for (int i = 0; i < allMenus.count(); i++) {
QAction *m = allMenus.at(i);
QIcon ic = m->icon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setIcon(newIcon);
}
......@@ -91,7 +91,7 @@ void TransitionSettings::refreshIcons()
for (int i = 0; i < allButtons.count(); i++) {
QToolButton *m = allButtons.at(i);
QIcon ic = m->icon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setIcon(newIcon);
}
......
......@@ -821,7 +821,7 @@ void Timeline::refreshIcons()
for (int i = 0; i < allMenus.count(); i++) {
QAction *m = allMenus.at(i);
QIcon ic = m->icon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setIcon(newIcon);
}
......@@ -829,11 +829,11 @@ void Timeline::refreshIcons()
for (int i = 0; i < allButtons.count(); i++) {
KDualAction *m = allButtons.at(i);
QIcon ic = m->activeIcon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
QIcon newIcon = KoIconUtils::themedIcon(ic.name());
m->setActiveIcon(newIcon);
ic = m->inactiveIcon();
if (ic.isNull()) continue;
if (ic.isNull() || ic.name().isEmpty()) continue;
newIcon = KoIconUtils::themedIcon(ic.name());
m->setInactiveIcon(newIcon);
}
......
......@@ -30,11 +30,11 @@ namespace KoIconUtils
{
QIcon themedIcon(const QString &name) {
QString realName;
// try load themed icon
if (name.isEmpty()) return QIcon();
QColor background = qApp->palette().window().color();
bool useDarkIcons = background.value() < 100;
QString realName;
const char * const prefix = useDarkIcons ? "dk_" : "lt_";
if (name.at(2) == '_') {
realName = name.mid(3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment