mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-14 20:36:32 +02:00
History: display the sum of selected transactions
This commit is contained in:
parent
c9bb2f5718
commit
07319582b9
@ -41,11 +41,28 @@ Rectangle {
|
|||||||
property var model
|
property var model
|
||||||
|
|
||||||
color: "#F0EEEE"
|
color: "#F0EEEE"
|
||||||
|
|
||||||
|
function getSelectedAmount() {
|
||||||
|
var total = 0
|
||||||
|
var count = model.rowCount()
|
||||||
|
for (var i = 0; i < count; ++i) {
|
||||||
|
var idx = model.index(i, 0)
|
||||||
|
var isout = model.data(idx, TransactionHistoryModel.TransactionIsOutRole);
|
||||||
|
var amount = model.data(idx, TransactionHistoryModel.TransactionAmountRole);
|
||||||
|
if (isout)
|
||||||
|
total -= amount
|
||||||
|
else
|
||||||
|
total += amount
|
||||||
|
}
|
||||||
|
return count + qsTr(" selected: ") + total;
|
||||||
|
}
|
||||||
|
|
||||||
onModelChanged: {
|
onModelChanged: {
|
||||||
if (typeof model !== 'undefined') {
|
if (typeof model !== 'undefined') {
|
||||||
// setup date filter scope according to real transactions
|
// setup date filter scope according to real transactions
|
||||||
fromDatePicker.currentDate = model.transactionHistory.firstDateTime
|
fromDatePicker.currentDate = model.transactionHistory.firstDateTime
|
||||||
toDatePicker.currentDate = model.transactionHistory.lastDateTime
|
toDatePicker.currentDate = model.transactionHistory.lastDateTime
|
||||||
|
selectedAmount.text = getSelectedAmount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +82,18 @@ Rectangle {
|
|||||||
text: qsTr("Filter transaction history") + translationManager.emptyString
|
text: qsTr("Filter transaction history") + translationManager.emptyString
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: selectedAmount
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.rightMargin: 17
|
||||||
|
anchors.topMargin: 17
|
||||||
|
text: getSelectedAmount()
|
||||||
|
fontSize: 14
|
||||||
|
tipText: qsTr("<b>Total amount of selected payments</b>") + translationManager.emptyString
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Filter by Address input (senseless, removing)
|
// Filter by Address input (senseless, removing)
|
||||||
/*
|
/*
|
||||||
Label {
|
Label {
|
||||||
@ -213,6 +242,7 @@ Rectangle {
|
|||||||
model.directionFilter = directionFilter
|
model.directionFilter = directionFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectedAmount.text = getSelectedAmount()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user