diff --git a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp index 408e3876c..d2d76f169 100644 --- a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp +++ b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp @@ -1503,8 +1503,8 @@ void WpaGui::updateTrayIcon(TrayIconType type) if (!tray_icon || currentIconType == type) return; - QIcon icon; QIcon fallback_icon; + QStringList names; if (QImageReader::supportedImageFormats().contains(QByteArray("svg"))) fallback_icon = QIcon(":/icons/wpa_gui.svg"); @@ -1513,41 +1513,59 @@ void WpaGui::updateTrayIcon(TrayIconType type) switch (type) { case TrayIconOffline: - icon = QIcon::fromTheme("network-wireless-offline", - fallback_icon); + names << "network-wireless-offline-symbolic" + << "network-wireless-offline" + << "network-wireless-signal-none-symbolic" + << "network-wireless-signal-none"; break; case TrayIconAcquiring: - icon = QIcon::fromTheme("network-wireless-acquiring", - fallback_icon); + names << "network-wireless-acquiring-symbolic" + << "network-wireless-acquiring"; break; case TrayIconConnected: - icon = QIcon::fromTheme("network-wireless-connected", - fallback_icon); + names << "network-wireless-connected-symbolic" + << "network-wireless-connected"; break; case TrayIconSignalNone: - icon = QIcon::fromTheme("network-wireless-signal-none", - fallback_icon); + names << "network-wireless-signal-none-symbolic" + << "network-wireless-signal-none"; break; case TrayIconSignalWeak: - icon = QIcon::fromTheme("network-wireless-signal-weak", - fallback_icon); + names << "network-wireless-signal-weak-symbolic" + << "network-wireless-signal-weak"; break; case TrayIconSignalOk: - icon = QIcon::fromTheme("network-wireless-signal-ok", - fallback_icon); + names << "network-wireless-signal-ok-symbolic" + << "network-wireless-signal-ok"; break; case TrayIconSignalGood: - icon = QIcon::fromTheme("network-wireless-signal-good", - fallback_icon); + names << "network-wireless-signal-good-symbolic" + << "network-wireless-signal-good"; break; case TrayIconSignalExcellent: - icon = QIcon::fromTheme("network-wireless-signal-excellent", - fallback_icon); + names << "network-wireless-signal-excellent-symbolic" + << "network-wireless-signal-excellent"; break; } currentIconType = type; - tray_icon->setIcon(icon); + tray_icon->setIcon(loadThemedIcon(names, fallback_icon)); +} + + +QIcon WpaGui::loadThemedIcon(const QStringList &names, + const QIcon &fallback) +{ + QIcon icon; + + for (QStringList::ConstIterator it = names.begin(); + it != names.end(); it++) { + icon = QIcon::fromTheme(*it); + if (!icon.isNull()) + return icon; + } + + return fallback; } diff --git a/wpa_supplicant/wpa_gui-qt4/wpagui.h b/wpa_supplicant/wpa_gui-qt4/wpagui.h index c0de67b0d..58c655d71 100644 --- a/wpa_supplicant/wpa_gui-qt4/wpagui.h +++ b/wpa_supplicant/wpa_gui-qt4/wpagui.h @@ -85,6 +85,8 @@ public slots: virtual void showTrayStatus(); virtual void updateTrayIcon(TrayIconType type); virtual void updateTrayToolTip(const QString &msg); + virtual QIcon loadThemedIcon(const QStringList &names, + const QIcon &fallback); virtual void wpsDialog(); virtual void peersDialog(); virtual void tabChanged(int index);