[PATCH] wpa_gui-qt4: remove lastWindowClosed() signal handler

Kel Modderman kel
Thu Sep 25 01:50:01 PDT 2008


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 at otaku42.de>
---
--- a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
@@ -595,9 +595,6 @@
 		delete scanres;
 	}
 
-	if (!isVisible())
-		show();
-
 	scanres = new ScanResults();
 	if (scanres == NULL)
 		return;
@@ -614,9 +611,6 @@
 		delete eh;
 	}
 
-	if (!isVisible())
-		show();
-
 	eh = new EventHistory();
 	if (eh == NULL)
 		return;
@@ -1093,6 +1087,8 @@
 
 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::fileExit()
 {
-	if (tray_icon)
-		tray_icon->hide();
-
-	close();
+	qApp->quit();
 }
 
 
@@ -1267,5 +1260,5 @@
 		return;
 	}
 
-	event->accept();
+	qApp->quit();
 }
--- a/wpa_supplicant/wpa_gui-qt4/main.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/main.cpp
@@ -33,7 +33,6 @@
 #endif /* CONFIG_NATIVE_WINDOWS */
 
 	w.show();
-	app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
 	ret = app.exec();
 
 #ifdef CONFIG_NATIVE_WINDOWS
---



More information about the Hostap mailing list