From f562ad38cf5e1d32a4618a717fe368506ebc0060 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 14 Apr 2023 14:18:49 +0200 Subject: [PATCH] qml: add confirm dialog before disabling recoverable channels (similar to trampoline) --- electrum/gui/qml/components/Preferences.qml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/electrum/gui/qml/components/Preferences.qml b/electrum/gui/qml/components/Preferences.qml index b4d07c127..569f75add 100644 --- a/electrum/gui/qml/components/Preferences.qml +++ b/electrum/gui/qml/components/Preferences.qml @@ -287,8 +287,23 @@ Pane { Switch { id: useRecoverableChannels onCheckedChanged: { - if (activeFocus) - Config.useRecoverableChannels = checked + if (activeFocus) { + if (!checked) { + var dialog = app.messageDialog.createObject(app, { + text: qsTr('Are you sure? This option allows you to recover your lightning funds if you lose your device, or if you uninstall this app while lightning channels are active. Do not disable it unless you know how to recover channels from backups.'), + yesno: true + }) + dialog.accepted.connect(function() { + Config.useRecoverableChannels = False + }) + dialog.rejected.connect(function() { + checked = true // revert + }) + dialog.open() + } else { + Config.useRecoverableChannels = checked + } + } } } Label {