changeset 2992:11bc6bfc0983 draft

Merge commit '293f264' into 0.6.0.x
author Luke Dashjr <luke-jr+git@utopios.org>
date Mon, 07 May 2012 04:00:26 +0000
parents 846d9bb768eb (current diff) 116bad5f9ba5 (diff)
children 56be19ae00ed
files src/qt/bitcoin.cpp src/qt/walletmodel.cpp
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -287,6 +287,7 @@
 #endif
                 app.exec();
 
+                window.hide();
                 guiref = 0;
             }
             Shutdown(NULL);
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -153,14 +153,20 @@
         hex = QString::fromStdString(wtx.GetHash().GetHex());
     }
 
-    // Add addresses that we've sent to to the address book
+    // Add addresses / update labels that we've sent to to the address book
     foreach(const SendCoinsRecipient &rcp, recipients)
     {
         std::string strAddress = rcp.address.toStdString();
+        std::string strLabel = rcp.label.toStdString();
         CRITICAL_BLOCK(wallet->cs_wallet)
         {
-            if (!wallet->mapAddressBook.count(strAddress))
-                wallet->SetAddressBookName(strAddress, rcp.label.toStdString());
+            std::map<CBitcoinAddress, std::string>::iterator mi = wallet->mapAddressBook.find(strAddress);
+
+            // Check if we have a new address or an updated label
+            if (mi == wallet->mapAddressBook.end() || mi->second != strLabel)
+            {
+                wallet->SetAddressBookName(strAddress, strLabel);
+            }
         }
     }