diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-21 19:54:09 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-21 19:54:09 +0200 |
commit | f5927f5b32c9e28033fb7a00dd43f3162781c1d0 (patch) | |
tree | e1c59d89e8a2eb0347ffd3fce560df8d00750aa5 /src/qt/addresstablemodel.cpp | |
parent | c92fc340a2a1fa019a1f392e97c3220aa738441b (diff) |
highlight default address
Diffstat (limited to 'src/qt/addresstablemodel.cpp')
-rw-r--r-- | src/qt/addresstablemodel.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 2d69df3da0..0558bfa453 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -3,6 +3,7 @@ #include "main.h" #include <QFont> +#include <QColor> const QString AddressTableModel::Send = "S"; const QString AddressTableModel::Receive = "R"; @@ -21,6 +22,16 @@ struct AddressTableEntry AddressTableEntry() {} AddressTableEntry(Type type, const QString &label, const QString &address): type(type), label(label), address(address) {} + + bool isDefaultAddress() const + { + std::vector<unsigned char> vchPubKey; + if (CWalletDB("r").ReadDefaultKey(vchPubKey)) + { + return address == QString::fromStdString(PubKeyToAddress(vchPubKey)); + } + return false; + } }; // Private implementation @@ -110,9 +121,30 @@ QVariant AddressTableModel::data(const QModelIndex &index, int role) const } else if (role == Qt::FontRole) { + QFont font; if(index.column() == Address) { - return GUIUtil::bitcoinAddressFont(); + font = GUIUtil::bitcoinAddressFont(); + } + if(rec->isDefaultAddress()) + { + font.setBold(true); + } + return font; + } + else if (role == Qt::ForegroundRole) + { + // Show default address in alternative color + if(rec->isDefaultAddress()) + { + return QColor(0,0,255); + } + } + else if (role == Qt::ToolTipRole) + { + if(rec->isDefaultAddress()) + { + return tr("Default receiving address"); } } else if (role == TypeRole) |