2022-08-31 17:09:07 +00:00
|
|
|
|
import QtQuick 2.14
|
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
import StatusQ.Controls.Validators 0.1
|
|
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
|
|
import "../helpers"
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property var sharedKeycardModule
|
|
|
|
|
|
2022-11-16 18:35:40 +00:00
|
|
|
|
property int remainingAttempts: root.sharedKeycardModule.remainingAttempts
|
2022-08-31 17:09:07 +00:00
|
|
|
|
|
2022-09-13 10:03:25 +00:00
|
|
|
|
signal pinUpdated(string pin)
|
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
|
onRemainingAttemptsChanged: {
|
2022-09-13 10:03:25 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongKeychainPin) {
|
2022-08-31 17:09:07 +00:00
|
|
|
|
pinInputField.statesInitialization()
|
|
|
|
|
pinInputField.forceFocus()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onStateChanged: {
|
2022-10-17 10:12:22 +00:00
|
|
|
|
if(d.useFakePin) {
|
2022-08-31 17:09:07 +00:00
|
|
|
|
pinInputField.setPin("123456") // we are free to set fake pin in this case
|
|
|
|
|
} else {
|
|
|
|
|
pinInputField.statesInitialization()
|
|
|
|
|
pinInputField.forceFocus()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-17 10:12:22 +00:00
|
|
|
|
Component.onCompleted: {
|
2023-01-23 11:41:59 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.authentication ||
|
|
|
|
|
root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.factoryReset) {
|
2022-10-17 10:12:22 +00:00
|
|
|
|
timer.start()
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-09-13 10:03:25 +00:00
|
|
|
|
|
|
|
|
|
Timer {
|
|
|
|
|
id: timer
|
2023-01-23 11:41:59 +00:00
|
|
|
|
interval: 500
|
2022-09-13 10:03:25 +00:00
|
|
|
|
onTriggered: {
|
|
|
|
|
pinInputField.statesInitialization()
|
|
|
|
|
pinInputField.forceFocus()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-17 10:12:22 +00:00
|
|
|
|
QtObject {
|
|
|
|
|
id: d
|
|
|
|
|
readonly property bool useFakePin: root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.pinSet ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.pinVerified ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.changingKeycardPinSuccess ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.changingKeycardPinFailure
|
|
|
|
|
readonly property string message1: qsTr("It is very important that you do not lose this PIN")
|
|
|
|
|
readonly property string message2: qsTr("Don’t lose your PIN! If you do, you may lose\naccess to your funds.")
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-13 10:03:25 +00:00
|
|
|
|
Component {
|
2022-12-16 09:37:08 +00:00
|
|
|
|
id: keyPairForProcessingComponent
|
2022-09-13 10:03:25 +00:00
|
|
|
|
KeyPairItem {
|
2022-12-16 09:37:08 +00:00
|
|
|
|
keyPairType: root.sharedKeycardModule.keyPairForProcessing.pairType
|
2023-05-18 18:28:46 +00:00
|
|
|
|
keyPairKeyUid: root.sharedKeycardModule.keyPairForProcessing.keyUid
|
2022-12-16 09:37:08 +00:00
|
|
|
|
keyPairName: root.sharedKeycardModule.keyPairForProcessing.name
|
|
|
|
|
keyPairIcon: root.sharedKeycardModule.keyPairForProcessing.icon
|
|
|
|
|
keyPairImage: root.sharedKeycardModule.keyPairForProcessing.image
|
|
|
|
|
keyPairDerivedFrom: root.sharedKeycardModule.keyPairForProcessing.derivedFrom
|
|
|
|
|
keyPairAccounts: root.sharedKeycardModule.keyPairForProcessing.accounts
|
|
|
|
|
keyPairCardLocked: root.sharedKeycardModule.keyPairForProcessing.locked
|
2022-09-13 10:03:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
|
ColumnLayout {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.topMargin: Style.current.xlPadding
|
|
|
|
|
anchors.bottomMargin: Style.current.halfPadding
|
|
|
|
|
anchors.leftMargin: Style.current.xlPadding
|
|
|
|
|
anchors.rightMargin: Style.current.xlPadding
|
2022-09-20 14:01:57 +00:00
|
|
|
|
spacing: root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.authentication?
|
|
|
|
|
Style.current.halfPadding : Style.current.padding
|
2022-08-31 17:09:07 +00:00
|
|
|
|
|
|
|
|
|
KeycardImage {
|
|
|
|
|
id: image
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
Layout.preferredHeight: Constants.keycard.shared.imageHeight
|
|
|
|
|
Layout.preferredWidth: Constants.keycard.shared.imageWidth
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
id: title
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
|
font.weight: Font.Bold
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-13 10:03:25 +00:00
|
|
|
|
StatusBaseText {
|
|
|
|
|
id: subTitle
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
visible: text !== ""
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
|
StatusPinInput {
|
|
|
|
|
id: pinInputField
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
validator: StatusIntValidator{bottom: 0; top: 999999;}
|
|
|
|
|
pinLen: Constants.keycard.general.keycardPinLength
|
2022-10-17 10:12:22 +00:00
|
|
|
|
enabled: !d.useFakePin
|
2022-08-31 17:09:07 +00:00
|
|
|
|
onPinInputChanged: {
|
2022-09-13 10:03:25 +00:00
|
|
|
|
root.pinUpdated(pinInput)
|
2022-10-17 10:44:09 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType !== Constants.keycardSharedState.wrongPin &&
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType !== Constants.keycardSharedState.wrongKeychainPin) {
|
2022-08-31 17:09:07 +00:00
|
|
|
|
image.source = Style.png("keycard/enter-pin-%1".arg(pinInput.length))
|
|
|
|
|
}
|
|
|
|
|
if(pinInput.length == 0) {
|
|
|
|
|
return
|
|
|
|
|
}
|
2022-10-17 10:12:22 +00:00
|
|
|
|
if(root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.createPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.enterPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongKeychainPin) {
|
2022-08-31 17:09:07 +00:00
|
|
|
|
root.sharedKeycardModule.setPin(pinInput)
|
2022-09-13 10:03:25 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.authentication)
|
|
|
|
|
return
|
2022-09-15 08:05:37 +00:00
|
|
|
|
root.sharedKeycardModule.currentState.doSecondaryAction()
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
2022-10-17 10:12:22 +00:00
|
|
|
|
else if(root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.repeatPin) {
|
2022-08-31 17:09:07 +00:00
|
|
|
|
let pinsMatch = root.sharedKeycardModule.checkRepeatedKeycardPinWhileTyping(pinInput)
|
|
|
|
|
if (pinsMatch) {
|
2022-10-17 10:12:22 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.changeKeycardPin)
|
|
|
|
|
info.text = d.message2
|
|
|
|
|
else
|
|
|
|
|
info.text = d.message1
|
2022-09-15 08:05:37 +00:00
|
|
|
|
root.sharedKeycardModule.currentState.doSecondaryAction()
|
2022-08-31 17:09:07 +00:00
|
|
|
|
} else {
|
|
|
|
|
info.text = qsTr("PINs don't match")
|
|
|
|
|
image.source = Style.png("keycard/plain-error")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
id: info
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
2022-10-17 10:12:22 +00:00
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2022-08-31 17:09:07 +00:00
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
visible: text !== ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
id: message
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
2022-10-17 10:12:22 +00:00
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2022-08-31 17:09:07 +00:00
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
visible: text !== ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Loader {
|
2022-09-20 14:01:57 +00:00
|
|
|
|
id: loader
|
2022-08-31 17:09:07 +00:00
|
|
|
|
Layout.preferredWidth: parent.width
|
2022-09-13 10:03:25 +00:00
|
|
|
|
active: {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.setupNewKeycard) {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.createPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.repeatPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.pinSet) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.authentication) {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.enterPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongKeychainPin) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sourceComponent: {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.setupNewKeycard) {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.createPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.repeatPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.pinSet) {
|
2022-12-16 09:37:08 +00:00
|
|
|
|
return keyPairForProcessingComponent
|
2022-09-13 10:03:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.authentication) {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.enterPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongPin ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongKeychainPin) {
|
2022-12-28 14:57:13 +00:00
|
|
|
|
return keyPairForProcessingComponent
|
2022-09-13 10:03:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
|
2022-09-13 10:03:25 +00:00
|
|
|
|
return undefined
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-09-20 14:01:57 +00:00
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: spacer
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
visible: !loader.active
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
states: [
|
|
|
|
|
State {
|
|
|
|
|
name: Constants.keycardSharedState.enterPin
|
|
|
|
|
when: root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.enterPin
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: image
|
|
|
|
|
source: Style.png("keycard/card-empty")
|
|
|
|
|
pattern: ""
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: title
|
2022-10-17 10:12:22 +00:00
|
|
|
|
text: {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.changeKeycardPin) {
|
|
|
|
|
return qsTr("Enter the Keycard PIN")
|
|
|
|
|
}
|
|
|
|
|
return qsTr("Enter this Keycard’s PIN")
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
}
|
2022-09-13 10:03:25 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: subTitle
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: info
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: message
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: Constants.keycardSharedState.wrongPin
|
|
|
|
|
when: root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongPin
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: image
|
|
|
|
|
source: Style.png("keycard/plain-error")
|
|
|
|
|
pattern: ""
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: title
|
|
|
|
|
text: qsTr("Enter Keycard PIN")
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
}
|
2022-09-13 10:03:25 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: subTitle
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: info
|
|
|
|
|
text: qsTr("PIN incorrect")
|
|
|
|
|
color: Theme.palette.dangerColor1
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize3
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: message
|
|
|
|
|
text: qsTr("%n attempt(s) remaining", "", root.remainingAttempts)
|
|
|
|
|
color: root.remainingAttempts === 1?
|
|
|
|
|
Theme.palette.dangerColor1 :
|
|
|
|
|
Theme.palette.baseColor1
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize3
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: Constants.keycardSharedState.wrongKeychainPin
|
|
|
|
|
when: root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongKeychainPin
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: image
|
|
|
|
|
source: Style.png("keycard/plain-error")
|
|
|
|
|
pattern: ""
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: title
|
|
|
|
|
text: qsTr("Your saved PIN is out of date")
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: subTitle
|
|
|
|
|
text: qsTr("Enter your new PIN to proceed")
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize3
|
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: info
|
|
|
|
|
text: qsTr("PIN incorrect")
|
|
|
|
|
color: Theme.palette.dangerColor1
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize3
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: message
|
|
|
|
|
text: qsTr("%n attempt(s) remaining", "", root.remainingAttempts)
|
|
|
|
|
color: root.remainingAttempts === 1?
|
|
|
|
|
Theme.palette.dangerColor1 :
|
|
|
|
|
Theme.palette.baseColor1
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize3
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: Constants.keycardSharedState.createPin
|
|
|
|
|
when: root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.createPin
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: image
|
|
|
|
|
source: Style.png("keycard/enter-pin-0")
|
|
|
|
|
pattern: ""
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: title
|
2022-10-17 10:12:22 +00:00
|
|
|
|
text: {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.changeKeycardPin) {
|
|
|
|
|
return qsTr("Enter new Keycard PIN")
|
|
|
|
|
}
|
|
|
|
|
return qsTr("Choose a Keycard PIN")
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
}
|
2022-09-13 10:03:25 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: subTitle
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: info
|
2022-10-17 10:12:22 +00:00
|
|
|
|
text: {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.changeKeycardPin) {
|
|
|
|
|
return d.message2
|
|
|
|
|
}
|
|
|
|
|
return d.message1
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
color: Theme.palette.dangerColor1
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize3
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: message
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: Constants.keycardSharedState.repeatPin
|
|
|
|
|
when: root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.repeatPin
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: image
|
|
|
|
|
source: Style.png("keycard/enter-pin-0")
|
|
|
|
|
pattern: ""
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: title
|
2022-10-17 10:12:22 +00:00
|
|
|
|
text: {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.changeKeycardPin) {
|
|
|
|
|
return qsTr("Repeat new Keycard PIN")
|
|
|
|
|
}
|
|
|
|
|
return qsTr("Repeat Keycard PIN")
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
}
|
2022-09-13 10:03:25 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: subTitle
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: info
|
2022-10-17 10:12:22 +00:00
|
|
|
|
text: {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.changeKeycardPin) {
|
2022-10-17 10:44:09 +00:00
|
|
|
|
return d.message2
|
2022-10-17 10:12:22 +00:00
|
|
|
|
}
|
|
|
|
|
return d.message1
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
color: Theme.palette.dangerColor1
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize3
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: message
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
2022-10-17 10:12:22 +00:00
|
|
|
|
name: "success-state"
|
|
|
|
|
when: root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.pinSet ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.pinVerified ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.changingKeycardPinSuccess
|
2022-08-31 17:09:07 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: image
|
2022-10-18 08:31:23 +00:00
|
|
|
|
pattern: Constants.keycardAnimations.strongSuccess.pattern
|
2022-08-31 17:09:07 +00:00
|
|
|
|
source: ""
|
2022-10-18 08:31:23 +00:00
|
|
|
|
startImgIndexForTheFirstLoop: Constants.keycardAnimations.strongSuccess.startImgIndexForTheFirstLoop
|
|
|
|
|
startImgIndexForOtherLoops: Constants.keycardAnimations.strongSuccess.startImgIndexForOtherLoops
|
|
|
|
|
endImgIndex: Constants.keycardAnimations.strongSuccess.endImgIndex
|
|
|
|
|
duration: Constants.keycardAnimations.strongSuccess.duration
|
|
|
|
|
loops: Constants.keycardAnimations.strongSuccess.loops
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: title
|
2022-10-17 10:12:22 +00:00
|
|
|
|
text: {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.pinSet) {
|
|
|
|
|
return qsTr("Keycard PIN set")
|
|
|
|
|
}
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.pinVerified) {
|
|
|
|
|
return qsTr("Keycard PIN verified!")
|
|
|
|
|
}
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.changingKeycardPinSuccess) {
|
|
|
|
|
return qsTr("PIN successfully changed")
|
|
|
|
|
}
|
|
|
|
|
return ""
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
}
|
2022-09-13 10:03:25 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: subTitle
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: info
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: message
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
2022-10-17 10:12:22 +00:00
|
|
|
|
name: "error-state"
|
|
|
|
|
when: root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.changingKeycardPinFailure
|
2022-08-31 17:09:07 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: image
|
2022-10-18 08:31:23 +00:00
|
|
|
|
pattern: Constants.keycardAnimations.strongError.pattern
|
2022-08-31 17:09:07 +00:00
|
|
|
|
source: ""
|
2022-10-18 08:31:23 +00:00
|
|
|
|
startImgIndexForTheFirstLoop: Constants.keycardAnimations.strongError.startImgIndexForTheFirstLoop
|
|
|
|
|
startImgIndexForOtherLoops: Constants.keycardAnimations.strongError.startImgIndexForOtherLoops
|
|
|
|
|
endImgIndex: Constants.keycardAnimations.strongError.endImgIndex
|
|
|
|
|
duration: Constants.keycardAnimations.strongError.duration
|
|
|
|
|
loops: Constants.keycardAnimations.strongError.loops
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: title
|
2022-10-17 10:12:22 +00:00
|
|
|
|
text: {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.changingKeycardPinFailure) {
|
|
|
|
|
return qsTr("Changing PIN failed")
|
|
|
|
|
}
|
|
|
|
|
return ""
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
}
|
2022-09-13 10:03:25 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: subTitle
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: info
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: message
|
|
|
|
|
text: ""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|