2025-10-29 18:54:29 +01:00
|
|
|
/*
|
|
|
|
|
* 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
|
2026-03-14 21:14:42 +01:00
|
|
|
required property QtObject account
|
2025-10-29 18:54:29 +01:00
|
|
|
|
|
|
|
|
implicitWidth: 300
|
2025-10-29 22:03:57 +01:00
|
|
|
property bool longName: 6 + accountName.contentWidth + 6 + bchAmountLabel.width + 6 > width
|
|
|
|
|
|
2025-10-29 18:54:29 +01:00
|
|
|
implicitHeight: {
|
2026-03-14 21:14:42 +01:00
|
|
|
var h = accountName.height + lastActive.height + 6 * 3
|
2025-10-29 22:03:57 +01:00
|
|
|
// if the width is not enough to fit, the bchamount moves to its own line.
|
|
|
|
|
if (longName)
|
2025-10-29 18:54:29 +01:00
|
|
|
h += bchAmountLabel.height + 6
|
2026-03-14 21:14:42 +01:00
|
|
|
return h
|
2025-10-29 18:54:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Image {
|
|
|
|
|
id: lockIcon
|
|
|
|
|
x: 6
|
|
|
|
|
width: 12
|
|
|
|
|
height: 12
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
visible: root.account.needsPinToPay
|
|
|
|
|
source: {
|
|
|
|
|
if (visible)
|
2026-03-14 21:14:42 +01:00
|
|
|
return "qrc:/lock" + (Pay.useDarkSkin ? "-light.svg" : ".svg")
|
|
|
|
|
return ""
|
2025-10-29 18:54:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Flowee.Label {
|
|
|
|
|
id: accountName
|
|
|
|
|
y: 6
|
|
|
|
|
text: account.name
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: lockIcon.visible ? 24: 6
|
2025-10-29 22:03:57 +01:00
|
|
|
anchors.right: longName ? parent.right : fiat.left
|
2025-10-29 18:54:29 +01:00
|
|
|
anchors.rightMargin: 6
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
}
|
|
|
|
|
Flowee.Label {
|
|
|
|
|
id: fiat
|
2025-10-29 22:03:57 +01:00
|
|
|
y: accountName.y + (longName ? accountName.height + 6 : 0)
|
2025-10-29 18:54:29 +01:00
|
|
|
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
|
2026-03-14 21:14:42 +01:00
|
|
|
property var lastMined: account.lastMinedTransaction
|
2025-10-29 18:54:29 +01:00
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
}
|