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
This commit is contained in:
defnax 2009-09-08 12:34:18 +00:00
parent 700fd1d72f
commit 26b149429b
4 changed files with 36 additions and 7 deletions

View File

@ -515,18 +515,27 @@ void MainWindow::closeEvent(QCloseEvent *e)
{ {
static bool firstTime = true; static bool firstTime = true;
if (trayIcon->isVisible()) { if(!_settings->value(QString::fromUtf8("ClosetoTray"), false).toBool())
if (firstTime) {
{ if (trayIcon->isVisible()) {
if (firstTime)
{
/***** /*****
QMessageBox::information(this, tr("RetroShare System tray"), QMessageBox::information(this, tr("RetroShare System tray"),
tr("Application will continue running. Quit using context menu in the system tray")); tr("Application will continue running. Quit using context menu in the system tray"));
*****/ *****/
firstTime = false; firstTime = false;
} }
hide(); hide();
e->ignore(); e->ignore();
} }
}
else
{
rsicontrol->rsGlobalShutDown();
qApp->quit();
}
} }

View File

@ -57,6 +57,8 @@ GeneralPage::save(QString &errmsg)
_settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized()); _settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized());
_settings->setValue(QString::fromUtf8("doQuit"), quit()); _settings->setValue(QString::fromUtf8("doQuit"), quit());
_settings->setValue(QString::fromUtf8("ClosetoTray"), closetoTray());
_settings->setRunRetroshareOnBoot( _settings->setRunRetroshareOnBoot(
ui.chkRunRetroshareAtSystemStartup->isChecked()); ui.chkRunRetroshareAtSystemStartup->isChecked());
@ -74,6 +76,8 @@ GeneralPage::load()
ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool()); ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool());
ui.checkQuit->setChecked(_settings->value(QString::fromUtf8("doQuit"), 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(); 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. */ /** Called when the "show on startup" checkbox is toggled. */
void void
GeneralPage::toggleShowOnStartup(bool checked) GeneralPage::toggleShowOnStartup(bool checked)

View File

@ -48,6 +48,7 @@ public:
/** Loads the settings for this page */ /** Loads the settings for this page */
void load(); void load();
bool startMinimized() const; bool startMinimized() const;
bool closetoTray() const;
bool quit() const; bool quit() const;

View File

@ -545,6 +545,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkClosetoTray">
<property name="text">
<string>Do not Minimize to Tray Icon</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>