aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-05-13 02:53:25 -0700
committerWladimir J. van der Laan <laanwj@gmail.com>2012-05-13 02:53:25 -0700
commit82f66082b986132ab9ef039afa3c1e116dcbb36b (patch)
tree2f138ae6ef5d7fe0389a62e61081955beccf415b /src
parent3986a05c62c08f3b51067de196fd1f9b3b1ffa83 (diff)
parent3ef1f41550d5e9ba032dcc5e550e5f85f7e6aa07 (diff)
Merge pull request #1270 from laanwj/2012_05_overviewpage2
When a transaction is clicked on overview page, focus it on history page
Diffstat (limited to 'src')
-rw-r--r--src/qt/bitcoingui.cpp1
-rw-r--r--src/qt/overviewpage.cpp12
-rw-r--r--src/qt/overviewpage.h3
-rw-r--r--src/qt/transactionview.cpp10
-rw-r--r--src/qt/transactionview.h1
5 files changed, 24 insertions, 3 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 74969fc6f3..ae9bf2a4b9 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -157,6 +157,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
// Clicking on a transaction on the overview page simply sends you to transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
+ connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
// Doubleclicking on a transaction on the transaction history page shows details
connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp
index 259f819deb..d0ba377967 100644
--- a/src/qt/overviewpage.cpp
+++ b/src/qt/overviewpage.cpp
@@ -94,7 +94,7 @@ OverviewPage::OverviewPage(QWidget *parent) :
ui(new Ui::OverviewPage),
currentBalance(-1),
currentUnconfirmedBalance(-1),
- txdelegate(new TxViewDelegate())
+ txdelegate(new TxViewDelegate()), filter(0)
{
ui->setupUi(this);
@@ -104,7 +104,13 @@ OverviewPage::OverviewPage(QWidget *parent) :
ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2));
ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false);
- connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SIGNAL(transactionClicked(QModelIndex)));
+ connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex)));
+}
+
+void OverviewPage::handleTransactionClicked(const QModelIndex &index)
+{
+ if(filter)
+ emit transactionClicked(filter->mapToSource(index));
}
OverviewPage::~OverviewPage()
@@ -132,7 +138,7 @@ void OverviewPage::setModel(WalletModel *model)
if(model)
{
// Set up transaction list
- TransactionFilterProxy *filter = new TransactionFilterProxy();
+ filter = new TransactionFilterProxy();
filter->setSourceModel(model->getTransactionTableModel());
filter->setLimit(NUM_ITEMS);
filter->setDynamicSortFilter(true);
diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h
index 1199227168..1acd1b7f39 100644
--- a/src/qt/overviewpage.h
+++ b/src/qt/overviewpage.h
@@ -12,6 +12,7 @@ namespace Ui {
}
class WalletModel;
class TxViewDelegate;
+class TransactionFilterProxy;
/** Overview ("home") page widget */
class OverviewPage : public QWidget
@@ -38,9 +39,11 @@ private:
qint64 currentUnconfirmedBalance;
TxViewDelegate *txdelegate;
+ TransactionFilterProxy *filter;
private slots:
void displayUnitChanged();
+ void handleTransactionClicked(const QModelIndex &index);
};
#endif // OVERVIEWPAGE_H
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index 1c427d6fe4..a0e7dd4e77 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -417,3 +417,13 @@ void TransactionView::dateRangeChanged()
QDateTime(dateFrom->date()),
QDateTime(dateTo->date()).addDays(1));
}
+
+void TransactionView::focusTransaction(const QModelIndex &idx)
+{
+ if(!transactionProxyModel)
+ return;
+ QModelIndex targetIdx = transactionProxyModel->mapFromSource(idx);
+ transactionView->scrollTo(targetIdx);
+ transactionView->setCurrentIndex(targetIdx);
+ transactionView->setFocus();
+}
diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h
index bc6e1e4e05..4ade3ecd5f 100644
--- a/src/qt/transactionview.h
+++ b/src/qt/transactionview.h
@@ -75,6 +75,7 @@ public slots:
void changedPrefix(const QString &prefix);
void changedAmount(const QString &amount);
void exportClicked();
+ void focusTransaction(const QModelIndex&);
};