From 1b869eb0261f5d89aa2199951f622d33d755f9c0 Mon Sep 17 00:00:00 2001
From: johnny9 <985648+johnny9@users.noreply.github.com>
Date: Fri, 22 Nov 2024 01:25:34 -0500
Subject: [PATCH] qml: Introduce RequestConfirmation page
This page contains the details of a payment request. It is
pushed onto the RequestPayment page's stack after the user
has clicke don Continue.
---
src/Makefile.qt.include | 1 +
src/qml/bitcoin_qml.qrc | 1 +
src/qml/pages/wallet/RequestConfirmation.qml | 167 +++++++++++++++++++
src/qml/pages/wallet/RequestPayment.qml | 7 +
4 files changed, 176 insertions(+)
create mode 100644 src/qml/pages/wallet/RequestConfirmation.qml
diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include
index 1b1917eea7..b1d8ef368b 100644
--- a/src/Makefile.qt.include
+++ b/src/Makefile.qt.include
@@ -441,6 +441,7 @@ QML_RES_QML = \
qml/pages/wallet/CreatePassword.qml \
qml/pages/wallet/CreateWalletWizard.qml \
qml/pages/wallet/DesktopWallets.qml \
+ qml/pages/wallet/RequestConfirmation.qml \
qml/pages/wallet/RequestPayment.qml \
qml/pages/wallet/WalletBadge.qml \
qml/pages/wallet/WalletSelect.qml
diff --git a/src/qml/bitcoin_qml.qrc b/src/qml/bitcoin_qml.qrc
index 0471f967f1..0681680270 100644
--- a/src/qml/bitcoin_qml.qrc
+++ b/src/qml/bitcoin_qml.qrc
@@ -76,6 +76,7 @@
pages/wallet/CreatePassword.qml
pages/wallet/CreateWalletWizard.qml
pages/wallet/DesktopWallets.qml
+ pages/wallet/RequestConfirmation.qml
pages/wallet/RequestPayment.qml
pages/wallet/WalletBadge.qml
pages/wallet/WalletSelect.qml
diff --git a/src/qml/pages/wallet/RequestConfirmation.qml b/src/qml/pages/wallet/RequestConfirmation.qml
new file mode 100644
index 0000000000..aed4931ab5
--- /dev/null
+++ b/src/qml/pages/wallet/RequestConfirmation.qml
@@ -0,0 +1,167 @@
+// Copyright (c) 2024 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Layouts 1.15
+import org.bitcoincore.qt 1.0
+
+import "../../controls"
+import "../../components"
+import "../settings"
+
+Page {
+ id: root
+ background: null
+ property string label: "alice"
+ property string message: "payment for goods"
+ property string amount: "0.000"
+
+ header: NavigationBar2 {
+ id: navbar
+ leftItem: NavButton {
+ iconSource: "image://images/caret-left"
+ text: qsTr("Back")
+ onClicked: {
+ root.StackView.view.pop()
+ }
+ }
+ centerItem: Item {
+ id: header
+ Layout.fillWidth: true
+
+ CoreText {
+ anchors.left: parent.left
+ text: qsTr("Payment request")
+ font.pixelSize: 21
+ bold: true
+ }
+ }
+ }
+
+ ScrollView {
+ clip: true
+ width: parent.width
+ height: parent.height
+ contentWidth: width
+
+ ColumnLayout {
+ id: columnLayout
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: Math.min(parent.width, 450)
+ spacing: 30
+
+ Image {
+ width: 60
+ height: 60
+ Layout.alignment: Qt.AlignHCenter
+ source: "image://images/pending"
+ sourceSize.width: 60
+ sourceSize.height: 60
+ }
+
+ CoreText {
+ Layout.alignment: Qt.AlignHCenter
+ text: qsTr("Created just now")
+ color: Theme.color.neutral7
+ font.pixelSize: 18
+ }
+
+ LabeledTextInput {
+ id: labelInput
+ Layout.fillWidth: true
+ labelText: qsTr("Label")
+ visible: label != ""
+ enabled: false
+ text: label
+ }
+
+ Item {
+ BitcoinAmount {
+ id: bitcoinAmount
+ }
+
+ height: 50
+ Layout.fillWidth: true
+ visible: amount != ""
+ CoreText {
+ anchors.left: parent.left
+ anchors.top: parent.top
+ color: Theme.color.neutral7
+ text: qsTr("Amount")
+ font.pixelSize: 15
+ }
+
+ TextField {
+ id: bitcoinAmountText
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ leftPadding: 0
+ font.family: "Inter"
+ font.styleName: "Regular"
+ font.pixelSize: 18
+ color: Theme.color.neutral9
+ placeholderTextColor: Theme.color.neutral7
+ background: Item {}
+ placeholderText: "0.00000000"
+ text: request.amount
+ enabled: false
+ onTextChanged: {
+ bitcoinAmountText.text = bitcoinAmount.sanitize(bitcoinAmountText.text)
+ }
+ }
+ }
+
+
+ LabeledTextInput {
+ id: messageInput
+ Layout.fillWidth: true
+ labelText: qsTr("Message")
+ visible: message != ""
+ enabled: false
+ text: message
+ }
+
+ Item {
+ height: addressLabel.height + addressText.height
+ Layout.fillWidth: true
+ CoreText {
+ id: addressLabel
+ anchors.left: parent.left
+ anchors.top: parent.top
+ color: Theme.color.neutral7
+ text: qsTr("Address")
+ font.pixelSize: 15
+ }
+
+ CoreText {
+ id: addressText
+ anchors.left: parent.left
+ anchors.right: copyIcon.left
+ anchors.top: addressLabel.bottom
+ leftPadding: 0
+ font.family: "Inter"
+ font.styleName: "Regular"
+ font.pixelSize: 18
+ horizontalAlignment: Text.AlignLeft
+ color: Theme.color.neutral9
+ text: "bc1q wvlv mha3 cvhy q6qz tjzu mq2d 63ff htzy xxu6 q8"
+ }
+
+ Icon {
+ id: copyIcon
+ anchors.right: parent.right
+ anchors.verticalCenter: addressText.verticalCenter
+ source: "image://images/copy"
+ color: Theme.color.neutral8
+ size: 30
+ enabled: true
+ onClicked: {
+ Clipboard.setText(addressText.text)
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/qml/pages/wallet/RequestPayment.qml b/src/qml/pages/wallet/RequestPayment.qml
index fa6574aa67..428dc2fec8 100644
--- a/src/qml/pages/wallet/RequestPayment.qml
+++ b/src/qml/pages/wallet/RequestPayment.qml
@@ -143,9 +143,16 @@ StackView {
Layout.rightMargin: 20
Layout.alignment: Qt.AlignCenter
text: qsTr("Continue")
+ onClicked: stackView.push(confirmationComponent)
}
}
}
}
}
+
+ Component {
+ id: confirmationComponent
+ RequestConfirmation {
+ }
+ }
}