Browse Source

GUI: Display label rather than address on popups

0.13
Luke Dashjr 10 years ago
parent
commit
721cb557aa
  1. 18
      src/qt/bitcoingui.cpp
  2. 2
      src/qt/bitcoingui.h
  3. 8
      src/qt/walletview.cpp
  4. 2
      src/qt/walletview.h

18
src/qt/bitcoingui.cpp

@ -859,18 +859,18 @@ void BitcoinGUI::closeEvent(QCloseEvent *event)
} }
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
void BitcoinGUI::incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address) void BitcoinGUI::incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label)
{ {
// On new transaction, make an info balloon // On new transaction, make an info balloon
QString msg = tr("Date: %1\n").arg(date) +
tr("Amount: %1\n").arg(BitcoinUnits::formatWithUnit(unit, amount, true)) +
tr("Type: %1\n").arg(type);
if (!label.isEmpty())
msg += tr("Label: %1\n").arg(label);
else if (!address.isEmpty())
msg += tr("Address: %1\n").arg(address);
message((amount)<0 ? tr("Sent transaction") : tr("Incoming transaction"), message((amount)<0 ? tr("Sent transaction") : tr("Incoming transaction"),
tr("Date: %1\n" msg, CClientUIInterface::MSG_INFORMATION);
"Amount: %2\n"
"Type: %3\n"
"Address: %4\n")
.arg(date)
.arg(BitcoinUnits::formatWithUnit(unit, amount, true))
.arg(type)
.arg(address), CClientUIInterface::MSG_INFORMATION);
} }
#endif // ENABLE_WALLET #endif // ENABLE_WALLET

2
src/qt/bitcoingui.h

@ -165,7 +165,7 @@ public slots:
bool handlePaymentRequest(const SendCoinsRecipient& recipient); bool handlePaymentRequest(const SendCoinsRecipient& recipient);
/** Show incoming transaction notification for new transactions. */ /** Show incoming transaction notification for new transactions. */
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address); void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label);
#endif // ENABLE_WALLET #endif // ENABLE_WALLET
private slots: private slots:

8
src/qt/walletview.cpp

@ -93,7 +93,7 @@ void WalletView::setBitcoinGUI(BitcoinGUI *gui)
connect(this, SIGNAL(encryptionStatusChanged(int)), gui, SLOT(setEncryptionStatus(int))); connect(this, SIGNAL(encryptionStatusChanged(int)), gui, SLOT(setEncryptionStatus(int)));
// Pass through transaction notifications // Pass through transaction notifications
connect(this, SIGNAL(incomingTransaction(QString,int,CAmount,QString,QString)), gui, SLOT(incomingTransaction(QString,int,CAmount,QString,QString))); connect(this, SIGNAL(incomingTransaction(QString,int,CAmount,QString,QString,QString)), gui, SLOT(incomingTransaction(QString,int,CAmount,QString,QString,QString)));
} }
} }
@ -149,9 +149,11 @@ void WalletView::processNewTransaction(const QModelIndex& parent, int start, int
QString date = ttm->index(start, TransactionTableModel::Date, parent).data().toString(); QString date = ttm->index(start, TransactionTableModel::Date, parent).data().toString();
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent).data(Qt::EditRole).toULongLong(); qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent).data(Qt::EditRole).toULongLong();
QString type = ttm->index(start, TransactionTableModel::Type, parent).data().toString(); QString type = ttm->index(start, TransactionTableModel::Type, parent).data().toString();
QString address = ttm->index(start, TransactionTableModel::ToAddress, parent).data().toString(); QModelIndex index = ttm->index(start, 0, parent);
QString address = ttm->data(index, TransactionTableModel::AddressRole).toString();
QString label = ttm->data(index, TransactionTableModel::LabelRole).toString();
emit incomingTransaction(date, walletModel->getOptionsModel()->getDisplayUnit(), amount, type, address); emit incomingTransaction(date, walletModel->getOptionsModel()->getDisplayUnit(), amount, type, address, label);
} }
void WalletView::gotoOverviewPage() void WalletView::gotoOverviewPage()

2
src/qt/walletview.h

@ -113,7 +113,7 @@ signals:
/** Encryption status of wallet changed */ /** Encryption status of wallet changed */
void encryptionStatusChanged(int status); void encryptionStatusChanged(int status);
/** Notify that a new transaction appeared */ /** Notify that a new transaction appeared */
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address); void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label);
}; };
#endif // BITCOIN_QT_WALLETVIEW_H #endif // BITCOIN_QT_WALLETVIEW_H

Loading…
Cancel
Save