summaryrefslogtreecommitdiff
path: root/client/ProxyClientApp.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2012-03-24 09:21:01 +0200
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2012-03-24 09:21:01 +0200
commita1bb0a81f13df7868fcec2c00ff58a123fcd37b4 (patch)
tree6cf6ca00aadc1da507b957eb46c4b87285a3c107 /client/ProxyClientApp.cpp
parent1a0baf7f15d744103674f594343eb74c778dcf4d (diff)
parent23f69b08e46c6101cbcba2f8c9592aa14bf1dccd (diff)
Merge branch 'master' of ssh://sss.chaoslab.ru//home/private_git/proxy_ui
Diffstat (limited to 'client/ProxyClientApp.cpp')
-rw-r--r--client/ProxyClientApp.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/client/ProxyClientApp.cpp b/client/ProxyClientApp.cpp
index e111001..c20d232 100644
--- a/client/ProxyClientApp.cpp
+++ b/client/ProxyClientApp.cpp
@@ -2,7 +2,6 @@
#include <QtGui>
#include "client.h"
-#include "Dialog.h"
#include "Proxifier.h"
#include "ProxyClientApp.h"
#include "UpdatedConfig.h"
@@ -10,7 +9,9 @@
using namespace std;
ProxyClientApp::ProxyClientApp(int &argc, char *argv[]): QApplication(argc, argv)
-{
+{
+ dialog = NULL;
+
/* initiates UpdatedConfig singleton that start sending configuration requests */
UpdatedConfig *cfg = UpdatedConfig::CurrentConfig();
connect(cfg, SIGNAL(updated()),
@@ -73,17 +74,28 @@ ProxyClientApp::ProxyClientApp(int &argc, char *argv[]): QApplication(argc, argv
void ProxyClientApp::trayActivated(QSystemTrayIcon::ActivationReason reason)
{
- if (reason == QSystemTrayIcon::Trigger)
+ if (reason != QSystemTrayIcon::Trigger)
{
- showProxyDialog();
- }
+ return;
+ }
+
+ if (dialog == NULL)
+ {
+ showProxyDialog();
+ }
+ else
+ {
+ dialog->reject();
+ delete dialog;
+ dialog = NULL;
+ }
}
void ProxyClientApp::showProxyDialog()
{
- Logger::Trace("Creating proxy dialog.\n");
- ProxyDialog *dialog = new ProxyDialog();
- dialog->show();
+ dialog = new ProxyDialog();
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ dialog->show();
}
void ProxyClientApp::configUpdated()