wpa_gui: More informative tray icon tool tip message
authorArkadiusz (Arkq) Bokowy <arkadiusz.bokowy@gmail.com>
Sat, 6 Dec 2014 16:02:18 +0000 (17:02 +0100)
committerJouni Malinen <j@w1.fi>
Sun, 14 Dec 2014 15:23:43 +0000 (17:23 +0200)
Show associated network SSID in the tool tip message of the
application's tray icon. When network is not associated, then simple
"(not-associated)" message is shown.

Signed-off-by: Arkadiusz Bokowy <arkadiusz.bokowy@gmail.com>
wpa_supplicant/wpa_gui-qt4/wpagui.cpp
wpa_supplicant/wpa_gui-qt4/wpagui.h

index 91874d4..09e547f 100644 (file)
@@ -492,6 +492,7 @@ void WpaGui::updateStatus()
                textSsid->clear();
                textBssid->clear();
                textIpAddress->clear();
+               updateTrayToolTip(tr("no status information"));
 
 #ifdef CONFIG_NATIVE_WINDOWS
                static bool first = true;
@@ -539,6 +540,7 @@ void WpaGui::updateStatus()
                        } else if (strcmp(start, "ssid") == 0) {
                                ssid_updated = true;
                                textSsid->setText(pos);
+                               updateTrayToolTip(pos + tr(" (associated)"));
                        } else if (strcmp(start, "ip_address") == 0) {
                                ipaddr_updated = true;
                                textIpAddress->setText(pos);
@@ -586,8 +588,10 @@ void WpaGui::updateStatus()
                textStatus->clear();
        if (!auth_updated)
                textAuthentication->clear();
-       if (!ssid_updated)
+       if (!ssid_updated) {
                textSsid->clear();
+               updateTrayToolTip(tr("(not-associated)"));
+       }
        if (!bssid_updated)
                textBssid->clear();
        if (!ipaddr_updated)
@@ -1271,7 +1275,6 @@ void WpaGui::createTrayIcon(bool trayOnly)
        QApplication::setQuitOnLastWindowClosed(false);
 
        tray_icon = new QSystemTrayIcon(this);
-       tray_icon->setToolTip(qAppName() + tr(" - wpa_supplicant user interface"));
        if (QImageReader::supportedImageFormats().contains(QByteArray("svg")))
                tray_icon->setIcon(QIcon(":/icons/wpa_gui.svg"));
        else
@@ -1408,6 +1411,13 @@ void WpaGui::showTrayStatus()
 }
 
 
+void WpaGui::updateTrayToolTip(const QString &msg)
+{
+       if (tray_icon)
+               tray_icon->setToolTip(msg);
+}
+
+
 void WpaGui::closeEvent(QCloseEvent *event)
 {
        if (eh) {
index 340286c..33634ac 100644 (file)
@@ -70,6 +70,7 @@ public slots:
        virtual void showTrayMessage(QSystemTrayIcon::MessageIcon type,
                                     int sec, const QString &msg);
        virtual void showTrayStatus();
+       virtual void updateTrayToolTip(const QString &msg);
        virtual void wpsDialog();
        virtual void peersDialog();
        virtual void tabChanged(int index);