2022-08-05 13:50:54 +00:00
|
|
|
|
import QtQuick 2.14
|
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
|
|
StatusModal {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property var sharedKeycardModule
|
2022-12-16 09:37:08 +00:00
|
|
|
|
property var emojiPopup
|
2022-08-05 13:50:54 +00:00
|
|
|
|
|
2023-07-06 13:54:35 +00:00
|
|
|
|
width: Constants.keycard.general.popupWidth
|
2023-09-04 16:06:51 +00: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 13:50:54 +00:00
|
|
|
|
|
2023-05-23 12:46:16 +00:00
|
|
|
|
headerSettings.title: {
|
2022-11-09 10:22:08 +00:00
|
|
|
|
switch (root.sharedKeycardModule.currentState.flowType) {
|
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycard:
|
2022-08-31 17:09:07 +00:00
|
|
|
|
return qsTr("Set up a new Keycard with an existing account")
|
2022-12-16 09:37:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycardNewSeedPhrase:
|
|
|
|
|
return qsTr("Create a new Keycard account with a new seed phrase")
|
2022-12-26 12:52:21 +00:00
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycardOldSeedPhrase:
|
|
|
|
|
return qsTr("Import or restore a Keycard via a seed phrase")
|
2022-12-27 13:20:58 +00:00
|
|
|
|
case Constants.keycardSharedFlow.importFromKeycard:
|
|
|
|
|
return qsTr("Migrate account from Keycard to Status")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.factoryReset:
|
2022-08-31 17:09:07 +00:00
|
|
|
|
return qsTr("Factory reset a Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.authentication:
|
2022-09-13 10:03:25 +00:00
|
|
|
|
return qsTr("Authenticate")
|
2023-10-27 17:14:39 +00:00
|
|
|
|
case Constants.keycardSharedFlow.sign:
|
|
|
|
|
return qsTr("Signing")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.unlockKeycard:
|
2022-09-20 14:01:57 +00:00
|
|
|
|
return qsTr("Unlock Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.displayKeycardContent:
|
2022-09-21 13:11:39 +00:00
|
|
|
|
return qsTr("Check what’s on a Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.renameKeycard:
|
2022-10-12 17:08:59 +00:00
|
|
|
|
return qsTr("Rename Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.changeKeycardPin:
|
2022-10-17 10:12:22 +00:00
|
|
|
|
return qsTr("Change pin")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.changeKeycardPuk:
|
2022-10-17 10:44:09 +00:00
|
|
|
|
return qsTr("Create a 12-digit personal unblocking key (PUK)")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.changePairingCode:
|
2022-10-18 08:04:51 +00:00
|
|
|
|
return qsTr("Create a new pairing code")
|
2022-11-18 08:16:02 +00:00
|
|
|
|
case Constants.keycardSharedFlow.createCopyOfAKeycard:
|
|
|
|
|
return qsTr("Create a backup copy of this Keycard")
|
2023-08-29 14:22:41 +00:00
|
|
|
|
case Constants.keycardSharedFlow.migrateFromKeycardToApp:
|
2023-09-04 16:06:51 +00: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 13:29:09 +00:00
|
|
|
|
return qsTr("Migrate a key pair from Keycard to Status")
|
2023-09-06 09:16:23 +00:00
|
|
|
|
case Constants.keycardSharedFlow.migrateFromAppToKeycard:
|
|
|
|
|
if (root.sharedKeycardModule.forceFlow) {
|
|
|
|
|
return qsTr("Enable Keycard login on this device")
|
|
|
|
|
}
|
2022-10-18 08:04:51 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
|
return ""
|
|
|
|
|
}
|
2022-08-05 13:50:54 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
KeycardPopupDetails {
|
2022-08-05 13:50:54 +00:00
|
|
|
|
id: d
|
2022-11-07 11:43:34 +00:00
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
2023-05-23 12:46:16 +00:00
|
|
|
|
onCancelBtnClicked: {
|
|
|
|
|
root.close();
|
|
|
|
|
}
|
2022-08-05 13:50:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onClosed: {
|
2023-05-23 12:46:16 +00:00
|
|
|
|
root.sharedKeycardModule.currentState.doCancelAction();
|
2022-08-05 13:50:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-31 20:58:23 +00:00
|
|
|
|
StatusScrollView {
|
2022-11-07 11:43:34 +00:00
|
|
|
|
id: scrollView
|
2023-05-31 20:58:23 +00:00
|
|
|
|
anchors.fill: parent
|
|
|
|
|
contentWidth: availableWidth
|
2023-06-05 12:02:11 +00:00
|
|
|
|
horizontalPadding: 0
|
2022-08-05 13:50:54 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
KeycardPopupContent {
|
|
|
|
|
id: content
|
|
|
|
|
width: scrollView.availableWidth
|
2023-05-31 20:58:23 +00:00
|
|
|
|
implicitHeight: {
|
2022-11-18 08:16:02 +00: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 11:23:25 +00:00
|
|
|
|
return Constants.keycard.general.popupBiggerHeight
|
2022-10-18 08:04:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-11-18 08:16:02 +00:00
|
|
|
|
|
2022-12-27 13:20:58 +00: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 11:23:25 +00:00
|
|
|
|
return Constants.keycard.general.popupBiggerHeight
|
2022-12-27 13:20:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-25 11:23:25 +00:00
|
|
|
|
return Constants.keycard.general.popupHeight
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
2022-08-05 13:50:54 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
2022-12-16 09:37:08 +00:00
|
|
|
|
emojiPopup: root.emojiPopup
|
2022-11-07 11:43:34 +00:00
|
|
|
|
onPrimaryButtonEnabledChanged: d.primaryButtonEnabled = primaryButtonEnabled
|
2022-08-05 13:50:54 +00:00
|
|
|
|
}
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
leftButtons: d.leftButtons
|
|
|
|
|
rightButtons: d.rightButtons
|
2022-08-05 13:50:54 +00:00
|
|
|
|
}
|