diff options
Diffstat (limited to 'gui/src/bitcoingui.cpp')
-rw-r--r-- | gui/src/bitcoingui.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
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); + } +} |