Browse Source

qml: show all keystores on WalletDetails page

master
Sander van Grieken 3 years ago
parent
commit
98e395e78e
  1. 112
      electrum/gui/qml/components/WalletDetails.qml
  2. 11
      electrum/gui/qml/qewallet.py

112
electrum/gui/qml/components/WalletDetails.qml

@ -246,52 +246,86 @@ Pane {
} }
} }
Label { Repeater {
text: qsTr('Derivation prefix') id: keystores
visible: Daemon.currentWallet.derivationPrefix model: Daemon.currentWallet.keystores
color: Material.accentColor delegate: ColumnLayout {
} Layout.columnSpan: 2
Label { RowLayout {
Layout.fillWidth: true Label {
text: Daemon.currentWallet.derivationPrefix text: qsTr('Keystore')
visible: Daemon.currentWallet.derivationPrefix color: Material.accentColor
} }
Label {
text: '#' + index
visible: keystores.count > 1
}
}
TextHighlightPane {
Layout.fillWidth: true
leftPadding: constants.paddingLarge
Label { GridLayout {
visible: Daemon.currentWallet.masterPubkey width: parent.width
Layout.columnSpan:2; text: qsTr('Master Public Key'); color: Material.accentColor columns: 2
}
TextHighlightPane { Label {
visible: Daemon.currentWallet.masterPubkey text: qsTr('Derivation prefix')
visible: modelData.derivation_prefix
color: Material.accentColor
}
Label {
Layout.fillWidth: true
text: modelData.derivation_prefix
visible: modelData.derivation_prefix
}
Layout.columnSpan: 2 Label {
Layout.fillWidth: true text: qsTr('BIP32 fingerprint')
padding: 0 visible: modelData.fingerprint
leftPadding: constants.paddingSmall color: Material.accentColor
}
RowLayout { Label {
width: parent.width Layout.fillWidth: true
Label { text: modelData.fingerprint
text: Daemon.currentWallet.masterPubkey visible: modelData.fingerprint
wrapMode: Text.Wrap font.family: FixedFont
Layout.fillWidth: true }
font.family: FixedFont
font.pixelSize: constants.fontSizeMedium Label {
} Layout.columnSpan: 2
ToolButton { visible: modelData.master_pubkey
icon.source: '../../icons/share.png' text: qsTr('Master Public Key')
icon.color: 'transparent' color: Material.accentColor
onClicked: { }
var dialog = app.genericShareDialog.createObject(rootItem, { RowLayout {
title: qsTr('Master Public Key'), Layout.fillWidth: true
text: Daemon.currentWallet.masterPubkey Layout.columnSpan: 2
}) Layout.leftMargin: constants.paddingLarge
dialog.open() Label {
text: modelData.master_pubkey
wrapMode: Text.Wrap
Layout.fillWidth: true
font.family: FixedFont
font.pixelSize: constants.fontSizeMedium
}
ToolButton {
icon.source: '../../icons/share.png'
icon.color: 'transparent'
onClicked: {
var dialog = app.genericShareDialog.createObject(rootItem, {
title: qsTr('Master Public Key'),
text: modelData.master_pubkey
})
dialog.open()
}
}
}
} }
} }
} }
} }
} }
} }
} }

11
electrum/gui/qml/qewallet.py

@ -338,6 +338,17 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
def isHardware(self): def isHardware(self):
return self.wallet.storage.is_encrypted_with_hw_device() return self.wallet.storage.is_encrypted_with_hw_device()
@pyqtProperty('QVariantList', notify=dataChanged)
def keystores(self):
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 ''
})
return result
@pyqtProperty(str, notify=dataChanged) @pyqtProperty(str, notify=dataChanged)
def derivationPrefix(self): def derivationPrefix(self):
keystores = self.wallet.get_keystores() keystores = self.wallet.get_keystores()

Loading…
Cancel
Save