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 {
|
|
|
|
id: knownKeyPairComponent
|
|
|
|
KeyPairItem {
|
2022-09-02 11:04:59 +00:00
|
|
|
keyPairType: root.sharedKeycardModule.keyPairStoredOnKeycard.pairType
|
2022-08-31 17:09:07 +00:00
|
|
|
keyPairPubKey: root.sharedKeycardModule.keyPairStoredOnKeycard.pubKey
|
|
|
|
keyPairName: root.sharedKeycardModule.keyPairStoredOnKeycard.name
|
|
|
|
keyPairIcon: root.sharedKeycardModule.keyPairStoredOnKeycard.icon
|
|
|
|
keyPairImage: root.sharedKeycardModule.keyPairStoredOnKeycard.image
|
|
|
|
keyPairDerivedFrom: root.sharedKeycardModule.keyPairStoredOnKeycard.derivedFrom
|
|
|
|
keyPairAccounts: root.sharedKeycardModule.keyPairStoredOnKeycard.accounts
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: unknownKeyPairCompontnt
|
|
|
|
KeyPairUnknownItem {
|
|
|
|
keyPairPubKey: root.sharedKeycardModule.keyPairStoredOnKeycard.pubKey
|
|
|
|
keyPairName: root.sharedKeycardModule.keyPairStoredOnKeycard.name
|
|
|
|
keyPairIcon: root.sharedKeycardModule.keyPairStoredOnKeycard.icon
|
|
|
|
keyPairImage: root.sharedKeycardModule.keyPairStoredOnKeycard.image
|
|
|
|
keyPairDerivedFrom: root.sharedKeycardModule.keyPairStoredOnKeycard.derivedFrom
|
|
|
|
keyPairAccounts: root.sharedKeycardModule.keyPairStoredOnKeycard.accounts
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
if (!!Global.userProfile && root.sharedKeycardModule.keyPairStoredOnKeycard.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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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) {
|
|
|
|
return knownKeyPairComponent
|
|
|
|
}
|
|
|
|
return unknownKeyPairCompontnt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.factoryReset) {
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
if (root.sharedKeycardModule.keyPairStoredOnKeycardIsKnown) {
|
|
|
|
return knownKeyPairComponent
|
|
|
|
}
|
|
|
|
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) {
|
|
|
|
return knownKeyPairComponent
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|