From: Olaf Wintermann Date: Thu, 9 Oct 2025 14:35:19 +0000 (+0200) Subject: add markCurrentFeed toolbar item X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=3ca41ca9cc10f657d6620dc8d7ba3995e9216c52;p=rssreader.git add markCurrentFeed toolbar item --- 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) }