Browse Source

add manual input option

patch-4
Sander van Grieken 2 years ago
parent
commit
58e3e0c235
  1. 53
      electrum/gui/qml/components/SendDialog.qml
  2. 73
      electrum/gui/qml/components/WalletMainView.qml

53
electrum/gui/qml/components/SendDialog.qml

@ -2,7 +2,6 @@ import QtQuick 2.6
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.0
import QtQuick.Controls.Material 2.0
import QtQml.Models 2.1
import org.electrum 1.0
@ -13,8 +12,6 @@ ElDialog {
property InvoiceParser invoiceParser
signal manualInput
parent: Overlay.overlay
modal: true
standardButtons: Dialog.Close
@ -28,8 +25,6 @@ ElDialog {
padding: 0
onClosed: destroy()
ColumnLayout {
anchors.fill: parent
@ -44,7 +39,12 @@ ElDialog {
Layout.fillWidth: true
text: qsTr('Manual input')
onClicked: {
manualInput()
var _mid = manualInputDialog.createObject(mainView)
_mid.accepted.connect(function() {
console.log(_mid.recipient)
invoiceParser.recipient = _mid.recipient
})
_mid.open()
}
}
@ -55,4 +55,45 @@ ElDialog {
}
}
Component {
id: manualInputDialog
ElDialog {
property alias recipient: recipientTextEdit.text
anchors.centerIn: parent
implicitWidth: parent.width * 0.9
parent: Overlay.overlay
modal: true
standardButtons: Dialog.Ok
Overlay.modal: Rectangle {
color: "#aa000000"
}
title: qsTr('Manual Input')
ColumnLayout {
width: parent.width
Label {
text: 'Enter a bitcoin address or a Lightning invoice'
wrapMode: Text.Wrap
}
TextField {
id: recipientTextEdit
topPadding: constants.paddingXXLarge
bottomPadding: constants.paddingXXLarge
Layout.preferredWidth: parent.width
font.family: FixedFont
wrapMode: TextInput.WrapAnywhere
placeholderText: qsTr('Enter the payment request here')
}
}
onClosed: destroy()
}
}
}

73
electrum/gui/qml/components/WalletMainView.qml

@ -73,8 +73,6 @@ Item {
}
}
property var _sendDialog
ColumnLayout {
anchors.centerIn: parent
width: parent.width
@ -115,11 +113,7 @@ Item {
text: qsTr('Send')
onClicked: {
console.log('send')
var comp = Qt.createComponent(Qt.resolvedUrl('SendDialog.qml'))
if (comp.status == Component.Error)
console.log(comp.errorString())
_sendDialog = comp.createObject(mainView, { invoiceParser: invoiceParser } )
// dialog.
_sendDialog = sendDialog.createObject(mainView, {invoiceParser: invoiceParser})
_sendDialog.open()
}
}
@ -180,39 +174,48 @@ Item {
Component {
id: invoiceDialog
InvoiceDialog {
onDoPay: {
if (invoice.invoiceType == Invoice.OnchainInvoice) {
var dialog = confirmPaymentDialog.createObject(mainView, {
'address': invoice.address,
'satoshis': invoice.amount,
'message': invoice.message
})
var wo = Daemon.currentWallet.isWatchOnly
dialog.txaccepted.connect(function() {
if (wo) {
showUnsignedTx(dialog.finalizer.serializedTx(false), dialog.finalizer.serializedTx(true))
} else {
dialog.finalizer.send_onchain()
InvoiceDialog {
onDoPay: {
if (invoice.invoiceType == Invoice.OnchainInvoice) {
var dialog = confirmPaymentDialog.createObject(mainView, {
'address': invoice.address,
'satoshis': invoice.amount,
'message': invoice.message
})
var wo = Daemon.currentWallet.isWatchOnly
dialog.txaccepted.connect(function() {
if (wo) {
showUnsignedTx(dialog.finalizer.serializedTx(false), dialog.finalizer.serializedTx(true))
} else {
dialog.finalizer.send_onchain()
}
})
dialog.open()
} else if (invoice.invoiceType == Invoice.LightningInvoice) {
console.log('About to pay lightning invoice')
if (invoice.key == '') {
console.log('No invoice key, aborting')
return
}
})
dialog.open()
} else if (invoice.invoiceType == Invoice.LightningInvoice) {
console.log('About to pay lightning invoice')
if (invoice.key == '') {
console.log('No invoice key, aborting')
return
var dialog = lightningPaymentProgressDialog.createObject(mainView, {
invoice_key: invoice.key
})
dialog.open()
Daemon.currentWallet.pay_lightning_invoice(invoice.key)
}
var dialog = lightningPaymentProgressDialog.createObject(mainView, {
invoice_key: invoice.key
})
dialog.open()
Daemon.currentWallet.pay_lightning_invoice(invoice.key)
close()
}
close()
// onClosed: destroy()
}
// onClosed: destroy()
}
property var _sendDialog
Component {
id: sendDialog
SendDialog {
onClosed: destroy()
}
}
Component {

Loading…
Cancel
Save