1
0

qml: more robust keystore properties builder, support imported type

This commit is contained in:
Sander van Grieken
2023-03-09 21:49:42 +01:00
parent aaca7c58ad
commit 016eea2c04
2 changed files with 31 additions and 4 deletions

View File

@@ -404,6 +404,30 @@ Pane {
width: parent.width
columns: 2
Label {
text: qsTr('Keystore type')
visible: modelData.keystore_type
color: Material.accentColor
}
Label {
Layout.fillWidth: true
text: modelData.keystore_type
visible: modelData.keystore_type
}
Label {
text: modelData.watch_only
? qsTr('Imported addresses')
: qsTr('Imported keys')
visible: modelData.num_imported
color: Material.accentColor
}
Label {
Layout.fillWidth: true
text: modelData.num_imported
visible: modelData.num_imported
}
Label {
text: qsTr('Derivation prefix')
visible: modelData.derivation_prefix
@@ -438,6 +462,7 @@ Pane {
Layout.fillWidth: true
Layout.columnSpan: 2
Layout.leftMargin: constants.paddingLarge
visible: modelData.master_pubkey
Label {
text: modelData.master_pubkey
wrapMode: Text.Wrap

View File

@@ -362,10 +362,12 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
result = []
for k in self.wallet.get_keystores():
result.append({
'derivation_prefix': k.get_derivation_prefix() or '',
'master_pubkey': k.get_master_public_key() or '',
'fingerprint': k.get_root_fingerprint() or '',
'watch_only': k.is_watching_only()
'keystore_type': k.type,
'watch_only': k.is_watching_only(),
'derivation_prefix': (k.get_derivation_prefix() if k.is_deterministic() else '') or '',
'master_pubkey': (k.get_master_public_key() if k.is_deterministic() else '') or '',
'fingerprint': (k.get_root_fingerprint() if k.is_deterministic() else '') or '',
'num_imported': len(k.keypairs) if k.can_import() else 0,
})
return result