aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-06-10 22:39:47 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-06-10 22:39:47 +0200
commit4181184acf8afa9e5f1c37396e7c8e5bd583f39a (patch)
treefed77af96bfd2edc810849071305e8d9e589c213 /gui
parent5b0dc80bf720a78953a07cb9c71e5da8cefe5279 (diff)
parent725d460e4b2a2d1d5e3786cb184ad87dcff72d2c (diff)
Merge branch 'master' of github.com:laanwj/bitcoin-qt
Diffstat (limited to 'gui')
-rw-r--r--gui/include/bitcoingui.h1
-rw-r--r--gui/include/transactiontablemodel.h2
-rw-r--r--gui/src/addressbookdialog.cpp7
-rw-r--r--gui/src/bitcoingui.cpp27
4 files changed, 33 insertions, 4 deletions
diff --git a/gui/include/bitcoingui.h b/gui/include/bitcoingui.h
index e18e2ff21a..96452ef18b 100644
--- a/gui/include/bitcoingui.h
+++ b/gui/include/bitcoingui.h
@@ -82,6 +82,7 @@ private slots:
void copyClipboardClicked();
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
void transactionDetails(const QModelIndex& idx);
+ void incomingTransaction(const QModelIndex & parent, int start, int end);
};
#endif
diff --git a/gui/include/transactiontablemodel.h b/gui/include/transactiontablemodel.h
index 47e4e4cf14..5974c0e7fe 100644
--- a/gui/include/transactiontablemodel.h
+++ b/gui/include/transactiontablemodel.h
@@ -37,7 +37,7 @@ public:
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
- QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
+ QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
private:
QStringList columns;
TransactionTablePriv *priv;
diff --git a/gui/src/addressbookdialog.cpp b/gui/src/addressbookdialog.cpp
index eaab66a202..90950a6441 100644
--- a/gui/src/addressbookdialog.cpp
+++ b/gui/src/addressbookdialog.cpp
@@ -82,7 +82,7 @@ void AddressBookDialog::on_copyToClipboard_clicked()
foreach (QModelIndex index, indexes)
{
- QVariant address = table->model()->data(index);
+ QVariant address = index.data();
QApplication::clipboard()->setText(address.toString());
}
}
@@ -94,6 +94,9 @@ void AddressBookDialog::on_editButton_clicked()
{
return;
}
+ /* Map selected index to source address book model */
+ QAbstractProxyModel *proxy_model = static_cast<QAbstractProxyModel*>(getCurrentTable()->model());
+ QModelIndex selected = proxy_model->mapToSource(indexes.at(0));
/* Double click also triggers edit button */
EditAddressDialog dlg(
@@ -101,7 +104,7 @@ void AddressBookDialog::on_editButton_clicked()
EditAddressDialog::EditSendingAddress :
EditAddressDialog::EditReceivingAddress);
dlg.setModel(model);
- dlg.loadRow(indexes.at(0).row());
+ dlg.loadRow(selected.row());
if(dlg.exec())
{
dlg.saveCurrentRow();
diff --git a/gui/src/bitcoingui.cpp b/gui/src/bitcoingui.cpp
index c92a546ea4..96125ef078 100644
--- a/gui/src/bitcoingui.cpp
+++ b/gui/src/bitcoingui.cpp
@@ -214,7 +214,7 @@ QWidget *BitcoinGUI::createTabs()
QTableView *view = new QTableView(this);
tabs->addTab(view, tab_labels.at(i));
- connect(view, SIGNAL(activated(const QModelIndex&)), this, SLOT(transactionDetails(const QModelIndex&)));
+ connect(view, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(transactionDetails(const QModelIndex&)));
transactionViews.append(view);
}
@@ -257,6 +257,9 @@ void BitcoinGUI::setTabsModel(QAbstractItemModel *transaction_model)
transaction_table->horizontalHeader()->resizeSection(
TransactionTableModel::Credit, 79);
}
+
+ connect(transaction_model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
+ this, SLOT(incomingTransaction(const QModelIndex &, int, int)));
}
void BitcoinGUI::sendcoinsClicked()
@@ -407,3 +410,25 @@ void BitcoinGUI::transactionDetails(const QModelIndex& idx)
dlg.exec();
}
+void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int end)
+{
+ TransactionTableModel *ttm = model->getTransactionTableModel();
+ qint64 credit = ttm->index(start, TransactionTableModel::Credit, parent)
+ .data(Qt::EditRole).toULongLong();
+ qint64 debit = ttm->index(start, TransactionTableModel::Debit, parent)
+ .data(Qt::EditRole).toULongLong();
+ if((credit+debit)>0)
+ {
+ /* On incoming transaction, make an info balloon */
+ QString date = ttm->index(start, TransactionTableModel::Date, parent)
+ .data().toString();
+ QString description = ttm->index(start, TransactionTableModel::Description, parent)
+ .data().toString();
+
+ trayIcon->showMessage(tr("Incoming transaction"),
+ "Date: " + date + "\n" +
+ "Amount: " + QString::fromStdString(FormatMoney(credit+debit, true)) + "\n" +
+ description,
+ QSystemTrayIcon::Information);
+ }
+}