diff options
author | Kel Modderman <kel@otaku42.de> | 2008-10-01 09:48:11 +0300 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2008-10-01 09:48:11 +0300 |
commit | fc0db5c9163f12a1a6aea1520c8d68afc657edf2 (patch) | |
tree | 2aaf701c1ecd5baebe22fd0acbaf5aa3e5fd9de7 | |
parent | 66897ae779173065b45d6d0bdc0e931bfd43c225 (diff) | |
download | external_wpa_supplicant_8_ti-fc0db5c9163f12a1a6aea1520c8d68afc657edf2.zip external_wpa_supplicant_8_ti-fc0db5c9163f12a1a6aea1520c8d68afc657edf2.tar.gz external_wpa_supplicant_8_ti-fc0db5c9163f12a1a6aea1520c8d68afc657edf2.tar.bz2 |
wpa_gui-qt4: add support for starting in system tray only
Allow application to be started in the system tray only when started with
the `-t' command line argument.
Signed-off-by: Kel Modderman <kel@otaku42.de>
-rw-r--r-- | wpa_supplicant/doc/docbook/wpa_gui.sgml | 9 | ||||
-rw-r--r-- | wpa_supplicant/wpa_gui-qt4/main.cpp | 1 | ||||
-rw-r--r-- | wpa_supplicant/wpa_gui-qt4/wpagui.cpp | 24 | ||||
-rw-r--r-- | wpa_supplicant/wpa_gui-qt4/wpagui.h | 3 |
4 files changed, 27 insertions, 10 deletions
diff --git a/wpa_supplicant/doc/docbook/wpa_gui.sgml b/wpa_supplicant/doc/docbook/wpa_gui.sgml index 32bcee0..41b5849 100644 --- a/wpa_supplicant/doc/docbook/wpa_gui.sgml +++ b/wpa_supplicant/doc/docbook/wpa_gui.sgml @@ -16,6 +16,7 @@ <command>wpa_gui</command> <arg>-p <replaceable>path to ctrl sockets</replaceable></arg> <arg>-i <replaceable>ifname</replaceable></arg> + <arg>-t</arg> </cmdsynopsis> </refsynopsisdiv> @@ -48,6 +49,14 @@ configured. By default, choose the first interface found with a control socket in the socket path.</para></listitem> </varlistentry> + + <varlistentry> + <term>-t</term> + + <listitem><para>Start program in the system tray only (if the window + manager supports it). By default the main status window is + shown.</para></listitem> + </varlistentry> </variablelist> </refsect1> <refsect1> diff --git a/wpa_supplicant/wpa_gui-qt4/main.cpp b/wpa_supplicant/wpa_gui-qt4/main.cpp index 64aa7e9..2bc468e 100644 --- a/wpa_supplicant/wpa_gui-qt4/main.cpp +++ b/wpa_supplicant/wpa_gui-qt4/main.cpp @@ -32,7 +32,6 @@ int main(int argc, char *argv[]) } #endif /* CONFIG_NATIVE_WINDOWS */ - w.show(); ret = app.exec(); #ifdef CONFIG_NATIVE_WINDOWS diff --git a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp index 8715267..f4847c0 100644 --- a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp +++ b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp @@ -80,17 +80,20 @@ WpaGui::WpaGui(QWidget *parent, const char *, Qt::WFlags) scanres = NULL; udr = NULL; tray_icon = NULL; + startInTray = false; ctrl_iface = NULL; ctrl_conn = NULL; monitor_conn = NULL; msgNotifier = NULL; ctrl_iface_dir = strdup("/var/run/wpa_supplicant"); - if (QSystemTrayIcon::isSystemTrayAvailable()) - createTrayIcon(); - parse_argv(); + if (QSystemTrayIcon::isSystemTrayAvailable()) + createTrayIcon(startInTray); + else + show(); + textStatus->setText("connecting to wpa_supplicant"); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), SLOT(ping())); @@ -105,9 +108,6 @@ WpaGui::WpaGui(QWidget *parent, const char *, Qt::WFlags) updateStatus(); networkMayHaveChanged = true; updateNetworks(); - - if (tray_icon) - tray_icon->show(); } @@ -161,7 +161,7 @@ void WpaGui::parse_argv() { int c; for (;;) { - c = getopt(qApp->argc(), qApp->argv(), "i:p:"); + c = getopt(qApp->argc(), qApp->argv(), "i:p:t"); if (c < 0) break; switch (c) { @@ -173,6 +173,9 @@ void WpaGui::parse_argv() free(ctrl_iface_dir); ctrl_iface_dir = strdup(optarg); break; + case 't': + startInTray = true; + break; } } } @@ -1085,7 +1088,7 @@ void WpaGui::selectAdapter( const QString & sel ) } -void WpaGui::createTrayIcon() +void WpaGui::createTrayIcon(bool trayOnly) { QApplication::setQuitOnLastWindowClosed(false); @@ -1134,6 +1137,11 @@ void WpaGui::createTrayIcon() tray_menu->addAction(quitAction); tray_icon->setContextMenu(tray_menu); + + tray_icon->show(); + + if (!trayOnly) + show(); } diff --git a/wpa_supplicant/wpa_gui-qt4/wpagui.h b/wpa_supplicant/wpa_gui-qt4/wpagui.h index 3aead1e..45e878a 100644 --- a/wpa_supplicant/wpa_gui-qt4/wpagui.h +++ b/wpa_supplicant/wpa_gui-qt4/wpagui.h @@ -100,8 +100,9 @@ private: QAction *quitAction; QMenu *tray_menu; QSystemTrayIcon *tray_icon; - void createTrayIcon(); + void createTrayIcon(bool); bool ackTrayIcon; + bool startInTray; int openCtrlConnection(const char *ifname); }; |