status-desktop/ui/imports/shared/keycard/PINModal.qml

72 lines
1.8 KiB
QML
Raw Normal View History

2021-09-24 12:03:57 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
2021-10-05 09:12:10 +00:00
import QtQuick.Layouts 1.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
2021-09-24 12:03:57 +00:00
import StatusQ.Controls 0.1
2021-10-05 09:12:10 +00:00
import StatusQ.Popups 0.1
import shared 1.0
import shared.controls 1.0
import utils 1.0 as Imports
2021-09-24 12:03:57 +00:00
2021-10-05 09:12:10 +00:00
StatusModal {
2021-09-24 12:03:57 +00:00
property bool pinFieldValid: false
2021-10-01 10:22:51 +00:00
property bool submitted: false
2021-09-24 12:03:57 +00:00
id: popup
2021-10-05 09:12:10 +00:00
header.title: qsTr("Authenticate PIN")
anchors.centerIn: parent
2021-09-24 12:03:57 +00:00
height: 400
onOpened: {
2021-10-01 10:22:51 +00:00
submitted = false
2021-09-24 12:03:57 +00:00
pinField.text = "";
pinField.forceActiveFocus(Qt.MouseFocusReason)
}
2021-10-05 09:12:10 +00:00
contentItem: Item {
Input {
id: pinField
anchors.rightMargin: 56
anchors.leftMargin: 56
anchors.top: parent.top
anchors.topMargin: 88
placeholderText: qsTr("PIN")
textField.echoMode: TextInput.Password
onTextChanged: {
[pinFieldValid, _] =
Imports.Utils.validatePINs("first", pinField, pinField);
}
2021-09-24 12:03:57 +00:00
}
2021-10-05 09:12:10 +00:00
StatusBaseText {
text: qsTr("Insert your 6-digit PIN")
wrapMode: Text.WordWrap
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
horizontalAlignment: Text.AlignHCenter
color: Theme.palette.directColor1
font.pixelSize: 12
}
2021-09-24 12:03:57 +00:00
}
2021-10-05 09:12:10 +00:00
rightButtons: [
2021-09-24 12:03:57 +00:00
StatusButton {
id: submitBtn
text: qsTr("Authenticate")
enabled: pinFieldValid
onClicked: {
2021-10-01 10:22:51 +00:00
submitted = true
// Not Refactored Yet
// keycardModel.authenticate(pinField.text)
2021-10-01 10:22:51 +00:00
popup.close()
2021-09-24 12:03:57 +00:00
}
}
2021-10-05 09:12:10 +00:00
]
2021-09-24 12:03:57 +00:00
}