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-08-31 17:09:07 +00:00
|
|
|
|
width: Constants.keycard.general.popupWidth
|
2022-08-05 13:50:54 +00:00
|
|
|
|
anchors.centerIn: parent
|
2022-08-31 17:09:07 +00:00
|
|
|
|
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: {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.setupNewKeycard) {
|
|
|
|
|
return qsTr("Set up a new Keycard with an existing account")
|
|
|
|
|
}
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.factoryReset) {
|
|
|
|
|
return qsTr("Factory reset a Keycard")
|
|
|
|
|
}
|
2022-09-13 10:03:25 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.authentication) {
|
|
|
|
|
return qsTr("Authenticate")
|
|
|
|
|
}
|
2022-09-20 14:01:57 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.unlockKeycard) {
|
|
|
|
|
return qsTr("Unlock Keycard")
|
|
|
|
|
}
|
2022-09-21 13:11:39 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.displayKeycardContent) {
|
|
|
|
|
return qsTr("Check what’s on a Keycard")
|
|
|
|
|
}
|
2022-10-12 17:08:59 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.renameKeycard) {
|
|
|
|
|
return qsTr("Rename Keycard")
|
|
|
|
|
}
|
2022-10-17 10:12:22 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.changeKeycardPin) {
|
|
|
|
|
return qsTr("Change pin")
|
|
|
|
|
}
|
2022-10-17 10:44:09 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.changeKeycardPuk) {
|
|
|
|
|
return qsTr("Create a 12-digit personal unblocking key (PUK)")
|
|
|
|
|
}
|
2022-10-18 08:04:51 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.changePairingCode) {
|
|
|
|
|
return qsTr("Create a new pairing code")
|
|
|
|
|
}
|
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-09-15 08:05:37 +00:00
|
|
|
|
root.sharedKeycardModule.currentState.doTertiaryAction()
|
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: {
|
|
|
|
|
if (!root.sharedKeycardModule.keyPairStoredOnKeycardIsKnown) {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.setupNewKeycard) {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.keycardMetadataDisplay ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
|
return Constants.keycard.general.popupBiggerHeight
|
|
|
|
|
}
|
2022-09-21 13:11:39 +00:00
|
|
|
|
}
|
2022-11-07 11:43:34 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.factoryReset) {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.keycardMetadataDisplay ||
|
|
|
|
|
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
|
|
|
|
return Constants.keycard.general.popupBiggerHeight
|
|
|
|
|
}
|
2022-09-13 10:03:25 +00:00
|
|
|
|
}
|
2022-11-07 11:43:34 +00:00
|
|
|
|
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.displayKeycardContent) {
|
|
|
|
|
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.keycardMetadataDisplay) {
|
|
|
|
|
return Constants.keycard.general.popupBiggerHeight
|
|
|
|
|
}
|
2022-10-18 08:04:51 +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
|
|
|
|
|
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
|
|
|
|
}
|