1 | /* |
2 | * Copyright (C) by Klaas Freitag <freitag@owncloud.com> |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. |
8 | * |
9 | * This program is distributed in the hope that it will be useful, but |
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
12 | * for more details. |
13 | */ |
14 | |
15 | #ifndef CLIENTPROXY_H |
16 | #define CLIENTPROXY_H |
17 | |
18 | #include <QObject> |
19 | #include <QNetworkProxy> |
20 | #include <QRunnable> |
21 | #include <QUrl> |
22 | |
23 | #include <csync.h> |
24 | #include "common/utility.h" |
25 | #include "owncloudlib.h" |
26 | |
27 | namespace OCC { |
28 | |
29 | class ConfigFile; |
30 | |
31 | /** |
32 | * @brief The ClientProxy class |
33 | * @ingroup libsync |
34 | */ |
35 | class ClientProxy : public QObject |
36 | { |
37 | Q_OBJECT |
38 | public: |
39 | explicit ClientProxy(QObject *parent = 0); |
40 | |
41 | static bool isUsingSystemDefault(); |
42 | static void lookupSystemProxyAsync(const QUrl &url, QObject *dst, const char *slot); |
43 | |
44 | public slots: |
45 | void setupQtProxyFromConfig(); |
46 | |
47 | private: |
48 | const char *proxyTypeToCStr(QNetworkProxy::ProxyType type); |
49 | }; |
50 | |
51 | class SystemProxyRunnable : public QObject, public QRunnable |
52 | { |
53 | Q_OBJECT |
54 | public: |
55 | SystemProxyRunnable(const QUrl &url); |
56 | void run(); |
57 | signals: |
58 | void systemProxyLookedUp(const QNetworkProxy &url); |
59 | |
60 | private: |
61 | QUrl _url; |
62 | }; |
63 | |
64 | QString printQNetworkProxy(const QNetworkProxy &proxy); |
65 | } |
66 | |
67 | #endif // CLIENTPROXY_H |
68 | |