From f9a5c2263380476dfac619518998a88411a58e9b Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Thu, 23 Mar 2023 14:00:46 +0100 Subject: [PATCH] qml: lnurl override disabled amount edit color, show lnurlError to user --- .../gui/qml/components/LnurlPayRequestDialog.qml | 14 ++++++++++++-- electrum/gui/qml/qeinvoice.py | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/electrum/gui/qml/components/LnurlPayRequestDialog.qml b/electrum/gui/qml/components/LnurlPayRequestDialog.qml index 3c836852c..ead002b68 100644 --- a/electrum/gui/qml/components/LnurlPayRequestDialog.qml +++ b/electrum/gui/qml/components/LnurlPayRequestDialog.qml @@ -55,10 +55,11 @@ ElDialog { BtcField { id: amountBtc text: Config.formatSats(invoiceParser.lnurlData['min_sendable_sat']) - enabled: invoiceParser.lnurlData['min_sendable_sat'] != invoiceParser.lnurlData['max_sendable_sat'] + enabled: invoiceParser.lnurlData['min_sendable_sat'] != invoiceParser.lnurlData['max_sendable_sat'] + color: Material.foreground // override gray-out on disabled fiatfield: null Layout.preferredWidth: parent.width /3 - onTextAsSatsChanged: { + onTextAsSatsChanged: { invoiceParser.amountOverride = textAsSats } } @@ -100,4 +101,13 @@ ElDialog { } } } + + Connections { + target: invoiceParser + function onLnurlError(code, message) { + var dialog = app.messageDialog.createObject(app, { text: message }) + dialog.open() + } + } + } diff --git a/electrum/gui/qml/qeinvoice.py b/electrum/gui/qml/qeinvoice.py index 3e4d6204b..367157d7e 100644 --- a/electrum/gui/qml/qeinvoice.py +++ b/electrum/gui/qml/qeinvoice.py @@ -558,7 +558,7 @@ class QEInvoiceParser(QEInvoice): assert amount >= self.lnurlData['min_sendable_sat'] assert amount <= self.lnurlData['max_sendable_sat'] except: - self.lnurlError.emit('lnurl', _('Amount out of bounds')) + self.lnurlError.emit('amount', _('Amount out of bounds')) return if self._lnurlData['comment_allowed'] == 0: