mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 00:07:51 +00:00
History: display the sum of selected transactions
This commit is contained in:
parent
c9bb2f5718
commit
07319582b9
1 changed files with 30 additions and 0 deletions
|
@ -41,11 +41,28 @@ Rectangle {
|
|||
property var model
|
||||
|
||||
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: {
|
||||
if (typeof model !== 'undefined') {
|
||||
// setup date filter scope according to real transactions
|
||||
fromDatePicker.currentDate = model.transactionHistory.firstDateTime
|
||||
toDatePicker.currentDate = model.transactionHistory.lastDateTime
|
||||
selectedAmount.text = getSelectedAmount()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +82,18 @@ Rectangle {
|
|||
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)
|
||||
/*
|
||||
Label {
|
||||
|
@ -213,6 +242,7 @@ Rectangle {
|
|||
model.directionFilter = directionFilter
|
||||
}
|
||||
|
||||
selectedAmount.text = getSelectedAmount()
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue