acid/firmware/acid-firmware/ui/user-edit-view.slint

76 lines
2.2 KiB
Plaintext
Raw Normal View History

2026-01-27 02:46:53 +01:00
import { LineEdit, StandardListView, Button } from "std-widgets.slint";
import { Style } from "globals.slint";
import { IconButton } from "widgets/icon-button.slint";
export component UserEditView inherits HorizontalLayout {
padding: Style.spacing;
spacing: Style.spacing;
in property <string> username;
2026-02-04 03:14:21 +01:00
in property <string> key_error;
2026-01-27 02:46:53 +01:00
in-out property <string> identicon;
2026-02-04 03:14:21 +01:00
in-out property <string> key_id;
callback compute_identicon(password: string);
callback compute_key_id(encrypted_key: string);
2026-01-27 02:46:53 +01:00
callback confirm(encrypted_key: string);
callback cancel <=> button_cancel.clicked;
VerticalLayout {
spacing: Style.spacing;
Rectangle { }
Text {
text: "Enter " + username + "'s encrypted key and press Enter:";
}
2026-02-04 03:14:21 +01:00
line_edit_password := LineEdit {
input-type: InputType.password;
placeholder-text: "Password";
2026-01-27 02:46:53 +01:00
edited(text) => {
root.identicon = "";
2026-02-04 03:14:21 +01:00
root.key_id = "";
2026-01-27 02:46:53 +01:00
}
accepted(text) => {
2026-02-04 03:14:21 +01:00
compute_identicon(text);
2026-01-27 02:46:53 +01:00
line_edit_password.focus();
}
}
2026-02-04 03:14:21 +01:00
Text {
text: identicon.is-empty ? "" : ("Check the identicon: " + identicon);
}
line_edit_encrypted_key := LineEdit {
2026-01-27 02:46:53 +01:00
input-type: InputType.text;
2026-02-04 03:14:21 +01:00
placeholder-text: "Encrypted key";
enabled: !identicon.is-empty;
2026-01-27 02:46:53 +01:00
edited(text) => {
2026-02-04 03:14:21 +01:00
root.key_id = "";
2026-01-27 02:46:53 +01:00
}
accepted(text) => {
2026-02-04 03:14:21 +01:00
compute_key_id(text);
button_confirm.focus();
2026-01-27 02:46:53 +01:00
}
}
Text {
2026-02-04 03:14:21 +01:00
text: !key_error.is-empty ? key_error : (!key_id.is-empty ? ("Key ID: " + key_id) : "");
2026-01-27 02:46:53 +01:00
}
HorizontalLayout {
spacing: Style.spacing;
button_cancel := Button {
text: "Cancel";
}
button_confirm := Button {
text: "Confirm";
2026-02-04 03:14:21 +01:00
enabled: !identicon.is-empty && !key_id.is-empty;
2026-01-27 02:46:53 +01:00
clicked => {
confirm(line_edit_encrypted_key.text);
}
}
}
Rectangle { }
}
}