mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 01:13:19 +00:00
Replace 'add source window' with popup
This commit is contained in:
parent
854152b395
commit
fcdeec19ed
8 changed files with 98 additions and 76 deletions
46
src/modals/EditSourceModal.slint
Normal file
46
src/modals/EditSourceModal.slint
Normal file
|
@ -0,0 +1,46 @@
|
|||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue