From: Olaf Wintermann Date: Sat, 30 Aug 2025 06:56:40 +0000 (+0200) Subject: extend new feed dialog, allow specification of read status updates (auto_mark_read) X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=b0b1af96e9b26ff7b7467e4f6455b99899e19b2a;p=rssreader.git extend new feed dialog, allow specification of read status updates (auto_mark_read) --- 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 204dae2..ef3d368 100644 --- a/rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt +++ b/rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt @@ -164,15 +164,19 @@ object Database { uris: Collection, user: String? = null, password: String? = null, - cert: String? = null) : FeedCollection + cert: String? = null, + updateInterval: Long = 0, + autoMarkRead: Boolean = false) : FeedCollection { var feedcollectionId = -1 val connection = dataSource.connection connection.prepareStatement(""" - insert into feedcollections (group_id, pos, name) select ?, coalesce(max(pos), 0)+1, ? from groups + insert into feedcollections (group_id, pos, name, update_interval, auto_mark_read) 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.setBoolean(4, autoMarkRead) stmt.execute() stmt.generatedKeys.use { rs -> if(rs.next()) { 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 27f49c2..be8be02 100644 --- a/rss-application/src/main/kotlin/de/unixwork/rssreader/MainWindow.kt +++ b/rss-application/src/main/kotlin/de/unixwork/rssreader/MainWindow.kt @@ -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 @@ -133,6 +134,7 @@ class MainWindow { var user: UiString? = null var password: UiString? = null var cert: UiString? = null + var readstatus: UiList? = null val w = dialogWindow( parent = window.ui, @@ -150,10 +152,22 @@ class MainWindow { val feedName = name.toString() val urlStr = urls.toString() val uris = urlStr.split("\n").map { it.trim() }.filter { it.isNotBlank() } + val readStatus = readstatus?.selectedIndex + val automarkread = readStatus == 1 println("groupSel: ${groups?.selectedIndex}, feedName: $feedName, urlStr: $urlStr") parent?.let { try { - val feedCol = Database.newFeeds(it, feedName, uris, user.toString(), password.toString(), cert.toString()) + val feedCol = Database.newFeeds( + it, + feedName, + uris, + user.toString(), + password.toString(), + cert.toString(), + 0, // TODO + automarkread + ) + parent.feeds.update() } catch (e: Exception) { e.printStackTrace() @@ -167,12 +181,16 @@ class MainWindow { groups = ui.list() name = ui.string() urls = ui.text() + readstatus = ui.list() user = ui.string() password = ui.string() cert = ui.string() groups.addAll(sourceList.groups) + readstatus.add("Mark items individually") + readstatus.add("Mark entire feed when opened") + // UI grid( margin = 12, @@ -196,6 +214,12 @@ class MainWindow { rlabel("URLs", overrideDefaults = true, hfill = true) // overrideDefaults for disabling default vfill textarea(value = urls, hexpand = true, vexpand = true, vfill = true, colspan = 2) } + row { + rlabel("Read Status", hfill = true) + dropdown(value = readstatus, hfill = true, colspan = 2) { elm, col -> + elm + } + } row { rlabel("User")