From: Olaf Wintermann Date: Wed, 3 Sep 2025 17:03:15 +0000 (+0200) Subject: small item state improvements X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=ff021b7980e3ec35c1b9760edff407407e24895f;p=rssreader.git small item state improvements --- 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 ff8e1de..770e584 100644 --- a/rss-application/src/main/kotlin/de/unixwork/rssreader/FeedList.kt +++ b/rss-application/src/main/kotlin/de/unixwork/rssreader/FeedList.kt @@ -25,7 +25,11 @@ class FeedList : Document() { fun loadFeed(feed: FeedCollection) { if(feed.itemStateMode > 0 && feed.unreadItemsCount > 0) { - feed.unreadItemsCount = 0 + // Only reset the unread counter if the feed is not already opened + // This is necessary to have a reliable counter in the sourcelist after a sync job finishes + if(feed != currentFeed) { + feed.unreadItemsCount = 0 + } GlobalScope.launch(Dispatchers.IO) { Database.updateFeedReadState(feed, true) } 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 a1c4bda..849cf1e 100644 --- a/rss-application/src/main/kotlin/de/unixwork/rssreader/MainWindow.kt +++ b/rss-application/src/main/kotlin/de/unixwork/rssreader/MainWindow.kt @@ -36,7 +36,11 @@ class MainWindow { feed?.let { println("feed: ${feed.name}") feedList.loadFeed(feed) - sourceList.feeds.update() + // mode 1: mark all items as read when opening the feed + // update the sourcelist to remove the unread counter badge from this feed + if(feed.itemStateMode == 1) { + sourceList.groups[evt.sublistIndex].feeds.update(evt.rowIndex) + } } } catch (e: Exception) { e.printStackTrace()