Merge bitcoin v0.4.0 into ppcoin
[novacoin.git] / src / ui.cpp
index 5ca6661..24e78f7 100644 (file)
@@ -1,5 +1,6 @@
 // Copyright (c) 2009-2010 Satoshi Nakamoto
 // Copyright (c) 2011 The Bitcoin developers
+// Copyright (c) 2011 The PPCoin developers
 // Distributed under the MIT/X11 software license, see the accompanying
 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
 
@@ -1032,7 +1033,6 @@ void MainFrameRepaint()
         printf("MainFrameRepaint\n");
         wxPaintEvent event;
         pframeMain->fRefresh = true;
-        pframeMain->fRefreshListCtrl = true;
         pframeMain->GetEventHandler()->AddPendingEvent(event);
     }
 }
@@ -1391,7 +1391,9 @@ void CMainFrame::OnButtonNew(wxCommandEvent& event)
         return;
 
     // Generate new key
-    strAddress = CBitcoinAddress(pwalletMain->GetOrReuseKeyFromPool()).ToString();
+    std::vector<unsigned char> newKey;
+    pwalletMain->GetKeyFromPool(newKey, true);
+    strAddress = CBitcoinAddress(newKey).ToString();
 
     if (fWasLocked)
         pwalletMain->Lock();
@@ -1778,7 +1780,7 @@ boost::filesystem::path GetAutostartDir()
 
 boost::filesystem::path GetAutostartFilePath()
 {
-    return GetAutostartDir() / boost::filesystem::path("bitcoin.desktop");
+    return GetAutostartDir() / boost::filesystem::path("ppcoin.desktop");
 }
 
 bool GetStartOnSystemStartup()
@@ -1804,7 +1806,11 @@ void SetStartOnSystemStartup(bool fAutoStart)
 {
     if (!fAutoStart)
     {
+#if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION >= 3
+        unlink(GetAutostartFilePath().string().c_str());
+#else
         unlink(GetAutostartFilePath().native_file_string().c_str());
+#endif
     }
     else
     {
@@ -1818,10 +1824,10 @@ void SetStartOnSystemStartup(bool fAutoStart)
         boost::filesystem::ofstream optionFile(GetAutostartFilePath(), ios_base::out|ios_base::trunc);
         if (!optionFile.good())
         {
-            wxMessageBox(_("Cannot write autostart/bitcoin.desktop file"), "Bitcoin");
+            wxMessageBox(_("Cannot write autostart/ppcoin.desktop file"), "Bitcoin");
             return;
         }
-        // Write a bitcoin.desktop file to the autostart directory:
+        // Write a ppcoin.desktop file to the autostart directory:
         optionFile << "[Desktop Entry]\n";
         optionFile << "Type=Application\n";
         optionFile << "Name=Bitcoin\n";
@@ -2171,7 +2177,10 @@ void CSendDialog::OnButtonSend(wxCommandEvent& event)
                 strError = pwalletMain->SendMoney(scriptPubKey, nValue, wtx, true);
             }
             if (strError == "")
+            {
+                pframeMain->RefreshListCtrl();
                 wxMessageBox(_("Payment sent  "), _("Sending..."));
+            }
             else if (strError == "ABORTED")
             {
                 if (fWasLocked)
@@ -2826,7 +2835,9 @@ void CAddressBookDialog::OnButtonNew(wxCommandEvent& event)
             return;
 
         // Generate new key
-        strAddress = CBitcoinAddress(pwalletMain->GetOrReuseKeyFromPool()).ToString();
+        std::vector<unsigned char> newKey;
+        pwalletMain->GetKeyFromPool(newKey, true);
+        strAddress = CBitcoinAddress(newKey).ToString();
 
         if (fWasLocked)
             pwalletMain->Lock();
@@ -3111,9 +3122,9 @@ bool CMyApp::OnInit()
     g_isPainting = 10000;
 #endif
 #if defined(__WXMSW__ ) || defined(__WXMAC_OSX__)
-    SetAppName("Bitcoin");
+    SetAppName("PPCoin");
 #else
-    SetAppName("bitcoin");
+    SetAppName("ppcoin");
 #endif
 #ifdef __WXMSW__
 #if wxUSE_UNICODE