aboutsummaryrefslogtreecommitdiff
path: root/src/qt/clientmodel.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-06-21 20:34:43 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-06-21 20:36:03 +0200
commitb9e80983a5c076fed655a7c3c67b53bd9ecc3dda (patch)
tree8160290efeef086d82cd7b156a0538e922363ad8 /src/qt/clientmodel.cpp
parentf5927f5b32c9e28033fb7a00dd43f3162781c1d0 (diff)
downloadbitcoin-b9e80983a5c076fed655a7c3c67b53bd9ecc3dda.tar.xz
Allow changing default address (fixes issue #6)
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r--src/qt/clientmodel.cpp28
1 files changed, 3 insertions, 25 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 86fc8b32d3..4e6a34c79f 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -27,19 +27,6 @@ qint64 ClientModel::getBalance() const
return GetBalance();
}
-QString ClientModel::getAddress() const
-{
- std::vector<unsigned char> vchPubKey;
- if (CWalletDB("r").ReadDefaultKey(vchPubKey))
- {
- return QString::fromStdString(PubKeyToAddress(vchPubKey));
- }
- else
- {
- return QString();
- }
-}
-
int ClientModel::getNumConnections() const
{
return vNodes.size();
@@ -63,23 +50,14 @@ int ClientModel::getNumTransactions() const
void ClientModel::update()
{
// Plainly emit all signals for now. To be more efficient this should check
- // whether the values actually changed first.
+ // whether the values actually changed first, although it'd be even better if these
+ // were events coming in from the bitcoin core.
emit balanceChanged(getBalance());
- emit addressChanged(getAddress());
emit numConnectionsChanged(getNumConnections());
emit numBlocksChanged(getNumBlocks());
emit numTransactionsChanged(getNumTransactions());
-}
-void ClientModel::setAddress(const QString &defaultAddress)
-{
- uint160 hash160;
- std::string strAddress = defaultAddress.toStdString();
- if (!AddressToHash160(strAddress, hash160))
- return;
- if (!mapPubKeys.count(hash160))
- return;
- CWalletDB().WriteDefaultKey(mapPubKeys[hash160]);
+ addressTableModel->update();
}
ClientModel::StatusCode ClientModel::sendCoins(const QString &payTo, qint64 payAmount)