From a74bdbd723ca5d7f67423425391d845bbe19e7d0 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Fri, 8 Jan 2021 22:41:03 +0100 Subject: [PATCH] Make #304 switchable. --- resources/scripts/7za | 2 +- src/librssguard/gui/messagesview.cpp | 8 ++++-- .../gui/settings/settingsfeedsmessages.cpp | 5 ++++ .../gui/settings/settingsfeedsmessages.ui | 28 ++++++++++++------- src/librssguard/gui/settings/settingsgui.cpp | 2 +- src/librssguard/miscellaneous/settings.cpp | 3 ++ src/librssguard/miscellaneous/settings.h | 3 ++ 7 files changed, 36 insertions(+), 15 deletions(-) diff --git a/resources/scripts/7za b/resources/scripts/7za index 47f412575..9c10723bf 160000 --- a/resources/scripts/7za +++ b/resources/scripts/7za @@ -1 +1 @@ -Subproject commit 47f4125753452eff8800dbd6600c5a05540b15d9 +Subproject commit 9c10723bfbaf6cb85107d6ee16e0324e9e487749 diff --git a/src/librssguard/gui/messagesview.cpp b/src/librssguard/gui/messagesview.cpp index c706aa8f7..7f328c9ec 100644 --- a/src/librssguard/gui/messagesview.cpp +++ b/src/librssguard/gui/messagesview.cpp @@ -393,9 +393,11 @@ void MessagesView::openSelectedSourceMessagesExternally() { QTimer::singleShot(0, this, &MessagesView::markSelectedMessagesRead); } - QTimer::singleShot(1000, this, []() { - qApp->mainForm()->display(); - }); + if (qApp->settings()->value(GROUP(Messages), SETTING(Messages::BringAppToFrontAfterMessageOpenedExternally)).toBool()) { + QTimer::singleShot(1000, this, []() { + qApp->mainForm()->display(); + }); + } } void MessagesView::openSelectedMessagesInternally() { diff --git a/src/librssguard/gui/settings/settingsfeedsmessages.cpp b/src/librssguard/gui/settings/settingsfeedsmessages.cpp index ca3d0287c..4614f78d5 100644 --- a/src/librssguard/gui/settings/settingsfeedsmessages.cpp +++ b/src/librssguard/gui/settings/settingsfeedsmessages.cpp @@ -43,6 +43,7 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent connect(m_ui->m_checkKeppMessagesInTheMiddle, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings); connect(m_ui->m_checkMessagesDateTimeFormat, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings); connect(m_ui->m_checkRemoveReadMessagesOnExit, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings); + connect(m_ui->m_checkBringToForegroundAfterMsgOpened, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings); connect(m_ui->m_checkUpdateAllFeedsOnStartup, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings); connect(m_ui->m_spinAutoUpdateInterval, static_cast(&QDoubleSpinBox::valueChanged), this, &SettingsFeedsMessages::dirtifySettings); @@ -123,6 +124,8 @@ void SettingsFeedsMessages::loadSettings() { m_ui->m_spinHeightRowsMessages->setValue(settings()->value(GROUP(GUI), SETTING(GUI::HeightRowMessages)).toInt()); m_ui->m_spinHeightRowsFeeds->setValue(settings()->value(GROUP(GUI), SETTING(GUI::HeightRowFeeds)).toInt()); + m_ui->m_checkBringToForegroundAfterMsgOpened->setChecked(settings()->value(GROUP(Messages), + SETTING(Messages::BringAppToFrontAfterMessageOpenedExternally)).toBool()); m_ui->m_checkAutoUpdateNotification->setChecked(settings()->value(GROUP(Feeds), SETTING(Feeds::EnableAutoUpdateNotification)).toBool()); m_ui->m_checkKeppMessagesInTheMiddle->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::KeepCursorInCenter)).toBool()); m_ui->m_checkRemoveReadMessagesOnExit->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::ClearReadOnExit)).toBool()); @@ -179,6 +182,8 @@ void SettingsFeedsMessages::saveSettings() { settings()->setValue(GROUP(GUI), GUI::HeightRowMessages, m_ui->m_spinHeightRowsMessages->value()); settings()->setValue(GROUP(GUI), GUI::HeightRowFeeds, m_ui->m_spinHeightRowsFeeds->value()); + settings()->setValue(GROUP(Messages), Messages::BringAppToFrontAfterMessageOpenedExternally, + m_ui->m_checkBringToForegroundAfterMsgOpened->isChecked()); settings()->setValue(GROUP(Feeds), Feeds::EnableAutoUpdateNotification, m_ui->m_checkAutoUpdateNotification->isChecked()); settings()->setValue(GROUP(Messages), Messages::KeepCursorInCenter, m_ui->m_checkKeppMessagesInTheMiddle->isChecked()); settings()->setValue(GROUP(Messages), Messages::ClearReadOnExit, m_ui->m_checkRemoveReadMessagesOnExit->isChecked()); diff --git a/src/librssguard/gui/settings/settingsfeedsmessages.ui b/src/librssguard/gui/settings/settingsfeedsmessages.ui index 22d0c7f29..d6def6c33 100644 --- a/src/librssguard/gui/settings/settingsfeedsmessages.ui +++ b/src/librssguard/gui/settings/settingsfeedsmessages.ui @@ -6,7 +6,7 @@ 0 0 - 651 + 788 497 @@ -50,7 +50,7 @@ 250 - 0 + 28 @@ -201,7 +201,7 @@ 250 - 0 + 28 @@ -266,14 +266,14 @@ - + Keep message selection in the middle of the message list viewport - + @@ -297,7 +297,7 @@ - + @@ -321,7 +321,7 @@ - + Use custom date/time format (overrides format loaded from active localization) @@ -334,10 +334,10 @@ - + - + @@ -393,7 +393,7 @@ - + Qt::Vertical @@ -406,6 +406,13 @@ + + + + Bring application window to front once message is opened in external web browser + + + @@ -433,6 +440,7 @@ m_cmbCountsFeedList m_checkRemoveReadMessagesOnExit m_checkDisplayPlaceholders + m_checkBringToForegroundAfterMsgOpened m_checkKeppMessagesInTheMiddle m_spinHeightRowsMessages m_spinHeightImageAttachments diff --git a/src/librssguard/gui/settings/settingsgui.cpp b/src/librssguard/gui/settings/settingsgui.cpp index 0750dacc5..6f89d9c44 100755 --- a/src/librssguard/gui/settings/settingsgui.cpp +++ b/src/librssguard/gui/settings/settingsgui.cpp @@ -48,7 +48,7 @@ SettingsGui::SettingsGui(Settings* settings, QWidget* parent) : SettingsPanel(se connect(m_ui->m_checkHideWhenMinimized, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings); connect(m_ui->m_checkHideTabBarIfOneTabVisible, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings); connect(m_ui->m_checkCloseTabsDoubleClick, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings); - connect(m_ui->m_checkCloseTabsMiddleClick, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings); + connect(m_ui->m_checkCloseTabsMiddleClick, &QCheckBox::toggled, thi s, &SettingsGui::dirtifySettings); connect(m_ui->m_checkNewTabDoubleClick, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings); connect(m_ui->m_grbCloseTabs, &QGroupBox::toggled, this, &SettingsGui::dirtifySettings); connect(m_ui->m_cmbToolbarButtonStyle, static_cast(&QComboBox::currentIndexChanged), this, diff --git a/src/librssguard/miscellaneous/settings.cpp b/src/librssguard/miscellaneous/settings.cpp index 93e0eed64..bc722bbc1 100755 --- a/src/librssguard/miscellaneous/settings.cpp +++ b/src/librssguard/miscellaneous/settings.cpp @@ -91,6 +91,9 @@ DVALUE(char*) Messages::CustomDateFormatDef = ""; DKEY Messages::ClearReadOnExit = "clear_read_on_exit"; DVALUE(bool) Messages::ClearReadOnExitDef = false; +DKEY Messages::BringAppToFrontAfterMessageOpenedExternally = "bring_app_to_front_after_msg_opened"; +DVALUE(bool) Messages::BringAppToFrontAfterMessageOpenedExternallyDef = true; + DKEY Messages::KeepCursorInCenter = "keep_cursor_center"; DVALUE(bool) Messages::KeepCursorInCenterDef = false; diff --git a/src/librssguard/miscellaneous/settings.h b/src/librssguard/miscellaneous/settings.h index 8504fa72f..0e9db8a8e 100644 --- a/src/librssguard/miscellaneous/settings.h +++ b/src/librssguard/miscellaneous/settings.h @@ -112,6 +112,9 @@ namespace Messages { KEY ClearReadOnExit; VALUE(bool) ClearReadOnExitDef; + KEY BringAppToFrontAfterMessageOpenedExternally; + VALUE(bool) BringAppToFrontAfterMessageOpenedExternallyDef; + KEY KeepCursorInCenter; VALUE(bool) KeepCursorInCenterDef;