/* * AdvoTracker - Hotline tackingtool for Advocats * * Copyright (c) 2017 Ralf Zerres * * AdvoTracker is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * AdvoTracker is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with AdvoTracker; If not, see . */ import QtQuick 2.10 import QtQuick.Controls 2.3 import QtQuick.Controls.Material 2.2 import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 // AdvoTracker Module import de.networkx.AdvoTracker 1.0 as Nwx Page { id: pageLogin leftPadding: 26 rightPadding: 26 topPadding: 18 bottomPadding: 18 ColumnLayout { id: columnLogin width: parent.width Layout.fillWidth: true visible: true /* ListView { width: 400; height: 400 model: 1 anchors.top: parent.top delegate: userImage.mycomponent UserImage { id: userImage anchors.horizontalCenter: parent.horizontalCenter //Layout.alignment: Qt.AlignHCenter } } */ Nwx.IconLabel { id: iconLogin text: Nwx.MdiFont.Icon.account anchors.top: parent.top font.pixelSize: 96 anchors.horizontalCenter: parent.horizontalCenter } RowLayout { id: rowLoginName Layout.alignment: Qt.AlignHCenter //anchors.horizontalCenter: parent.horizontalCenter spacing: 12 Nwx.Label { id: labelLogin text: qsTr("User") Layout.preferredWidth: implicitWidth horizontalAlignment: TextInput.AlignHRight } Nwx.TextField { id: loginName Layout.alignment: Qt.AlignRight | Qt.AlignBaseline Layout.preferredWidth: implicitWidth placeholderText: qsTr("User Name") Keys.onReturnPressed: loginPassword.forceActiveFocus() onEditingFinished: { // Assign password rows if (loginName.text != null) { rowLoginPassword.opacity = 1 } else { confirmResult.text = qsTr("Please enter a username."); confirmResult.opacity = 1; confirmResult.color = "#ff0000"; } } } } // rowLoginName RowLayout { id: rowLoginPassword anchors.horizontalCenter: parent.horizontalCenter spacing: 12 opacity: 0 Nwx.Label { id: labelPassword text: qsTr("Password") Layout.preferredWidth: implicitWidth horizontalAlignment: TextInput.AlignHRight } Nwx.TextField { id: loginPassword Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline placeholderText: qsTr("Your Password") echoMode: TextInput.Password passwordMaskDelay: 1000 Keys.onReturnPressed: confirmPassword.forceActiveFocus() onEditingFinished: { if (loginPassword.text.length < 5) { //confirmResult.text = qsTr("Please enter a valid password.") confirmResult.text = qsTr("Given password does not fulfill given policy.") confirmResult.color = "#ff0000" loginPassword.forceActiveFocus() confirmResult.opacity = 1 loginDialog.opacity = 0 } else { rowConfirmPassword.opacity = 1 } } } MouseArea { id: loginPasswordMouse onClicked: { loginPassword.text = qsTr("new password"); loginPassword.echoMode = TextInput.Password; } } } // rowLoginPassword RowLayout { id: rowConfirmPassword anchors.horizontalCenter: parent.horizontalCenter spacing: 12 opacity: 0 // Confirm password stuff Nwx.Label { id: labelConfirmPassword text: qsTr("Confirm password") Layout.preferredWidth: implicitWidth horizontalAlignment: TextInput.AlignHRight } Nwx.TextField { id: confirmPassword placeholderText: qsTr("Confirm the password") Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline echoMode: TextInput.Password passwordMaskDelay: 1000 //width: rowLoginPassword - 150 //renderType: Text.NativeRendering //Layout.preferredWidth: rowConfirmPassword - 100 //Layout.minimumWidth: 150 //font.pointSize: 12 //horizontalAlignment: Text.AlignLeft onEditingFinished: { // Checks whether the password and its confirmation are the same. if (loginPassword.text === confirmPassword.text) { //confirmResult.text = qsTr("Password confirmed.") loginDialog.opacity = 1.0 confirmResult.opacity = 0 confirmResult.color = "#00ff00" } else { confirmResult.text = qsTr("Please validate the password.") confirmResult.opacity = 1.0 confirmResult.color = "#ff0000" } } MouseArea { anchors.fill: parent onClicked: { confirmPassword.text = "" confirmPassword.echoMode = Nwx.TextField.Password confirmPassword.focus = true } } } } // rowConfirmPassword Text { id: confirmResult text: qsTr("Result") anchors.top: rowConfirmPassword.bottom anchors.horizontalCenter: iconLogin.horizontalCenter opacity: 0 property color property0: "#00ff00" //Layout.fillWidth: true //anchors.topMargin: 16 //anchors.top: rowConfirmPassword.bottom //anchors.left: rowConfirmPassword.left //font.wordSpacing: -1 //renderType: Text.NativeRendering //font.capitalization: Font.SmallCaps //clip: false } ColumnLayout { id: loginDialog antialiasing: false anchors.top: confirmResult.bottom anchors.horizontalCenter: iconLogin.horizontalCenter //anchors.bottomMargin: -130 spacing: 8 opacity: 0 RowLayout { spacing: 10 Nwx.Button { id: buttonApplyLogin text: qsTr("Apply") antialiasing: true onPressed: { // Checks whether the password and its confirmation are the same. if (loginPassword.text === confirmPassword.text) { confirmResult.text = qsTr("Password confirmed."); confirmResult.opacity = 1; confirmResult.color = "#00ff00"; } else { confirmResult.text = qsTr("Given passwords do not match."); confirmResult.opacity = 1; confirmResult.color = "#ff0000"; } } } // buttonApplyLogin Nwx.Button { id: buttonClearLogin text: qsTr("Clear") antialiasing: true onPressed: { // Reset all dialog Fields loginName.clear(), loginPassword.clear(), confirmPassword.clear(), confirmResult.opacity = 0, loginDialog.opacity = 0, rowLoginPassword.opacity = 0, rowConfirmPassword.opacity = 0; } } // buttonClearLogin } } } }