From: Olaf Wintermann Date: Tue, 5 May 2026 18:10:37 +0000 (+0200) Subject: implement contextmenu "Mark as read"/"Mark as unread" X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=7119615fb3f491b4a7ce51e22dd4664dd7511d04;p=rssreader.git implement contextmenu "Mark as read"/"Mark as unread" --- diff --git a/rss-application/src/main/kotlin/de/unixwork/rssreader/FeedList.kt b/rss-application/src/main/kotlin/de/unixwork/rssreader/FeedList.kt index 95fb68c..b77e8cb 100644 --- a/rss-application/src/main/kotlin/de/unixwork/rssreader/FeedList.kt +++ b/rss-application/src/main/kotlin/de/unixwork/rssreader/FeedList.kt @@ -218,4 +218,18 @@ class FeedList(window: MainWindow) : Document() { starred.setBooleanValue(star) } } + + fun updateCurrentReadStatus(read: Boolean) { + currentItem?.let { item -> + if (read == item.isRead) { + return + } + item.isRead = read + item.collection?.unreadItemsCount += if(read) -1 else 1 + GlobalScope.launch(Dispatchers.IO) { + Database.updateReadState(item, read) + } + items.update(items.selectedIndex) + } + } } \ No newline at end of file diff --git a/rss-application/src/main/kotlin/de/unixwork/rssreader/MainWindow.kt b/rss-application/src/main/kotlin/de/unixwork/rssreader/MainWindow.kt index 0c3951d..700ff19 100644 --- a/rss-application/src/main/kotlin/de/unixwork/rssreader/MainWindow.kt +++ b/rss-application/src/main/kotlin/de/unixwork/rssreader/MainWindow.kt @@ -40,10 +40,10 @@ class MainWindow() { feedList.bookmarkCurrentItem() } menuItem("Mark as read") { event -> - + feedList.updateCurrentReadStatus(true) } menuItem("Mark as unread") { event -> - + feedList.updateCurrentReadStatus(false) } menuItem("Open in browser") { event ->