141 lines
4.0 KiB
QML
141 lines
4.0 KiB
QML
import QtCore
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Dialogs
|
|
import QtQuick.Layouts
|
|
|
|
|
|
Item {
|
|
property string recpass: ""
|
|
|
|
function dbConnectionFailed(msg) {
|
|
oschkar.notificationBox.informativeText = msg;
|
|
oschkar.notificationBox.text = "Verbindung zum Datenbankserver verloren";
|
|
oschkar.notificationBox.open();
|
|
}
|
|
function getEncryptionKey() {
|
|
recoveryPaswordDialog.open();
|
|
}
|
|
function loggedin() {
|
|
appLoader.source = "Dashboard.qml";
|
|
}
|
|
|
|
anchors.fill: parent
|
|
anchors.topMargin: Dimensions.l
|
|
|
|
Component.onCompleted: {
|
|
loggedin_user.loginOkay.connect(loggedin);
|
|
config.invalidEncryptionKey.connect(getEncryptionKey);
|
|
config.checkEncryptionKey();
|
|
loggedin_user.noDbConnection.connect(dbConnectionFailed);
|
|
benutzerName.forceActiveFocus();
|
|
}
|
|
|
|
ColumnLayout {
|
|
spacing: Dimensions.m
|
|
anchors.centerIn: parent
|
|
|
|
Label {
|
|
font: Typography.h1
|
|
text: qsTr("Login")
|
|
Layout.alignment: Qt.AlignHCenter
|
|
Layout.bottomMargin: Dimensions.l
|
|
}
|
|
|
|
Field {
|
|
label: qsTr("Benutzername")
|
|
|
|
TextField {
|
|
id: benutzerName
|
|
|
|
focus: true
|
|
implicitWidth: 300
|
|
placeholderText: qsTr("Benutzernamen eingeben")
|
|
|
|
onAccepted: {
|
|
if (benutzerName.text.trim() && passwort.text.trim())
|
|
loggedin_user.login(benutzerName.text.trim(), passwort.text);
|
|
else if (benutzerName.text.trim())
|
|
passwort.forceActiveFocus();
|
|
}
|
|
}
|
|
}
|
|
Field {
|
|
label: qsTr("Passwort")
|
|
|
|
TextField {
|
|
id: passwort
|
|
|
|
echoMode: TextInput.Password
|
|
implicitWidth: 300
|
|
placeholderText: qsTr("Passwort eingeben")
|
|
|
|
onAccepted: {
|
|
if (benutzerName.text.trim() && passwort.text.trim())
|
|
loggedin_user.login(benutzerName.text.trim(), passwort.text);
|
|
else if (passwort.text.trim())
|
|
benutzerName.forceActiveFocus();
|
|
}
|
|
}
|
|
}
|
|
|
|
Button {
|
|
Layout.topMargin: Dimensions.m
|
|
text: qsTr("Login")
|
|
width: parent.width
|
|
|
|
onClicked: {
|
|
if (benutzerName.text.trim() && passwort.text.trim())
|
|
loggedin_user.login(benutzerName.text.trim(), passwort.text);
|
|
}
|
|
}
|
|
Item {
|
|
Layout.fillHeight: true
|
|
}
|
|
Dialog {
|
|
id: recoveryPaswordDialog
|
|
|
|
anchors.centerIn: parent
|
|
modal: true
|
|
standardButtons: Dialog.Ok | Dialog.Cancel
|
|
title: qsTr("Wiederherstellung")
|
|
|
|
onAccepted: {
|
|
recpass = recoveryPaswordInput.text;
|
|
getRecoveryDialog.open();
|
|
}
|
|
|
|
ColumnLayout {
|
|
RowLayout {
|
|
Label {
|
|
text: qsTr("Wiederherstellungspasswort eingeben: ")
|
|
}
|
|
TextField {
|
|
id: recoveryPaswordInput
|
|
|
|
echoMode: TextInput.Password
|
|
implicitWidth: 300
|
|
placeholderText: qsTr("Hier Wiederherstellungspasswort eingeben")
|
|
text: ""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
FileDialog {
|
|
id: getRecoveryDialog
|
|
|
|
currentFolder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]
|
|
fileMode: FileDialog.OpenFile
|
|
nameFilters: ["PYQCRM Recovery files (*.pyqrec)"]
|
|
title: qsTr("Wiederherstellungsdatei")
|
|
|
|
onAccepted: config.getRecoveryKey(getRecoveryDialog.currentFile, recpass)
|
|
onRejected: quit()
|
|
}
|
|
Notifications {
|
|
id: oschkar
|
|
|
|
}
|
|
}
|
|
}
|