Skip to content

Commit

Permalink
Add "last month" filter
Browse files Browse the repository at this point in the history
  • Loading branch information
laanwj committed Jul 1, 2011
1 parent b5384e9 commit 05bae43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/qt/transactionview.cpp
Expand Up @@ -36,6 +36,7 @@ TransactionView::TransactionView(QWidget *parent) :
dateWidget->addItem(tr("Today"), Today);
dateWidget->addItem(tr("This week"), ThisWeek);
dateWidget->addItem(tr("This month"), ThisMonth);
dateWidget->addItem(tr("Last month"), LastMonth);
dateWidget->addItem(tr("This year"), ThisYear);
dateWidget->addItem(tr("Range..."), Range);
hlayout->addWidget(dateWidget);
Expand Down Expand Up @@ -147,6 +148,11 @@ void TransactionView::chooseDate(int idx)
QDateTime(QDate(current.year(), current.month(), 1)),
TransactionFilterProxy::MAX_DATE);
break;
case LastMonth:
transactionProxyModel->setDateRange(
QDateTime(QDate(current.year(), current.month()-1, 1)),
QDateTime(QDate(current.year(), current.month(), 1)));
break;
case ThisYear:
transactionProxyModel->setDateRange(
QDateTime(QDate(current.year(), 1, 1)),
Expand All @@ -172,7 +178,7 @@ void TransactionView::changedPrefix(const QString &prefix)

void TransactionView::changedAmount(const QString &amount)
{
qint64 amount_parsed;
qint64 amount_parsed = 0;
if(GUIUtil::parseMoney(amount, &amount_parsed))
{
transactionProxyModel->setMinAmount(amount_parsed);
Expand Down
1 change: 1 addition & 0 deletions src/qt/transactionview.h
Expand Up @@ -27,6 +27,7 @@ class TransactionView : public QWidget
Today,
ThisWeek,
ThisMonth,
LastMonth,
ThisYear,
Range
};
Expand Down

0 comments on commit 05bae43

Please sign in to comment.