mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-12 13:43:20 +00:00
Add 'remove source' feature
This commit is contained in:
parent
0046cb9bbb
commit
e608a4afcc
11 changed files with 126 additions and 286 deletions
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue