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.Controls 2.14
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
import QtQml.Models 2.1
import org.electrum 1.0 import org.electrum 1.0
@ -13,8 +12,6 @@ ElDialog {
property InvoiceParser invoiceParser property InvoiceParser invoiceParser
signal manualInput
parent: Overlay.overlay parent: Overlay.overlay
modal: true modal: true
standardButtons: Dialog.Close standardButtons: Dialog.Close
@ -28,8 +25,6 @@ ElDialog {
padding: 0 padding: 0
onClosed: destroy()
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
@ -44,7 +39,12 @@ ElDialog {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr('Manual input') text: qsTr('Manual input')
onClicked: { 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 { ColumnLayout {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width width: parent.width
@ -115,11 +113,7 @@ Item {
text: qsTr('Send') text: qsTr('Send')
onClicked: { onClicked: {
console.log('send') console.log('send')
var comp = Qt.createComponent(Qt.resolvedUrl('SendDialog.qml')) _sendDialog = sendDialog.createObject(mainView, {invoiceParser: invoiceParser})
if (comp.status == Component.Error)
console.log(comp.errorString())
_sendDialog = comp.createObject(mainView, { invoiceParser: invoiceParser } )
// dialog.
_sendDialog.open() _sendDialog.open()
} }
} }
@ -180,39 +174,48 @@ Item {
Component { Component {
id: invoiceDialog id: invoiceDialog
InvoiceDialog { InvoiceDialog {
onDoPay: { onDoPay: {
if (invoice.invoiceType == Invoice.OnchainInvoice) { if (invoice.invoiceType == Invoice.OnchainInvoice) {
var dialog = confirmPaymentDialog.createObject(mainView, { var dialog = confirmPaymentDialog.createObject(mainView, {
'address': invoice.address, 'address': invoice.address,
'satoshis': invoice.amount, 'satoshis': invoice.amount,
'message': invoice.message 'message': invoice.message
}) })
var wo = Daemon.currentWallet.isWatchOnly var wo = Daemon.currentWallet.isWatchOnly
dialog.txaccepted.connect(function() { dialog.txaccepted.connect(function() {
if (wo) { if (wo) {
showUnsignedTx(dialog.finalizer.serializedTx(false), dialog.finalizer.serializedTx(true)) showUnsignedTx(dialog.finalizer.serializedTx(false), dialog.finalizer.serializedTx(true))
} else { } else {
dialog.finalizer.send_onchain() 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
} }
}) var dialog = lightningPaymentProgressDialog.createObject(mainView, {
dialog.open() invoice_key: invoice.key
} else if (invoice.invoiceType == Invoice.LightningInvoice) { })
console.log('About to pay lightning invoice') dialog.open()
if (invoice.key == '') { Daemon.currentWallet.pay_lightning_invoice(invoice.key)
console.log('No invoice key, aborting')
return
} }
var dialog = lightningPaymentProgressDialog.createObject(mainView, { close()
invoice_key: invoice.key
})
dialog.open()
Daemon.currentWallet.pay_lightning_invoice(invoice.key)
} }
close() // onClosed: destroy()
} }
// onClosed: destroy()
} }
property var _sendDialog
Component {
id: sendDialog
SendDialog {
onClosed: destroy()
}
} }
Component { Component {

Loading…
Cancel
Save