wpa_gui: More informative tray icon tool tip message
[mech_eap.git] / wpa_supplicant / wpa_gui-qt4 / wpagui.cpp
index e3dbbc3..09e547f 100644 (file)
@@ -1,27 +1,17 @@
 /*
  * wpa_gui - WpaGui class
- * Copyright (c) 2005-2010, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2005-2011, Jouni Malinen <j@w1.fi>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
  */
 
-#ifdef __MINGW32__
-/* Need to get getopt() */
-#include <unistd.h>
-#endif
-
 #ifdef CONFIG_NATIVE_WINDOWS
 #include <windows.h>
 #endif /* CONFIG_NATIVE_WINDOWS */
 
 #include <cstdio>
+#include <unistd.h>
 #include <QMessageBox>
 #include <QCloseEvent>
 #include <QImageReader>
@@ -46,6 +36,7 @@ WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags)
        : QMainWindow(parent), app(_app)
 {
        setupUi(this);
+       this->setWindowFlags(Qt::Dialog);
 
 #ifdef CONFIG_NATIVE_WINDOWS
        fileStopServiceAction = new QAction(this);
@@ -501,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;
@@ -548,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);
@@ -595,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)
@@ -719,17 +714,13 @@ void WpaGui::helpContents()
 void WpaGui::helpAbout()
 {
        QMessageBox::about(this, "wpa_gui for wpa_supplicant",
-                          "Copyright (c) 2003-2010,\n"
+                          "Copyright (c) 2003-2013,\n"
                           "Jouni Malinen <j@w1.fi>\n"
                           "and contributors.\n"
                           "\n"
-                          "This program is free software. You can\n"
-                          "distribute it and/or modify it under the terms "
-                          "of\n"
-                          "the GNU General Public License version 2.\n"
-                          "\n"
-                          "Alternatively, this software may be distributed\n"
-                          "under the terms of the BSD license.\n"
+                          "This software may be distributed under\n"
+                          "the terms of the BSD license.\n"
+                          "See README for more details.\n"
                           "\n"
                           "This product includes software developed\n"
                           "by the OpenSSL Project for use in the\n"
@@ -1284,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
@@ -1421,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) {