From 938af7b2eea38a53f78dffb68c04a00cedc4879d Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Mon, 2 Jun 2025 17:09:47 +0200 Subject: [PATCH] qml: remove green check-mark on request paid, open lightning payment details (LN) or Tx details (on-chain) instead --- electrum/gui/qml/components/ReceiveDialog.qml | 47 ++++--------------- .../gui/qml/components/WalletMainView.qml | 9 ++++ electrum/gui/qml/qerequestdetails.py | 14 +++++- 3 files changed, 30 insertions(+), 40 deletions(-) diff --git a/electrum/gui/qml/components/ReceiveDialog.qml b/electrum/gui/qml/components/ReceiveDialog.qml index 45a94918c..19982d05f 100644 --- a/electrum/gui/qml/components/ReceiveDialog.qml +++ b/electrum/gui/qml/components/ReceiveDialog.qml @@ -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() } } } diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml index 50d13c5b7..e2d7229ca 100644 --- a/electrum/gui/qml/components/WalletMainView.qml +++ b/electrum/gui/qml/components/WalletMainView.qml @@ -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() } } diff --git a/electrum/gui/qml/qerequestdetails.py b/electrum/gui/qml/qerequestdetails.py index 319d512bd..6f5e35dc1 100644 --- a/electrum/gui/qml/qerequestdetails.py +++ b/electrum/gui/qml/qerequestdetails.py @@ -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