From 4f9da0cedcf1670c8b6530d9fc6d7375392e04b9 Mon Sep 17 00:00:00 2001 From: Krzysztof Date: Wed, 14 Jun 2023 20:43:05 +0200 Subject: [PATCH] feat: Fetch new articles after 'Read all' --- package/contents/config/main.xml | 3 +++ package/contents/ui/ConfigGeneral.qml | 6 ++++++ package/contents/ui/InoreaderModel.qml | 1 + package/contents/ui/Logic.qml | 9 ++++++++- package/contents/ui/StreamView.qml | 2 +- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/package/contents/config/main.xml b/package/contents/config/main.xml index 287623a..a2ba666 100644 --- a/package/contents/config/main.xml +++ b/package/contents/config/main.xml @@ -29,6 +29,9 @@ true + + false + true diff --git a/package/contents/ui/ConfigGeneral.qml b/package/contents/ui/ConfigGeneral.qml index f447572..f2e8360 100644 --- a/package/contents/ui/ConfigGeneral.qml +++ b/package/contents/ui/ConfigGeneral.qml @@ -12,6 +12,7 @@ Kirigami.FormLayout { property alias cfg_itemsDownloadLimit: itemsDownloadLimit.value property alias cfg_autoRead: autoRead.checked property alias cfg_fetchUnreadOnly: fetchUnreadOnly.checked + property alias cfg_readAndFetch: readAndFetch.checked signal configurationChanged @@ -78,6 +79,11 @@ Kirigami.FormLayout { Kirigami.FormData.label: i18n("Fetch unread only") } + CheckBox { + id: readAndFetch + Kirigami.FormData.label: i18n("Fetch articles after 'Read all'") + } + CheckBox { id: autoRead Kirigami.FormData.label: i18n("Automatically mark an article as read") diff --git a/package/contents/ui/InoreaderModel.qml b/package/contents/ui/InoreaderModel.qml index 7e925cd..8896f94 100644 --- a/package/contents/ui/InoreaderModel.qml +++ b/package/contents/ui/InoreaderModel.qml @@ -25,6 +25,7 @@ BaseObject { onSetArticleRead: _.setArticleRead(article, read) onSetAllArticlesRead: _.setAllArticlesRead(read) + onSetAllArticlesReadAndFetch: _.callPending(() => _.setAllArticlesRead(read).then(_.loadData), 'fetchStream') onSetArticleStarred: _.setArticleStarred(article, starred) } diff --git a/package/contents/ui/Logic.qml b/package/contents/ui/Logic.qml index 1f92489..f663741 100644 --- a/package/contents/ui/Logic.qml +++ b/package/contents/ui/Logic.qml @@ -10,6 +10,7 @@ QtObject { signal fetchStreamContinuation() signal setAllArticlesRead(bool read) + signal setAllArticlesReadAndFetch(bool read) signal setArticleRead(var article, bool read) signal setArticleStarred(var article, bool starred) @@ -52,7 +53,13 @@ QtObject { icon.name: "checkbox" text: i18n("Read all") onTriggered: setAllArticlesRead(true) - } + } + + readonly property Action readAllAndFetchAction: Action { + icon.name: "checkbox" + text: i18n("Read all and fetch") + onTriggered: setAllArticlesReadAndFetch(true) + } readonly property Action starAction: Action { readonly property var icons: ({ false: "non-starred-symbolic", true: "starred-symbolic" }) diff --git a/package/contents/ui/StreamView.qml b/package/contents/ui/StreamView.qml index 4e9fbd6..b30dfff 100644 --- a/package/contents/ui/StreamView.qml +++ b/package/contents/ui/StreamView.qml @@ -54,7 +54,7 @@ FocusScope { Layout.fillWidth: true } ToolButton { - action: logic.readAllAction + action: plasmoid.configuration.readAndFetch ? logic.readAllAndFetchAction : logic.readAllAction } ToolButton { action: logic.reloadAction