aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bitcoin-qt.pro2
-rw-r--r--src/bitcoinrpc.cpp2
-rw-r--r--src/init.cpp1
-rw-r--r--src/keystore.cpp2
-rw-r--r--src/main.cpp14
-rw-r--r--src/net.cpp22
-rw-r--r--src/qt/bitcoingui.cpp37
-rw-r--r--src/qt/bitcoingui.h4
8 files changed, 63 insertions, 21 deletions
diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro
index 0eeae86510..e2097fd4b0 100644
--- a/bitcoin-qt.pro
+++ b/bitcoin-qt.pro
@@ -76,7 +76,7 @@ contains(FIRST_CLASS_MESSAGING, 1) {
contains(BITCOIN_NEED_QT_PLUGINS, 1) {
DEFINES += BITCOIN_NEED_QT_PLUGINS
- QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs
+ QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets
}
!windows {
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index 7fe8f21682..5d38f042f9 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -1561,7 +1561,7 @@ void ThreadCleanWalletPassphrase(void* parg)
if (nWalletUnlockTime < nMyWakeTime)
nWalletUnlockTime = nMyWakeTime;
}
- free(parg);
+ delete (int*)parg;
return;
}
diff --git a/src/init.cpp b/src/init.cpp
index d39e18e485..22f34aa755 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -21,6 +21,7 @@ Q_IMPORT_PLUGIN(qcncodecs)
Q_IMPORT_PLUGIN(qjpcodecs)
Q_IMPORT_PLUGIN(qtwcodecs)
Q_IMPORT_PLUGIN(qkrcodecs)
+Q_IMPORT_PLUGIN(qtaccessiblewidgets)
#endif
using namespace std;
diff --git a/src/keystore.cpp b/src/keystore.cpp
index 4a59010fdb..18e5c377dc 100644
--- a/src/keystore.cpp
+++ b/src/keystore.cpp
@@ -192,7 +192,7 @@ bool CCryptoKeyStore::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
BOOST_FOREACH(KeyMap::value_type& mKey, mapKeys)
{
CKey key;
- if (!key.SetSecret(mKey.second.first, false))
+ if (!key.SetSecret(mKey.second.first, mKey.second.second))
return false;
const std::vector<unsigned char> vchPubKey = key.GetPubKey();
std::vector<unsigned char> vchCryptedSecret;
diff --git a/src/main.cpp b/src/main.cpp
index f78133b535..e4c6714eae 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -618,11 +618,15 @@ bool CTransaction::RemoveFromMemoryPool()
// Remove transaction from memory pool
CRITICAL_BLOCK(cs_mapTransactions)
{
- BOOST_FOREACH(const CTxIn& txin, vin)
- mapNextTx.erase(txin.prevout);
- mapTransactions.erase(GetHash());
- nTransactionsUpdated++;
- --nPooledTx;
+ uint256 hash = GetHash();
+ if (mapTransactions.count(hash))
+ {
+ BOOST_FOREACH(const CTxIn& txin, vin)
+ mapNextTx.erase(txin.prevout);
+ mapTransactions.erase(hash);
+ nTransactionsUpdated++;
+ --nPooledTx;
+ }
}
return true;
}
diff --git a/src/net.cpp b/src/net.cpp
index f0ea5506e2..63829d0e0a 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -530,7 +530,7 @@ void CNode::PushVersion()
/// when NTP implemented, change to just nTime = GetAdjustedTime()
int64 nTime = (fInbound ? GetAdjustedTime() : GetTime());
CAddress addrYou = (fUseProxy ? CAddress(CService("0.0.0.0",0)) : addr);
- CAddress addrMe = (fUseProxy ? CAddress(CService("0.0.0.0",0)) : addrLocalHost);
+ CAddress addrMe = (fUseProxy || !addrLocalHost.IsRoutable() ? CAddress(CService("0.0.0.0",0)) : addrLocalHost);
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight);
@@ -965,6 +965,26 @@ void ThreadMapPort2(void* parg)
r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
if (r == 1)
{
+ if (!addrLocalHost.IsRoutable())
+ {
+ char externalIPAddress[40];
+ r = UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIPAddress);
+ if(r != UPNPCOMMAND_SUCCESS)
+ printf("UPnP: GetExternalIPAddress() returned %d\n", r);
+ else
+ {
+ if(externalIPAddress[0])
+ {
+ printf("UPnP: ExternalIPAddress = %s\n", externalIPAddress);
+ CAddress addrExternalFromUPnP(CService(externalIPAddress, 0), nLocalServices);
+ if (addrExternalFromUPnP.IsRoutable())
+ addrLocalHost = addrExternalFromUPnP;
+ }
+ else
+ printf("UPnP: GetExternalIPAddress failed.\n");
+ }
+ }
+
string strDesc = "Bitcoin " + FormatFullVersion();
#ifndef UPNPDISCOVER_SUCCESS
/* miniupnpc 1.5 */
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index f67a5d6b56..b72f128291 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -56,6 +56,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
QMainWindow(parent),
clientModel(0),
walletModel(0),
+ dummyWidget(0),
encryptWalletAction(0),
changePassphraseAction(0),
aboutQtAction(0),
@@ -85,6 +86,9 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
// Create the tray icon (or setup the dock icon)
createTrayIcon();
+ // Dummy widget used when restoring window state after minimization
+ dummyWidget = new QWidget();
+
// Create tabs
overviewPage = new OverviewPage();
@@ -162,6 +166,7 @@ BitcoinGUI::~BitcoinGUI()
#ifdef Q_WS_MAC
delete appMenuBar;
#endif
+ delete dummyWidget;
}
void BitcoinGUI::createActions()
@@ -205,17 +210,17 @@ void BitcoinGUI::createActions()
#endif
tabGroup->addAction(messageAction);
- connect(overviewAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
- connect(historyAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
- connect(addressBookAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
- connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
- connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
- connect(messageAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(messageAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(messageAction, SIGNAL(triggered()), this, SLOT(gotoMessagePage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
@@ -234,7 +239,7 @@ void BitcoinGUI::createActions()
openBitcoinAction = new QAction(QIcon(":/icons/bitcoin"), tr("Open &Bitcoin"), this);
openBitcoinAction->setToolTip(tr("Show the Bitcoin window"));
exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
- exportAction->setToolTip(tr("Export the current view to a file"));
+ exportAction->setToolTip(tr("Export the data in the current tab to a file"));
encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet"), this);
encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet"));
encryptWalletAction->setCheckable(true);
@@ -262,6 +267,7 @@ void BitcoinGUI::createMenuBar()
// Configure the menus
QMenu *file = appMenuBar->addMenu(tr("&File"));
+ file->addAction(exportAction);
#ifndef FIRST_CLASS_MESSAGING
file->addAction(messageAction);
file->addSeparator();
@@ -405,10 +411,17 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
// Click on system tray icon triggers "open bitcoin"
openBitcoinAction->trigger();
}
-
}
#endif
+void BitcoinGUI::showNormal()
+{
+ // Reparent window to the desktop (in case it was hidden on minimize)
+ if(parent() != NULL)
+ setParent(NULL, Qt::Window);
+ QMainWindow::showNormal();
+}
+
void BitcoinGUI::optionsClicked()
{
if(!clientModel || !clientModel->getOptionsModel())
@@ -550,13 +563,13 @@ void BitcoinGUI::changeEvent(QEvent *e)
{
if(isMinimized())
{
- hide();
- e->ignore();
+ // Hiding the window from taskbar
+ setParent(dummyWidget, Qt::SubWindow);
+ return;
}
else
{
- show();
- e->accept();
+ showNormal();
}
}
}
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 09ad89a894..37ab12577c 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -58,6 +58,8 @@ private:
QStackedWidget *centralWidget;
+ QWidget *dummyWidget;
+
OverviewPage *overviewPage;
QWidget *transactionsPage;
AddressBookPage *addressBookPage;
@@ -131,6 +133,8 @@ public slots:
void gotoMessagePage();
void gotoMessagePage(QString);
+ void showNormal();
+
private slots:
/** Switch to overview (home) page */
void gotoOverviewPage();