2024-10-15 19:26:12 +00:00
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
2022-08-31 17:09:07 +00:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2023-08-09 10:41:55 +00:00
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
|
import "../helpers"
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property var sharedKeycardModule
|
|
|
|
|
|
2022-09-02 11:04:59 +00:00
|
|
|
|
signal keyPairSelected()
|
|
|
|
|
|
2023-08-09 10:41:55 +00:00
|
|
|
|
QtObject {
|
|
|
|
|
id: d
|
|
|
|
|
readonly property string profilePairTypeValue: Constants.keycard.keyPairType.profile
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
|
ColumnLayout {
|
|
|
|
|
anchors.fill: parent
|
2024-10-15 19:26:12 +00:00
|
|
|
|
anchors.topMargin: Theme.xlPadding
|
|
|
|
|
anchors.bottomMargin: Theme.halfPadding
|
|
|
|
|
anchors.leftMargin: Theme.xlPadding
|
|
|
|
|
anchors.rightMargin: Theme.xlPadding
|
|
|
|
|
spacing: Theme.padding
|
2022-08-31 17:09:07 +00:00
|
|
|
|
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 you’d like to move to this Keycard")
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
Layout.fillWidth: true
|
2024-10-15 19:26:12 +00:00
|
|
|
|
Layout.preferredHeight: Theme.halfPadding
|
2022-08-31 17:09:07 +00:00
|
|
|
|
Layout.fillHeight: root.sharedKeycardModule.keyPairModel.count === 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
2022-09-26 11:01:26 +00:00
|
|
|
|
visible: !userProfile.isKeycardUser
|
2024-10-15 19:26:12 +00:00
|
|
|
|
Layout.preferredWidth: parent.width - 2 * Theme.padding
|
|
|
|
|
Layout.leftMargin: Theme.padding
|
2022-08-31 17:09:07 +00:00
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
|
text: qsTr("Profile key pair")
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KeyPairList {
|
2022-09-26 11:01:26 +00:00
|
|
|
|
visible: !userProfile.isKeycardUser
|
2022-08-31 17:09:07 +00:00
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: 100
|
|
|
|
|
Layout.fillHeight: visible && root.sharedKeycardModule.keyPairModel.count === 1
|
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
|
|
2023-08-09 10:41:55 +00:00
|
|
|
|
modelFilters: ExpressionFilter {
|
2024-10-15 19:26:12 +00:00
|
|
|
|
expression: model.keyPair.pairType === d.profilePairTypeValue
|
2023-08-09 10:41:55 +00:00
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
keyPairModel: root.sharedKeycardModule.keyPairModel
|
|
|
|
|
buttonGroup: keyPairsButtonGroup
|
2022-09-02 11:04:59 +00:00
|
|
|
|
|
|
|
|
|
onKeyPairSelected: {
|
2023-08-09 10:41:55 +00:00
|
|
|
|
root.sharedKeycardModule.setSelectedKeyPair(keyUid)
|
2022-09-02 11:04:59 +00:00
|
|
|
|
root.keyPairSelected()
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
2022-09-26 11:01:26 +00:00
|
|
|
|
visible: userProfile.isKeycardUser && root.sharedKeycardModule.keyPairModel.count > 0 ||
|
|
|
|
|
!userProfile.isKeycardUser && root.sharedKeycardModule.keyPairModel.count > 1
|
2024-10-15 19:26:12 +00:00
|
|
|
|
Layout.preferredWidth: parent.width - 2 * Theme.padding
|
|
|
|
|
Layout.leftMargin: Theme.padding
|
2022-08-31 17:09:07 +00:00
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
|
text: qsTr("Other key pairs")
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KeyPairList {
|
2022-09-26 11:01:26 +00:00
|
|
|
|
visible: userProfile.isKeycardUser && root.sharedKeycardModule.keyPairModel.count > 0 ||
|
|
|
|
|
!userProfile.isKeycardUser && root.sharedKeycardModule.keyPairModel.count > 1
|
2022-08-31 17:09:07 +00:00
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
|
|
2023-08-09 10:41:55 +00:00
|
|
|
|
modelFilters: ExpressionFilter {
|
2024-10-15 19:26:12 +00:00
|
|
|
|
expression: model.keyPair.pairType === d.profilePairTypeValue
|
2023-08-09 10:41:55 +00:00
|
|
|
|
inverted: true
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
keyPairModel: root.sharedKeycardModule.keyPairModel
|
|
|
|
|
buttonGroup: keyPairsButtonGroup
|
2022-09-02 11:04:59 +00:00
|
|
|
|
|
|
|
|
|
onKeyPairSelected: {
|
2023-08-09 10:41:55 +00:00
|
|
|
|
root.sharedKeycardModule.setSelectedKeyPair(keyUid)
|
2022-09-02 11:04:59 +00:00
|
|
|
|
root.keyPairSelected()
|
|
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|