diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp index 3403f1a74..4447935fe 100755 --- a/src/gui/formmain.cpp +++ b/src/gui/formmain.cpp @@ -210,10 +210,6 @@ void FormMain::onAboutToQuit() { } } -bool FormMain::event(QEvent *event) { - return QMainWindow::event(event); -} - void FormMain::setupIcons() { IconThemeFactory *icon_theme_factory = IconThemeFactory::instance(); @@ -355,10 +351,12 @@ void FormMain::loadWebBrowserMenu(int index) { void FormMain::changeEvent(QEvent *event) { switch (event->type()) { case QEvent::WindowStateChange: { - if (SystemTrayIcon::isSystemTrayActivated()) { - if (this->windowState() & Qt::WindowMinimized) { - QTimer::singleShot(250, this, SLOT(hide())); - } + if (this->windowState() & Qt::WindowMinimized && + SystemTrayIcon::isSystemTrayActivated() && + Settings::instance()->value(APP_CFG_GUI, + "hide_when_minimized", + false).toBool()) { + QTimer::singleShot(250, this, SLOT(hide())); } break; diff --git a/src/gui/formmain.h b/src/gui/formmain.h index 758974097..5759784b6 100644 --- a/src/gui/formmain.h +++ b/src/gui/formmain.h @@ -54,7 +54,6 @@ class FormMain : public QMainWindow { // Event handler reimplementations. void changeEvent(QEvent *event); - bool event(QEvent *event); // Sets up proper icons for this widget. void setupIcons(); diff --git a/src/gui/formsettings.cpp b/src/gui/formsettings.cpp index 3bf7576ac..7868e281f 100755 --- a/src/gui/formsettings.cpp +++ b/src/gui/formsettings.cpp @@ -607,9 +607,6 @@ void FormSettings::loadInterface() { m_ui->m_radioTrayOff->setChecked(!settings->value(APP_CFG_GUI, "use_tray_icon", true).toBool()); - m_ui->m_checkHidden->setChecked(settings->value(APP_CFG_GUI, - "start_hidden", - false).toBool()); } // Tray icon is not supported on this machine. else { @@ -618,6 +615,13 @@ void FormSettings::loadInterface() { m_ui->m_grpTray->setDisabled(true); } + m_ui->m_checkHidden->setChecked(settings->value(APP_CFG_GUI, + "start_hidden", + false).toBool()); + m_ui->m_checkHideWhenMinimized->setChecked(settings->value(APP_CFG_GUI, + "hide_when_minimized", + false).toBool()); + // Load settings of icon theme. QString current_theme = IconThemeFactory::instance()->currentIconTheme(); @@ -715,8 +719,6 @@ void FormSettings::saveInterface() { if (SystemTrayIcon::isSystemTrayAvailable()) { settings->setValue(APP_CFG_GUI, "use_tray_icon", m_ui->m_radioTrayOn->isChecked()); - settings->setValue(APP_CFG_GUI, "start_hidden", - m_ui->m_checkHidden->isChecked()); if (settings->value(APP_CFG_GUI, "use_tray_icon", true).toBool()) { SystemTrayIcon::instance()->show(); FormMain::instance()->tabWidget()->feedMessageViewer()->feedsView()->notifyWithCounts(); @@ -727,6 +729,12 @@ void FormSettings::saveInterface() { } } + settings->setValue(APP_CFG_GUI, "start_hidden", + m_ui->m_checkHidden->isChecked()); + settings->setValue(APP_CFG_GUI, + "hide_when_minimized", + m_ui->m_checkHideWhenMinimized->isChecked()); + // Save selected icon theme. QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString(); QString original_icon_theme = IconThemeFactory::instance()->currentIconTheme(); diff --git a/src/gui/formsettings.ui b/src/gui/formsettings.ui index e582dbb61..bff35ae35 100644 --- a/src/gui/formsettings.ui +++ b/src/gui/formsettings.ui @@ -17,7 +17,7 @@ - 1 + 0 @@ -286,8 +286,8 @@ Authors of this application are NOT responsible for lost data. 0 0 - 100 - 30 + 564 + 363 @@ -364,8 +364,8 @@ Authors of this application are NOT responsible for lost data. 0 0 - 209 - 245 + 558 + 337 @@ -508,13 +508,20 @@ Authors of this application are NOT responsible for lost data. - + Start application hidden + + + + Hide main window when it is minimized + + + @@ -1229,5 +1236,21 @@ Authors of this application are NOT responsible for lost data. + + m_radioTrayOn + toggled(bool) + m_checkHideWhenMinimized + setEnabled(bool) + + + 515 + 94 + + + 357 + 117 + + +