[PATCH]: wpa_gui-qt4: use QCloseEvent handler to close children dialogs

Kel Modderman kel
Mon Jan 21 06:09:38 PST 2008


By implementing a custom QCloseEvent::closeEvent() handler, wpa_gui-qt4 can
close the scan, event history and user request dialogs via File->Exit and the
X on the titlebar.

The current mechanism only handles the closure of other dialogs via File->Exit.

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
@@ -18,6 +18,7 @@
 #endif
 
 #include <QMessageBox>
+#include <QCloseEvent>
 
 #include "wpagui.h"
 #include "dirent.h"
@@ -36,7 +37,7 @@
 	connect(helpContentsAction, SIGNAL(triggered()), this,
 		SLOT(helpContents()));
 	connect(helpAboutAction, SIGNAL(triggered()), this, SLOT(helpAbout()));
-	connect(fileExitAction, SIGNAL(triggered()), this, SLOT(exitApp()));
+	connect(fileExitAction, SIGNAL(triggered()), this, SLOT(close()));
 	connect(disconnectButton, SIGNAL(clicked()), this, SLOT(disconnect()));
 	connect(scanButton, SIGNAL(clicked()), this, SLOT(scan()));
 	connect(connectButton, SIGNAL(clicked()), this, SLOT(connectB()));
@@ -841,7 +842,7 @@
 }
 
 
-void WpaGui::exitApp()
+void WpaGui::closeEvent(QCloseEvent *event)
 {
 	if (eh) {
 		eh->close();
@@ -861,5 +862,5 @@
 		udr = NULL;
 	}
 
-	close();
+	event->accept();
 }
--- a/wpa_supplicant/wpa_gui-qt4/wpagui.h
+++ b/wpa_supplicant/wpa_gui-qt4/wpagui.h
@@ -55,10 +55,10 @@
 	virtual void disableAllNetworks();
 	virtual void saveConfig();
 	virtual void selectAdapter(const QString &sel);
-	virtual void exitApp();
 
 protected slots:
 	virtual void languageChange();
+	virtual void closeEvent(QCloseEvent *event);
 
 private:
 	ScanResults *scanres;
---



More information about the Hostap mailing list