allow adding address to address book in send dialog

This commit is contained in:
Wladimir J. van der Laan
2011-06-25 19:32:36 +02:00
parent c88e14fe26
commit 38deedc1b5
5 changed files with 47 additions and 7 deletions

View File

@@ -60,7 +60,7 @@ void ClientModel::update()
addressTableModel->update();
}
ClientModel::StatusCode ClientModel::sendCoins(const QString &payTo, qint64 payAmount)
ClientModel::StatusCode ClientModel::sendCoins(const QString &payTo, qint64 payAmount, const QString &addToAddressBookAs)
{
uint160 hash160 = 0;
bool valid = false;
@@ -95,7 +95,7 @@ ClientModel::StatusCode ClientModel::sendCoins(const QString &payTo, qint64 payA
std::string strError = SendMoney(scriptPubKey, payAmount, wtx, true);
if (strError == "")
{
return OK;
// OK
}
else if (strError == "ABORTED")
{
@@ -107,11 +107,12 @@ ClientModel::StatusCode ClientModel::sendCoins(const QString &payTo, qint64 payA
return MiscError;
}
}
// Add addresses that we've sent to to the address book
std::string strAddress = payTo.toStdString();
CRITICAL_BLOCK(cs_mapAddressBook)
if (!mapAddressBook.count(strAddress))
SetAddressBookName(strAddress, "");
SetAddressBookName(strAddress, addToAddressBookAs.toStdString());
return OK;
}