Commit efb58d59 authored by Jonathan Marten's avatar Jonathan Marten Committed by Stefano Crocco
Browse files

Fix proxy configuration where WebEngine is not the default

Commit 2b45b2af introduced checking and synchronisation of the KIO proxy
configuration with WebEngine (which can only use a limited set of the
available options).  However, if WebEngine is not the default part
(webengineIsDefault in KonqMainWindow::updateProxyForWebEngine()), the
Qt application proxy is unconditionally set to NoProxy.  This may not be
correct if the user has set proxy environment variables suitable for
WebEngine but it is not the default.

In order to cover the case where WebEngine is not the default but the user
may wish to switch to it later, if it is not the default then assume that
the existing proxy settings are as intended and do not change them.
parent 257014a8
......@@ -5534,11 +5534,13 @@ void KonqMainWindow::updateProxyForWebEngine(bool updateProtocolManager)
KService::Ptr service = KMimeTypeTrader::self()->preferredService("text/html", "KParts/ReadOnlyPart");
Q_ASSERT(service);
bool webengineIsDefault = service->desktopEntryName() == "webenginepart";
const bool webengineIsDefault = service->desktopEntryName() == "webenginepart";
if (!webengineIsDefault) {
return;
}
KProtocolManager::ProxyType proxyType = KProtocolManager::proxyType();
if (proxyType == KProtocolManager::WPADProxy || proxyType == KProtocolManager::PACProxy) {
if (webengineIsDefault) {
QString msg = i18n("Your proxy configuration can't be used with the QtWebEngine HTML engine. "
"No proxy will be used\n\n QtWebEngine only support a fixed proxy, so proxy auto-configuration (PAC) "
"and Web Proxy Auto-Discovery protocol can't be used with QtWebEngine. If you need a proxy, please select "
......@@ -5549,17 +5551,14 @@ void KonqMainWindow::updateProxyForWebEngine(bool updateProtocolManager)
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::NoProxy));
if (ans == KMessageBox::No) {
slotConfigure("proxy");
}
} else {
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::NoProxy));
}
return;
}
}
QString httpProxy = KProtocolManager::proxyForUrl(QUrl("http://fakeurl.test.com"));
QString httpsProxy = KProtocolManager::proxyForUrl(QUrl("https://fakeurl.test.com"));
if (httpProxy == "DIRECT" && httpsProxy == "DIRECT") {
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::NoProxy));
} else if (webengineIsDefault) {
} else {
QUrl url(httpsProxy);
if (httpProxy != httpsProxy) {
QString msg = i18n("Your proxy configuration can't be used with the QtWebEngine HTML engine because it doesn't support having different proxies for the HTTP and HTTPS protocols. Your current settings are:"
......@@ -5575,7 +5574,5 @@ void KonqMainWindow::updateProxyForWebEngine(bool updateProtocolManager)
}
}
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::HttpProxy, url.host(), url.port(), url.userName(), url.password()));
} else {
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::NoProxy));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment