Browse Source

qml: add channel backup option to channel details page

patch-4
Sander van Grieken 2 years ago
parent
commit
b0cfc2ab14
  1. 13
      electrum/gui/qml/components/ChannelDetails.qml
  2. 12
      electrum/gui/qml/qechanneldetails.py

13
electrum/gui/qml/components/ChannelDetails.qml

@ -22,8 +22,17 @@ Pane {
icon.color: 'transparent'
action: Action {
text: qsTr('Backup');
enabled: false
onTriggered: {}
enabled: true
onTriggered: {
var dialog = app.genericShareDialog.createObject(root,
{
title: qsTr('Channel Backup for %1').arg(channeldetails.short_cid),
text: channeldetails.channelBackup(),
text_help: channeldetails.channelBackupHelpText()
}
)
dialog.open()
}
icon.source: '../../icons/file.png'
}
}

12
electrum/gui/qml/qechanneldetails.py

@ -188,3 +188,15 @@ class QEChannelDetails(QObject, QtEventListener):
@pyqtSlot()
def deleteChannel(self):
self._wallet.wallet.lnworker.remove_channel(self._channel.channel_id)
@pyqtSlot(result=str)
def channelBackup(self):
return self._wallet.wallet.lnworker.export_channel_backup(self._channel.channel_id)
@pyqtSlot(result=str)
def channelBackupHelpText(self):
return ' '.join([
_("Channel backups can be imported in another instance of the same wallet, by scanning this QR code."),
_("Please note that channel backups cannot be used to restore your channels."),
_("If you lose your wallet file, the only thing you can do with a backup is to request your channel to be closed, so that your funds will be sent on-chain."),
])

Loading…
Cancel
Save