]> uap-core.de Git - rssreader.git/commitdiff
add UI for max item age in the new feed dialog
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 18 Sep 2025 18:47:00 +0000 (20:47 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 18 Sep 2025 18:47:00 +0000 (20:47 +0200)
rss-application/src/main/kotlin/de/unixwork/rssreader/ConfigWindow.kt
rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt
rss-application/src/main/kotlin/de/unixwork/rssreader/MainWindow.kt

index 8cd893bb7c6f5ec8f90d84fca7e14667f3b02522..3a0332d9cbf91495d92ad112a4a3c973b5783bc9 100644 (file)
@@ -19,6 +19,7 @@ class ConfigWindow {
 
     init {
         window = simpleWindow("")
+        window.ui.setSize(600, 500)
         window.ui.addCloseHandler {
             App.configWindow = null
         }
index 04b27e03ada193e2901c0197324792dde0f779fc..cba05ea0cf40fed2abf1d7efe2e14ac46a564edf 100644 (file)
@@ -188,18 +188,20 @@ object Database {
         password: String? = null,
         cert: String? = null,
         updateInterval: Long = 0,
+        maxItemAge: Int = 0,
         itemStateMode: Int = 0) : FeedCollection
     {
         var feedcollectionId = -1
         var feedCol: FeedCollection
         dataSource.connection.use { connection ->
             connection.prepareStatement("""
-            insert into feedcollections (group_id, pos, name, update_interval, item_state_mode) select ?, coalesce(max(pos), 0)+1, ?, ?, ? from groups
+            insert into feedcollections (group_id, pos, name, update_interval, max_item_age, item_state_mode) select ?, coalesce(max(pos), 0)+1, ?, ?, ?, ? from groups
             """.trimIndent(), Statement.RETURN_GENERATED_KEYS).use { stmt ->
                 stmt.setInt(1, parent.id)
                 stmt.setString(2, name)
                 stmt.setLong(3, updateInterval)
-                stmt.setInt(4, itemStateMode)
+                stmt.setInt(4, maxItemAge)
+                stmt.setInt(5, itemStateMode)
                 stmt.execute()
                 stmt.generatedKeys.use { rs ->
                     if(rs.next()) {
index 870ec5fcc4a15a1f6b180620d7c92db3476da077..e1c7d3468d4a7df0862cb436a57c549dfa701fdf 100644 (file)
@@ -4,6 +4,7 @@ import de.unixwork.ui.ColumnType
 import de.unixwork.ui.SubListItem
 import de.unixwork.ui.TabViewType
 import de.unixwork.ui.TableModel
+import de.unixwork.ui.UiInteger
 import de.unixwork.ui.UiList
 import de.unixwork.ui.UiString
 import de.unixwork.ui.UiText
@@ -193,6 +194,7 @@ class MainWindow() {
         var password: UiString? = null
         var cert: UiString? = null
         var readstatus: UiList<String>? = null
+        var maxItemAge: UiInteger? = null
 
         val w = dialogWindow(
             parent = window.ui,
@@ -211,6 +213,7 @@ class MainWindow() {
                     val urlStr = urls.toString()
                     val uris = urlStr.split("\n").map { it.trim() }.filter { it.isNotBlank() }
                     var itemStateMode = readstatus?.selectedIndex ?: 0
+                    val maxItemAge = maxItemAge?.intValue() ?: -1
                     if(itemStateMode < 0 || itemStateMode > 2) {
                         itemStateMode = 0
                     }
@@ -225,6 +228,7 @@ class MainWindow() {
                                 password.toString(),
                                 cert.toString(),
                                 0, // TODO
+                                maxItemAge,
                                 itemStateMode
                             )
 
@@ -248,6 +252,8 @@ class MainWindow() {
             user = ui.string()
             password = ui.string()
             cert = ui.string()
+            maxItemAge = ui.integer()
+            maxItemAge?.setIntValue(-1)
 
             groups.addAll(sourceList.groups)
             println("prev group: $newFeedPrevGroup")
@@ -285,6 +291,10 @@ class MainWindow() {
                         elm
                     }
                 }
+                row {
+                    rlabel("Max Item Age (Days)")
+                    spinbox(intValue = maxItemAge, min = -1.0, max = 100000.0, step = 1.0, colspan = 2)
+                }
 
                 row {
                     rlabel("User")