From 497934688179c3626105b7459a397b91c248c688 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Tue, 14 Mar 2023 10:20:42 +0100 Subject: [PATCH] qml: detect channel backups in send dialog --- electrum/gui/qml/components/SendDialog.qml | 3 +++ electrum/gui/qml/components/WalletMainView.qml | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/electrum/gui/qml/components/SendDialog.qml b/electrum/gui/qml/components/SendDialog.qml index 11df6b8f6..edf438446 100644 --- a/electrum/gui/qml/components/SendDialog.qml +++ b/electrum/gui/qml/components/SendDialog.qml @@ -13,6 +13,7 @@ ElDialog { property InvoiceParser invoiceParser signal txFound(data: string) + signal channelBackupFound(data: string) parent: Overlay.overlay modal: true @@ -32,6 +33,8 @@ ElDialog { function dispatch(data) { if (bitcoin.isRawTx(data)) { txFound(data) + } else if (Daemon.currentWallet.isValidChannelBackup(data)) { + channelBackupFound(data) } else { invoiceParser.recipient = data } diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml index e664e7cb1..a4d64daac 100644 --- a/electrum/gui/qml/components/WalletMainView.qml +++ b/electrum/gui/qml/components/WalletMainView.qml @@ -308,6 +308,20 @@ Item { app.stack.push(Qt.resolvedUrl('TxDetails.qml'), { rawtx: data }) close() } + onChannelBackupFound: { + var dialog = app.messageDialog.createObject(app, { + text: qsTr('Import Channel backup?'), + yesno: true + }) + dialog.yesClicked.connect(function() { + Daemon.currentWallet.importChannelBackup(data) + close() + }) + dialog.rejected.connect(function() { + close() + }) + dialog.open() + } onClosed: destroy() } }