From: Olaf Wintermann Date: Tue, 16 Sep 2025 13:42:22 +0000 (+0200) Subject: add Update Current Feed menu item X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=2893f08c581ec474313897bf3c3f1bf80a247ba0;p=rssreader.git add Update Current Feed menu 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 12fd670..2e18ec7 100644 --- a/rss-application/src/main/kotlin/de/unixwork/rssreader/App.kt +++ b/rss-application/src/main/kotlin/de/unixwork/rssreader/App.kt @@ -32,6 +32,14 @@ object App : Application { } } + fun syncCurrent() { + window?.feedList?.currentFeed?.let { + SyncJob({ Database.getCollectionFeeds(it)}).sync() { + window?.reload() + } + } + } + fun initToolbar() { toolbarItem(name = "reload", icon = "view-refresh") { event -> syncAll() @@ -41,6 +49,9 @@ object App : Application { menuItem(label = "Update All") { syncAll() } + menuItem(label = "Update Current Feed") { + syncCurrent() + } separator() menuItem(label = "Mark Current Feed as Read") { if(window?.feedList?.currentFeed != null) { diff --git a/rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt b/rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt index 98f7560..04b27e0 100644 --- a/rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt +++ b/rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt @@ -297,6 +297,35 @@ object Database { return feeds } + public fun getCollectionFeeds(feed: FeedCollection) : MutableList { + val feeds = mutableListOf() + + dataSource.connection.use { conn -> + conn.prepareStatement(""" + select * from feeds where feedcollection_id = ? + """.trimIndent()).use { stmt -> + stmt.setInt(1, feed.id) + stmt.executeQuery().use { rs -> + while(rs.next()) { + val id = rs.getInt("feed_id") + val feedCollectionId = rs.getInt("feedcollection_id") + val url = rs.getString("url") + val authUser = rs.getString("auth_user") + val authPassword = rs.getString("auth_password") + val certPath = rs.getString("certpath") + val feed = Feed(id, feedCollectionId, url) + feed.user = authUser + feed.password = authPassword + feed.certpath = certPath + feeds.add(feed) + } + } + } + } + + return feeds + } + public fun getPendingFeeds(defaultInterval: Int) : MutableList { val feeds = mutableListOf()