Browse Source

Merge pull request #9091 from accumulator/channel_backup_import_nolightning

qml: fix handling of channel backup import on lightning-disabled wallets
master
accumulator 2 years ago committed by GitHub
parent
commit
784f209d02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      electrum/gui/qml/components/SendDialog.qml
  2. 20
      electrum/gui/qml/components/WalletMainView.qml

4
electrum/gui/qml/components/SendDialog.qml

@ -56,7 +56,9 @@ ElDialog {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
hint: qsTr('Scan an Invoice, an Address, an LNURL-pay, a PSBT or a Channel backup') hint: Daemon.currentWallet.isLightning
? qsTr('Scan an Invoice, an Address, an LNURL-pay, a PSBT or a Channel Backup')
: qsTr('Scan an Invoice, an Address, an LNURL-pay or a PSBT')
onFound: dialog.dispatch(scanData) onFound: dialog.dispatch(scanData)
} }

20
electrum/gui/qml/components/WalletMainView.qml

@ -43,7 +43,9 @@ Item {
// Android based send dialog if on android // Android based send dialog if on android
var scanner = app.scanDialog.createObject(mainView, { var scanner = app.scanDialog.createObject(mainView, {
hint: qsTr('Scan an Invoice, an Address, an LNURL-pay, a PSBT or a Channel backup'), hint: Daemon.currentWallet.isLightning
? qsTr('Scan an Invoice, an Address, an LNURL-pay, a PSBT or a Channel Backup')
: qsTr('Scan an Invoice, an Address, an LNURL-pay or a PSBT')
}) })
scanner.onFound.connect(function() { scanner.onFound.connect(function() {
var data = scanner.scanData var data = scanner.scanData
@ -52,7 +54,7 @@ Item {
app.stack.push(Qt.resolvedUrl('TxDetails.qml'), { rawtx: data }) app.stack.push(Qt.resolvedUrl('TxDetails.qml'), { rawtx: data })
} else if (Daemon.currentWallet.isValidChannelBackup(data)) { } else if (Daemon.currentWallet.isValidChannelBackup(data)) {
var dialog = app.messageDialog.createObject(app, { var dialog = app.messageDialog.createObject(app, {
title: qsTr('Import Channel backup?'), title: qsTr('Import Channel Backup?'),
yesno: true yesno: true
}) })
dialog.accepted.connect(function() { dialog.accepted.connect(function() {
@ -508,13 +510,21 @@ Item {
width: parent.width width: parent.width
height: parent.height height: parent.height
onTxFound: { onTxFound: (data) => {
app.stack.push(Qt.resolvedUrl('TxDetails.qml'), { rawtx: data }) app.stack.push(Qt.resolvedUrl('TxDetails.qml'), { rawtx: data })
close() close()
} }
onChannelBackupFound: { onChannelBackupFound: (data) => {
if (!Daemon.currentWallet.isLightning) {
var dialog = app.messageDialog.createObject(app, {
title: qsTr('Cannot import Channel Backup, Lightning not enabled.')
})
dialog.open()
return
}
var dialog = app.messageDialog.createObject(app, { var dialog = app.messageDialog.createObject(app, {
title: qsTr('Import Channel backup?'), title: qsTr('Import Channel Backup?'),
yesno: true yesno: true
}) })
dialog.accepted.connect(function() { dialog.accepted.connect(function() {

Loading…
Cancel
Save