}
}
}
+ return feeds
+ }
+
+ public fun getGroupFeeds(group: FeedGroup) : MutableList<Feed> {
+ val feeds = mutableListOf<Feed>()
+ dataSource.connection.use { conn ->
+ conn.prepareStatement("""
+ select f.* from feeds f
+ inner join feedcollections c on f.feedcollection_id = c.feedcollection_id
+ where c.group_id = ?
+ """.trimIndent()).use { stmt ->
+ stmt.setInt(1, group.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
}
menuItem("Reload") { event ->
val evt = event.subListEventData
val feedIndex = evt.rowIndex
- if(feedIndex >= 0 && evt.sublistIndex >= 0) {
- val feed = sourceList.groups[evt.sublistIndex].feeds[feedIndex]
- SyncJob({ Database.getCollectionFeeds(feed)}).sync() {
+ if(evt.sublistIndex >= 0) {
+ SyncJob({
+ if(feedIndex >= 0) {
+ Database.getCollectionFeeds(sourceList.groups[evt.sublistIndex].feeds[feedIndex])
+ } else {
+ Database.getGroupFeeds(sourceList.groups[evt.sublistIndex])
+ }
+ }).sync() {
App.window?.reload()
}
}