Skip to content

Commit 8953910

Browse files
committed
add option to have article marked automatically unread when its content/date is changed
1 parent 45f8b15 commit 8953910

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

src/librssguard/database/databasequeries.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,8 @@ UpdatedArticles DatabaseQueries::updateMessages(const QSqlDatabase& db,
18261826
(!ignore_contents_changes && message.m_contents != contents_existing_message);
18271827

18281828
if (cond_1 || cond_2 || cond_3 || force_update) {
1829-
if (!feed->getParentServiceRoot()->isSyncable()) {
1829+
if (!feed->getParentServiceRoot()->isSyncable() &&
1830+
qApp->settings()->value(GROUP(Messages), SETTING(Messages::MarkUnreadOnUpdated)).toBool()) {
18301831
// Feed is not syncable, thus we got RSS/JSON/whatever.
18311832
// Article is only updated, so we now prefer to keep original read state
18321833
// pretty much the same way starred state is kept.

src/librssguard/gui/settings/settingsfeedsmessages.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent
192192
&QComboBox::currentTextChanged,
193193
this,
194194
&SettingsFeedsMessages::dirtifySettings);
195+
connect(m_ui->m_cbUnreadWhenUpdated, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
195196

196197
connect(m_ui->m_cmbMessagesTimeFormat, &QComboBox::currentTextChanged, this, &SettingsFeedsMessages::dirtifySettings);
197198
connect(m_ui->m_cmbMessagesDateTimeFormatForDatesOnly,
@@ -294,6 +295,8 @@ void SettingsFeedsMessages::loadSettings() {
294295
m_ui->m_cbLegacyArticleFormatting->setVisible(false);
295296
}
296297

298+
m_ui->m_cbUnreadWhenUpdated
299+
->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::MarkUnreadOnUpdated)).toBool());
297300
m_ui->m_cmbArticleMarkingPolicy
298301
->setCurrentIndex(m_ui->m_cmbArticleMarkingPolicy->findData(settings()
299302
->value(GROUP(Messages),
@@ -414,6 +417,7 @@ void SettingsFeedsMessages::loadSettings() {
414417
void SettingsFeedsMessages::saveSettings() {
415418
onBeginSaveSettings();
416419

420+
settings()->setValue(GROUP(Messages), Messages::MarkUnreadOnUpdated, m_ui->m_cbUnreadWhenUpdated->isChecked());
417421
settings()->setValue(GROUP(Messages),
418422
Messages::ArticleMarkOnSelection,
419423
m_ui->m_cmbArticleMarkingPolicy->currentData().toInt());

src/librssguard/gui/settings/settingsfeedsmessages.ui

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@
301301
</property>
302302
</widget>
303303
</item>
304-
<item row="3" column="0" colspan="2">
304+
<item row="4" column="0" colspan="2">
305305
<widget class="QCheckBox" name="m_cbFixupArticleDatetime">
306306
<property name="text">
307307
<string>Fixup date/time of articles which are in the future</string>
@@ -421,13 +421,20 @@
421421
</property>
422422
</widget>
423423
</item>
424-
<item row="4" column="0" colspan="2">
424+
<item row="7" column="0" colspan="2">
425425
<widget class="QCheckBox" name="m_cbLegacyArticleFormatting">
426426
<property name="text">
427427
<string>Use legacy article formatting</string>
428428
</property>
429429
</widget>
430430
</item>
431+
<item row="3" column="0" colspan="2">
432+
<widget class="QCheckBox" name="m_cbUnreadWhenUpdated">
433+
<property name="text">
434+
<string>Mark existing article unread when its updated version is fetched from the feed</string>
435+
</property>
436+
</widget>
437+
</item>
431438
</layout>
432439
</widget>
433440
<widget class="QWidget" name="m_tabArticlesList">
@@ -738,6 +745,7 @@
738745
<tabstop>m_checkRemoveReadMessagesOnExit</tabstop>
739746
<tabstop>m_cbArticleViewerAlwaysVisible</tabstop>
740747
<tabstop>m_cmbIgnoreContentsChanges</tabstop>
748+
<tabstop>m_cbUnreadWhenUpdated</tabstop>
741749
<tabstop>m_cbFixupArticleDatetime</tabstop>
742750
<tabstop>m_checkBringToForegroundAfterMsgOpened</tabstop>
743751
<tabstop>m_cbShowEnclosuresDirectly</tabstop>

src/librssguard/miscellaneous/settings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ DVALUE(bool) Messages::ClearReadOnExitDef = false;
237237
DKEY Messages::IgnoreContentsChanges = "ignore_contents_changes";
238238
DVALUE(bool) Messages::IgnoreContentsChangesDef = true;
239239

240+
DKEY Messages::MarkUnreadOnUpdated = "mark_unread_on_update";
241+
DVALUE(bool) Messages::MarkUnreadOnUpdatedDef = false;
242+
240243
DKEY Messages::UnreadIconType = "unread_icons_in_message_list";
241244
DVALUE(int) Messages::UnreadIconTypeDef = 1; /* MessagesModel::MessageUnreadIcon::Dot */
242245

src/librssguard/miscellaneous/settings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ namespace Messages {
237237
KEY IgnoreContentsChanges;
238238
VALUE(bool) IgnoreContentsChangesDef;
239239

240+
KEY MarkUnreadOnUpdated;
241+
VALUE(bool) MarkUnreadOnUpdatedDef;
242+
240243
KEY UnreadIconType;
241244
VALUE(int) UnreadIconTypeDef;
242245

0 commit comments

Comments
 (0)