2023-08-09 10:41:55 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
2023-08-21 10:58:21 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-08-09 10:41:55 +00:00
|
|
|
|
|
|
|
import shared.popups.keycard.helpers 1.0
|
2023-08-21 10:58:21 +00:00
|
|
|
import shared.status 1.0
|
2023-08-09 10:41:55 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
import "../stores"
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property KeypairImportStore store
|
|
|
|
|
|
|
|
implicitHeight: layout.implicitHeight
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
readonly property string fullyOperableValue: Constants.keypair.operability.fullyOperable
|
|
|
|
readonly property string partiallyOperableValue: Constants.keypair.operability.partiallyOperable
|
2023-08-21 10:58:21 +00:00
|
|
|
readonly property string profileTypeValue: Constants.keypair.type.profile
|
|
|
|
readonly property int margin: 16
|
|
|
|
|
|
|
|
function importKeypairs() {
|
|
|
|
root.store.currentState.doSecondaryAction()
|
|
|
|
}
|
2023-08-09 10:41:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: layout
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 16
|
|
|
|
spacing: 16
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
2023-08-21 10:58:21 +00:00
|
|
|
Layout.leftMargin: d.margin
|
|
|
|
Layout.rightMargin: d.margin
|
2023-08-23 12:01:26 +00:00
|
|
|
text: qsTr("To use the derived accounts on this device, you need to import their keypairs.")
|
2023-08-09 10:41:55 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
}
|
|
|
|
|
2023-08-21 10:58:21 +00:00
|
|
|
StatusSectionHeadline {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: d.margin
|
|
|
|
Layout.rightMargin: d.margin
|
|
|
|
text: qsTr("Import keypairs from your other device")
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
title: qsTr("Import via scanning encrypted QR")
|
|
|
|
asset {
|
|
|
|
width: 24
|
|
|
|
height: 24
|
|
|
|
name: "qr"
|
|
|
|
}
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
d.importKeypairs()
|
|
|
|
}
|
|
|
|
|
|
|
|
components: [
|
|
|
|
StatusIcon {
|
|
|
|
icon: "next"
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
|
|
|
d.importKeypairs()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusSectionHeadline {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: d.margin
|
|
|
|
Layout.rightMargin: d.margin
|
|
|
|
text: qsTr("Import individual keys")
|
|
|
|
}
|
|
|
|
|
2023-08-09 10:41:55 +00:00
|
|
|
KeyPairList {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
|
|
|
|
disableSelectionForKeypairsWithNonDefaultDerivationPath: false
|
|
|
|
displayRadioButtonForSelection: false
|
2023-08-21 10:58:21 +00:00
|
|
|
useTransparentItemBackgroundColor: true
|
|
|
|
|
2023-08-09 10:41:55 +00:00
|
|
|
modelFilters: ExpressionFilter {
|
|
|
|
expression: model.keyPair.migratedToKeycard ||
|
2023-08-21 10:58:21 +00:00
|
|
|
model.keyPair.pairType == d.profileTypeValue ||
|
2023-08-09 10:41:55 +00:00
|
|
|
model.keyPair.operability == d.fullyOperableValue ||
|
|
|
|
model.keyPair.operability == d.partiallyOperableValue
|
|
|
|
inverted: true
|
|
|
|
}
|
|
|
|
keyPairModel: root.store.keypairImportModule.keypairModel
|
|
|
|
|
|
|
|
onKeyPairSelected: {
|
|
|
|
root.store.keypairImportModule.setSelectedKeyPair(keyUid)
|
|
|
|
root.store.currentState.doPrimaryAction()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|