wpa_gui: Quiet mode - disable tray icon messages

If tray icon messages are perceived as disturbing, one can pass `-q`
parameter on the command line to disable them permanently.

Signed-off-by: Arkadiusz Bokowy <arkadiusz.bokowy@gmail.com>
This commit is contained in:
Arkadiusz (Arkq) Bokowy 2014-12-06 17:05:09 +01:00 committed by Jouni Malinen
parent 2087b64fef
commit 7b244d577a
2 changed files with 7 additions and 2 deletions

View file

@ -130,6 +130,7 @@ WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags)
udr = NULL; udr = NULL;
tray_icon = NULL; tray_icon = NULL;
startInTray = false; startInTray = false;
quietMode = false;
ctrl_iface = NULL; ctrl_iface = NULL;
ctrl_conn = NULL; ctrl_conn = NULL;
monitor_conn = NULL; monitor_conn = NULL;
@ -234,7 +235,7 @@ void WpaGui::parse_argv()
{ {
int c; int c;
for (;;) { for (;;) {
c = getopt(qApp->argc(), qApp->argv(), "i:p:t"); c = getopt(qApp->argc(), qApp->argv(), "i:p:tq");
if (c < 0) if (c < 0)
break; break;
switch (c) { switch (c) {
@ -249,6 +250,9 @@ void WpaGui::parse_argv()
case 't': case 't':
startInTray = true; startInTray = true;
break; break;
case 'q':
quietMode = true;
break;
} }
} }
} }
@ -1336,7 +1340,7 @@ void WpaGui::showTrayMessage(QSystemTrayIcon::MessageIcon type, int sec,
if (!QSystemTrayIcon::supportsMessages()) if (!QSystemTrayIcon::supportsMessages())
return; return;
if (isVisible() || !tray_icon || !tray_icon->isVisible()) if (isVisible() || !tray_icon || !tray_icon->isVisible() || quietMode)
return; return;
tray_icon->showMessage(qAppName(), msg, type, sec * 1000); tray_icon->showMessage(qAppName(), msg, type, sec * 1000);

View file

@ -117,6 +117,7 @@ private:
void createTrayIcon(bool); void createTrayIcon(bool);
bool ackTrayIcon; bool ackTrayIcon;
bool startInTray; bool startInTray;
bool quietMode;
int openCtrlConnection(const char *ifname); int openCtrlConnection(const char *ifname);