From 94c54f7057716ab490404954aca090705ef0ae86 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Wed, 9 Oct 2024 17:45:40 +0200 Subject: [PATCH] qml: sweep: allow sweep to watch-only wallet, but ask confirmation. --- electrum/gui/qml/components/WalletMainView.qml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml index 5aa727f75..f9c0228cb 100644 --- a/electrum/gui/qml/components/WalletMainView.qml +++ b/electrum/gui/qml/components/WalletMainView.qml @@ -142,6 +142,19 @@ Item { sendButtonText: qsTr('Sweep') }) finalizerDialog.accepted.connect(function() { + if (Daemon.currentWallet.isWatchOnly) { + var confirmdialog = app.messageDialog.createObject(mainView, { + title: qsTr('Confirm Sweep'), + text: qsTr('Current wallet is watch-only. You might not be able to spend from these addresses.\n\nAre you sure?'), + yesno: true + }) + confirmdialog.accepted.connect(function() { + finalizerDialog.finalizer.send() + close() + }) + confirmdialog.open() + return + } console.log("Sending sweep transaction") finalizerDialog.finalizer.send() }) @@ -211,7 +224,6 @@ Item { icon.source: '../../icons/sweep.png' action: Action { text: qsTr('Sweep key') - enabled: !Daemon.currentWallet.isWatchOnly // watchonly might be acceptable onTriggered: { startSweep() menu.deselect()