diff --git a/src/lib/network/networkmanager.cpp b/src/lib/network/networkmanager.cpp index 14d60c54c..343c4f87b 100644 --- a/src/lib/network/networkmanager.cpp +++ b/src/lib/network/networkmanager.cpp @@ -238,13 +238,28 @@ void NetworkManager::loadSettings() QNetworkProxy proxy; settings.beginGroup("Web-Proxy"); - proxy.setType(QNetworkProxy::ProxyType(settings.value("ProxyType", QNetworkProxy::NoProxy).toInt())); + const int proxyType = settings.value("ProxyType", 2).toInt(); proxy.setHostName(settings.value("HostName", QString()).toString()); proxy.setPort(settings.value("Port", 8080).toInt()); proxy.setUser(settings.value("Username", QString()).toString()); proxy.setPassword(settings.value("Password", QString()).toString()); settings.endGroup(); - QNetworkProxy::setApplicationProxy(proxy); + + if (proxyType == 0) { + proxy.setType(QNetworkProxy::NoProxy); + } else if (proxyType == 3) { + proxy.setType(QNetworkProxy::HttpProxy); + } else if (proxyType == 4) { + proxy.setType(QNetworkProxy::Socks5Proxy); + } + + if (proxyType == 2) { + QNetworkProxy::setApplicationProxy(QNetworkProxy()); + QNetworkProxyFactory::setUseSystemConfiguration(true); + } else { + QNetworkProxy::setApplicationProxy(proxy); + QNetworkProxyFactory::setUseSystemConfiguration(false); + } m_urlInterceptor->loadSettings(); } diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index 90f43f219..6d8aed994 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -498,15 +498,17 @@ Preferences::Preferences(BrowserWindow* window) // Proxy Configuration settings.beginGroup("Web-Proxy"); - QNetworkProxy::ProxyType proxyType = QNetworkProxy::ProxyType(settings.value("ProxyType", QNetworkProxy::NoProxy).toInt()); - - ui->systemProxy->setChecked(proxyType == QNetworkProxy::NoProxy); - ui->manualProxy->setChecked(proxyType != QNetworkProxy::NoProxy); - if (proxyType == QNetworkProxy::Socks5Proxy) { - ui->proxyType->setCurrentIndex(1); - } - else { + int proxyType = settings.value("ProxyType", 1).toInt(); + if (proxyType == 0) { + ui->noProxy->setChecked(true); + } else if (proxyType == 2) { + ui->systemProxy->setChecked(true); + } else if (proxyType == 3) { + ui->manualProxy->setChecked(true); ui->proxyType->setCurrentIndex(0); + } else { + ui->manualProxy->setChecked(true); + ui->proxyType->setCurrentIndex(1); } ui->proxyServer->setText(settings.value("HostName", "").toString()); @@ -515,8 +517,7 @@ Preferences::Preferences(BrowserWindow* window) ui->proxyPassword->setText(settings.value("Password", "").toString()); settings.endGroup(); - setManualProxyConfigurationEnabled(proxyType != QNetworkProxy::NoProxy); - + setManualProxyConfigurationEnabled(ui->manualProxy->isChecked()); connect(ui->manualProxy, SIGNAL(toggled(bool)), this, SLOT(setManualProxyConfigurationEnabled(bool))); //CONNECTS @@ -1046,15 +1047,15 @@ void Preferences::saveSettings() settings.endGroup(); //Proxy Configuration - QNetworkProxy::ProxyType proxyType; - if (ui->systemProxy->isChecked()) { - proxyType = QNetworkProxy::NoProxy; - } - else if (ui->proxyType->currentIndex() == 0) { - proxyType = QNetworkProxy::HttpProxy; - } - else { - proxyType = QNetworkProxy::Socks5Proxy; + int proxyType; + if (ui->noProxy->isChecked()) { + proxyType = 0; + } else if (ui->systemProxy->isChecked()) { + proxyType = 2; + } else if (ui->proxyType->currentIndex() == 0) { // Http + proxyType = 3; + } else { // Socks5 + proxyType = 4; } settings.beginGroup("Web-Proxy"); diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui index cff521def..4533001ce 100644 --- a/src/lib/preferences/preferences.ui +++ b/src/lib/preferences/preferences.ui @@ -1413,7 +1413,7 @@ Proxy Configuration - + Qt::Vertical @@ -1426,14 +1426,14 @@ - + System proxy configuration - + Qt::Horizontal @@ -1449,14 +1449,14 @@ - + Manual configuration - + @@ -1494,7 +1494,7 @@ - + @@ -1531,6 +1531,13 @@ + + + + No proxy + + + @@ -2436,8 +2443,8 @@ 0 0 - 560 - 80 + 96 + 28