Files
pay/guis/mobile/SendTransactionsTab.qml
T

135 lines
4.5 KiB
QML
Raw Permalink Normal View History

2022-11-26 18:01:11 +01:00
/*
* This file is part of the Flowee project
2024-12-21 13:04:19 +01:00
* Copyright (C) 2022-2024 Tom Zander <tom@flowee.org>
2022-11-26 18:01:11 +01:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick
2022-12-05 18:34:53 +01:00
import QtQuick.Layouts
2025-06-18 17:48:29 +02:00
import QtQuick.Controls.Basic as QQC2
2024-12-22 14:41:46 +01:00
import "../Flowee" as Flowee
import Flowee.org.pay;
import "WorkflowStarter.js" as WorkflowStarter
2022-11-26 18:01:11 +01:00
FocusScope {
id: root
2022-12-08 11:34:10 +01:00
property string icon: "qrc:/sending" + (Pay.useDarkSkin ? "-light.svg" : ".svg");
2022-11-26 18:01:11 +01:00
property string title: qsTr("Send")
2024-12-21 13:04:19 +01:00
Flickable {
anchors.fill: parent
contentHeight: col.height
boundsBehavior: Flickable.StopAtBounds
ColumnLayout {
id: col
width: parent.width - 20
x: 10
y: 10
spacing: 10
2022-11-26 18:01:11 +01:00
2024-12-21 13:04:19 +01:00
PageTitledBox {
width: parent.width
title: qsTr("Start Payment")
2023-05-19 16:29:36 +02:00
2024-12-21 13:04:19 +01:00
TextButton {
text: qsTr("Scan QR")
2024-12-23 18:51:55 +01:00
pageButton: true
2024-12-21 13:04:19 +01:00
iconSource: "qrc:/qr-code" + (Pay.useDarkSkin ? "-light" : "") + ".svg";
2024-12-22 14:41:46 +01:00
onClicked: thePile.push("ScanQRPage.qml")
2024-12-21 13:04:19 +01:00
}
TextButton {
text: qsTr("Paste")
iconSource: "qrc:/edit-clipboard" + (Pay.useDarkSkin ? "-light.svg" : ".svg");
2024-12-23 18:51:55 +01:00
pageButton: true
2024-12-22 14:41:46 +01:00
onClicked: thePile.push(pastePage);
2024-12-21 13:04:19 +01:00
}
Repeater {
model: ModuleManager.sendMenuItems
TextButton {
text: modelData.text
subtext: modelData.subtext
2024-12-23 18:51:55 +01:00
pageButton: true
2024-12-21 13:04:19 +01:00
onClicked: thePile.push(modelData.qml)
}
}
}
PageTitledBox {
width: parent.width
title: qsTr("Options")
2024-12-23 18:44:30 +01:00
SelectDefaultConfigButton { }
2024-12-21 13:04:19 +01:00
InstaPayConfigButton { }
2023-06-12 15:26:31 +02:00
}
2023-03-10 22:16:37 +01:00
}
2022-11-26 18:01:11 +01:00
}
2024-12-22 14:41:46 +01:00
Component {
id: pastePage
Page {
Item { // data
ClipboardHelper {
id: cbh
onClipboardScanned: {
let t = cbh.type;
if (t === ClipboardHelper.Addresses
|| t === ClipboardHelper.LegacyAddresses
2025-03-25 14:41:46 +01:00
|| t === ClipboardHelper.AddressUrl
|| t === ClipboardHelper.PaymentProtocol) {
2024-12-22 14:41:46 +01:00
var item = thePile.replace("PayWithQR.qml");
item.start(text);
return;
}
else if (t === ClipboardHelper.PrivateKey) {
if (WorkflowStarter.startSweep(text))
return;
}
// if plugin missing, handle privatekey here.
if (t === ClipboardHelper.MnemonicSeed || t === ClipboardHelper.PrivateKey) {
WorkflowStarter.startImportWithSecret(text);
}
else {
shrug.visible = true;
detectedText.text = text;
}
}
}
}
Image {
id: shrug
y: 200
visible: false
anchors.horizontalCenter: parent.horizontalCenter
width: 200
height: 170
source: "qrc:/shrug" + (Pay.useDarkSkin ? "-light.svg" : ".svg");
}
Flowee.Label {
id: detectedText
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: shrug.bottom
anchors.topMargin: 10
width: root.width - 20
x: 10
wrapMode: Text.WrapAnywhere
}
}
}
2022-11-26 18:01:11 +01:00
}