2014-01-16 15:06:45 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2016-10-25 12:00:07 +03:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2014-01-16 15:06:45 +04:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CLIENTPROXY_H
|
|
|
|
#define CLIENTPROXY_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QNetworkProxy>
|
2015-03-24 23:30:42 +03:00
|
|
|
#include <QRunnable>
|
2015-03-26 20:36:37 +03:00
|
|
|
#include <QUrl>
|
2014-01-16 15:06:45 +04:00
|
|
|
|
|
|
|
#include <csync.h>
|
2017-08-16 09:36:52 +03:00
|
|
|
#include "common/utility.h"
|
|
|
|
#include "owncloudlib.h"
|
2014-01-16 15:06:45 +04:00
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
namespace OCC {
|
2014-01-16 15:06:45 +04:00
|
|
|
|
2014-11-10 00:30:29 +03:00
|
|
|
class ConfigFile;
|
2014-01-16 15:06:45 +04:00
|
|
|
|
2015-06-29 19:56:09 +03:00
|
|
|
/**
|
|
|
|
* @brief The ClientProxy class
|
|
|
|
* @ingroup libsync
|
2015-06-26 18:07:47 +03:00
|
|
|
*/
|
2018-02-21 17:03:55 +03:00
|
|
|
class ClientProxy : public QObject
|
2014-01-16 15:06:45 +04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2018-11-11 12:56:22 +03:00
|
|
|
explicit ClientProxy(QObject *parent = nullptr);
|
2014-01-16 15:06:45 +04:00
|
|
|
|
2015-03-24 23:30:42 +03:00
|
|
|
static bool isUsingSystemDefault();
|
|
|
|
static void lookupSystemProxyAsync(const QUrl &url, QObject *dst, const char *slot);
|
2014-01-16 15:06:45 +04:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setupQtProxyFromConfig();
|
|
|
|
|
|
|
|
private:
|
|
|
|
const char *proxyTypeToCStr(QNetworkProxy::ProxyType type);
|
|
|
|
};
|
|
|
|
|
2015-03-24 23:30:42 +03:00
|
|
|
class SystemProxyRunnable : public QObject, public QRunnable
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
SystemProxyRunnable(const QUrl &url);
|
2018-11-11 13:08:03 +03:00
|
|
|
void run() override;
|
2015-03-24 23:30:42 +03:00
|
|
|
signals:
|
|
|
|
void systemProxyLookedUp(const QNetworkProxy &url);
|
2017-05-17 11:55:42 +03:00
|
|
|
|
2015-03-24 23:30:42 +03:00
|
|
|
private:
|
|
|
|
QUrl _url;
|
|
|
|
};
|
|
|
|
|
2018-02-21 17:03:55 +03:00
|
|
|
QString printQNetworkProxy(const QNetworkProxy &proxy);
|
2014-01-16 15:06:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // CLIENTPROXY_H
|