AusweisApp2/resources/qml/Governikus/EnterPinView/PinField.qml

72 lines
1.7 KiB
QML
Raw Normal View History

2017-07-03 09:33:28 +02:00
import QtQuick 2.7
2017-12-20 14:54:05 +01:00
import Governikus.Global 1.0
2017-07-03 09:33:28 +02:00
Item {
id: baseItem
property alias text: echoField.text
property string inputConfirmation
readonly property bool confirmedInput: inputConfirmation.length != text.length || inputConfirmation === text
readonly property bool validInput: echoField.acceptableInput && confirmedInput
function append(number) {
echoField.insert(echoField.length, number)
}
function removeLast() {
echoField.remove(echoField.length-1, echoField.length)
}
height: sample.implicitHeight * 1.5
width: lines.width
clip: true
TextInput {
id: echoField
2018-03-28 15:10:51 +02:00
color: Constants.secondary_text
2017-07-03 09:33:28 +02:00
verticalAlignment: TextInput.AlignVCenter
echoMode: TextInput.Password
font.pixelSize: Utils.sp(18)
font.letterSpacing: Utils.dp(10)
passwordMaskDelay: 500
cursorVisible: false
activeFocusOnPress: false
focus: false
validator: RegExpValidator {
regExp: baseItem.state === "PUK" ? /[0-9]{10}/ :
2018-03-28 15:10:51 +02:00
baseItem.state === "PIN_OR_TRANSPORT_PIN" ? /[0-9]{5,6}/ :
baseItem.state === "REMOTE_PIN" ? /[0-9]{4}/ : /[0-9]{6}/
}
maximumLength: baseItem.state === "PUK" ? 10 :
baseItem.state === "REMOTE_PIN" ? 4 : 6
2017-07-03 09:33:28 +02:00
clip: true
}
TextInput {
id: sample
2018-03-28 15:10:51 +02:00
color: Constants.secondary_text
2017-07-03 09:33:28 +02:00
visible: false
echoMode: echoField.echoMode
font: echoField.font
text: "0"
}
Row {
id: lines
anchors.bottom: baseItem.bottom
spacing: echoField.font.letterSpacing
anchors.left: echoField.left
Repeater {
2018-03-28 15:10:51 +02:00
model: baseItem.state === "PUK" ? 10 :
baseItem.state === "REMOTE_PIN" ? 4 : 6
2017-07-03 09:33:28 +02:00
delegate:
Rectangle {
width: sample.contentWidth - sample.font.letterSpacing
height: 1
color: "black"
}
}
}
}