Files
pay/guis/mobile/AccountListItem.qml
2026-03-14 21:14:42 +01:00

99 lines
3.3 KiB
QML

/*
* This file is part of the Flowee project
* Copyright (C) 2022-2025 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
Item {
id: root
required property QtObject account
implicitWidth: 300
property bool longName: 6 + accountName.contentWidth + 6 + bchAmountLabel.width + 6 > width
implicitHeight: {
var h = accountName.height + lastActive.height + 6 * 3
// if the width is not enough to fit, the bchamount moves to its own line.
if (longName)
h += bchAmountLabel.height + 6
return h
}
Image {
id: lockIcon
x: 6
width: 12
height: 12
anchors.verticalCenter: parent.verticalCenter
visible: root.account.needsPinToPay
source: {
if (visible)
return "qrc:/lock" + (Pay.useDarkSkin ? "-light.svg" : ".svg")
return ""
}
}
Flowee.Label {
id: accountName
y: 6
text: account.name
anchors.left: parent.left
anchors.leftMargin: lockIcon.visible ? 24: 6
anchors.right: longName ? parent.right : fiat.left
anchors.rightMargin: 6
elide: Text.ElideRight
}
Flowee.Label {
id: fiat
y: accountName.y + (longName ? accountName.height + 6 : 0)
anchors.right: parent.right
anchors.rightMargin: 6
text: Fiat.formattedPrice(account.balanceConfirmed + account.balanceUnconfirmed, Fiat.price)
visible: account.countBalance && (account.isDecrypted || !account.needsPinToOpen)
}
Flowee.Label {
id: lastActive
anchors.top: accountName.bottom
anchors.topMargin: 6
anchors.left: accountName.left
property var lastMined: account.lastMinedTransaction
text: qsTr("last active") + ": " + Pay.formatDate(lastMined)
font.pixelSize: accountName.font.pixelSize * 0.8
visible: !lockStatus.visible && !isNaN(lastMined)
}
Flowee.Label {
id: lockStatus
anchors.top: accountName.bottom
anchors.topMargin: 6
anchors.left: accountName.left
text: qsTr("Needs PIN to open")
font.pixelSize: accountName.font.pixelSize * 0.8
visible: account.needsPinToOpen && !account.isDecrypted
}
Flowee.BitcoinAmountLabel {
id: bchAmountLabel
anchors.right: fiat.right
anchors.bottom: parent.bottom
anchors.bottomMargin: 6
font.pixelSize: lastActive.font.pixelSize
showFiat: false
value: account.balanceConfirmed + account.balanceUnconfirmed
colorize: false
visible: fiat.visible
}
}