aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/qt/transactionview.cpp51
-rw-r--r--src/qt/transactionview.h9
2 files changed, 58 insertions, 2 deletions
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index 8aa43395e7..50291fea42 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -25,6 +25,8 @@
#include <QMenu>
#include <QApplication>
#include <QClipboard>
+#include <QLabel>
+#include <QDateTimeEdit>
#include <QDebug>
@@ -90,6 +92,7 @@ TransactionView::TransactionView(QWidget *parent) :
QTableView *view = new QTableView(this);
vlayout->addLayout(hlayout);
+ vlayout->addWidget(createDateRangeWidget());
vlayout->addWidget(view);
vlayout->setSpacing(0);
int width = view->verticalScrollBar()->sizeHint().width();
@@ -167,6 +170,7 @@ void TransactionView::setModel(WalletModel *model)
void TransactionView::chooseDate(int idx)
{
QDate current = QDate::currentDate();
+ dateRangeWidget->setVisible(false);
switch(dateWidget->itemData(idx).toInt())
{
case All:
@@ -203,10 +207,10 @@ void TransactionView::chooseDate(int idx)
TransactionFilterProxy::MAX_DATE);
break;
case Range:
- // TODO ask specific range
+ dateRangeWidget->setVisible(true);
+ dateRangeChanged();
break;
}
-
}
void TransactionView::chooseType(int idx)
@@ -337,3 +341,46 @@ void TransactionView::showDetails()
dlg.exec();
}
}
+
+QWidget *TransactionView::createDateRangeWidget()
+{
+ dateRangeWidget = new QFrame();
+ dateRangeWidget->setFrameStyle(QFrame::Panel | QFrame::Raised);
+ dateRangeWidget->setContentsMargins(1,1,1,1);
+ QHBoxLayout *layout = new QHBoxLayout(dateRangeWidget);
+ layout->setContentsMargins(0,0,0,0);
+ layout->addSpacing(23);
+ layout->addWidget(new QLabel("Range:"));
+
+ dateFrom = new QDateTimeEdit(this);
+ dateFrom->setDisplayFormat("dd/MM/yy");
+ dateFrom->setCalendarPopup(true);
+ dateFrom->setMinimumWidth(100);
+ dateFrom->setDate(QDate::currentDate().addDays(-7));
+ layout->addWidget(dateFrom);
+ layout->addWidget(new QLabel("to"));
+
+ dateTo = new QDateTimeEdit(this);
+ dateTo->setDisplayFormat("dd/MM/yy");
+ dateTo->setCalendarPopup(true);
+ dateTo->setMinimumWidth(100);
+ dateTo->setDate(QDate::currentDate());
+ layout->addWidget(dateTo);
+ layout->addStretch();
+
+ // Hide by default
+ dateRangeWidget->setVisible(false);
+
+ // Notify on change
+ connect(dateFrom, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged()));
+ connect(dateTo, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged()));
+
+ return dateRangeWidget;
+}
+
+void TransactionView::dateRangeChanged()
+{
+ transactionProxyModel->setDateRange(
+ QDateTime(dateFrom->date()),
+ QDateTime(dateTo->date()).addDays(1));
+}
diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h
index f02751a074..54925f2855 100644
--- a/src/qt/transactionview.h
+++ b/src/qt/transactionview.h
@@ -12,6 +12,8 @@ class QComboBox;
class QLineEdit;
class QModelIndex;
class QMenu;
+class QFrame;
+class QDateTimeEdit;
QT_END_NAMESPACE
class TransactionView : public QWidget
@@ -45,8 +47,15 @@ private:
QMenu *contextMenu;
+ QFrame *dateRangeWidget;
+ QDateTimeEdit *dateFrom;
+ QDateTimeEdit *dateTo;
+
+ QWidget *createDateRangeWidget();
+
private slots:
void contextualMenu(const QPoint &);
+ void dateRangeChanged();
signals:
void doubleClicked(const QModelIndex&);