Files

64 lines
1.9 KiB
QML
Raw Permalink Normal View History

2023-05-19 16:29:36 +02:00
/*
* This file is part of the Flowee project
2025-03-03 14:10:09 +01:00
* Copyright (C) 2023-2025 Tom Zander <tom@flowee.org>
2023-05-19 16:29:36 +02: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
TextButton {
id: root
property QtObject account: portfolio.current
property int limit: 0
2025-03-03 19:58:49 +01:00
currentValue: {
if (!root.account.allowInstaPay)
2026-03-14 21:14:42 +01:00
return false
return Fiat.formattedPrice(limit)
2025-03-03 19:58:49 +01:00
}
2025-03-08 16:59:38 +01:00
function doUpdates() {
2026-03-14 21:14:42 +01:00
limit = root.account.fiatInstaPayLimit(Fiat.currencyName)
2025-03-08 16:59:38 +01:00
text = root.account.allowInstaPay ? qsTr("Configure Instant Pay") : qsTr("Enable Instant Pay")
}
2026-03-14 21:14:42 +01:00
onAccountChanged: doUpdates()
Component.onCompleted: doUpdates()
Connections {
target: root.account
function onInstaPayLimitChanged() {
2026-03-14 21:14:42 +01:00
doUpdates()
}
}
Connections {
target: Fiat
function onCurrencyNameChanged() {
2026-03-14 21:14:42 +01:00
doUpdates()
}
}
2023-05-19 16:29:36 +02:00
subtext: {
2025-03-04 11:14:54 +01:00
if (portfolio.singleAccountSetup)
2026-03-14 21:14:42 +01:00
return ""
2025-03-08 16:59:38 +01:00
if (root.account.allowInstaPay)
2026-03-14 21:14:42 +01:00
return qsTr("Limits for %1", "argument is a name").arg(root.account.name)
return qsTr("Disabled for %1", "argument is a name").arg(root.account.name)
2023-05-19 16:29:36 +02:00
}
2024-12-23 18:51:55 +01:00
pageButton: true
2023-05-19 16:29:36 +02:00
onClicked: {
var newPage = thePile.push("./InstaPayConfigPage.qml")
2026-03-14 21:14:42 +01:00
newPage.account = root.account
2023-05-19 16:29:36 +02:00
}
}