2022-08-05 13:50:54 +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.Controls 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
import "../helpers"
|
|
|
|
|
2022-08-05 13:50:54 +00:00
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property var sharedKeycardModule
|
|
|
|
|
|
|
|
signal confirmationUpdated(bool value)
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
Component {
|
2022-12-16 09:37:08 +00:00
|
|
|
id: keyPairForProcessingComponent
|
2022-08-31 17:09:07 +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-08-31 17:09:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: unknownKeyPairCompontnt
|
|
|
|
KeyPairUnknownItem {
|
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
|
2023-05-18 18:28:46 +00:00
|
|
|
keyPairCardLocked: root.sharedKeycardModule.keyPairForProcessing.locked
|
2022-08-31 17:09:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-05 13:50:54 +00:00
|
|
|
ColumnLayout {
|
2022-08-31 17:09:07 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
anchors.topMargin: Style.current.xlPadding
|
|
|
|
anchors.bottomMargin: Style.current.halfPadding
|
|
|
|
anchors.leftMargin: Style.current.xlPadding
|
|
|
|
anchors.rightMargin: Style.current.xlPadding
|
2022-08-05 13:50:54 +00:00
|
|
|
spacing: Style.current.padding
|
2022-08-31 17:09:07 +00:00
|
|
|
clip: true
|
2022-08-05 13:50:54 +00:00
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
KeycardImage {
|
2022-08-05 13:50:54 +00:00
|
|
|
id: image
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
Layout.preferredHeight: Constants.keycard.shared.imageHeight
|
|
|
|
Layout.preferredWidth: Constants.keycard.shared.imageWidth
|
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-05 13:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: title
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2022-08-31 17:09:07 +00:00
|
|
|
Layout.preferredHeight: Constants.keycard.general.titleHeight
|
2022-12-02 10:24:59 +00:00
|
|
|
text: {
|
2022-12-09 19:43:36 +00:00
|
|
|
// we need to check userProfile since factory reset flow is also available before user logs in the app
|
2022-12-16 09:37:08 +00:00
|
|
|
if (!!Global.userProfile &&
|
|
|
|
!!root.sharedKeycardModule.keyPairForProcessing &&
|
|
|
|
root.sharedKeycardModule.keyPairForProcessing.keyUid === Global.userProfile.keyUid)
|
2022-12-02 10:24:59 +00:00
|
|
|
return qsTr("Warning, this Keycard stores your main Status profile and\naccounts. A factory reset will permanently delete it.")
|
|
|
|
|
|
|
|
return qsTr("A factory reset will delete the key on this Keycard.\nAre you sure you want to do this?")
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
2022-08-05 13:50:54 +00:00
|
|
|
color: Theme.palette.dangerColor1
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusCheckBox {
|
|
|
|
id: confirmation
|
2022-08-31 17:09:07 +00:00
|
|
|
Layout.preferredHeight: Constants.keycard.general.messageHeight
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
2022-08-05 13:50:54 +00:00
|
|
|
leftSide: false
|
|
|
|
spacing: Style.current.smallPadding
|
2022-08-31 17:09:07 +00:00
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
2022-08-05 13:50:54 +00:00
|
|
|
text: qsTr("I understand the key pair on this Keycard will be deleted")
|
|
|
|
|
|
|
|
onCheckedChanged: {
|
|
|
|
root.confirmationUpdated(checked)
|
|
|
|
}
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: loader
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
active: {
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.setupNewKeycard) {
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
2022-12-16 09:37:08 +00:00
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.setupNewKeycardNewSeedPhrase) {
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
2022-12-26 12:52:21 +00:00
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.setupNewKeycardOldSeedPhrase) {
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.factoryReset) {
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
2022-11-18 08:16:02 +00:00
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.createCopyOfAKeycard) {
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceComponent: {
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.setupNewKeycard) {
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
if (root.sharedKeycardModule.keyPairStoredOnKeycardIsKnown) {
|
2022-12-16 09:37:08 +00:00
|
|
|
return keyPairForProcessingComponent
|
|
|
|
}
|
|
|
|
return unknownKeyPairCompontnt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.setupNewKeycardNewSeedPhrase) {
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
if (root.sharedKeycardModule.keyPairStoredOnKeycardIsKnown) {
|
|
|
|
return keyPairForProcessingComponent
|
2022-08-31 17:09:07 +00:00
|
|
|
}
|
|
|
|
return unknownKeyPairCompontnt
|
|
|
|
}
|
|
|
|
}
|
2022-12-26 12:52:21 +00:00
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.setupNewKeycardOldSeedPhrase) {
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
if (root.sharedKeycardModule.keyPairStoredOnKeycardIsKnown) {
|
|
|
|
return keyPairForProcessingComponent
|
|
|
|
}
|
|
|
|
return unknownKeyPairCompontnt
|
|
|
|
}
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.factoryReset) {
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
if (root.sharedKeycardModule.keyPairStoredOnKeycardIsKnown) {
|
2022-12-16 09:37:08 +00:00
|
|
|
return keyPairForProcessingComponent
|
2022-08-31 17:09:07 +00:00
|
|
|
}
|
|
|
|
return unknownKeyPairCompontnt
|
|
|
|
}
|
|
|
|
}
|
2022-11-18 08:16:02 +00:00
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.createCopyOfAKeycard) {
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
if (root.sharedKeycardModule.keyPairStoredOnKeycardIsKnown) {
|
2022-12-16 09:37:08 +00:00
|
|
|
return keyPairForProcessingComponent
|
2022-11-18 08:16:02 +00:00
|
|
|
}
|
|
|
|
return unknownKeyPairCompontnt
|
|
|
|
}
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
visible: !loader.active
|
|
|
|
Layout.fillWidth: true
|
2022-09-02 11:04:59 +00:00
|
|
|
Layout.fillHeight: visible
|
2022-08-31 17:09:07 +00:00
|
|
|
}
|
2022-08-05 13:50:54 +00:00
|
|
|
}
|
|
|
|
}
|