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
|
Layout.fillWidth: true
|
||||||
text: qsTr('Import')
|
text: qsTr('Import')
|
||||||
enabled: valid
|
enabled: valid
|
||||||
onClicked: accept()
|
onClicked: doAccept()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ ElDialog {
|
|||||||
return valid = Daemon.currentWallet.isValidChannelBackup(text)
|
return valid = Daemon.currentWallet.isValidChannelBackup(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onAccepted: {
|
||||||
|
Daemon.currentWallet.importChannelBackup(channelbackup_ta.text)
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 0
|
spacing: 0
|
||||||
@@ -84,10 +88,7 @@ ElDialog {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
enabled: valid
|
enabled: valid
|
||||||
text: qsTr('Import')
|
text: qsTr('Import')
|
||||||
onClicked: {
|
onClicked: doAccept()
|
||||||
Daemon.currentWallet.importChannelBackup(channelbackup_ta.text)
|
|
||||||
root.accept()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ ElDialog {
|
|||||||
text: qsTr('Ok')
|
text: qsTr('Ok')
|
||||||
icon.source: Qt.resolvedUrl('../../icons/confirmed.png')
|
icon.source: Qt.resolvedUrl('../../icons/confirmed.png')
|
||||||
visible: !yesno
|
visible: !yesno
|
||||||
onClicked: accept()
|
onClicked: doAccept()
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatButton {
|
FlatButton {
|
||||||
@@ -57,7 +57,7 @@ ElDialog {
|
|||||||
text: qsTr('Yes')
|
text: qsTr('Yes')
|
||||||
icon.source: Qt.resolvedUrl('../../icons/confirmed.png')
|
icon.source: Qt.resolvedUrl('../../icons/confirmed.png')
|
||||||
visible: yesno
|
visible: yesno
|
||||||
onClicked: accept()
|
onClicked: doAccept()
|
||||||
}
|
}
|
||||||
FlatButton {
|
FlatButton {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -66,7 +66,7 @@ ElDialog {
|
|||||||
text: qsTr('No')
|
text: qsTr('No')
|
||||||
icon.source: Qt.resolvedUrl('../../icons/closebutton.png')
|
icon.source: Qt.resolvedUrl('../../icons/closebutton.png')
|
||||||
visible: yesno
|
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
|
enabled: confirmPassword ? pw_1.text.length >= 6 && pw_1.text == pw_2.text : true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
password = pw_1.text
|
password = pw_1.text
|
||||||
passworddialog.accept()
|
passworddialog.doAccept()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ ElDialog {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: qsTr('Create request')
|
text: qsTr('Create request')
|
||||||
icon.source: '../../icons/confirmed.png'
|
icon.source: '../../icons/confirmed.png'
|
||||||
onClicked: accept()
|
onClicked: doAccept()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,10 +57,10 @@ Pane {
|
|||||||
Layout.bottomMargin: constants.paddingLarge
|
Layout.bottomMargin: constants.paddingLarge
|
||||||
visible: txdetails.canBump || txdetails.canCpfp || txdetails.canCancel || txdetails.canRemove
|
visible: txdetails.canBump || txdetails.canCpfp || txdetails.canCancel || txdetails.canRemove
|
||||||
text: txdetails.canRemove
|
text: txdetails.canRemove
|
||||||
? qsTr('This transaction is local to your wallet. It has not been published yet.')
|
? qsTr('This transaction is local to your wallet. It has not been published yet.')
|
||||||
: qsTr('This transaction is still unconfirmed.') + '\n' + (txdetails.canCancel
|
: 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, or cancel this transaction')
|
||||||
: qsTr('You can bump its fee to speed up its confirmation'))
|
: qsTr('You can bump its fee to speed up its confirmation'))
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|||||||
@@ -9,8 +9,27 @@ Dialog {
|
|||||||
property string iconSource
|
property string iconSource
|
||||||
property bool resizeWithKeyboard: true
|
property bool resizeWithKeyboard: true
|
||||||
|
|
||||||
|
property bool _result: false
|
||||||
|
|
||||||
|
// called to finally close dialog after checks by onClosing handler in main.qml
|
||||||
function doClose() {
|
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
|
parent: resizeWithKeyboard ? Overlay.overlay.children[0] : Overlay.overlay
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ ElDialog {
|
|||||||
function finish() {
|
function finish() {
|
||||||
currentItem.accept()
|
currentItem.accept()
|
||||||
_setWizardData(pages.contentChildren[currentIndex].wizard_data)
|
_setWizardData(pages.contentChildren[currentIndex].wizard_data)
|
||||||
wizard.accept()
|
wizard.doAccept()
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool pagevalid: false
|
property bool pagevalid: false
|
||||||
@@ -163,7 +163,7 @@ ElDialog {
|
|||||||
Layout.preferredWidth: 1
|
Layout.preferredWidth: 1
|
||||||
visible: pages.currentIndex == 0
|
visible: pages.currentIndex == 0
|
||||||
text: qsTr("Cancel")
|
text: qsTr("Cancel")
|
||||||
onClicked: wizard.reject()
|
onClicked: wizard.doReject()
|
||||||
}
|
}
|
||||||
FlatButton {
|
FlatButton {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|||||||
Reference in New Issue
Block a user