Add 'remove source' feature

This commit is contained in:
Vyn 2025-07-03 10:57:14 +02:00
parent 0046cb9bbb
commit e608a4afcc
Signed by: vyn
GPG key ID: E1B2BE34E7A971E7
11 changed files with 126 additions and 286 deletions

View file

@ -32,8 +32,9 @@ export struct CreateEventParams {
export global AppActions {
callback task-clicked(int, int);
callback source-clicked(int);
callback add-source(name: string, path: string);
callback add-source(name: string, color: string, path: string);
callback edit-source(sourceId: int, name: string, color: string, path: string);
callback remove-source(sourceId: int);
callback toggle-show-completed-tasks();
callback delete-task-clicked(int, int);

View file

@ -9,6 +9,7 @@ export component AddSourceModal inherits Modal {
private property <int> source-id-to-edit: -1;
private property <string> name: "";
private property <string> path: "";
private property <string> color_: "#ffffff";
public function open() {
root.show();
@ -21,6 +22,10 @@ export component AddSourceModal inherits Modal {
label: "Name";
text <=> root.name;
}
colorInput := VTextInput {
label: "Color";
text <=> root.color_;
}
pathInput := VTextInput {
label: "Path";
text <=> root.path;
@ -28,7 +33,7 @@ export component AddSourceModal inherits Modal {
VButton {
text: "Add";
clicked => {
AppActions.add-source(name, path);
AppActions.add-source(name, color_, path);
root.close();
}
}

View file

@ -30,10 +30,10 @@ export component EditSourceModal inherits Modal {
label: "Color";
text <=> root.color_;
}
pathInput := VTextInput {
label: "Path";
text <=> root.path;
}
//pathInput := VTextInput {
//label: "Path";
//text <=> root.path;
//}
VButton {
text: "Save";
clicked => {
@ -45,7 +45,8 @@ export component EditSourceModal inherits Modal {
text: "Delete";
background-color: Palette.red;
double-clicked => {
//root.delete-source(root.id)
AppActions.remove-source(source-id-to-edit);
root.close();
}
}
}

View file

@ -66,7 +66,11 @@ export component SideBar inherits Rectangle {
TouchArea {
clicked => { AppActions.source-clicked(source.id) }
//right-clicked => { editSourcePopup.edit(source.id) }
pointer-event(e) => {
if (e.button == PointerEventButton.right && e.kind == PointerEventKind.up) {
editSourcePopup.edit(source.id)
}
}
}
}
}