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
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
|
width: Constants.keycard.general.popupWidth
|
|
|
|
|
closePolicy: d.disablePopupClose? Popup.NoAutoClose : Popup.CloseOnEscape
|
2022-08-05 13:50:54 +00:00
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
|
header.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-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")
|
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")
|
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
|
2022-08-05 13:50:54 +00:00
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
|
onDisablePopupCloseChanged: {
|
|
|
|
|
hasCloseButton = !disablePopupClose
|
2022-08-05 13:50:54 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onClosed: {
|
2022-11-10 09:06:42 +00:00
|
|
|
|
root.sharedKeycardModule.currentState.doCancelAction()
|
2022-08-05 13:50:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-07 11:43:34 +00: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 13:50:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
KeycardPopupContent {
|
|
|
|
|
id: content
|
|
|
|
|
width: scrollView.availableWidth
|
|
|
|
|
height: {
|
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) {
|
|
|
|
|
return Constants.keycard.general.popupBiggerHeight
|
2022-10-18 08:04:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-11-18 08:16:02 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +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
|
|
|
|
}
|