7#include "pppoesetting.h"
8#include "pppoesetting_p.h"
12NetworkManager::PppoeSettingPrivate::PppoeSettingPrivate()
13 : name(NM_SETTING_PPPOE_SETTING_NAME)
14 , passwordFlags(Setting::
None)
18NetworkManager::PppoeSetting::PppoeSetting()
19 : Setting(Setting::Pppoe)
20 , d_ptr(new PppoeSettingPrivate())
24NetworkManager::PppoeSetting::PppoeSetting(
const Ptr &other)
26 , d_ptr(new PppoeSettingPrivate())
28 setService(other->service());
29 setUsername(other->username());
30 setPassword(other->password());
31 setPasswordFlags(other->passwordFlags());
34NetworkManager::PppoeSetting::~PppoeSetting()
46void NetworkManager::PppoeSetting::setService(
const QString &service)
53QString NetworkManager::PppoeSetting::service()
const
55 Q_D(
const PppoeSetting);
60void NetworkManager::PppoeSetting::setParent(
const QString &parent)
67QString NetworkManager::PppoeSetting::parent()
const
69 Q_D(
const PppoeSetting);
74void NetworkManager::PppoeSetting::setUsername(
const QString &username)
78 d->username = username;
81QString NetworkManager::PppoeSetting::username()
const
83 Q_D(
const PppoeSetting);
88void NetworkManager::PppoeSetting::setPassword(
const QString &password)
92 d->password = password;
95QString NetworkManager::PppoeSetting::password()
const
97 Q_D(
const PppoeSetting);
106 d->passwordFlags = flags;
111 Q_D(
const PppoeSetting);
113 return d->passwordFlags;
116QStringList NetworkManager::PppoeSetting::needSecrets(
bool requestNew)
const
120 if ((password().isEmpty() || requestNew) && !passwordFlags().testFlag(Setting::NotRequired)) {
127void NetworkManager::PppoeSetting::secretsFromMap(
const QVariantMap &secrets)
129 if (secrets.contains(
QLatin1String(NM_SETTING_PPPOE_PASSWORD))) {
134QVariantMap NetworkManager::PppoeSetting::secretsToMap()
const
138 if (!password().isEmpty()) {
139 secrets.insert(
QLatin1String(NM_SETTING_PPPOE_PASSWORD), password());
147 if (setting.contains(
QLatin1String(NM_SETTING_PPPOE_SERVICE))) {
148 setService(setting.value(
QLatin1String(NM_SETTING_PPPOE_SERVICE)).toString());
151 if (setting.contains(
QLatin1String(NM_SETTING_PPPOE_USERNAME))) {
152 setUsername(setting.value(
QLatin1String(NM_SETTING_PPPOE_USERNAME)).toString());
155 if (setting.contains(
QLatin1String(NM_SETTING_PPPOE_PASSWORD))) {
156 setPassword(setting.value(
QLatin1String(NM_SETTING_PPPOE_PASSWORD)).toString());
159 if (setting.contains(
QLatin1String(NM_SETTING_PPPOE_PASSWORD_FLAGS))) {
168 if (!service().isEmpty()) {
169 setting.insert(
QLatin1String(NM_SETTING_PPPOE_SERVICE), service());
172 if (!parent().isEmpty()) {
173 setting.insert(
QLatin1String(NM_SETTING_PPPOE_PARENT), parent());
176 if (!username().isEmpty()) {
177 setting.insert(
QLatin1String(NM_SETTING_PPPOE_USERNAME), username());
180 if (!password().isEmpty()) {
181 setting.insert(
QLatin1String(NM_SETTING_PPPOE_PASSWORD), password());
184 if (passwordFlags()) {
185 setting.insert(
QLatin1String(NM_SETTING_PPPOE_PASSWORD_FLAGS), (
int)passwordFlags());
193 dbg.
nospace() <<
"type: " << setting.typeAsString(setting.type()) <<
'\n';
194 dbg.
nospace() <<
"initialized: " << !setting.isNull() <<
'\n';
196 dbg.
nospace() << NM_SETTING_PPPOE_SERVICE <<
": " << setting.service() <<
'\n';
197 dbg.
nospace() << NM_SETTING_PPPOE_PARENT <<
": " << setting.parent() <<
'\n';
198 dbg.
nospace() << NM_SETTING_PPPOE_USERNAME <<
": " << setting.username() <<
'\n';
199 dbg.
nospace() << NM_SETTING_PPPOE_PASSWORD <<
": " << setting.password() <<
'\n';
200 dbg.
nospace() << NM_SETTING_PPPOE_PASSWORD_FLAGS <<
": " << setting.passwordFlags() <<
'\n';
Represents pppoe setting.
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.
QString name() const override
Must be reimplemented, default implementationd does nothing.
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.
char * toString(const EngineQuery &query)