]> uap-core.de Git - rssreader.git/commitdiff
add Update Current Feed menu item
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 16 Sep 2025 13:42:22 +0000 (15:42 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 16 Sep 2025 13:42:22 +0000 (15:42 +0200)
rss-application/src/main/kotlin/de/unixwork/rssreader/App.kt
rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt

index 12fd670e4e431e907a61ddf8905f1de72b5e2b36..2e18ec73f5e3c4e320b5d21bffd9871ad2e28813 100644 (file)
@@ -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) {
index 98f7560e564750ecd34b7b6e287736c182ddf9a9..04b27e03ada193e2901c0197324792dde0f779fc 100644 (file)
@@ -297,6 +297,35 @@ object Database {
         return feeds
     }
 
+    public fun getCollectionFeeds(feed: FeedCollection) : MutableList<Feed> {
+        val feeds = mutableListOf<Feed>()
+
+        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<Feed> {
         val feeds = mutableListOf<Feed>()