}
}
+ fun syncCurrent() {
+ window?.feedList?.currentFeed?.let {
+ SyncJob({ Database.getCollectionFeeds(it)}).sync() {
+ window?.reload()
+ }
+ }
+ }
+
fun initToolbar() {
toolbarItem(name = "reload", icon = "view-refresh") { event ->
syncAll()
menuItem(label = "Update All") {
syncAll()
}
+ menuItem(label = "Update Current Feed") {
+ syncCurrent()
+ }
separator()
menuItem(label = "Mark Current Feed as Read") {
if(window?.feedList?.currentFeed != null) {
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>()