qml: add doAccept and doReject functions to ElDialog.
These functions make sure no duplicate accepted/rejected signals are emitted.
This commit is contained in:
@@ -104,7 +104,7 @@ ElDialog {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr('Import')
|
||||
enabled: valid
|
||||
onClicked: accept()
|
||||
onClicked: doAccept()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ ElDialog {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr('Create request')
|
||||
icon.source: '../../icons/confirmed.png'
|
||||
onClicked: accept()
|
||||
onClicked: doAccept()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user