Browse Source

qml: refactor txaccepted/txcancelled signals to standard accepted/rejected.

master
Sander van Grieken 3 years ago
parent
commit
9bbc354e0e
  1. 10
      electrum/gui/qml/components/ConfirmTxDialog.qml
  2. 9
      electrum/gui/qml/components/CpfpBumpFeeDialog.qml
  3. 2
      electrum/gui/qml/components/OpenChannelDialog.qml
  4. 9
      electrum/gui/qml/components/RbfBumpFeeDialog.qml
  5. 9
      electrum/gui/qml/components/RbfCancelDialog.qml
  6. 6
      electrum/gui/qml/components/TxDetails.qml
  7. 2
      electrum/gui/qml/components/WalletMainView.qml

10
electrum/gui/qml/components/ConfirmTxDialog.qml

@ -17,9 +17,6 @@ ElDialog {
property alias amountLabelText: amountLabel.text property alias amountLabelText: amountLabel.text
property alias sendButtonText: sendButton.text property alias sendButtonText: sendButton.text
signal txcancelled
signal txaccepted
title: qsTr('Confirm Transaction') title: qsTr('Confirm Transaction')
// copy these to finalizer // copy these to finalizer
@ -223,12 +220,9 @@ ElDialog {
: qsTr('Pay') : qsTr('Pay')
icon.source: '../../icons/confirmed.png' icon.source: '../../icons/confirmed.png'
enabled: finalizer.valid enabled: finalizer.valid
onClicked: { onClicked: doAccept()
txaccepted()
dialog.close()
}
} }
} }
onClosed: txcancelled() onClosed: doReject()
} }

9
electrum/gui/qml/components/CpfpBumpFeeDialog.qml

@ -13,8 +13,6 @@ ElDialog {
required property string txid required property string txid
required property QtObject cpfpfeebumper required property QtObject cpfpfeebumper
signal txaccepted
title: qsTr('Bump Fee') title: qsTr('Bump Fee')
iconSource: Qt.resolvedUrl('../../icons/rocket.png') iconSource: Qt.resolvedUrl('../../icons/rocket.png')
@ -224,17 +222,14 @@ ElDialog {
text: qsTr('Ok') text: qsTr('Ok')
icon.source: '../../icons/confirmed.png' icon.source: '../../icons/confirmed.png'
enabled: cpfpfeebumper.valid enabled: cpfpfeebumper.valid
onClicked: { onClicked: doAccept()
txaccepted()
dialog.close()
}
} }
} }
Connections { Connections {
target: cpfpfeebumper target: cpfpfeebumper
function onTxMined() { function onTxMined() {
dialog.close() dialog.doReject()
} }
} }
} }

2
electrum/gui/qml/components/OpenChannelDialog.qml

@ -202,7 +202,7 @@ ElDialog {
var dialog = confirmOpenChannelDialog.createObject(app, { var dialog = confirmOpenChannelDialog.createObject(app, {
'satoshis': channelopener.amount 'satoshis': channelopener.amount
}) })
dialog.txaccepted.connect(function() { dialog.accepted.connect(function() {
dialog.finalizer.signAndSend() dialog.finalizer.signAndSend()
}) })
dialog.open() dialog.open()

9
electrum/gui/qml/components/RbfBumpFeeDialog.qml

@ -13,8 +13,6 @@ ElDialog {
required property string txid required property string txid
required property QtObject rbffeebumper required property QtObject rbffeebumper
signal txaccepted
title: qsTr('Bump Fee') title: qsTr('Bump Fee')
iconSource: Qt.resolvedUrl('../../icons/rocket.png') iconSource: Qt.resolvedUrl('../../icons/rocket.png')
@ -237,17 +235,14 @@ ElDialog {
text: qsTr('Ok') text: qsTr('Ok')
icon.source: '../../icons/confirmed.png' icon.source: '../../icons/confirmed.png'
enabled: rbffeebumper.valid enabled: rbffeebumper.valid
onClicked: { onClicked: doAccept()
txaccepted()
dialog.close()
}
} }
} }
Connections { Connections {
target: rbffeebumper target: rbffeebumper
function onTxMined() { function onTxMined() {
dialog.close() dialog.doReject()
} }
} }
} }

9
electrum/gui/qml/components/RbfCancelDialog.qml

@ -13,8 +13,6 @@ ElDialog {
required property string txid required property string txid
required property QtObject txcanceller required property QtObject txcanceller
signal txaccepted
title: qsTr('Cancel Transaction') title: qsTr('Cancel Transaction')
width: parent.width width: parent.width
@ -207,17 +205,14 @@ ElDialog {
text: qsTr('Ok') text: qsTr('Ok')
icon.source: '../../icons/confirmed.png' icon.source: '../../icons/confirmed.png'
enabled: txcanceller.valid enabled: txcanceller.valid
onClicked: { onClicked: doAccept()
txaccepted()
dialog.close()
}
} }
} }
Connections { Connections {
target: txcanceller target: txcanceller
function onTxMined() { function onTxMined() {
dialog.close() dialog.doReject()
} }
} }
} }

6
electrum/gui/qml/components/TxDetails.qml

@ -440,7 +440,7 @@ Pane {
wallet: Daemon.currentWallet wallet: Daemon.currentWallet
txid: dialog.txid txid: dialog.txid
} }
onTxaccepted: { onAccepted: {
root.rawtx = rbffeebumper.getNewTx() root.rawtx = rbffeebumper.getNewTx()
if (txdetails.wallet.canSignWithoutCosigner) { if (txdetails.wallet.canSignWithoutCosigner) {
txdetails.sign_and_broadcast() txdetails.sign_and_broadcast()
@ -465,7 +465,7 @@ Pane {
txid: dialog.txid txid: dialog.txid
} }
onTxaccepted: { onAccepted: {
// replaces parent tx with cpfp tx // replaces parent tx with cpfp tx
root.rawtx = cpfpfeebumper.getNewTx() root.rawtx = cpfpfeebumper.getNewTx()
if (txdetails.wallet.canSignWithoutCosigner) { if (txdetails.wallet.canSignWithoutCosigner) {
@ -491,7 +491,7 @@ Pane {
txid: dialog.txid txid: dialog.txid
} }
onTxaccepted: { onAccepted: {
root.rawtx = txcanceller.getNewTx() root.rawtx = txcanceller.getNewTx()
if (txdetails.wallet.canSignWithoutCosigner) { if (txdetails.wallet.canSignWithoutCosigner) {
txdetails.sign_and_broadcast() txdetails.sign_and_broadcast()

2
electrum/gui/qml/components/WalletMainView.qml

@ -328,7 +328,7 @@ Item {
message: invoice.message message: invoice.message
}) })
var canComplete = !Daemon.currentWallet.isWatchOnly && Daemon.currentWallet.canSignWithoutCosigner var canComplete = !Daemon.currentWallet.isWatchOnly && Daemon.currentWallet.canSignWithoutCosigner
dialog.txaccepted.connect(function() { dialog.accepted.connect(function() {
if (!canComplete) { if (!canComplete) {
if (Daemon.currentWallet.isWatchOnly) { if (Daemon.currentWallet.isWatchOnly) {
dialog.finalizer.save() dialog.finalizer.save()

Loading…
Cancel
Save