1
0

qml: remove green check-mark on request paid, open lightning payment details (LN) or Tx details (on-chain) instead

This commit is contained in:
Sander van Grieken
2025-06-02 17:09:47 +02:00
parent 5775fd790e
commit 938af7b2ee
3 changed files with 30 additions and 40 deletions

View File

@@ -12,23 +12,25 @@ ElDialog {
id: dialog
title: qsTr('Receive Payment')
iconSource: Qt.resolvedUrl('../../icons/tab_receive.png')
property string key
property bool isLightning: request.isLightning
property string _bolt11: request.bolt11
property string _bip21uri: request.bip21
property string _address: request.address
property bool _render_qr: false // delay qr rendering until dialog is shown
property bool _ispaid: false
iconSource: Qt.resolvedUrl('../../icons/tab_receive.png')
signal requestPaid
padding: 0
function getPaidTxid() {
return request.paidTxid
}
ColumnLayout {
visible: !_ispaid
anchors.fill: parent
spacing: 0
@@ -40,7 +42,7 @@ ElDialog {
rightMargin: constants.paddingLarge
contentHeight: rootLayout.height
clip:true
clip: true
interactive: height < contentHeight
ColumnLayout {
@@ -186,43 +188,12 @@ ElDialog {
}
}
ColumnLayout {
visible: _ispaid
anchors.centerIn: parent
states: [
State {
name: 'paid'
when: _ispaid
}
]
transitions: [
Transition {
from: ''
to: 'paid'
NumberAnimation { target: paidIcon; properties: 'opacity'; from: 0; to: 1; duration: 200 }
NumberAnimation { target: paidIcon; properties: 'scale'; from: 0; to: 1; duration: 500; easing.type: Easing.OutBack; easing.overshoot: 10 }
}
]
Image {
id: paidIcon
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: constants.iconSizeXXLarge
Layout.preferredHeight: constants.iconSizeXXLarge
source: '../../icons/confirmed.png'
}
Label {
Layout.alignment: Qt.AlignHCenter
text: qsTr('Paid!')
font.pixelSize: constants.fontSizeXXLarge
}
}
RequestDetails {
id: request
wallet: Daemon.currentWallet
onStatusChanged: {
if (status == RequestDetails.Paid || status == RequestDetails.Unconfirmed) {
_ispaid = true
requestPaid()
}
}
}

View File

@@ -639,6 +639,15 @@ Item {
width: parent.width
height: parent.height
onRequestPaid: {
close()
if (isLightning) {
app.stack.push(Qt.resolvedUrl('LightningPaymentDetails.qml'), {'key': key})
} else {
let paidTxid = getPaidTxid()
app.stack.push(Qt.resolvedUrl('TxDetails.qml'), {'txid': paidTxid})
}
}
onClosed: destroy()
}
}

View File

@@ -29,7 +29,7 @@ class QERequestDetails(QObject, QtEventListener):
_logger = get_logger(__name__)
detailsChanged = pyqtSignal() # generic request properties changed signal
detailsChanged = pyqtSignal() # generic request properties changed signal
statusChanged = pyqtSignal()
def __init__(self, parent=None):
@@ -95,7 +95,7 @@ class QERequestDetails(QObject, QtEventListener):
@pyqtProperty(bool, notify=detailsChanged)
def isLightning(self):
return self._req.is_lightning()
return self._req.is_lightning() if self._req else False
@pyqtProperty(str, notify=detailsChanged)
def address(self):
@@ -118,6 +118,16 @@ class QERequestDetails(QObject, QtEventListener):
def expiration(self):
return self._req.get_expiration_date()
@pyqtProperty(str, notify=statusChanged)
def paidTxid(self):
"""only used when Request status is PR_PAID"""
if not self._req:
return ''
is_paid, conf_needed, txids = self._wallet.wallet._is_onchain_invoice_paid(self._req)
if len(txids) > 0:
return txids[0]
return ''
@pyqtProperty(str, notify=detailsChanged)
def bolt11(self):
wallet = self._wallet.wallet