camper/src/Main.qml

81 lines
1.4 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Camper
ApplicationWindow {
height: 480
title: qsTr("Camper")
visible: true
width: 640
ColumnLayout {
Label {
text: qsTr("&User:")
}
TextField {
id: user
focus: true
validator: RegularExpressionValidator {
regularExpression: /[^s].*/
}
onAccepted: function () {
loginAction.trigger();
}
}
Label {
text: qsTr("&Password:")
}
TextField {
id: password
echoMode: TextInput.Password
onAccepted: function () {
loginAction.trigger();
}
}
Button {
action: loginAction
}
}
ErrorNotification {
id: errorNotification
anchors {
bottom: parent.bottom
bottomMargin: 8
left: parent.left
margins: 18 * 4
right: parent.right
}
}
Action {
id: loginAction
enabled: user.acceptableInput
text: "&Login"
onTriggered: function () {
Database.open(user.text, password.text);
}
}
Connections {
function onErrorOcurred(errorMessage) {
errorNotification.show(errorMessage);
}
target: Database
}
}