7#include "proxysetting.h"
8#include "proxysetting_p.h"
12#if !NM_CHECK_VERSION(1, 6, 0)
13#define NM_SETTING_PROXY_SETTING_NAME "proxy"
14#define NM_SETTING_PROXY_BROWSER_ONLY "browser-only"
15#define NM_SETTING_PROXY_METHOD "method"
16#define NM_SETTING_PROXY_PAC_SCRIPT "pac-script"
17#define NM_SETTING_PROXY_PAC_URL "pac-url"
20NetworkManager::ProxySettingPrivate::ProxySettingPrivate()
21 : name(NM_SETTING_PROXY_SETTING_NAME)
23 , method(ProxySetting::
None)
27NetworkManager::ProxySetting::ProxySetting()
28 : Setting(Setting::Proxy)
29 , d_ptr(new ProxySettingPrivate())
33NetworkManager::ProxySetting::ProxySetting(
const Ptr &other)
35 , d_ptr(new ProxySettingPrivate())
37 setBrowserOnly(other->browserOnly());
38 setMethod(other->method());
39 setPacScript(other->pacScript());
40 setPacUrl(other->pacUrl());
43NetworkManager::ProxySetting::~ProxySetting()
55void NetworkManager::ProxySetting::setBrowserOnly(
bool browserOnly)
59 d->browserOnly = browserOnly;
62bool NetworkManager::ProxySetting::browserOnly()
const
64 Q_D(
const ProxySetting);
66 return d->browserOnly;
69void NetworkManager::ProxySetting::setMethod(NetworkManager::ProxySetting::Mode method)
76NetworkManager::ProxySetting::Mode NetworkManager::ProxySetting::method()
const
78 Q_D(
const ProxySetting);
83void NetworkManager::ProxySetting::setPacScript(
const QString &script)
87 d->pacScript = script;
90QString NetworkManager::ProxySetting::pacScript()
const
92 Q_D(
const ProxySetting);
97void NetworkManager::ProxySetting::setPacUrl(
const QString &url)
104QString NetworkManager::ProxySetting::pacUrl()
const
106 Q_D(
const ProxySetting);
113 if (setting.contains(
QLatin1String(NM_SETTING_PROXY_BROWSER_ONLY))) {
114 setBrowserOnly(setting.value(
QLatin1String(NM_SETTING_PROXY_BROWSER_ONLY)).toBool());
117 if (setting.contains(
QLatin1String(NM_SETTING_PROXY_METHOD))) {
118 setMethod((Mode)setting.value(
QLatin1String(NM_SETTING_PROXY_METHOD)).toUInt());
121 if (setting.contains(
QLatin1String(NM_SETTING_PROXY_PAC_SCRIPT))) {
122 setPacScript(setting.value(
QLatin1String(NM_SETTING_PROXY_PAC_SCRIPT)).toString());
125 if (setting.contains(
QLatin1String(NM_SETTING_PROXY_PAC_URL))) {
126 setPacUrl(setting.value(
QLatin1String(NM_SETTING_PROXY_PAC_URL)).toString());
134 setting.insert(
QLatin1String(NM_SETTING_PROXY_BROWSER_ONLY), browserOnly());
137 setting.insert(
QLatin1String(NM_SETTING_PROXY_METHOD), (
int)method());
140 if (!pacScript().isEmpty()) {
141 setting.insert(
QLatin1String(NM_SETTING_PROXY_PAC_SCRIPT), pacScript());
144 if (!pacUrl().isEmpty()) {
145 setting.insert(
QLatin1String(NM_SETTING_PROXY_PAC_URL), pacUrl());
153 dbg.
nospace() <<
"type: " << setting.typeAsString(setting.type()) <<
'\n';
154 dbg.
nospace() <<
"initialized: " << !setting.isNull() <<
'\n';
156 dbg.
nospace() << NM_SETTING_PROXY_BROWSER_ONLY <<
": " << setting.browserOnly() <<
'\n';
157 dbg.
nospace() << NM_SETTING_PROXY_METHOD <<
": " << setting.method() <<
'\n';
158 dbg.
nospace() << NM_SETTING_PROXY_PAC_SCRIPT <<
": " << setting.pacScript() <<
'\n';
159 dbg.
nospace() << NM_SETTING_PROXY_PAC_URL <<
": " << setting.pacUrl() <<
'\n';
Represents proxy setting.
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.
QString name() const override
Must be reimplemented, default implementationd does nothing.
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.