Sale Djenic afa7928bae feat(@desktop/keycard): keycard settings -> migrate keypair flow
- Added flow which covers `Setup a new Keycard with an existing account` from
the keycard settings part (though two sub-flows there are missing, `Unlock Keycard`
and `Authentication` cause we don't have them yet).
- Updated factory reset flow (part of shared module) that it can read and display metadata
from a keycard if they are set, with this update this flow is almost complete, we are missing
`Unlock Keycard` flow for it as well.
2022-09-06 15:06:13 +02:00

110 lines
3.8 KiB
QML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import QtQuick 2.14
import QtQuick.Layouts 1.14
import QtQuick.Controls 2.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
import utils 1.0
import shared.status 1.0
import "../helpers"
Item {
id: root
property var sharedKeycardModule
ColumnLayout {
anchors.fill: parent
anchors.topMargin: Style.current.xlPadding
anchors.bottomMargin: Style.current.halfPadding
anchors.leftMargin: Style.current.xlPadding
anchors.rightMargin: Style.current.xlPadding
spacing: Style.current.padding
clip: true
ButtonGroup {
id: keyPairsButtonGroup
}
StatusBaseText {
id: title
Layout.alignment: Qt.AlignHCenter
text: qsTr("Select a key pair")
font.pixelSize: Constants.keycard.general.fontSize1
font.weight: Font.Bold
color: Theme.palette.directColor1
wrapMode: Text.WordWrap
}
StatusBaseText {
id: subTitle
Layout.alignment: Qt.AlignHCenter
text: qsTr("Select which key pair youd like to move to this Keycard")
font.pixelSize: Constants.keycard.general.fontSize2
color: Theme.palette.baseColor1
wrapMode: Text.WordWrap
}
Item {
Layout.fillWidth: true
Layout.preferredHeight: Style.current.halfPadding
Layout.fillHeight: root.sharedKeycardModule.keyPairModel.count === 0
}
StatusBaseText {
visible: !root.sharedKeycardModule.isProfileKeyPairMigrated()
Layout.preferredWidth: parent.width - 2 * Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.alignment: Qt.AlignLeft
text: qsTr("Profile key pair")
font.pixelSize: Constants.keycard.general.fontSize2
color: Theme.palette.baseColor1
wrapMode: Text.WordWrap
}
KeyPairList {
visible: !root.sharedKeycardModule.isProfileKeyPairMigrated()
Layout.fillWidth: true
Layout.preferredHeight: 100
Layout.fillHeight: visible && root.sharedKeycardModule.keyPairModel.count === 1
Layout.alignment: Qt.AlignLeft
Layout.preferredWidth: parent.width
sharedKeycardModule: root.sharedKeycardModule
filterProfilePair: true
keyPairModel: root.sharedKeycardModule.keyPairModel
buttonGroup: keyPairsButtonGroup
}
StatusBaseText {
visible: root.sharedKeycardModule.isProfileKeyPairMigrated() && root.sharedKeycardModule.keyPairModel.count > 0 ||
!root.sharedKeycardModule.isProfileKeyPairMigrated() && root.sharedKeycardModule.keyPairModel.count > 1
Layout.preferredWidth: parent.width - 2 * Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.alignment: Qt.AlignLeft
text: qsTr("Other key pairs")
font.pixelSize: Constants.keycard.general.fontSize2
color: Theme.palette.baseColor1
wrapMode: Text.WordWrap
}
KeyPairList {
visible: root.sharedKeycardModule.isProfileKeyPairMigrated() && root.sharedKeycardModule.keyPairModel.count > 0 ||
!root.sharedKeycardModule.isProfileKeyPairMigrated() && root.sharedKeycardModule.keyPairModel.count > 1
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignLeft
Layout.preferredWidth: parent.width
sharedKeycardModule: root.sharedKeycardModule
keyPairModel: root.sharedKeycardModule.keyPairModel
buttonGroup: keyPairsButtonGroup
}
}
}