2023-08-04 10:29:04 +00:00
import QtQuick 2.15
import StatusQ . Core . Theme 0.1
import StatusQ . Popups 0.1
import utils 1.0
StatusMenu {
id: root
property var keyPair
2023-08-21 10:58:21 +00:00
property bool hasPairedDevices: false
2023-08-04 10:29:04 +00:00
2023-08-21 10:58:21 +00:00
signal runExportQrFlow ( )
signal runImportViaQrFlow ( )
2023-08-04 12:41:57 +00:00
signal runImportViaSeedPhraseFlow ( )
signal runImportViaPrivateKeyFlow ( )
2023-08-04 10:29:04 +00:00
signal runRenameKeypairFlow ( )
signal runRemoveKeypairFlow ( )
2023-08-25 09:05:05 +00:00
signal runMoveKeypairToKeycardFlow ( )
2023-08-29 14:22:41 +00:00
signal runStopUsingKeycardFlow ( )
2023-08-04 10:29:04 +00:00
StatusAction {
2023-08-21 10:58:21 +00:00
text: enabled ? qsTr ( "Show encrypted QR on device" ) : ""
enabled: root . hasPairedDevices &&
! ! root . keyPair &&
2023-08-04 10:29:04 +00:00
root . keyPair . pairType !== Constants . keypair . type . profile &&
! root . keyPair . migratedToKeycard &&
2023-08-09 10:41:55 +00:00
root . keyPair . operability !== Constants . keypair . operability . nonOperable
2023-08-04 10:29:04 +00:00
icon.name: "qr"
icon.color: Theme . palette . primaryColor1
onTriggered: {
2023-08-21 10:58:21 +00:00
root . runExportQrFlow ( )
2023-08-04 10:29:04 +00:00
}
}
StatusAction {
2023-08-25 09:05:05 +00:00
text: enabled ? root . keyPair . migratedToKeycard ? qsTr ( "Stop using Keycard" ) : qsTr ( "Move keypair to a Keycard" ) : ""
2024-03-01 10:13:32 +00:00
enabled: ! ! root . keyPair && root . keyPair . pairType !== Constants . keypair . type . privateKeyImport
2023-08-04 10:29:04 +00:00
icon.name: ! ! root . keyPair && root . keyPair . migratedToKeycard ? "keycard-crossed" : "keycard"
icon.color: Theme . palette . primaryColor1
onTriggered: {
if ( root . keyPair . migratedToKeycard )
2023-08-29 14:22:41 +00:00
root . runStopUsingKeycardFlow ( )
2023-08-04 10:29:04 +00:00
else
2023-08-25 09:05:05 +00:00
root . runMoveKeypairToKeycardFlow ( )
2023-08-04 10:29:04 +00:00
}
}
StatusAction {
text: enabled ? qsTr ( "Import keypair from device via encrypted QR" ) : ""
2023-08-21 10:58:21 +00:00
enabled: root . hasPairedDevices &&
! ! root . keyPair &&
2023-08-04 10:29:04 +00:00
root . keyPair . pairType !== Constants . keypair . type . profile &&
2023-08-09 10:41:55 +00:00
! root . keyPair . migratedToKeycard &&
2023-08-21 10:58:21 +00:00
root . keyPair . operability === Constants . keypair . operability . nonOperable
2023-08-04 10:29:04 +00:00
icon.name: "qr-scan"
icon.color: Theme . palette . primaryColor1
onTriggered: {
2023-08-21 10:58:21 +00:00
root . runImportViaQrFlow ( )
2023-08-04 10:29:04 +00:00
}
}
StatusAction {
text: enabled ? root . keyPair . pairType === Constants . keypair . type . privateKeyImport ? qsTr ( "Import via entering private key" ) : qsTr ( "Import via entering seed phrase" ) : ""
enabled: ! ! root . keyPair &&
2023-08-09 10:41:55 +00:00
! root . keyPair . migratedToKeycard &&
2023-08-04 12:41:57 +00:00
root . keyPair . operability === Constants . keypair . operability . nonOperable &&
2023-08-04 10:29:04 +00:00
( root . keyPair . pairType === Constants . keypair . type . seedImport ||
root . keyPair . pairType === Constants . keypair . type . privateKeyImport )
icon.name: enabled ? root . keyPair . pairType === Constants . keypair . type . privateKeyImport ? "objects" : "key_pair_seed_phrase" : ""
icon.color: Theme . palette . primaryColor1
onTriggered: {
if ( root . keyPair . pairType === Constants . keypair . type . privateKeyImport )
2023-08-04 12:41:57 +00:00
root . runImportViaPrivateKeyFlow ( )
2023-08-04 10:29:04 +00:00
else
2023-08-04 12:41:57 +00:00
root . runImportViaSeedPhraseFlow ( )
2023-08-04 10:29:04 +00:00
}
}
StatusAction {
text: enabled ? qsTr ( "Rename keypair" ) : ""
2024-05-16 09:17:33 +00:00
objectName: "renameKeypairMenuItem"
2023-08-04 10:29:04 +00:00
enabled: ! ! root . keyPair &&
root . keyPair . pairType !== Constants . keypair . type . profile
icon.name: "edit"
icon.color: Theme . palette . primaryColor1
onTriggered: {
root . runRenameKeypairFlow ( )
}
}
StatusMenuSeparator {
visible: ! ! root . keyPair &&
root . keyPair . pairType !== Constants . keypair . type . profile
}
StatusAction {
2023-08-23 12:01:26 +00:00
text: enabled ? qsTr ( "Remove keypair and derived accounts" ) : ""
2023-08-04 10:29:04 +00:00
enabled: ! ! root . keyPair &&
root . keyPair . pairType !== Constants . keypair . type . profile
type: StatusAction . Type . Danger
icon.name: "delete"
icon.color: Theme . palette . dangerColor1
onTriggered: {
root . runRemoveKeypairFlow ( )
}
}
2023-08-04 12:41:57 +00:00
}