mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-01 17:03:19 +00:00
47 lines
1.2 KiB
Text
47 lines
1.2 KiB
Text
|
import { Palette } from "@selenite";
|
||
|
import { VTextInput } from "../../external/selenite/components/TextInput.slint";
|
||
|
import { VButton } from "../../external/selenite/components/index.slint";
|
||
|
import { AppWindowModels } from "../windows/AppWindow/Models.slint";
|
||
|
import { AppWindowActions } from "../windows/AppWindow/Actions.slint";
|
||
|
import { Modal } from "../../external/selenite/components/Modal.slint";
|
||
|
|
||
|
export component EditSourceModal inherits Modal {
|
||
|
private property <int> source-id-to-edit: -1;
|
||
|
private property <string> name: "";
|
||
|
private property <string> path: "";
|
||
|
|
||
|
public function edit(source-id: int) {
|
||
|
source-id-to-edit = source-id;
|
||
|
root.name = AppWindowModels.get-source-name-from-id(source-id);
|
||
|
root.path = AppWindowModels.get-source-path-from-id(source-id);
|
||
|
root.show();
|
||
|
}
|
||
|
|
||
|
VerticalLayout {
|
||
|
padding: 16px;
|
||
|
spacing: 8px;
|
||
|
nameInput := VTextInput {
|
||
|
label: "Name";
|
||
|
text <=> root.name;
|
||
|
}
|
||
|
pathInput := VTextInput {
|
||
|
label: "Path";
|
||
|
text <=> root.path;
|
||
|
}
|
||
|
VButton {
|
||
|
text: "Save";
|
||
|
clicked => {
|
||
|
AppWindowActions.edit-source(source-id-to-edit, name, path);
|
||
|
root.close();
|
||
|
}
|
||
|
}
|
||
|
VButton {
|
||
|
text: "Delete";
|
||
|
background-color: Palette.red;
|
||
|
double-clicked => {
|
||
|
//root.delete-source(root.id)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|