wpa_gui-qt4: clean up closeEvent handler
When the system tray icon is created, qApp's setQuitOnLastWindowClosed property is set to false, therefore do _not_ ignore widget close events, or else wpa_gui will refuse to exit when the window manager is logging out. While at it, remove WpaGui::fileExit() and connect fileExitAction to quit(). Signed-off-by: Kel Modderman <kel@otaku42.de>
This commit is contained in:
parent
6241fcb165
commit
66897ae779
2 changed files with 6 additions and 20 deletions
|
@ -37,7 +37,7 @@ WpaGui::WpaGui(QWidget *parent, const char *, Qt::WFlags)
|
||||||
SLOT(eventHistory()));
|
SLOT(eventHistory()));
|
||||||
connect(fileSaveConfigAction, SIGNAL(triggered()), this,
|
connect(fileSaveConfigAction, SIGNAL(triggered()), this,
|
||||||
SLOT(saveConfig()));
|
SLOT(saveConfig()));
|
||||||
connect(fileExitAction, SIGNAL(triggered()), this, SLOT(fileExit()));
|
connect(fileExitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
|
||||||
connect(networkAddAction, SIGNAL(triggered()), this,
|
connect(networkAddAction, SIGNAL(triggered()), this,
|
||||||
SLOT(addNetwork()));
|
SLOT(addNetwork()));
|
||||||
connect(networkEditAction, SIGNAL(triggered()), this,
|
connect(networkEditAction, SIGNAL(triggered()), this,
|
||||||
|
@ -1214,11 +1214,6 @@ void WpaGui::showTrayStatus()
|
||||||
showTrayMessage(QSystemTrayIcon::Information, 10, msg);
|
showTrayMessage(QSystemTrayIcon::Information, 10, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WpaGui::fileExit()
|
|
||||||
{
|
|
||||||
qApp->quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void WpaGui::closeEvent(QCloseEvent *event)
|
void WpaGui::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
|
@ -1240,29 +1235,21 @@ void WpaGui::closeEvent(QCloseEvent *event)
|
||||||
udr = NULL;
|
udr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tray_icon && tray_icon->isVisible()) {
|
if (tray_icon && !ackTrayIcon) {
|
||||||
/* give user a visual hint that the tray icon exists */
|
/* give user a visual hint that the tray icon exists */
|
||||||
if (!ackTrayIcon && QSystemTrayIcon::supportsMessages()) {
|
if (QSystemTrayIcon::supportsMessages()) {
|
||||||
hide();
|
hide();
|
||||||
showTrayMessage(QSystemTrayIcon::Information, 3,
|
showTrayMessage(QSystemTrayIcon::Information, 3,
|
||||||
qAppName() + " will keep running in "
|
qAppName() + " will keep running in "
|
||||||
"the system tray.");
|
"the system tray.");
|
||||||
} else if (!ackTrayIcon) {
|
} else {
|
||||||
QMessageBox::information(this, qAppName() + " systray",
|
QMessageBox::information(this, qAppName() + " systray",
|
||||||
"The program will keep "
|
"The program will keep "
|
||||||
"running in the system "
|
"running in the system "
|
||||||
"tray.");
|
"tray.");
|
||||||
hide();
|
|
||||||
}
|
}
|
||||||
|
ackTrayIcon = true;
|
||||||
if (ackTrayIcon)
|
|
||||||
hide();
|
|
||||||
else
|
|
||||||
ackTrayIcon = true;
|
|
||||||
|
|
||||||
event->ignore();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qApp->quit();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ public slots:
|
||||||
virtual void parse_argv();
|
virtual void parse_argv();
|
||||||
virtual void updateStatus();
|
virtual void updateStatus();
|
||||||
virtual void updateNetworks();
|
virtual void updateNetworks();
|
||||||
virtual void fileExit();
|
|
||||||
virtual void helpIndex();
|
virtual void helpIndex();
|
||||||
virtual void helpContents();
|
virtual void helpContents();
|
||||||
virtual void helpAbout();
|
virtual void helpAbout();
|
||||||
|
|
Loading…
Reference in a new issue