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.
This commit is contained in:
parent
6fa68a0ee5
commit
a5da9c64c9
3 changed files with 59 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue