2023-05-17 23:42:07 +02:00
/*
* This file is part of the Flowee project
* Copyright (C) 2023 Tom Zander <tom@flowee.org>
*
* 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
import "../Flowee" as Flowee
Page {
id: root
headerText: qsTr ( "Instant Pay" )
property QtObject account: portfolio . current
Flowee . Label {
id: introText
2024-02-13 14:25:54 +01:00
text: qsTr ( "Scanning QR code with Instant Pay enabled will make the transfer go out without confirmation. As long as it does not exceed the set limit." )
2023-05-17 23:42:07 +02:00
anchors.left: parent . left
anchors.right: parent . right
anchors.top: parent . top
anchors.topMargin: 10
wrapMode: Text . WrapAtWordBoundaryOrAnywhere
}
Rectangle {
2023-08-27 20:36:30 +02:00
id: warningLabel
2023-05-17 23:42:07 +02:00
anchors.top: introText . bottom
anchors.topMargin: 10
width: parent . width
radius: 10
height: warning . implicitHeight + 20
2023-06-28 22:46:22 +02:00
visible: root . account . needsPinToPay
2023-05-17 23:42:07 +02:00
color: "#00000000"
border.width: 2
border.color: "blue"
Flowee . Label {
x: 10
y: 10
width: parent . width - 20
id: warning
text: qsTr ( "Protected wallets can not be used for InstaPay because they require a PIN before usage" )
2023-08-27 20:36:30 +02:00
wrapMode: Text . WrapAtWordBoundaryOrAnywhere
2023-05-17 23:42:07 +02:00
}
}
Flowee . CheckBox {
id: mainToggle
2023-08-27 20:36:30 +02:00
anchors.top: root . account . needsPinToPay ? warningLabel.bottom : introText . bottom
2023-05-17 23:42:07 +02:00
anchors.topMargin: 10
width: parent . width
2023-08-27 20:36:30 +02:00
enabled: root . account . needsPinToPay === false
2023-05-17 23:42:07 +02:00
text: qsTr ( "Enable Instant Pay for this wallet" )
checked: root . account . allowInstaPay
onClicked: root . account . allowInstaPay = checked
}
PageTitledBox {
id: priceInput
title: qsTr ( "Maximum Amount" )
anchors.top: mainToggle . bottom
anchors.topMargin: 40
width: parent . width
enabled: mainToggle . checked
property string currency: Fiat . currencyName
property int instaPayLimit: root . account . fiatInstaPayLimit ( currency ) ;
property alias editor: priceFiat . money
function shake ( ) { shaker . start ( ) ; }
Item {
width: parent . width
Flowee . Label {
text: Fiat . currencyName
font.pixelSize: 20
color: enabled ? palette.windowText : palette . brightText
}
Flowee . FiatValueField {
id: priceFiat
value: priceInput . instaPayLimit
focus: true
Flowee . ObjectShaker { id: shaker }
onValueEdited: root . account . setFiatInstaPayLimit ( priceInput . currency , value ) ;
fontPixelSize: 20
color: enabled ? palette.windowText : palette . brightText
}
}
}
NumericKeyboardWidget {
id: numericKeyboard
anchors.bottom: parent . bottom
anchors.bottomMargin: 15
width: parent . width
enabled: mainToggle . checked
2023-07-04 20:50:39 +02:00
dataInput: priceInput
2023-05-17 23:42:07 +02:00
}
/*
List currencies a limit has been set for.
*/
}