Browse Source

When a transaction is clicked on overview page, focus it on history page

0.8
Wladimir J. van der Laan 13 years ago
parent
commit
3ef1f41550
  1. 1
      src/qt/bitcoingui.cpp
  2. 12
      src/qt/overviewpage.cpp
  3. 3
      src/qt/overviewpage.h
  4. 10
      src/qt/transactionview.cpp
  5. 1
      src/qt/transactionview.h

1
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 // 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)), this, SLOT(gotoHistoryPage()));
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
// Doubleclicking on a transaction on the transaction history page shows details // Doubleclicking on a transaction on the transaction history page shows details
connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails())); connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

12
src/qt/overviewpage.cpp

@ -94,7 +94,7 @@ OverviewPage::OverviewPage(QWidget *parent) :
ui(new Ui::OverviewPage), ui(new Ui::OverviewPage),
currentBalance(-1), currentBalance(-1),
currentUnconfirmedBalance(-1), currentUnconfirmedBalance(-1),
txdelegate(new TxViewDelegate()) txdelegate(new TxViewDelegate()), filter(0)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -104,7 +104,13 @@ OverviewPage::OverviewPage(QWidget *parent) :
ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2)); ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2));
ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false); 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() OverviewPage::~OverviewPage()
@ -132,7 +138,7 @@ void OverviewPage::setModel(WalletModel *model)
if(model) if(model)
{ {
// Set up transaction list // Set up transaction list
TransactionFilterProxy *filter = new TransactionFilterProxy(); filter = new TransactionFilterProxy();
filter->setSourceModel(model->getTransactionTableModel()); filter->setSourceModel(model->getTransactionTableModel());
filter->setLimit(NUM_ITEMS); filter->setLimit(NUM_ITEMS);
filter->setDynamicSortFilter(true); filter->setDynamicSortFilter(true);

3
src/qt/overviewpage.h

@ -12,6 +12,7 @@ namespace Ui {
} }
class WalletModel; class WalletModel;
class TxViewDelegate; class TxViewDelegate;
class TransactionFilterProxy;
/** Overview ("home") page widget */ /** Overview ("home") page widget */
class OverviewPage : public QWidget class OverviewPage : public QWidget
@ -38,9 +39,11 @@ private:
qint64 currentUnconfirmedBalance; qint64 currentUnconfirmedBalance;
TxViewDelegate *txdelegate; TxViewDelegate *txdelegate;
TransactionFilterProxy *filter;
private slots: private slots:
void displayUnitChanged(); void displayUnitChanged();
void handleTransactionClicked(const QModelIndex &index);
}; };
#endif // OVERVIEWPAGE_H #endif // OVERVIEWPAGE_H

10
src/qt/transactionview.cpp

@ -417,3 +417,13 @@ void TransactionView::dateRangeChanged()
QDateTime(dateFrom->date()), QDateTime(dateFrom->date()),
QDateTime(dateTo->date()).addDays(1)); 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();
}

1
src/qt/transactionview.h

@ -75,6 +75,7 @@ public slots:
void changedPrefix(const QString &prefix); void changedPrefix(const QString &prefix);
void changedAmount(const QString &amount); void changedAmount(const QString &amount);
void exportClicked(); void exportClicked();
void focusTransaction(const QModelIndex&);
}; };

Loading…
Cancel
Save