From d2bab4d51a1b526d5f2ec320f6b0020985a917fc Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Tue, 31 Jan 2023 13:15:19 +0100 Subject: [PATCH] qml: confirm close electrum dialog instead of double-tap back button --- electrum/gui/qml/components/main.qml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/electrum/gui/qml/components/main.qml b/electrum/gui/qml/components/main.qml index 48f1faba1..ec31d5720 100644 --- a/electrum/gui/qml/components/main.qml +++ b/electrum/gui/qml/components/main.qml @@ -30,6 +30,8 @@ ApplicationWindow property variant activeDialogs: [] + property bool _wantClose: false + header: ToolBar { id: toolbar @@ -302,23 +304,25 @@ ApplicationWindow stack.pop() } else { // destroy most GUI components so that we don't dump so many null reference warnings on exit - if (closeMsgTimer.running) { + if (app._wantClose) { app.header.visible = false mainStackView.clear() } else { - notificationPopup.show('Press Back again to exit') - closeMsgTimer.start() + var dialog = app.messageDialog.createObject(app, { + text: qsTr('Close Electrum?'), + yesno: true + }) + dialog.yesClicked.connect(function() { + dialog.close() + app._wantClose = true + app.close() + }) + dialog.open() close.accepted = false } } } - Timer { - id: closeMsgTimer - interval: 5000 - repeat: false - } - Connections { target: Daemon function onWalletRequiresPassword() {