From 26b149429b41f21c8acb6bcc2eebcb27de99d42a Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 8 Sep 2009 12:34:18 +0000 Subject: [PATCH] added Enable disable minimize to Tray feature when closing RetroShare git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1614 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/MainWindow.cpp | 23 +++++++++++++------ .../src/gui/settings/GeneralPage.cpp | 9 ++++++++ retroshare-gui/src/gui/settings/GeneralPage.h | 1 + .../src/gui/settings/GeneralPage.ui | 10 ++++++++ 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index b5df9562c..dcc063f7a 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -515,18 +515,27 @@ void MainWindow::closeEvent(QCloseEvent *e) { static bool firstTime = true; - if (trayIcon->isVisible()) { - if (firstTime) - { + if(!_settings->value(QString::fromUtf8("ClosetoTray"), false).toBool()) + { + if (trayIcon->isVisible()) { + if (firstTime) + { /***** QMessageBox::information(this, tr("RetroShare System tray"), tr("Application will continue running. Quit using context menu in the system tray")); *****/ firstTime = false; - } - hide(); - e->ignore(); - } + } + hide(); + e->ignore(); + } + } + else + { + rsicontrol->rsGlobalShutDown(); + qApp->quit(); + } + } diff --git a/retroshare-gui/src/gui/settings/GeneralPage.cpp b/retroshare-gui/src/gui/settings/GeneralPage.cpp index f279bc528..28444fec2 100755 --- a/retroshare-gui/src/gui/settings/GeneralPage.cpp +++ b/retroshare-gui/src/gui/settings/GeneralPage.cpp @@ -57,6 +57,8 @@ GeneralPage::save(QString &errmsg) _settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized()); _settings->setValue(QString::fromUtf8("doQuit"), quit()); + + _settings->setValue(QString::fromUtf8("ClosetoTray"), closetoTray()); _settings->setRunRetroshareOnBoot( ui.chkRunRetroshareAtSystemStartup->isChecked()); @@ -74,6 +76,8 @@ GeneralPage::load() ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool()); ui.checkQuit->setChecked(_settings->value(QString::fromUtf8("doQuit"), false).toBool()); + + ui.checkClosetoTray->setChecked(_settings->value(QString::fromUtf8("ClosetoTray"), false).toBool()); } @@ -87,6 +91,11 @@ bool GeneralPage::startMinimized() const { return ui.checkStartMinimized->isChecked(); } +bool GeneralPage::closetoTray() const { + if(ui.checkClosetoTray->isChecked()) return true; + return ui.checkClosetoTray->isChecked(); +} + /** Called when the "show on startup" checkbox is toggled. */ void GeneralPage::toggleShowOnStartup(bool checked) diff --git a/retroshare-gui/src/gui/settings/GeneralPage.h b/retroshare-gui/src/gui/settings/GeneralPage.h index 416e5117f..f68261f48 100755 --- a/retroshare-gui/src/gui/settings/GeneralPage.h +++ b/retroshare-gui/src/gui/settings/GeneralPage.h @@ -48,6 +48,7 @@ public: /** Loads the settings for this page */ void load(); bool startMinimized() const; + bool closetoTray() const; bool quit() const; diff --git a/retroshare-gui/src/gui/settings/GeneralPage.ui b/retroshare-gui/src/gui/settings/GeneralPage.ui index b693302a5..9471fef11 100755 --- a/retroshare-gui/src/gui/settings/GeneralPage.ui +++ b/retroshare-gui/src/gui/settings/GeneralPage.ui @@ -545,6 +545,16 @@ + + + + Do not Minimize to Tray Icon + + + true + + +