Browse Source

qml: don't show ln payment dialog, update info text instead

master
Sander van Grieken 3 years ago
parent
commit
7efd6fe1e2
  1. 25
      electrum/gui/qml/components/InvoiceDialog.qml
  2. 5
      electrum/gui/qml/components/WalletMainView.qml
  3. 4
      electrum/gui/qml/qeinvoice.py

25
electrum/gui/qml/components/InvoiceDialog.qml

@ -47,10 +47,11 @@ ElDialog {
columns: 2
InfoTextArea {
id: helpText
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.bottomMargin: constants.paddingLarge
visible: invoice.userinfo
visible: text
text: invoice.userinfo
iconStyle: InfoTextArea.IconStyle.Warn
}
@ -457,14 +458,34 @@ ElDialog {
// save invoice if new or modified
invoice.save_invoice()
}
dialog.close()
doPay() // only signal here
helpText.text = qsTr('Payment in progress...')
}
}
}
}
Connections {
target: Daemon.currentWallet
function onPaymentSucceeded(key) {
if (key != invoice.key) {
console.log('wrong invoice ' + key + ' != ' + invoice.key)
return
}
console.log('payment succeeded!')
helpText.text = qsTr('Paid!')
}
function onPaymentFailed(key, reason) {
if (key != invoice.key) {
console.log('wrong invoice ' + key + ' != ' + invoice.key)
return
}
console.log('payment failed: ' + reason)
helpText.text = qsTr('Payment failed: ' + reason)
}
}
Component.onCompleted: {
if (invoice_key != '') {
invoice.initFromKey(invoice_key)

5
electrum/gui/qml/components/WalletMainView.qml

@ -312,13 +312,8 @@ Item {
console.log('No invoice key, aborting')
return
}
var dialog = lightningPaymentProgressDialog.createObject(mainView, {
invoice_key: invoice.key
})
dialog.open()
Daemon.currentWallet.pay_lightning_invoice(invoice.key)
}
close()
}
onClosed: destroy()

4
electrum/gui/qml/qeinvoice.py

@ -347,8 +347,10 @@ class QEInvoiceParser(QEInvoice):
self.canSave = True
if amount.isEmpty: # unspecified amount
if self.amount.isEmpty:
self.userinfo = _('Enter the amount you want to send')
if amount.isEmpty and self.status == PR_UNPAID: # unspecified amount
return
if self.invoiceType == QEInvoice.Type.LightningInvoice:

Loading…
Cancel
Save