Try to fix proxy for webengine.
This commit is contained in:
parent
13e132f86b
commit
9774daac6a
7 changed files with 36 additions and 14 deletions
|
@ -5,7 +5,7 @@ clone_depth: 1
|
|||
clone_folder: C:\rssguard
|
||||
|
||||
environment:
|
||||
QTDIR: 'C:\Qt\5.12\msvc2017_64'
|
||||
QTDIR: 'C:\Qt\5.14.2\msvc2017_64'
|
||||
QMAKESPEC: win32-msvc
|
||||
access_token:
|
||||
secure: oR2iY1h+Z5AF4t3yP1mxNW7HL8qhPm8y4Uupp4b03QSC7puVrkkCaO1E1NQA9q9K
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6bd7ec93a76a14de24f9dbb8570b4d68eb4b27be
|
||||
Subproject commit 2bd2ee0af492cabea6fda7bb04790245e3039c4c
|
|
@ -6,6 +6,7 @@
|
|||
#include "miscellaneous/application.h"
|
||||
#include "miscellaneous/externaltool.h"
|
||||
#include "network-web/silentnetworkaccessmanager.h"
|
||||
#include "network-web/webfactory.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
|
@ -224,6 +225,8 @@ void SettingsBrowserMail::saveSettings() {
|
|||
|
||||
ExternalTool::setToolsToSettings(tools);
|
||||
|
||||
qApp->web()->updateProxy();
|
||||
|
||||
// Reload settings for all network access managers.
|
||||
SilentNetworkAccessManager::instance()->loadSettings();
|
||||
onEndSaveSettings();
|
||||
|
|
|
@ -80,6 +80,8 @@ Application::Application(const QString& id, int& argc, char** argv)
|
|||
Debugging::instance()->setTargetFile(IOFactory::getSystemFolder(QStandardPaths::TempLocation) +
|
||||
QDir::separator() + QL1S("rssguard.log"));
|
||||
}
|
||||
|
||||
m_webFactory->updateProxy();
|
||||
}
|
||||
|
||||
Application::~Application() {
|
||||
|
|
|
@ -27,19 +27,8 @@ void BaseNetworkAccessManager::loadSettings() {
|
|||
// No extra setting is needed, set new proxy and exit this method.
|
||||
setProxy(QNetworkProxy::NoProxy);
|
||||
}
|
||||
else if (selected_proxy_type == QNetworkProxy::DefaultProxy) {
|
||||
setProxy(QNetworkProxy::applicationProxy());
|
||||
}
|
||||
else {
|
||||
const Settings* settings = qApp->settings();
|
||||
|
||||
// Custom proxy is selected, set it up.
|
||||
new_proxy.setType(selected_proxy_type);
|
||||
new_proxy.setHostName(settings->value(GROUP(Proxy), SETTING(Proxy::Host)).toString());
|
||||
new_proxy.setPort(quint16(settings->value(GROUP(Proxy), SETTING(Proxy::Port)).toInt()));
|
||||
new_proxy.setUser(settings->value(GROUP(Proxy), SETTING(Proxy::Username)).toString());
|
||||
new_proxy.setPassword(settings->password(GROUP(Proxy), SETTING(Proxy::Password)).toString());
|
||||
setProxy(new_proxy);
|
||||
setProxy(QNetworkProxy::applicationProxy());
|
||||
}
|
||||
|
||||
qDebug("Settings of BaseNetworkAccessManager loaded.");
|
||||
|
|
|
@ -124,6 +124,33 @@ QString WebFactory::toSecondLevelDomain(const QUrl& url) {
|
|||
return domain + top_level_domain;
|
||||
}
|
||||
|
||||
void WebFactory::updateProxy() {
|
||||
const QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(qApp->settings()->value(GROUP(Proxy),
|
||||
SETTING(Proxy::Type)).
|
||||
toInt());
|
||||
|
||||
if (selected_proxy_type == QNetworkProxy::NoProxy) {
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
|
||||
}
|
||||
else if (selected_proxy_type == QNetworkProxy::DefaultProxy) {
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
}
|
||||
else {
|
||||
const Settings* settings = qApp->settings();
|
||||
QNetworkProxy new_proxy;
|
||||
|
||||
// Custom proxy is selected, set it up.
|
||||
new_proxy.setType(selected_proxy_type);
|
||||
new_proxy.setHostName(settings->value(GROUP(Proxy), SETTING(Proxy::Host)).toString());
|
||||
new_proxy.setPort(quint16(settings->value(GROUP(Proxy), SETTING(Proxy::Port)).toInt()));
|
||||
new_proxy.setUser(settings->value(GROUP(Proxy), SETTING(Proxy::Username)).toString());
|
||||
new_proxy.setPassword(settings->password(GROUP(Proxy), SETTING(Proxy::Password)).toString());
|
||||
|
||||
QNetworkProxy::setApplicationProxy(new_proxy);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
QAction* WebFactory::engineSettingsAction() {
|
||||
if (m_engineSettings == nullptr) {
|
||||
|
|
|
@ -38,6 +38,7 @@ class WebFactory : public QObject {
|
|||
#endif
|
||||
|
||||
public slots:
|
||||
void updateProxy();
|
||||
bool openUrlInExternalBrowser(const QString& url) const;
|
||||
bool sendMessageViaEmail(const Message& message);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue