[pkg-wpa-devel] r1308 - in /wpasupplicant/trunk/debian: changelog patches/11_wpa_gui_qt4_qsession.patch patches/series

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Sun Jan 18 16:31:18 UTC 2009


Author: kelmo-guest
Date: Sun Jan 18 16:31:17 2009
New Revision: 1308

URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1308
Log:
Add debian/patches/11_wpa_gui_qt4_qsession.patch to enhance wpa_gui
with session saving support.

Added:
    wpasupplicant/trunk/debian/patches/11_wpa_gui_qt4_qsession.patch
Modified:
    wpasupplicant/trunk/debian/changelog
    wpasupplicant/trunk/debian/patches/series

Modified: wpasupplicant/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/changelog?rev=1308&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/changelog (original)
+++ wpasupplicant/trunk/debian/changelog Sun Jan 18 16:31:17 2009
@@ -9,8 +9,10 @@
     debian/patches/01_use_pkg-config_for_pcsc-lite_module.patch.
   * Add debian/patches/10_wpa_gui_qt4_wps_tab_cleanups.patch to cleanup
     a couple of minor glitches with new wpa_gui-qt4 WPS additions.
-
- -- Kel Modderman <kel at otaku42.de>  Sun, 11 Jan 2009 22:42:03 +1000
+  * Add debian/patches/11_wpa_gui_qt4_qsession.patch to enhance wpa_gui
+    with session saving support.
+
+ -- Kel Modderman <kel at otaku42.de>  Sun, 18 Jan 2009 00:50:51 +1000
 
 wpasupplicant (0.6.6-2) experimental; urgency=low
 

Added: wpasupplicant/trunk/debian/patches/11_wpa_gui_qt4_qsession.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/patches/11_wpa_gui_qt4_qsession.patch?rev=1308&op=file
==============================================================================
--- wpasupplicant/trunk/debian/patches/11_wpa_gui_qt4_qsession.patch (added)
+++ wpasupplicant/trunk/debian/patches/11_wpa_gui_qt4_qsession.patch Sun Jan 18 16:31:17 2009
@@ -1,0 +1,162 @@
+From: Jouni Malinen <j at w1.fi>
+Date: Sat, 17 Jan 2009 11:45:05 +0000 (+0200)
+Subject: Save and restore wpa_gui state when session manager restarts the app
+X-Git-Url: http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff_plain;h=a5da9c64c9072408f6c736dd666052116d0e6779
+
+Save and restore wpa_gui state when session manager restarts the app
+
+This makes wpa_gui remember whether it was only in the tray when the
+session was terminated and starts only in the tray if session manager
+restarts it automatically.
+---
+
+--- a/wpa_supplicant/wpa_gui-qt4/main.cpp
++++ b/wpa_supplicant/wpa_gui-qt4/main.cpp
+@@ -18,10 +18,32 @@
+ #include <QApplication>
+ #include "wpagui.h"
+ 
++
++class WpaGuiApp : public QApplication
++{
++public:
++	WpaGuiApp(int &argc, char **argv);
++
++	virtual void saveState(QSessionManager &manager);
++
++	WpaGui *w;
++};
++
++WpaGuiApp::WpaGuiApp(int &argc, char **argv) : QApplication(argc, argv)
++{
++}
++
++void WpaGuiApp::saveState(QSessionManager &manager)
++{
++	QApplication::saveState(manager);
++	w->saveState();
++}
++
++
+ int main(int argc, char *argv[])
+ {
+-	QApplication app(argc, argv);
+-	WpaGui w;
++	WpaGuiApp app(argc, argv);
++	WpaGui w(&app);
+ 	int ret;
+ 
+ #ifdef CONFIG_NATIVE_WINDOWS
+@@ -32,6 +54,8 @@ int main(int argc, char *argv[])
+ 	}
+ #endif /* CONFIG_NATIVE_WINDOWS */
+ 
++	app.w = &w;
++
+ 	ret = app.exec();
+ 
+ #ifdef CONFIG_NATIVE_WINDOWS
+--- a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
++++ b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
+@@ -25,6 +25,7 @@
+ #include <QMessageBox>
+ #include <QCloseEvent>
+ #include <QImageReader>
++#include <QSettings>
+ 
+ #include "wpagui.h"
+ #include "dirent.h"
+@@ -41,8 +42,8 @@ static int wpagui_printf(const char *, .
+ }
+ #endif
+ 
+-WpaGui::WpaGui(QWidget *parent, const char *, Qt::WFlags)
+-	: QMainWindow(parent)
++WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags)
++	: QMainWindow(parent), app(_app)
+ {
+ 	setupUi(this);
+ 
+@@ -137,6 +138,15 @@ WpaGui::WpaGui(QWidget *parent, const ch
+ 
+ 	parse_argv();
+ 
++	if (app->isSessionRestored()) {
++		QSettings settings("wpa_supplicant", "wpa_gui");
++		settings.beginGroup("state");
++		if (app->sessionId().compare(settings.value("session_id").
++					     toString()) == 0)
++			startInTray = settings.value("in_tray").toBool();
++		settings.endGroup();
++	}
++
+ 	if (QSystemTrayIcon::isSystemTrayAvailable())
+ 		createTrayIcon(startInTray);
+ 	else
+@@ -1294,6 +1304,7 @@ void WpaGui::createTrayIcon(bool trayOnl
+ 
+ 	if (!trayOnly)
+ 		show();
++	inTray = trayOnly;
+ }
+ 
+ 
+@@ -1317,10 +1328,13 @@ void WpaGui::trayActivated(QSystemTrayIc
+ 	 * custom closeEvent handler take care of children */
+ 	case QSystemTrayIcon::Trigger:
+ 		ackTrayIcon = true;
+-		if (isVisible())
++		if (isVisible()) {
+ 			close();
+-		else
++			inTray = true;
++		} else {
+ 			show();
++			inTray = false;
++		}
+ 		break;
+ 	case QSystemTrayIcon::MiddleClick:
+ 		showTrayStatus();
+@@ -1664,3 +1678,13 @@ void WpaGui::addInterface()
+ 	add_iface->show();
+ 	add_iface->exec();
+ }
++
++
++void WpaGui::saveState()
++{
++	QSettings settings("wpa_supplicant", "wpa_gui");
++	settings.beginGroup("state");
++	settings.setValue("session_id", app->sessionId());
++	settings.setValue("in_tray", inTray);
++	settings.endGroup();
++}
+--- a/wpa_supplicant/wpa_gui-qt4/wpagui.h
++++ b/wpa_supplicant/wpa_gui-qt4/wpagui.h
+@@ -28,7 +28,7 @@ class WpaGui : public QMainWindow, publi
+ 	Q_OBJECT
+ 
+ public:
+-	WpaGui(QWidget *parent = 0, const char *name = 0,
++	WpaGui(QApplication *app, QWidget *parent = 0, const char *name = 0,
+ 	       Qt::WFlags fl = 0);
+ 	~WpaGui();
+ 
+@@ -40,6 +40,7 @@ public:
+ 	virtual void disableNetwork(const QString &sel);
+ 	virtual int getNetworkDisabled(const QString &sel);
+ 	void setBssFromScan(const QString &bssid);
++	void saveState();
+ 
+ public slots:
+ 	virtual void parse_argv();
+@@ -136,6 +137,9 @@ private:
+ 	AddInterface *add_iface;
+ 
+ 	bool connectedToService;
++
++	QApplication *app;
++	bool inTray;
+ };
+ 
+ #endif /* WPAGUI_H */

Modified: wpasupplicant/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/patches/series?rev=1308&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/patches/series (original)
+++ wpasupplicant/trunk/debian/patches/series Sun Jan 18 16:31:17 2009
@@ -5,3 +5,4 @@
 05_qmake_version_makefile.patch
 06_wpa_gui_menu_exec_path.patch
 10_wpa_gui_qt4_wps_tab_cleanups.patch
+11_wpa_gui_qt4_qsession.patch




More information about the Pkg-wpa-devel mailing list