diff --git a/electrum/gui/qml/components/ImportAddressesKeysDialog.qml b/electrum/gui/qml/components/ImportAddressesKeysDialog.qml index 10a069b19..703543221 100644 --- a/electrum/gui/qml/components/ImportAddressesKeysDialog.qml +++ b/electrum/gui/qml/components/ImportAddressesKeysDialog.qml @@ -104,7 +104,7 @@ ElDialog { Layout.fillWidth: true text: qsTr('Import') enabled: valid - onClicked: accept() + onClicked: doAccept() } } diff --git a/electrum/gui/qml/components/ImportChannelBackupDialog.qml b/electrum/gui/qml/components/ImportChannelBackupDialog.qml index 42dce5d96..309066ac5 100644 --- a/electrum/gui/qml/components/ImportChannelBackupDialog.qml +++ b/electrum/gui/qml/components/ImportChannelBackupDialog.qml @@ -23,6 +23,10 @@ ElDialog { return valid = Daemon.currentWallet.isValidChannelBackup(text) } + onAccepted: { + Daemon.currentWallet.importChannelBackup(channelbackup_ta.text) + } + ColumnLayout { anchors.fill: parent spacing: 0 @@ -84,10 +88,7 @@ ElDialog { Layout.fillWidth: true enabled: valid text: qsTr('Import') - onClicked: { - Daemon.currentWallet.importChannelBackup(channelbackup_ta.text) - root.accept() - } + onClicked: doAccept() } } diff --git a/electrum/gui/qml/components/MessageDialog.qml b/electrum/gui/qml/components/MessageDialog.qml index 4b01c915a..1256df7e8 100644 --- a/electrum/gui/qml/components/MessageDialog.qml +++ b/electrum/gui/qml/components/MessageDialog.qml @@ -47,7 +47,7 @@ ElDialog { text: qsTr('Ok') icon.source: Qt.resolvedUrl('../../icons/confirmed.png') visible: !yesno - onClicked: accept() + onClicked: doAccept() } FlatButton { @@ -57,7 +57,7 @@ ElDialog { text: qsTr('Yes') icon.source: Qt.resolvedUrl('../../icons/confirmed.png') visible: yesno - onClicked: accept() + onClicked: doAccept() } FlatButton { Layout.fillWidth: true @@ -66,7 +66,7 @@ ElDialog { text: qsTr('No') icon.source: Qt.resolvedUrl('../../icons/closebutton.png') visible: yesno - onClicked: reject() + onClicked: doReject() } } } diff --git a/electrum/gui/qml/components/PasswordDialog.qml b/electrum/gui/qml/components/PasswordDialog.qml index 85d2dc853..4b3cef5e4 100644 --- a/electrum/gui/qml/components/PasswordDialog.qml +++ b/electrum/gui/qml/components/PasswordDialog.qml @@ -73,7 +73,7 @@ ElDialog { enabled: confirmPassword ? pw_1.text.length >= 6 && pw_1.text == pw_2.text : true onClicked: { password = pw_1.text - passworddialog.accept() + passworddialog.doAccept() } } } diff --git a/electrum/gui/qml/components/ReceiveDetailsDialog.qml b/electrum/gui/qml/components/ReceiveDetailsDialog.qml index 4950f1e34..0f663fb73 100644 --- a/electrum/gui/qml/components/ReceiveDetailsDialog.qml +++ b/electrum/gui/qml/components/ReceiveDetailsDialog.qml @@ -97,7 +97,7 @@ ElDialog { Layout.fillWidth: true text: qsTr('Create request') icon.source: '../../icons/confirmed.png' - onClicked: accept() + onClicked: doAccept() } } diff --git a/electrum/gui/qml/components/TxDetails.qml b/electrum/gui/qml/components/TxDetails.qml index 6e46904f2..0a2878dcb 100644 --- a/electrum/gui/qml/components/TxDetails.qml +++ b/electrum/gui/qml/components/TxDetails.qml @@ -57,10 +57,10 @@ Pane { Layout.bottomMargin: constants.paddingLarge visible: txdetails.canBump || txdetails.canCpfp || txdetails.canCancel || txdetails.canRemove text: txdetails.canRemove - ? qsTr('This transaction is local to your wallet. It has not been published yet.') - : qsTr('This transaction is still unconfirmed.') + '\n' + (txdetails.canCancel - ? qsTr('You can bump its fee to speed up its confirmation, or cancel this transaction') - : qsTr('You can bump its fee to speed up its confirmation')) + ? qsTr('This transaction is local to your wallet. It has not been published yet.') + : qsTr('This transaction is still unconfirmed.') + '\n' + (txdetails.canCancel + ? qsTr('You can bump its fee to speed up its confirmation, or cancel this transaction') + : qsTr('You can bump its fee to speed up its confirmation')) } RowLayout { diff --git a/electrum/gui/qml/components/controls/ElDialog.qml b/electrum/gui/qml/components/controls/ElDialog.qml index 82bafd16f..ebc133919 100644 --- a/electrum/gui/qml/components/controls/ElDialog.qml +++ b/electrum/gui/qml/components/controls/ElDialog.qml @@ -9,8 +9,27 @@ Dialog { property string iconSource property bool resizeWithKeyboard: true + property bool _result: false + + // called to finally close dialog after checks by onClosing handler in main.qml function doClose() { - close() + doReject() + } + + // avoid potential multiple signals, only emit once + function doAccept() { + if (_result) + return + _result = true + accept() + } + + // avoid potential multiple signals, only emit once + function doReject() { + if (_result) + return + _result = true + reject() } parent: resizeWithKeyboard ? Overlay.overlay.children[0] : Overlay.overlay diff --git a/electrum/gui/qml/components/wizard/Wizard.qml b/electrum/gui/qml/components/wizard/Wizard.qml index 80818c0db..5df89f842 100644 --- a/electrum/gui/qml/components/wizard/Wizard.qml +++ b/electrum/gui/qml/components/wizard/Wizard.qml @@ -131,7 +131,7 @@ ElDialog { function finish() { currentItem.accept() _setWizardData(pages.contentChildren[currentIndex].wizard_data) - wizard.accept() + wizard.doAccept() } property bool pagevalid: false @@ -163,7 +163,7 @@ ElDialog { Layout.preferredWidth: 1 visible: pages.currentIndex == 0 text: qsTr("Cancel") - onClicked: wizard.reject() + onClicked: wizard.doReject() } FlatButton { Layout.fillWidth: true