aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-07-15 15:20:50 +1000
committerGavin Andresen <gavinandresen@gmail.com>2013-08-22 11:05:45 +1000
commit618855133d4ae4ece130aec3b35c5a65bea95b8f (patch)
treefbbaf4bfdf5751ad24635fdcb4b633d71433a2d0 /src/qt
parentb94595bb7f6b98c11182df5373fe6461f4776098 (diff)
downloadbitcoin-618855133d4ae4ece130aec3b35c5a65bea95b8f.tar.xz
Refactor: CAddressBookData for mapAddressBook
Straight refactor, so mapAddressBook stores a CAddressBookData (which just contains a std::string) instead of a std::string. Preparation for payment protocol work, which will add the notion of refund addresses to the address book.
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/addresstablemodel.cpp8
-rw-r--r--src/qt/transactiondesc.cpp16
-rw-r--r--src/qt/walletmodel.cpp4
3 files changed, 14 insertions, 14 deletions
diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp
index 1801444521..823730c4ca 100644
--- a/src/qt/addresstablemodel.cpp
+++ b/src/qt/addresstablemodel.cpp
@@ -59,10 +59,10 @@ public:
cachedAddressTable.clear();
{
LOCK(wallet->cs_wallet);
- BOOST_FOREACH(const PAIRTYPE(CTxDestination, std::string)& item, wallet->mapAddressBook)
+ BOOST_FOREACH(const PAIRTYPE(CTxDestination, CAddressBookData)& item, wallet->mapAddressBook)
{
const CBitcoinAddress& address = item.first;
- const std::string& strName = item.second;
+ const std::string& strName = item.second.name;
bool fMine = IsMine(*wallet, address.Get());
cachedAddressTable.append(AddressTableEntry(fMine ? AddressTableEntry::Receiving : AddressTableEntry::Sending,
QString::fromStdString(strName),
@@ -397,10 +397,10 @@ QString AddressTableModel::labelForAddress(const QString &address) const
{
LOCK(wallet->cs_wallet);
CBitcoinAddress address_parsed(address.toStdString());
- std::map<CTxDestination, std::string>::iterator mi = wallet->mapAddressBook.find(address_parsed.Get());
+ std::map<CTxDestination, CAddressBookData>::iterator mi = wallet->mapAddressBook.find(address_parsed.Get());
if (mi != wallet->mapAddressBook.end())
{
- return QString::fromStdString(mi->second);
+ return QString::fromStdString(mi->second.name);
}
}
return QString();
diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp
index aeef721ce5..e9f3eb478d 100644
--- a/src/qt/transactiondesc.cpp
+++ b/src/qt/transactiondesc.cpp
@@ -88,8 +88,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
strHTML += "<b>" + tr("To") + ":</b> ";
strHTML += GUIUtil::HtmlEscape(CBitcoinAddress(address).ToString());
- if (!wallet->mapAddressBook[address].empty())
- strHTML += " (" + tr("own address") + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(wallet->mapAddressBook[address]) + ")";
+ if (!wallet->mapAddressBook[address].name.empty())
+ strHTML += " (" + tr("own address") + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + ")";
else
strHTML += " (" + tr("own address") + ")";
strHTML += "<br>";
@@ -110,8 +110,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
std::string strAddress = wtx.mapValue["to"];
strHTML += "<b>" + tr("To") + ":</b> ";
CTxDestination dest = CBitcoinAddress(strAddress).Get();
- if (wallet->mapAddressBook.count(dest) && !wallet->mapAddressBook[dest].empty())
- strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[dest]) + " ";
+ if (wallet->mapAddressBook.count(dest) && !wallet->mapAddressBook[dest].name.empty())
+ strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[dest].name) + " ";
strHTML += GUIUtil::HtmlEscape(strAddress) + "<br>";
}
@@ -167,8 +167,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
if (ExtractDestination(txout.scriptPubKey, address))
{
strHTML += "<b>" + tr("To") + ":</b> ";
- if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].empty())
- strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address]) + " ";
+ if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].name.empty())
+ strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + " ";
strHTML += GUIUtil::HtmlEscape(CBitcoinAddress(address).ToString());
strHTML += "<br>";
}
@@ -254,8 +254,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
CTxDestination address;
if (ExtractDestination(vout.scriptPubKey, address))
{
- if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].empty())
- strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address]) + " ";
+ if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].name.empty())
+ strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + " ";
strHTML += QString::fromStdString(CBitcoinAddress(address).ToString());
}
strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, vout.nValue);
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index fb3ffc5c91..d3c3ddcab1 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -214,10 +214,10 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipie
{
LOCK(wallet->cs_wallet);
- std::map<CTxDestination, std::string>::iterator mi = wallet->mapAddressBook.find(dest);
+ std::map<CTxDestination, CAddressBookData>::iterator mi = wallet->mapAddressBook.find(dest);
// Check if we have a new address or an updated label
- if (mi == wallet->mapAddressBook.end() || mi->second != strLabel)
+ if (mi == wallet->mapAddressBook.end() || mi->second.name != strLabel)
{
wallet->SetAddressBookName(dest, strLabel);
}