Merge pull request #1886 from nextcloud/enh/proxy

Move the proxyfiles to libsync where they make more sense
This commit is contained in:
Michael Schuster 2020-06-18 20:38:27 +02:00 committed by GitHub
commit 1afb70e114
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 29 deletions

View file

@ -54,7 +54,6 @@ set(client_SRCS
accountmanager.cpp
accountsettings.cpp
application.cpp
clientproxy.cpp
connectionvalidator.cpp
folder.cpp
folderman.cpp

View file

@ -24,6 +24,7 @@ set(libsync_SRCS
wordlist.cpp
bandwidthmanager.cpp
capabilities.cpp
clientproxy.cpp
cookiejar.cpp
discoveryphase.cpp
filesystem.cpp

View file

@ -56,9 +56,29 @@ bool ClientProxy::isUsingSystemDefault()
return true;
}
const char *proxyTypeToCStr(QNetworkProxy::ProxyType type)
{
switch (type) {
case QNetworkProxy::NoProxy:
return "NoProxy";
case QNetworkProxy::DefaultProxy:
return "DefaultProxy";
case QNetworkProxy::Socks5Proxy:
return "Socks5Proxy";
case QNetworkProxy::HttpProxy:
return "HttpProxy";
case QNetworkProxy::HttpCachingProxy:
return "HttpCachingProxy";
case QNetworkProxy::FtpCachingProxy:
return "FtpCachingProxy";
default:
return "NoProxy";
}
}
QString printQNetworkProxy(const QNetworkProxy &proxy)
{
return QString("%1://%2:%3").arg(proxy.type()).arg(proxy.hostName()).arg(proxy.port());
return QString("%1://%2:%3").arg(proxyTypeToCStr(proxy.type())).arg(proxy.hostName()).arg(proxy.port());
}
void ClientProxy::setupQtProxyFromConfig()
@ -108,26 +128,6 @@ void ClientProxy::setupQtProxyFromConfig()
}
}
const char *ClientProxy::proxyTypeToCStr(QNetworkProxy::ProxyType type)
{
switch (type) {
case QNetworkProxy::NoProxy:
return "NoProxy";
case QNetworkProxy::DefaultProxy:
return "DefaultProxy";
case QNetworkProxy::Socks5Proxy:
return "Socks5Proxy";
case QNetworkProxy::HttpProxy:
return "HttpProxy";
case QNetworkProxy::HttpCachingProxy:
return "HttpCachingProxy";
case QNetworkProxy::FtpCachingProxy:
return "FtpCachingProxy";
default:
return "NoProxy";
}
}
void ClientProxy::lookupSystemProxyAsync(const QUrl &url, QObject *dst, const char *slot)
{
auto *runnable = new SystemProxyRunnable(url);

View file

@ -32,7 +32,7 @@ class ConfigFile;
* @brief The ClientProxy class
* @ingroup libsync
*/
class ClientProxy : public QObject
class OWNCLOUDSYNC_EXPORT ClientProxy : public QObject
{
Q_OBJECT
public:
@ -43,12 +43,9 @@ public:
public slots:
void setupQtProxyFromConfig();
private:
const char *proxyTypeToCStr(QNetworkProxy::ProxyType type);
};
class SystemProxyRunnable : public QObject, public QRunnable
class OWNCLOUDSYNC_EXPORT SystemProxyRunnable : public QObject, public QRunnable
{
Q_OBJECT
public:

View file

@ -69,7 +69,6 @@ list(APPEND FolderMan_SRC ../src/gui/guiutility.cpp )
list(APPEND FolderMan_SRC ../src/gui/navigationpanehelper.cpp )
list(APPEND FolderMan_SRC ../src/gui/userinfo.cpp )
list(APPEND FolderMan_SRC ../src/gui/connectionvalidator.cpp )
list(APPEND FolderMan_SRC ../src/gui/clientproxy.cpp )
list(APPEND FolderMan_SRC ../src/gui/ocsjob.cpp )
list(APPEND FolderMan_SRC ../src/gui/ocsnavigationappsjob.cpp )
list(APPEND FolderMan_SRC ../src/gui/accountstate.cpp )
@ -79,7 +78,6 @@ list(APPEND FolderMan_SRC stubfolderman.cpp )
nextcloud_add_test(FolderMan "${FolderMan_SRC}")
SET(RemoteWipe_SRC ../src/gui/remotewipe.cpp)
list(APPEND RemoteWipe_SRC ../src/gui/clientproxy.cpp )
list(APPEND RemoteWipe_SRC ../src/gui/guiutility.cpp )
list(APPEND RemoteWipe_SRC ../src/gui/userinfo.cpp )
list(APPEND RemoteWipe_SRC ../src/gui/connectionvalidator.cpp )