wpa_gui-qt4: remove lastWindowClosed() signal handler
authorKel Modderman <kel@otaku42.de>
Thu, 25 Sep 2008 18:12:08 +0000 (21:12 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 25 Sep 2008 18:12:08 +0000 (21:12 +0300)
Do not connect lastWindowClosed() to quit(), instead explicitly close the
application if File->Exit or window manager close button is activated.
This allows the tray app to avoid being closed with last visible window,
and launch scan and event history windows individually.

Signed-off-by: Kel Modderman <kel@otaku42.de>
wpa_supplicant/wpa_gui-qt4/main.cpp
wpa_supplicant/wpa_gui-qt4/wpagui.cpp

index eeeda39..64aa7e9 100644 (file)
@@ -33,7 +33,6 @@ int main(int argc, char *argv[])
 #endif /* CONFIG_NATIVE_WINDOWS */
 
        w.show();
-       app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
        ret = app.exec();
 
 #ifdef CONFIG_NATIVE_WINDOWS
index ba11a83..dfec128 100644 (file)
@@ -595,9 +595,6 @@ void WpaGui::scan()
                delete scanres;
        }
 
-       if (!isVisible())
-               show();
-
        scanres = new ScanResults();
        if (scanres == NULL)
                return;
@@ -614,9 +611,6 @@ void WpaGui::eventHistory()
                delete eh;
        }
 
-       if (!isVisible())
-               show();
-
        eh = new EventHistory();
        if (eh == NULL)
                return;
@@ -1093,6 +1087,8 @@ void WpaGui::selectAdapter( const QString & sel )
 
 void WpaGui::createTrayIcon()
 {
+       QApplication::setQuitOnLastWindowClosed(false);
+
        tray_icon = new QSystemTrayIcon(this);
        tray_icon->setToolTip(qAppName() + " - wpa_supplicant user interface");
        tray_icon->setIcon(QIcon(":/icons/wpa_gui.svg"));
@@ -1219,10 +1215,7 @@ void WpaGui::showTrayStatus()
 
 void WpaGui::fileExit()
 {
-       if (tray_icon)
-               tray_icon->hide();
-
-       close();
+       qApp->quit();
 }
 
 
@@ -1267,5 +1260,5 @@ void WpaGui::closeEvent(QCloseEvent *event)
                return;
        }
 
-       event->accept();
+       qApp->quit();
 }