2022-08-05 15:50:54 +02: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 10:37:08 +01:00
|
|
|
|
property var emojiPopup
|
2022-08-05 15:50:54 +02:00
|
|
|
|
|
2022-08-31 19:09:07 +02:00
|
|
|
|
width: Constants.keycard.general.popupWidth
|
|
|
|
|
closePolicy: d.disablePopupClose? Popup.NoAutoClose : Popup.CloseOnEscape
|
2022-08-05 15:50:54 +02:00
|
|
|
|
|
2022-08-31 19:09:07 +02:00
|
|
|
|
header.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")
|
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")
|
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
|
2022-08-05 15:50:54 +02:00
|
|
|
|
|
2022-08-31 19:09:07 +02:00
|
|
|
|
onDisablePopupCloseChanged: {
|
|
|
|
|
hasCloseButton = !disablePopupClose
|
2022-08-05 15:50:54 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onClosed: {
|
2022-11-10 10:06:42 +01:00
|
|
|
|
root.sharedKeycardModule.currentState.doCancelAction()
|
2022-08-05 15:50:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-07 12:43:34 +01:00
|
|
|
|
contentItem: StatusScrollView {
|
|
|
|
|
id: scrollView
|
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
|
|
|
width: parent.width
|
|
|
|
|
height: {
|
|
|
|
|
let availableSpace = Global.applicationWindow.height - (root.margins * 2 + root.topPadding + root.bottomPadding)
|
|
|
|
|
return Math.min(content.height, availableSpace)
|
2022-08-05 15:50:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-07 12:43:34 +01:00
|
|
|
|
KeycardPopupContent {
|
|
|
|
|
id: content
|
|
|
|
|
width: scrollView.availableWidth
|
|
|
|
|
height: {
|
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) {
|
|
|
|
|
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) {
|
|
|
|
|
return Constants.keycard.general.popupBiggerHeight
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-07 12:43:34 +01: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
|
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
|
|
|
|
}
|