1
0

qml: add channel backup option to channel details page

This commit is contained in:
Sander van Grieken
2022-08-24 10:15:44 +02:00
parent bb8af0cd08
commit b0cfc2ab14
2 changed files with 23 additions and 2 deletions

View File

@@ -22,8 +22,17 @@ Pane {
icon.color: 'transparent' icon.color: 'transparent'
action: Action { action: Action {
text: qsTr('Backup'); text: qsTr('Backup');
enabled: false enabled: true
onTriggered: {} 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' icon.source: '../../icons/file.png'
} }
} }

View File

@@ -188,3 +188,15 @@ class QEChannelDetails(QObject, QtEventListener):
@pyqtSlot() @pyqtSlot()
def deleteChannel(self): def deleteChannel(self):
self._wallet.wallet.lnworker.remove_channel(self._channel.channel_id) 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."),
])