From 3ca41ca9cc10f657d6620dc8d7ba3995e9216c52 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Thu, 9 Oct 2025 16:35:19 +0200 Subject: [PATCH] add markCurrentFeed toolbar item --- .../main/kotlin/de/unixwork/rssreader/App.kt | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/rss-application/src/main/kotlin/de/unixwork/rssreader/App.kt b/rss-application/src/main/kotlin/de/unixwork/rssreader/App.kt index 11bbf6a..784ab80 100644 --- a/rss-application/src/main/kotlin/de/unixwork/rssreader/App.kt +++ b/rss-application/src/main/kotlin/de/unixwork/rssreader/App.kt @@ -50,10 +50,27 @@ object App : Application { } } + fun markCurrentFeedAsRead() { + if(window?.feedList?.currentFeed != null) { + window?.feedList?.currentFeed?.unreadItemsCount = 0 + window?.feedList?.currentFeed?.items?.forEach { item -> + item.isRead = true + } + window?.feedList?.items?.update() + window?.updateCurrentFeedState() + GlobalScope.launch(Dispatchers.IO) { + Database.updateFeedReadState(window?.feedList?.currentFeed!!, true) + } + } + } + fun initToolbar() { toolbarItem(name = "reloadFeed", icon = "view-refresh") { event -> syncCurrent() } + toolbarItem(name = "markCurrentFeed", icon = "checkbox-checked") { event -> + markCurrentFeedAsRead() + } toolbarToggleItem(name = "starred", icon = "starred", varname = "starred") { event -> setBookmark(event.intValue == 1) @@ -68,17 +85,7 @@ object App : Application { } separator() menuItem(label = "Mark Current Feed as Read") { - if(window?.feedList?.currentFeed != null) { - window?.feedList?.currentFeed?.unreadItemsCount = 0 - window?.feedList?.currentFeed?.items?.forEach { item -> - item.isRead = true - } - window?.feedList?.items?.update() - window?.updateCurrentFeedState() - GlobalScope.launch(Dispatchers.IO) { - Database.updateFeedReadState(window?.feedList?.currentFeed!!, true) - } - } + markCurrentFeedAsRead() } menuItem(label = "Mark All as Read") { GlobalScope.launch(Dispatchers.IO) { @@ -98,6 +105,7 @@ object App : Application { } addToolbarDefault("reloadFeed", ToolbarPosition.LEFT) + addToolbarDefault("markCurrentFeed", ToolbarPosition.LEFT) addToolbarDefault("starred", ToolbarPosition.RIGHTPANEL_LEFT) } -- 2.47.3