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 c327f9ee51
commit 5b4df75918
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

@@ -223,6 +223,15 @@ class QEConfig(AuthMixin, QObject):
self.config.set_key('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)