2018-06-21 08:47:09 +02:00
|
|
|
import QtQuick 2.0
|
2018-06-21 16:41:02 +02:00
|
|
|
import QtQuick.Layouts 1.3
|
2018-06-21 08:47:09 +02:00
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
|
|
|
|
Page {
|
|
|
|
id: root
|
2018-07-06 13:29:16 +02:00
|
|
|
//anchors.fill: parent
|
2018-06-21 16:41:02 +02:00
|
|
|
objectName: "LoginPage";
|
|
|
|
|
|
|
|
header: AppToolBar {
|
2018-07-06 14:40:45 +02:00
|
|
|
Label {
|
|
|
|
text: "Anmeldung"
|
|
|
|
anchors.centerIn: parent
|
|
|
|
color: "white"
|
|
|
|
}
|
2018-06-21 08:47:09 +02:00
|
|
|
}
|
2018-06-21 16:41:02 +02:00
|
|
|
|
|
|
|
Image {
|
|
|
|
id: bigLogo
|
|
|
|
source: "favicon.png"
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.margins: window.height * 0.01
|
|
|
|
height: window.height * 0.2
|
|
|
|
fillMode: Image.PreserveAspectFit
|
2018-06-21 08:47:09 +02:00
|
|
|
}
|
|
|
|
|
2018-07-06 14:40:45 +02:00
|
|
|
Label {
|
|
|
|
id: infoText
|
|
|
|
text: "<html>Bitte melde dich mit den Anmeldedaten an, die du für den Vertretungsplan erhalten hast.
|
|
|
|
<a href='http://www.fanny-leicht.de/j34/index.php/aktuelles/vertretungsplan'>Weitere Informationen</a></html>"
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
onLinkActivated: {
|
|
|
|
Qt.openUrlExternally(link)
|
|
|
|
}
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: bigLogo.bottom
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
leftMargin: window.width * 0.05
|
|
|
|
rightMargin: window.width * 0.05
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-21 16:41:02 +02:00
|
|
|
ColumnLayout {
|
|
|
|
|
|
|
|
spacing: 40
|
|
|
|
width: parent.width
|
|
|
|
anchors.fill: parent
|
2018-07-06 14:40:45 +02:00
|
|
|
anchors.topMargin: bigLogo.height + infoText.height + window.height * 0.02
|
2018-06-21 16:41:02 +02:00
|
|
|
anchors.bottomMargin: window.height * 0.2
|
|
|
|
|
|
|
|
TextField {
|
|
|
|
id: tiuname
|
2018-08-05 15:09:27 +02:00
|
|
|
placeholderText: "Benutzername"
|
2018-06-21 16:41:02 +02:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
Keys.onReturnPressed: login(tiuname.text, tipasswd.text, cBperm.checked)
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.margins: window.width * 0.05
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TextField {
|
|
|
|
id: tipasswd
|
|
|
|
echoMode: TextInput.Password
|
2018-08-05 15:09:27 +02:00
|
|
|
placeholderText: "Passwort"
|
2018-06-21 16:41:02 +02:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
Keys.onReturnPressed: login(tiuname.text, tipasswd.text, cBperm.checked)
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.margins: window.width * 0.05
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckDelegate {
|
|
|
|
id: cBperm
|
2018-08-05 15:09:27 +02:00
|
|
|
text: qsTr("Angemeldet bleiben")
|
2018-06-21 16:41:02 +02:00
|
|
|
checked: true
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
2018-06-21 08:47:09 +02:00
|
|
|
|
2018-06-21 16:41:02 +02:00
|
|
|
Button {
|
|
|
|
id: loginButton
|
|
|
|
objectName: "loginButton"
|
|
|
|
text: qsTr("Login")
|
|
|
|
enabled: tiuname.length > 0 & tipasswd.length > 0
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.margins: window.width * 0.05
|
|
|
|
onClicked: login(tiuname.text, tipasswd.text, cBperm.checked)
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id: laStatus
|
|
|
|
text: qsTr("")
|
|
|
|
font.pixelSize: 20
|
|
|
|
color: "red"
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function login(username, password, permanent){
|
|
|
|
Qt.inputMethod.hide();
|
|
|
|
busyDialog.open()
|
|
|
|
loginButton.enabled = false
|
|
|
|
loginButton.text = "Loggin in.."
|
|
|
|
console.log(username, password, permanent)
|
|
|
|
var ret = _cppServerConn.login(username, password, permanent);
|
|
|
|
busyDialog.close()
|
|
|
|
loginButton.enabled = true
|
|
|
|
loginButton.text = "Login"
|
|
|
|
if(ret === "OK"){
|
|
|
|
_cppAppSettings.writeSetting("init", 1);
|
|
|
|
window.is_error = false;
|
2018-06-21 08:47:09 +02:00
|
|
|
root.StackView.view.push("MainPage.qml")
|
|
|
|
}
|
2018-06-21 16:41:02 +02:00
|
|
|
else{
|
|
|
|
if(_cppAppSettings.loadSetting("permanent") === "1"){
|
|
|
|
tiuname.text = _cppAppSettings.loadSetting("username")
|
|
|
|
tipasswd.text = _cppAppSettings.loadSetting("password")
|
|
|
|
_cppAppSettings.writeSetting("permanent", "0")
|
|
|
|
_cppAppSettings.writeSetting("username", "")
|
|
|
|
_cppAppSettings.writeSetting("password", "")
|
|
|
|
}
|
|
|
|
laStatus.text = ret
|
|
|
|
}
|
|
|
|
//root.qmlSignal(tiuname.text, tipasswd.text)
|
2018-06-21 08:47:09 +02:00
|
|
|
}
|
|
|
|
|
2018-06-21 16:41:02 +02:00
|
|
|
Dialog {
|
|
|
|
id: busyDialog
|
|
|
|
modal: true
|
|
|
|
closePolicy: "NoAutoClose"
|
|
|
|
focus: true
|
|
|
|
title: "Please wait..."
|
|
|
|
x: (window.width - width) / 2
|
|
|
|
y: window.height / 6
|
|
|
|
width: Math.min(window.width, window.height) / 3 * 2
|
|
|
|
height: 150
|
|
|
|
contentHeight: aboutColumn.height
|
|
|
|
Column {
|
|
|
|
id: aboutColumn
|
|
|
|
spacing: 20
|
|
|
|
RowLayout {
|
|
|
|
width: parent.width
|
|
|
|
BusyIndicator {
|
|
|
|
id: busyIndicator
|
|
|
|
visible: true
|
|
|
|
x: 22
|
|
|
|
y: 38
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
width: busyDialog.availableWidth
|
|
|
|
text: "logging in..."
|
|
|
|
wrapMode: Label.Wrap
|
|
|
|
font.pixelSize: 12
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-21 08:47:09 +02:00
|
|
|
|
|
|
|
}
|