2024-10-15 21:26:12 +02:00
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
2022-08-05 15:50:54 +02:00
|
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
2024-10-15 21:26:12 +02:00
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2024-08-05 15:44:32 +02:00
|
|
|
|
import StatusQ.Controls 0.1
|
2022-08-05 15:50:54 +02:00
|
|
|
|
import StatusQ.Popups 0.1
|
2024-08-05 15:44:32 +02:00
|
|
|
|
import StatusQ.Popups.Dialog 0.1
|
2022-08-05 15:50:54 +02:00
|
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
|
|
StatusModal {
|
|
|
|
|
id: root
|
|
|
|
|
|
2024-10-15 14:26:45 +02:00
|
|
|
|
property alias myKeyUid: content.myKeyUid
|
|
|
|
|
|
2022-08-05 15:50:54 +02:00
|
|
|
|
property var sharedKeycardModule
|
2022-12-16 10:37:08 +01:00
|
|
|
|
property var emojiPopup
|
2022-08-05 15:50:54 +02:00
|
|
|
|
|
2023-07-06 16:54:35 +03:00
|
|
|
|
width: Constants.keycard.general.popupWidth
|
2023-09-04 18:06:51 +02:00
|
|
|
|
closePolicy: root.sharedKeycardModule.forceFlow || d.disableActionPopupButtons || d.disableCloseButton?
|
|
|
|
|
Popup.NoAutoClose :
|
|
|
|
|
Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
|
|
|
|
hasCloseButton: !root.sharedKeycardModule.forceFlow && !d.disableActionPopupButtons && !d.disableCloseButton
|
2022-08-05 15:50:54 +02:00
|
|
|
|
|
2023-05-23 14:46:16 +02:00
|
|
|
|
headerSettings.title: {
|
2022-11-09 11:22:08 +01:00
|
|
|
|
switch (root.sharedKeycardModule.currentState.flowType) {
|
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycard:
|
2022-08-31 19:09:07 +02:00
|
|
|
|
return qsTr("Set up a new Keycard with an existing account")
|
2022-12-16 10:37:08 +01:00
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycardNewSeedPhrase:
|
|
|
|
|
return qsTr("Create a new Keycard account with a new seed phrase")
|
2022-12-26 13:52:21 +01:00
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycardOldSeedPhrase:
|
|
|
|
|
return qsTr("Import or restore a Keycard via a seed phrase")
|
2022-12-27 14:20:58 +01:00
|
|
|
|
case Constants.keycardSharedFlow.importFromKeycard:
|
|
|
|
|
return qsTr("Migrate account from Keycard to Status")
|
2022-11-09 11:22:08 +01:00
|
|
|
|
case Constants.keycardSharedFlow.factoryReset:
|
2022-08-31 19:09:07 +02:00
|
|
|
|
return qsTr("Factory reset a Keycard")
|
2022-11-09 11:22:08 +01:00
|
|
|
|
case Constants.keycardSharedFlow.authentication:
|
2022-09-13 12:03:25 +02:00
|
|
|
|
return qsTr("Authenticate")
|
2023-10-27 19:14:39 +02:00
|
|
|
|
case Constants.keycardSharedFlow.sign:
|
|
|
|
|
return qsTr("Signing")
|
2022-11-09 11:22:08 +01:00
|
|
|
|
case Constants.keycardSharedFlow.unlockKeycard:
|
2022-09-20 16:01:57 +02:00
|
|
|
|
return qsTr("Unlock Keycard")
|
2022-11-09 11:22:08 +01:00
|
|
|
|
case Constants.keycardSharedFlow.displayKeycardContent:
|
2022-09-21 15:11:39 +02:00
|
|
|
|
return qsTr("Check what’s on a Keycard")
|
2022-11-09 11:22:08 +01:00
|
|
|
|
case Constants.keycardSharedFlow.renameKeycard:
|
2022-10-12 19:08:59 +02:00
|
|
|
|
return qsTr("Rename Keycard")
|
2022-11-09 11:22:08 +01:00
|
|
|
|
case Constants.keycardSharedFlow.changeKeycardPin:
|
2022-10-17 12:12:22 +02:00
|
|
|
|
return qsTr("Change pin")
|
2022-11-09 11:22:08 +01:00
|
|
|
|
case Constants.keycardSharedFlow.changeKeycardPuk:
|
2022-10-17 12:44:09 +02:00
|
|
|
|
return qsTr("Create a 12-digit personal unblocking key (PUK)")
|
2022-11-09 11:22:08 +01:00
|
|
|
|
case Constants.keycardSharedFlow.changePairingCode:
|
2022-10-18 10:04:51 +02:00
|
|
|
|
return qsTr("Create a new pairing code")
|
2022-11-18 09:16:02 +01:00
|
|
|
|
case Constants.keycardSharedFlow.createCopyOfAKeycard:
|
|
|
|
|
return qsTr("Create a backup copy of this Keycard")
|
2023-08-29 16:22:41 +02:00
|
|
|
|
case Constants.keycardSharedFlow.migrateFromKeycardToApp:
|
2023-09-04 18:06:51 +02:00
|
|
|
|
// in the context of `migrateFromKeycardToApp` flow, `forceFlow` is set to `true` on paired devices
|
|
|
|
|
if (root.sharedKeycardModule.forceFlow) {
|
|
|
|
|
return qsTr("Enable password login on this device")
|
|
|
|
|
}
|
2024-06-07 16:29:09 +03:00
|
|
|
|
return qsTr("Migrate a key pair from Keycard to Status")
|
2023-09-06 11:16:23 +02:00
|
|
|
|
case Constants.keycardSharedFlow.migrateFromAppToKeycard:
|
|
|
|
|
if (root.sharedKeycardModule.forceFlow) {
|
|
|
|
|
return qsTr("Enable Keycard login on this device")
|
|
|
|
|
}
|
2022-10-18 10:04:51 +02:00
|
|
|
|
}
|
2022-11-09 11:22:08 +01:00
|
|
|
|
|
2022-08-31 19:09:07 +02:00
|
|
|
|
return ""
|
|
|
|
|
}
|
2022-08-05 15:50:54 +02:00
|
|
|
|
|
2022-11-07 12:43:34 +01:00
|
|
|
|
KeycardPopupDetails {
|
2022-08-05 15:50:54 +02:00
|
|
|
|
id: d
|
2022-11-07 12:43:34 +01:00
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
2023-05-23 14:46:16 +02:00
|
|
|
|
onCancelBtnClicked: {
|
|
|
|
|
root.close();
|
|
|
|
|
}
|
2024-08-05 15:44:32 +02:00
|
|
|
|
onAccountLimitWarning: {
|
|
|
|
|
limitPopup.active = true
|
|
|
|
|
}
|
2022-08-05 15:50:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onClosed: {
|
2023-05-23 14:46:16 +02:00
|
|
|
|
root.sharedKeycardModule.currentState.doCancelAction();
|
2022-08-05 15:50:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-31 23:58:23 +03:00
|
|
|
|
StatusScrollView {
|
2022-11-07 12:43:34 +01:00
|
|
|
|
id: scrollView
|
2023-05-31 23:58:23 +03:00
|
|
|
|
anchors.fill: parent
|
|
|
|
|
contentWidth: availableWidth
|
2023-06-05 14:02:11 +02:00
|
|
|
|
horizontalPadding: 0
|
2022-08-05 15:50:54 +02:00
|
|
|
|
|
2022-11-07 12:43:34 +01:00
|
|
|
|
KeycardPopupContent {
|
|
|
|
|
id: content
|
|
|
|
|
width: scrollView.availableWidth
|
2023-05-31 23:58:23 +03:00
|
|
|
|
implicitHeight: {
|
2022-11-18 09:16:02 +01:00
|
|
|
|
// for all flows
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.keycardMetadataDisplay ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
|
if (!root.sharedKeycardModule.keyPairStoredOnKeycardIsKnown) {
|
2023-09-25 13:23:25 +02:00
|
|
|
|
return Constants.keycard.general.popupBiggerHeight
|
2022-10-18 10:04:51 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-11-18 09:16:02 +01:00
|
|
|
|
|
2022-12-27 14:20:58 +01:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.importFromKeycard &&
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.manageKeycardAccounts &&
|
|
|
|
|
root.sharedKeycardModule.keyPairHelper.accounts.count > 1) {
|
2023-09-25 13:23:25 +02:00
|
|
|
|
return Constants.keycard.general.popupBiggerHeight
|
2022-12-27 14:20:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-25 13:23:25 +02:00
|
|
|
|
return Constants.keycard.general.popupHeight
|
2022-08-31 19:09:07 +02:00
|
|
|
|
}
|
2022-08-05 15:50:54 +02:00
|
|
|
|
|
2022-11-07 12:43:34 +01:00
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
2022-12-16 10:37:08 +01:00
|
|
|
|
emojiPopup: root.emojiPopup
|
2022-11-07 12:43:34 +01:00
|
|
|
|
onPrimaryButtonEnabledChanged: d.primaryButtonEnabled = primaryButtonEnabled
|
2024-08-05 15:44:32 +02:00
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: limitPopup
|
|
|
|
|
active: false
|
|
|
|
|
asynchronous: true
|
|
|
|
|
|
|
|
|
|
sourceComponent: StatusDialog {
|
2024-10-15 21:26:12 +02:00
|
|
|
|
width: root.width - 2*Theme.padding
|
2024-08-05 15:44:32 +02:00
|
|
|
|
|
|
|
|
|
title: Constants.walletConstants.maxNumberOfAccountsTitle
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
text: Constants.walletConstants.maxNumberOfAccountsContent
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
standardButtons: Dialog.Ok
|
|
|
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
|
limitPopup.active = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-05 15:50:54 +02:00
|
|
|
|
}
|
2022-11-07 12:43:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
leftButtons: d.leftButtons
|
|
|
|
|
rightButtons: d.rightButtons
|
2022-08-05 15:50:54 +02:00
|
|
|
|
}
|