}
}
+ public fun deleteFeedGroup(feedGroup: FeedGroup) {
+ dataSource.connection.use { conn ->
+ conn.prepareStatement("""
+ delete from groups where group_id = ?
+ """.trimIndent()).use { stmt ->
+ stmt.setInt(1, feedGroup.id)
+ stmt.execute()
+ }
+ }
+ }
+
public fun getPendingFeeds(defaultInterval: Int) : MutableList<Feed> {
val feeds = mutableListOf<Feed>()
groups.add(group)
}
+ fun removeFeedGroup(group: FeedGroup) {
+ val index = groups.indexOf(group)
+ groups.removeAt(index)
+ feeds.remove(index)
+ feeds.update()
+ }
+
fun swapFeedCollections(group: Int, feed1: Int, feed2: Int) {
if(group < 0 || group >= groups.size) {
return
package de.unixwork.rssreader
import de.unixwork.ui.ColumnType
+import de.unixwork.ui.LabelStyle
import de.unixwork.ui.LinkButtonType
import de.unixwork.ui.Menu
import de.unixwork.ui.SubListItem
}
}
} else {
- // TODO
+ val feedGroup = sourceList.groups[evt.sublistIndex]
+ var move:UiInteger? = null
+ var groups:UiList<FeedGroup>? = null
+ val dialog = dialogWindow(
+ parent = window.ui,
+ title = "Delete",
+ lbutton1 = "Cancel",
+ rbutton4 = "Delete",
+ defaultButton = 4,
+ showCloseButton = false,
+ onClick = { ev ->
+ if(ev.intValue == 4) {
+ sourceList.removeFeedGroup(feedGroup)
+ if(move!!.booleanValue() && groups!!.selected != null) {
+ // move and delete
+ } else {
+ // delete
+ GlobalScope.launch(Dispatchers.IO) {
+ Database.deleteFeedGroup(feedGroup)
+ }
+ }
+ }
+ ev.`object`.close()
+ })
+ {
+ move = ui.integer()
+ groups = ui.list<FeedGroup>()
+ groups.addAll(sourceList.groups.filter { it != feedGroup })
+
+ grid(margin = 12, columnspacing = 8, rowspacing = 8, fill = true) {
+ row {
+ label(label = "Delete ${feedGroup.name}?", colspan = 2, style = LabelStyle.TITLE, hexpand = true, hfill = true)
+ }
+ row {
+ checkbox(label = "Move feeds to other group", value = move, vfill = true, enableState = 1)
+ dropdown<FeedGroup>(value = groups, vfill = true, states = intArrayOf(1)) { elm, i ->
+ elm.name
+ }
+ }
+ }
+ }
+ dialog.show()
}
}
separator()
if(states != null) {
MemorySegment st = arena.allocate(ValueLayout.JAVA_INT, states.length);
MemorySegment.copy(states, 0, st, ValueLayout.JAVA_INT, 0, states.length);
- ui.list_args_set_groups.invoke(args, st);
+ ui.list_args_set_groups.invoke(args, st, states.length);
}
return args;
private int labelType;
private String varname;
private UiInteger value;
+ private int enableState;
private EventHandler onChange;
private int[] states;
return this;
}
+ public ToggleBuilder enableState(int enableState) {
+ this.enableState = enableState;
+ return this;
+ }
+
public ToggleBuilder onChange(EventHandler onChange) {
this.onChange = onChange;
return this;
if(value != null) {
ui.toggle_args_set_value.invoke(args, value.valuePtr);
}
+ if(enableState > 0) {
+ ui.toggle_args_set_enablegroup.invoke(args, enableState);
+ }
if(states != null) {
MemorySegment st = arena.allocate(ValueLayout.JAVA_INT, states.length);
MemorySegment.copy(states, 0, st, ValueLayout.JAVA_INT, 0, states.length);
tooltip: String? = null,
varname: String? = null,
value: UiInteger? = null,
+ enableState: Int = 0,
fill: Boolean = false,
hexpand: Boolean = false,
vexpand: Boolean = false,
value?.let {
button.value(it)
}
+ if(enableState > 0) {
+ button.enableState(enableState)
+ }
if(fill) {
button.fill(fill);
}
tooltip: String? = null,
varname: String? = null,
value: UiInteger? = null,
+ enableState: Int = 0,
fill: Boolean = false,
hexpand: Boolean = false,
vexpand: Boolean = false,
tooltip = tooltip,
varname = varname,
value = value,
+ enableState = enableState,
fill = fill,
hexpand = hexpand,
vexpand = vexpand,
tooltip: String? = null,
varname: String? = null,
value: UiInteger? = null,
+ enableState: Int = 0,
fill: Boolean = false,
hexpand: Boolean = false,
vexpand: Boolean = false,
tooltip = tooltip,
varname = varname,
value = value,
+ enableState = enableState,
fill = fill,
hexpand = hexpand,
vexpand = vexpand,
tooltip: String? = null,
varname: String? = null,
value: UiInteger? = null,
+ enableState: Int = 0,
fill: Boolean = false,
hexpand: Boolean = false,
vexpand: Boolean = false,
tooltip = tooltip,
varname = varname,
value = value,
+ enableState = enableState,
fill = fill,
hexpand = hexpand,
vexpand = vexpand,