mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-24 13:54:16 +00:00
show notification balloon on incoming transaction
This commit is contained in:
parent
a777f7b9b5
commit
725d460e4b
@ -82,6 +82,7 @@ private slots:
|
|||||||
void copyClipboardClicked();
|
void copyClipboardClicked();
|
||||||
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||||
void transactionDetails(const QModelIndex& idx);
|
void transactionDetails(const QModelIndex& idx);
|
||||||
|
void incomingTransaction(const QModelIndex & parent, int start, int end);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -257,6 +257,9 @@ void BitcoinGUI::setTabsModel(QAbstractItemModel *transaction_model)
|
|||||||
transaction_table->horizontalHeader()->resizeSection(
|
transaction_table->horizontalHeader()->resizeSection(
|
||||||
TransactionTableModel::Credit, 79);
|
TransactionTableModel::Credit, 79);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(transaction_model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
|
||||||
|
this, SLOT(incomingTransaction(const QModelIndex &, int, int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::sendcoinsClicked()
|
void BitcoinGUI::sendcoinsClicked()
|
||||||
@ -407,3 +410,25 @@ void BitcoinGUI::transactionDetails(const QModelIndex& idx)
|
|||||||
dlg.exec();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user