1
0

qml: fix lnurl-pay when config.BTC_AMOUNTS_ADD_THOUSANDS_SEP is True

when paying an lnurl-pay that provides an amount interval,
the amount field is editable by the user and it expects no spaces
This commit is contained in:
SomberNight
2023-06-23 16:23:12 +00:00
parent 8075c0d02a
commit 888291a8f8
2 changed files with 10 additions and 1 deletions

View File

@@ -64,7 +64,7 @@ ElDialog {
BtcField {
id: amountBtc
Layout.preferredWidth: rootLayout.width /3
text: Config.formatSats(invoiceParser.lnurlData['min_sendable_sat'])
text: Config.formatSatsForEditing(invoiceParser.lnurlData['min_sendable_sat'])
enabled: invoiceParser.lnurlData['min_sendable_sat'] != invoiceParser.lnurlData['max_sendable_sat']
color: Material.foreground // override gray-out on disabled
fiatfield: amountFiat

View File

@@ -211,6 +211,15 @@ class QEConfig(AuthMixin, QObject):
self.config.GUI_QML_USER_KNOWS_PRESS_AND_HOLD = userKnowsPressAndHold
self.userKnowsPressAndHoldChanged.emit()
@pyqtSlot('qint64', result=str)
@pyqtSlot(QEAmount, result=str)
def formatSatsForEditing(self, satoshis):
if isinstance(satoshis, QEAmount):
satoshis = satoshis.satsInt
return self.config.format_amount(
satoshis,
add_thousands_sep=False,
)
@pyqtSlot('qint64', result=str)
@pyqtSlot('qint64', bool, result=str)