qml create request: if no address is available, show how to access
the list of pending requests.
This commit is contained in:
@@ -265,21 +265,9 @@ Item {
|
|||||||
function onRequestCreateSuccess(key) {
|
function onRequestCreateSuccess(key) {
|
||||||
openRequest(key)
|
openRequest(key)
|
||||||
}
|
}
|
||||||
function onRequestCreateError(code, error) {
|
function onRequestCreateError(error) {
|
||||||
if (code == 'ln') {
|
console.log(error)
|
||||||
var dialog = app.messageDialog.createObject(app, {text: error, yesno: true})
|
var dialog = app.messageDialog.createObject(app, {text: error})
|
||||||
dialog.yesClicked.connect(function() {
|
|
||||||
createRequest(true, false)
|
|
||||||
})
|
|
||||||
} else if (code == 'reuse_addr') {
|
|
||||||
var dialog = app.messageDialog.createObject(app, {text: error, yesno: true})
|
|
||||||
dialog.yesClicked.connect(function() {
|
|
||||||
createRequest(false, true)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
console.log(error)
|
|
||||||
var dialog = app.messageDialog.createObject(app, {text: error})
|
|
||||||
}
|
|
||||||
dialog.open()
|
dialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
|||||||
|
|
||||||
requestStatusChanged = pyqtSignal([str,int], arguments=['key','status'])
|
requestStatusChanged = pyqtSignal([str,int], arguments=['key','status'])
|
||||||
requestCreateSuccess = pyqtSignal([str], arguments=['key'])
|
requestCreateSuccess = pyqtSignal([str], arguments=['key'])
|
||||||
requestCreateError = pyqtSignal([str,str], arguments=['code','error'])
|
requestCreateError = pyqtSignal([str], arguments=['error'])
|
||||||
invoiceStatusChanged = pyqtSignal([str,int], arguments=['key','status'])
|
invoiceStatusChanged = pyqtSignal([str,int], arguments=['key','status'])
|
||||||
invoiceCreateSuccess = pyqtSignal()
|
invoiceCreateSuccess = pyqtSignal()
|
||||||
invoiceCreateError = pyqtSignal([str,str], arguments=['code','error'])
|
invoiceCreateError = pyqtSignal([str,str], arguments=['code','error'])
|
||||||
@@ -621,16 +621,16 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
|||||||
else:
|
else:
|
||||||
has_lightning = self.wallet.has_lightning()
|
has_lightning = self.wallet.has_lightning()
|
||||||
msg = [
|
msg = [
|
||||||
_('No more unused addresses in your wallet.'),
|
_('No address available.'),
|
||||||
_('All your addresses are used by unpaid requests.'),
|
_('All your addresses are used in pending requests.'),
|
||||||
|
_('To see the list, press and hold the Receive button.'),
|
||||||
]
|
]
|
||||||
msg.append(_('Do you wish to create a lightning-only request?') if has_lightning else _('Do you want to reuse an address?'))
|
self.requestCreateError.emit(' '.join(msg))
|
||||||
self.requestCreateError.emit('ln' if has_lightning else 'reuse_addr', ' '.join(msg))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
key = self.wallet.create_request(amount, message, expiration, addr)
|
key = self.wallet.create_request(amount, message, expiration, addr)
|
||||||
except InvoiceError as e:
|
except InvoiceError as e:
|
||||||
self.requestCreateError.emit('fatal',_('Error creating payment request') + ':\n' + str(e))
|
self.requestCreateError.emit(_('Error creating payment request') + ':\n' + str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
assert key is not None
|
assert key is not None
|
||||||
|
|||||||
Reference in New Issue
Block a user