From 9af3c7e03e1bc386494956b12d5eb9ffa8b4cf8b Mon Sep 17 00:00:00 2001 From: "moneromooo.monero" Date: Wed, 16 Nov 2016 21:02:50 +0000 Subject: [PATCH] History: reset filter before setting new values This ensures an empty/invalid field does not keep the old bound --- pages/History.qml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pages/History.qml b/pages/History.qml index 29b34aec..85aec79f 100644 --- a/pages/History.qml +++ b/pages/History.qml @@ -70,6 +70,15 @@ Rectangle { return count + qsTr(" selected: ") + sign + walletManager.displayAmount(total); } + function resetFilter(model) { + model.dateFromFilter = "2014-04-18" // genesis block + model.dateToFilter = "9999-09-09" // fix before september 9999 + // negative values disable filters here; + model.amountFromFilter = -1; + model.amountToFilter = -1; + model.directionFilter = TransactionInfo.Direction_Both; + } + onModelChanged: { if (typeof model !== 'undefined') { @@ -285,6 +294,8 @@ Rectangle { model.paymentIdFilter = paymentIdLine.text + resetFilter(model) + if (fromDatePicker.currentDate > toDatePicker.currentDate) { console.error("Invalid date filter set: ", fromDatePicker.currentDate, toDatePicker.currentDate) } else { @@ -295,16 +306,10 @@ Rectangle { if (advancedFilteringCheckBox.checked) { if (amountFromLine.text.length) { model.amountFromFilter = parseFloat(amountFromLine.text) - } else { - // negative value disables filter here; - model.amountFromFilter = -1; } if (amountToLine.text.length) { model.amountToFilter = parseFloat(amountToLine.text) - } else { - // negative value disables filter here; - model.amountToFilter = -1; } var directionFilter = transactionsModel.get(transactionTypeDropdown.currentIndex).value