Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix Bitcoin-Qt proxy settings to always display the current setting

  • Loading branch information...
commit 22e96a1aee5196fe2f33c2faa35320d00c6499f4 1 parent eca96d7
Matt Corallo authored
Showing with 24 additions and 5 deletions.
  1. +8 −0 src/netbase.cpp
  2. +1 −0  src/netbase.h
  3. +15 −5 src/qt/optionsmodel.cpp
8 src/netbase.cpp
View
@@ -444,6 +444,14 @@ bool GetProxy(enum Network net, CService &addrProxy) {
return true;
}
+bool GetProxySocksVersion(enum Network net, int &nSocksVersion) {
+ assert(net >= 0 && net < NET_MAX);
+ if (!proxyInfo[net].second)
+ return false;
+ nSocksVersion = proxyInfo[net].second;
+ return true;
+}
+
bool SetNameProxy(CService addrProxy, int nSocksVersion) {
if (nSocksVersion != 0 && nSocksVersion != 5)
return false;
1  src/netbase.h
View
@@ -137,6 +137,7 @@ enum Network ParseNetwork(std::string net);
void SplitHostPort(std::string in, int &portOut, std::string &hostOut);
bool SetProxy(enum Network net, CService addrProxy, int nSocksVersion = 5);
bool GetProxy(enum Network net, CService &addrProxy);
+bool GetProxySocksVersion(enum Network net, int &nSocksVersion);
bool IsProxy(const CNetAddr &addr);
bool SetNameProxy(CService addrProxy, int nSocksVersion = 5);
bool GetNameProxy();
20 src/qt/optionsmodel.cpp
View
@@ -139,13 +139,23 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
case MinimizeToTray:
return QVariant(fMinimizeToTray);
case MapPortUPnP:
- return settings.value("fUseUPnP", GetBoolArg("-upnp", true));
+ return QVariant(fUseUPnP);
case MinimizeOnClose:
return QVariant(fMinimizeOnClose);
- case ProxyUse:
- return settings.value("fUseProxy", false);
- case ProxySocksVersion:
- return settings.value("nSocksVersion", 5);
+ case ProxyUse: {
+ int nSocksVersion;
+ if (GetProxySocksVersion(NET_IPV4, nSocksVersion))
+ return QVariant(true);
+ else
+ return QVariant(false);
+ }
+ case ProxySocksVersion: {
+ int nSocksVersion;
+ if (GetProxySocksVersion(NET_IPV4, nSocksVersion))
+ return QVariant(nSocksVersion);
+ else
+ return settings.value("nSocksVersion", 5);
+ }
case ProxyIP: {
CService addrProxy;
if (GetProxy(NET_IPV4, addrProxy))
Please sign in to comment.
Something went wrong with that request. Please try again.