diff options
| author | Riccardo Spagni <ric@spagni.net> | 2016-11-09 20:41:01 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2016-11-09 20:41:01 +0200 |
| commit | dca51b97b70452f16ec962f0315f337c0e21d46c (patch) | |
| tree | 1e2f1c2bef2bbfe9a7713ff8dee92ef83482b901 | |
| parent | 10c8a2db03fbea06dbec9b4585da6c4a9498b886 (diff) | |
| parent | 07319582b99a794c1e1c8880afcfa9b9d420592b (diff) | |
| download | monzero-gui-dca51b97b70452f16ec962f0315f337c0e21d46c.tar.gz monzero-gui-dca51b97b70452f16ec962f0315f337c0e21d46c.tar.xz monzero-gui-dca51b97b70452f16ec962f0315f337c0e21d46c.zip | |
Merge pull request #112
0731958 History: display the sum of selected transactions (moneromooo.monero)
| -rw-r--r-- | pages/History.qml | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pages/History.qml b/pages/History.qml index bf71791a..a6c216bf 100644 --- a/pages/History.qml +++ b/pages/History.qml @@ -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() } } |
