Fix login flow with system proxy

I must admit why this works is puzzling me. However if I just use a system
proxy without this it doesn't work. I suspect a Qt bug but will have to
dig deeper to find out if that is the case.

For now this little hack will have to do.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-01-30 22:48:40 +01:00
parent af443461e3
commit eb3245b241
No known key found for this signature in database
GPG key ID: F941078878347C0C
2 changed files with 12 additions and 0 deletions

View file

@ -3,6 +3,7 @@
#include <QWebEngineUrlRequestJob>
#include <QProgressBar>
#include <QVBoxLayout>
#include <QNetworkProxyFactory>
#include "owncloudwizard.h"
#include "creds/webflowcredentials.h"
@ -27,9 +28,17 @@ WebViewPage::WebViewPage(QWidget *parent)
setLayout(layout);
connect(_webView, &WebView::urlCatched, this, &WebViewPage::urlCatched);
_useSystemProxy = QNetworkProxyFactory::usesSystemConfiguration();
}
WebViewPage::~WebViewPage() {
QNetworkProxyFactory::setUseSystemConfiguration(_useSystemProxy);
}
void WebViewPage::initializePage() {
QNetworkProxy::setApplicationProxy(QNetworkProxy::applicationProxy());
QString url;
if (_ocWizard->registration()) {
url = "https://nextcloud.com/register";

View file

@ -14,6 +14,7 @@ class WebViewPage : public AbstractCredentialsWizardPage
Q_OBJECT
public:
WebViewPage(QWidget *parent = nullptr);
~WebViewPage();
void initializePage() override;
int nextId() const override;
@ -34,6 +35,8 @@ private:
QString _user;
QString _pass;
bool _useSystemProxy;
};
}