2024-10-20 21:21:05 +02:00
|
|
|
/*
|
|
|
|
|
* This file is part of the Flowee project
|
2026-02-10 13:54:10 +01:00
|
|
|
* Copyright (C) 2024-2026 Tom Zander <tom@flowee.org>
|
2024-10-20 21:21:05 +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
|
2024-10-21 13:28:00 +02:00
|
|
|
import QtQuick.Layouts
|
2024-10-20 21:21:05 +02:00
|
|
|
import "../Flowee" as Flowee
|
2026-02-10 13:54:10 +01:00
|
|
|
import Flowee.org.pay
|
2024-10-20 21:21:05 +02:00
|
|
|
|
|
|
|
|
// the widget that shows up on the AccountHistory
|
|
|
|
|
// allowing one to change the timeline filters
|
|
|
|
|
Item {
|
2026-02-10 13:54:10 +01:00
|
|
|
id: root
|
2024-10-21 13:28:00 +02:00
|
|
|
implicitHeight: coreColumn.height + 10
|
|
|
|
|
width: parent.width
|
2024-10-20 21:21:05 +02:00
|
|
|
|
|
|
|
|
function toggleFlag(flag, on) {
|
|
|
|
|
var cf = portfolio.current.transactions.includeFlags
|
|
|
|
|
if (((cf & flag) > 0) === on) // nothing to do.
|
2026-02-10 13:54:10 +01:00
|
|
|
return
|
2024-10-20 21:21:05 +02:00
|
|
|
if (on)
|
2026-02-10 13:54:10 +01:00
|
|
|
cf += flag
|
2024-10-20 21:21:05 +02:00
|
|
|
else
|
2026-02-10 13:54:10 +01:00
|
|
|
cf -= flag
|
2024-10-20 21:21:05 +02:00
|
|
|
portfolio.current.transactions.includeFlags = cf
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-21 13:28:00 +02:00
|
|
|
ColumnLayout {
|
2024-10-20 21:21:05 +02:00
|
|
|
id: coreColumn
|
2024-10-21 13:28:00 +02:00
|
|
|
width: parent.width
|
2024-10-20 21:21:05 +02:00
|
|
|
spacing: 10
|
|
|
|
|
Flowee.Label {
|
2024-10-23 12:50:31 +02:00
|
|
|
text: qsTr("Transactions Filter")
|
2024-10-20 21:21:05 +02:00
|
|
|
}
|
2026-02-10 13:54:10 +01:00
|
|
|
Flow {
|
|
|
|
|
width: parent.width
|
|
|
|
|
spacing: 12
|
2024-10-20 21:21:05 +02:00
|
|
|
Rectangle {
|
2024-10-21 13:28:00 +02:00
|
|
|
width: 80
|
|
|
|
|
height: 80
|
|
|
|
|
radius: 40
|
|
|
|
|
|
2024-10-20 21:21:05 +02:00
|
|
|
border.width: 3
|
2024-10-21 13:28:00 +02:00
|
|
|
color: checked ? palette.alternateBase : palette.base
|
|
|
|
|
border.color: checked ? palette.midlight : palette.mid
|
|
|
|
|
|
|
|
|
|
Image {
|
2026-02-10 13:54:10 +01:00
|
|
|
source: "qrc:/tx-receiving" + (Pay.useDarkSkin ? "-light.svg" : ".svg")
|
2024-10-21 13:28:00 +02:00
|
|
|
width: 50
|
|
|
|
|
height: 50
|
|
|
|
|
smooth: true
|
|
|
|
|
y: 11
|
|
|
|
|
x: 12
|
|
|
|
|
opacity: parent.checked ? 1 : 0.5
|
|
|
|
|
}
|
2026-02-10 13:54:10 +01:00
|
|
|
property bool checked: (portfolio.current.transactions.includeFlags
|
|
|
|
|
& Wallet.IncludeReceivedTransactions)
|
|
|
|
|
=== Wallet.IncludeReceivedTransactions
|
2024-10-20 21:21:05 +02:00
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
2026-02-10 13:54:10 +01:00
|
|
|
onClicked: toggleFlag(Wallet.IncludeReceivedTransactions, !parent.checked)
|
|
|
|
|
}
|
|
|
|
|
Rectangle {
|
|
|
|
|
visible: !parent.checked
|
|
|
|
|
width: parent.width * 1.4
|
|
|
|
|
height: 3
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
rotation: -45
|
|
|
|
|
color: mainWindow.errorRedBg
|
2024-10-20 21:21:05 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Rectangle {
|
2024-10-21 13:28:00 +02:00
|
|
|
width: 80
|
|
|
|
|
height: 80
|
|
|
|
|
radius: 40
|
|
|
|
|
|
2024-10-20 21:21:05 +02:00
|
|
|
border.width: 3
|
2024-10-21 13:28:00 +02:00
|
|
|
color: checked ? palette.alternateBase : palette.base
|
|
|
|
|
border.color: checked ? palette.midlight : palette.mid
|
|
|
|
|
|
|
|
|
|
Image {
|
2026-02-10 13:54:10 +01:00
|
|
|
source: "qrc:/tx-send" + (Pay.useDarkSkin ? "-light.svg" : ".svg")
|
2024-10-21 13:28:00 +02:00
|
|
|
width: 50
|
|
|
|
|
height: 50
|
|
|
|
|
smooth: true
|
|
|
|
|
x: 15
|
|
|
|
|
y: 11
|
|
|
|
|
opacity: parent.checked ? 1 : 0.5
|
|
|
|
|
}
|
2026-02-10 13:54:10 +01:00
|
|
|
property bool checked: (portfolio.current.transactions.includeFlags
|
|
|
|
|
& Wallet.IncludeSentTransactions)
|
|
|
|
|
=== Wallet.IncludeSentTransactions
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
onClicked: toggleFlag(Wallet.IncludeSentTransactions, !parent.checked)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Rectangle {
|
|
|
|
|
visible: !parent.checked
|
|
|
|
|
width: parent.width * 1.4
|
|
|
|
|
height: 3
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
rotation: -45
|
|
|
|
|
color: mainWindow.errorRedBg
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: cfCheckbox
|
|
|
|
|
width: 80
|
|
|
|
|
height: 80
|
|
|
|
|
radius: 6
|
|
|
|
|
color: checked ? palette.alternateBase : palette.base
|
|
|
|
|
border.width: 3
|
|
|
|
|
border.color: checked ? palette.midlight : palette.mid
|
|
|
|
|
visible: portfolio.current.hasAnonimityTransactions
|
|
|
|
|
|
|
|
|
|
property bool checked: (portfolio.current.transactions.includeFlags
|
|
|
|
|
& Wallet.IncludeCFs) > 0
|
|
|
|
|
|
|
|
|
|
Image {
|
|
|
|
|
source: "qrc:/cf.svg"
|
|
|
|
|
width: 60
|
|
|
|
|
height: 60
|
|
|
|
|
smooth: true
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
opacity: cfCheckbox.checked ? 1 : 0.5
|
2024-10-20 21:21:05 +02:00
|
|
|
}
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
2026-02-10 13:54:10 +01:00
|
|
|
onClicked: toggleFlag(Wallet.IncludeCFs, !cfCheckbox.checked)
|
2024-10-20 21:21:05 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-21 13:28:00 +02:00
|
|
|
Flowee.CheckBox {
|
2026-02-10 13:54:10 +01:00
|
|
|
id: commentCheckbox
|
2024-10-21 13:28:00 +02:00
|
|
|
width: parent.width
|
2026-02-10 13:54:10 +01:00
|
|
|
text: qsTr("Only with a comment", "This is a statement about a transaction")
|
2024-10-23 12:50:31 +02:00
|
|
|
checked: !(portfolio.current.transactions.includeFlags & Wallet.IncludeTxWithoutComment) > 0
|
2026-02-10 13:54:10 +01:00
|
|
|
onToggled: toggleFlag(Wallet.IncludeTxWithoutComment, !checked)
|
|
|
|
|
}
|
|
|
|
|
Flowee.TextField {
|
2026-02-10 14:09:01 +01:00
|
|
|
id: filterTextField
|
2026-02-10 13:54:10 +01:00
|
|
|
Layout.fillWidth: true
|
2026-02-10 14:09:01 +01:00
|
|
|
text: portfolio.current.transactions.filterString
|
2026-02-13 14:05:21 +01:00
|
|
|
onDisplayTextChanged: portfolio.current.transactions.filterString = displayText
|
2026-02-10 13:54:10 +01:00
|
|
|
placeholderText: qsTr("Filter on transaction details")
|
2026-02-10 14:09:01 +01:00
|
|
|
inputMethodHints: Qt.ImhNoAutoUppercase
|
|
|
|
|
|
|
|
|
|
Image {
|
|
|
|
|
source: "qrc:/backspace" + (Pay.useDarkSkin ? "-light.svg" : ".svg")
|
|
|
|
|
width: 22
|
|
|
|
|
height: 15
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.rightMargin: 6
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.margins: -10
|
|
|
|
|
onClicked: {
|
|
|
|
|
filterTextField.text = ""
|
|
|
|
|
root.forceActiveFocus()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-21 13:28:00 +02:00
|
|
|
}
|
2024-10-20 21:21:05 +02:00
|
|
|
}
|
|
|
|
|
}
|