File indexing completed on 2024-04-28 11:47:51
0001 /* 0002 SPDX-FileCopyrightText: 2012-2015 Jan Grulich <jgrulich@redhat.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "template.h" 0008 #include "template_p.h" 0009 0010 // TODO: Uncomment and replace the template with the setting that you want to implement 0011 //#include <nm-setting-template.h> 0012 0013 NetworkManager::TemplateSettingPrivate::TemplateSettingPrivate() 0014 // : name(NM_SETTING_TEMPLATE_SETTING_NAME) 0015 { 0016 } 0017 0018 NetworkManager::TemplateSetting::TemplateSetting() 0019 : /* TODO: Uncomment and replace the template with the setting that you want to implement 0020 * This setting must also be added into the enum in base class 0021 */ 0022 // Setting(Setting::Template), 0023 d_ptr(new TemplateSettingPrivate()) 0024 { 0025 } 0026 0027 NetworkManager::TemplateSetting::TemplateSetting(const Ptr &other) 0028 : Setting(other) 0029 , d_ptr(new TemplateSettingPrivate()) 0030 { 0031 /* 0032 * setFoo(setting->foo()); 0033 * 0034 */ 0035 } 0036 0037 NetworkManager::TemplateSetting::~TemplateSetting() 0038 { 0039 delete d_ptr; 0040 } 0041 0042 QString NetworkManager::TemplateSetting::name() const 0043 { 0044 Q_D(const TemplateSetting); 0045 0046 return d->name; 0047 } 0048 0049 void NetworkManager::TemplateSetting::fromMap(const QVariantMap &setting) 0050 { 0051 /* 0052 * if (setting.contains(QLatin1String(NM_SETTING_TEMPLATE_FOO))) { 0053 * setFoo(setting.value(QLatin1String(NM_SETTING_TEMPLATE_FOO))); 0054 * } 0055 * 0056 */ 0057 } 0058 0059 QVariantMap NetworkManager::TemplateSetting::toMap() const 0060 { 0061 QVariantMap setting; 0062 0063 /* 0064 * if (!foo.isEmpty()) { 0065 * setting.insert(QLatin1String(NM_SETTING_TEMPLATE_FOO), foo()); 0066 * } 0067 * 0068 */ 0069 0070 return setting; 0071 } 0072 0073 QDebug NetworkManager::operator<<(QDebug dbg, const NetworkManager::TemplateSetting &setting) 0074 { 0075 dbg.nospace() << "type: " << setting.typeAsString(setting.type()) << '\n'; 0076 dbg.nospace() << "initialized: " << !setting.isNull() << '\n'; 0077 0078 return dbg.maybeSpace(); 0079 }