Hello community,
here is the log from the commit of package libKF5NetworkManagerQt for
openSUSE:Factory checked in at 2015-01-29 13:14:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libKF5NetworkManagerQt (Old)
and /work/SRC/openSUSE:Factory/.libKF5NetworkManagerQt.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libKF5NetworkManagerQt"
Changes:
--------
---
/work/SRC/openSUSE:Factory/libKF5NetworkManagerQt/libKF5NetworkManagerQt.changes
2014-12-21 12:00:01.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.libKF5NetworkManagerQt.new/libKF5NetworkManagerQt.changes
2015-01-29 13:14:58.000000000 +0100
@@ -1,0 +2,16 @@
+Tue Jan 13 19:21:59 UTC 2015 - [email protected]
+
+- Added vpn.patch from upstream
+
+-------------------------------------------------------------------
+Sat Jan 3 18:03:26 UTC 2015 - [email protected]
+
+- Libary is now officially a part of KDE Frameworks 5 libraries
+- Update to 5.6.0
+ * For more details please see:
+ https://www.kde.org/announcements/kde-frameworks-5.6.0.php
+- Update summary and descriptions
+- Be more explicit about BuildRequires (using pkgconfig, etc)
+- Added baselibs.conf
+
+-------------------------------------------------------------------
Old:
----
libnm-qt-5.1.2.tar.xz
New:
----
baselibs.conf
networkmanager-qt-5.6.0.tar.xz
vpn.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libKF5NetworkManagerQt.spec ++++++
--- /var/tmp/diff_new_pack.Sc3HR2/_old 2015-01-29 13:15:00.000000000 +0100
+++ /var/tmp/diff_new_pack.Sc3HR2/_new 2015-01-29 13:15:00.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package libKF5NetworkManagerQt
#
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,32 +16,37 @@
#
-Url: http://www.kde.org
-%define soversion 5
-
+%define soversion 6
Name: libKF5NetworkManagerQt
-Version: 5.1.2
+Version: 5.6.0
Release: 0
-Summary: A qt wrapper around the NetworkManager libraries
+Summary: A Qt wrapper for NetworkManager DBus API
License: LGPL-2.1 or LGPL-3.0
Group: System/GUI/KDE
-Source0: libnm-qt-%{version}.tar.xz
-BuildRequires: NetworkManager-devel >= 0.9.8.4
+Url: http://www.kde.org
+Source:
http://download.kde.org/stable/frameworks/5.6/networkmanager-qt-%{version}.tar.xz
+Source1: baselibs.conf
+# PATCH-FIX-UPSTREAM vpn.patch
+Patch0: vpn.patch
BuildRequires: cmake
-BuildRequires: extra-cmake-modules >= 0.0.12
+BuildRequires: extra-cmake-modules >= 1.6.0
BuildRequires: kf5-filesystem
+BuildRequires: pkgconfig(NetworkManager) >= 0.9.8.4
BuildRequires: pkgconfig(Qt5Core) >= 5.2.0
BuildRequires: pkgconfig(Qt5DBus) >= 5.2.0
BuildRequires: pkgconfig(Qt5Network) >= 5.2.0
-BuildRequires: pkgconfig(Qt5Test) >= 5.2.0
-#BuildRequires: libKF5ModemManagerQt-devel
+BuildRequires: pkgconfig(libnm-glib) >= 0.9.8.4
+BuildRequires: pkgconfig(libnm-util) >= 0.9.8.4
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
-Qt5 wrapper around the NetworkManager libraries.
+NetworkManagerQt provides access to all NetworkManager features
+exposed on DBus. It allows you to manage your connections and control
+your network devices and also provides a library for parsing connection
+settings which are used in DBus communication.
%package devel
-Summary: Qt Wrapper for NetworkManager libraries
+Summary: A Qt wrapper for NetworkManager DBus API
Group: Development/Libraries/KDE
Requires: libKF5NetworkManagerQt%{soversion} = %{version}
Requires: pkgconfig(Qt5Core) >= 5.2.0
@@ -49,38 +54,46 @@
Requires: pkgconfig(Qt5Network) >= 5.2.0
%description devel
-Qt5 wrapper around the NetworkManager libraries. Development files.
+NetworkManagerQt provides access to all NetworkManager features
+exposed on DBus. It allows you to manage your connections and control
+your network devices and also provides a library for parsing connection
+settings which are used in DBus communication. Development files.
%package -n libKF5NetworkManagerQt%{soversion}
-Summary: Qt Wrapper for NetworkManager libraries
+Summary: A Qt wrapper for NetworkManager DBus API
Group: Development/Libraries/KDE
%description -n libKF5NetworkManagerQt%{soversion}
-Qt5 wrapper around the NetworkManager libraries.
+NetworkManagerQt provides access to all NetworkManager features
+exposed on DBus. It allows you to manage your connections and control
+your network devices and also provides a library for parsing connection
+settings which are used in DBus communication.
%prep
-%setup -q -n libnm-qt-%{version}
+%setup -q -n networkmanager-qt-%{version}
+%patch0 -p1
%build
- %cmake_kf5 -d build -- -DDISABLE_TESTING=ON
+ %cmake_kf5 -d build
%make_jobs
%install
%kf5_makeinstall -C build
%post -n libKF5NetworkManagerQt%{soversion} -p /sbin/ldconfig
+
%postun -n libKF5NetworkManagerQt%{soversion} -p /sbin/ldconfig
%files -n libKF5NetworkManagerQt%{soversion}
%defattr(-,root,root)
-%doc COPYING.LIB
+%doc COPYING*
%{_kf5_libdir}/libKF5NetworkManagerQt.so.*
%files devel
%defattr(-,root,root)
+%doc COPYING*
%{_kf5_libdir}/libKF5NetworkManagerQt.so
-%{_kf5_includedir}/NetworkManagerQt/
-%{_kf5_includedir}/*.h
+%{_kf5_includedir}/
%{_kf5_libdir}/cmake/KF5NetworkManagerQt/
%{_kf5_mkspecsdir}/qt_NetworkManagerQt.pri
++++++ baselibs.conf ++++++
libKF5NetworkManagerQt6
libKF5NetworkManagerQt-devel
requires "libKF5NetworkManagerQt6-<targettype> = <version>"++++++
vpn.patch ++++++
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1c69be3..f7abff4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -112,6 +112,7 @@ if (${NETWORKMANAGER_VERSION} VERSION_EQUAL 0.9.10.0 OR
${NETWORKMANAGER_VERSION
set(NetworkManagerQt_SETTINGS_SRCS
${NetworkManagerQt_SETTINGS_SRCS}
settings/teamsetting.cpp
+ settings/genericsetting.cpp
)
set(DBUS_INTERFACE_SRCS
@@ -129,7 +130,7 @@ add_library(KF5NetworkManagerQt SHARED
${NetworkManagerQt_PART_SRCS} ${NetworkMa
generate_export_header(KF5NetworkManagerQt BASE_NAME NetworkManagerQt)
add_library(KF5::NetworkManagerQt ALIAS KF5NetworkManagerQt)
-target_include_directories(KF5NetworkManagerQt INTERFACE
"$<INSTALL_INTERFACE:${KF5_INCLUDE_INSTALL_DIR}/NetworkManagerQt>")
+target_include_directories(KF5NetworkManagerQt INTERFACE
"$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/NetworkManagerQt>")
target_link_libraries(KF5NetworkManagerQt PUBLIC Qt5::Core Qt5::Network
Qt5::DBus)
@@ -196,6 +197,7 @@ ecm_generate_headers(NetworkManagerQt_SETTINGS_HEADERS
CdmaSetting
ConnectionSettings
GsmSetting
+ GenericSetting
InfinibandSetting
Ipv4Setting
Ipv6Setting
@@ -223,7 +225,7 @@ install(FILES
${CMAKE_CURRENT_BINARY_DIR}/networkmanagerqt_export.h
${NetworkManagerQt_HEADERS}
${NetworkManagerQt_SETTINGS_HEADERS}
- DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/NetworkManagerQt COMPONENT Devel
+ DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/NetworkManagerQt COMPONENT Devel
)
include(ECMGeneratePriFile)
diff --git a/src/settings/connectionsettings.cpp
b/src/settings/connectionsettings.cpp
index 6584280..bf491e5 100644
--- a/src/settings/connectionsettings.cpp
+++ b/src/settings/connectionsettings.cpp
@@ -62,7 +62,9 @@
#if NM_CHECK_VERSION(0, 9, 10)
#include "teamsetting.h"
+#include "genericsetting.h"
#include <nm-setting-team.h>
+#include <nm-setting-generic.h>
#endif
#include <QtCore/QUuid>
@@ -179,6 +181,11 @@ void
NetworkManager::ConnectionSettingsPrivate::initSettings(NMBluetoothCapabili
addSetting(Setting::Ptr(new Ipv4Setting()));
addSetting(Setting::Ptr(new Ipv6Setting()));
break;
+ case ConnectionSettings::Generic:
+ addSetting(Setting::Ptr(new GenericSetting()));
+ addSetting(Setting::Ptr(new Ipv4Setting()));
+ addSetting(Setting::Ptr(new Ipv6Setting()));
+ break;
#endif
case ConnectionSettings::Unknown:
default:
@@ -281,6 +288,11 @@ void
NetworkManager::ConnectionSettingsPrivate::initSettings(const NetworkManage
addSetting(connectionSettings->setting(Setting::Ipv4));
addSetting(connectionSettings->setting(Setting::Ipv6));
break;
+ case ConnectionSettings::Generic:
+ addSetting(connectionSettings->setting(Setting::Generic));
+ addSetting(connectionSettings->setting(Setting::Ipv4));
+ addSetting(connectionSettings->setting(Setting::Ipv6));
+ break;
#endif
case ConnectionSettings::Unknown:
default:
@@ -321,8 +333,10 @@ NetworkManager::ConnectionSettings::ConnectionType
NetworkManager::ConnectionSet
} else if (typeString == QLatin1String(NM_SETTING_WIRELESS_SETTING_NAME)) {
type = Wireless;
#if NM_CHECK_VERSION(0, 9, 10)
- } else if (typeString == QLatin1String(NM_SETTING_TEAM_SETTING_NAME)) {
+ } else if (typeString == QLatin1String(NM_SETTING_TEAM_SETTING_NAME)) {
type = Team;
+ } else if (typeString == QLatin1String(NM_SETTING_GENERIC_SETTING_NAME)) {
+ type = Generic;
#endif
}
@@ -380,6 +394,9 @@ QString
NetworkManager::ConnectionSettings::typeAsString(NetworkManager::Connect
case Team:
typeString = QLatin1String(NM_SETTING_TEAM_SETTING_NAME);
break;
+ case Generic:
+ typeString = QLatin1String(NM_SETTING_GENERIC_SETTING_NAME);
+ break;
#endif
default:
break;
diff --git a/src/settings/connectionsettings.h
b/src/settings/connectionsettings.h
index cdf4a27..ee06384 100644
--- a/src/settings/connectionsettings.h
+++ b/src/settings/connectionsettings.h
@@ -62,7 +62,8 @@ public:
Wired,
Wireless,
#if NM_CHECK_VERSION(0, 9, 10)
- Team
+ Team,
+ Generic
#endif
};
diff --git a/src/settings/genericsetting.cpp b/src/settings/genericsetting.cpp
new file mode 100644
index 0000000..7c3ce5c
--- /dev/null
+++ b/src/settings/genericsetting.cpp
@@ -0,0 +1,73 @@
+/*
+ Copyright 2015 Jan Grulich <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see
<http://www.gnu.org/licenses/>.
+*/
+
+#include "genericsetting.h"
+#include "genericsetting_p.h"
+
+#include "nmdebug.h"
+
+#include <nm-setting-generic.h>
+
+NetworkManager::GenericSettingPrivate::GenericSettingPrivate()
+ : name(NM_SETTING_GENERIC_SETTING_NAME)
+{ }
+
+NetworkManager::GenericSetting::GenericSetting()
+ : Setting(Setting::Generic)
+ , d_ptr(new GenericSettingPrivate())
+{ }
+
+NetworkManager::GenericSetting::GenericSetting(const Ptr &other)
+ : Setting(other)
+ , d_ptr(new GenericSettingPrivate())
+{
+}
+
+NetworkManager::GenericSetting::~GenericSetting()
+{
+ delete d_ptr;
+}
+
+QString NetworkManager::GenericSetting::name() const
+{
+ Q_D(const GenericSetting);
+
+ return d->name;
+}
+
+void NetworkManager::GenericSetting::fromMap(const QVariantMap &setting)
+{
+ Q_UNUSED(setting);
+}
+
+QVariantMap NetworkManager::GenericSetting::toMap() const
+{
+ QVariantMap setting;
+
+ return setting;
+}
+
+QDebug NetworkManager::operator <<(QDebug dbg, const
NetworkManager::GenericSetting &setting)
+{
+ dbg.nospace() << "type: " << setting.typeAsString(setting.type()) << '\n';
+ dbg.nospace() << "initialized: " << !setting.isNull() << '\n';
+
+ return dbg.maybeSpace();
+}
diff --git a/src/settings/genericsetting.h b/src/settings/genericsetting.h
new file mode 100644
index 0000000..610568a
--- /dev/null
+++ b/src/settings/genericsetting.h
@@ -0,0 +1,63 @@
+/*
+ Copyright 2015 Jan Grulich <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see
<http://www.gnu.org/licenses/>.
+*/
+
+#ifndef NETWORKMANAGERQT_GENERIC_SETTING_H
+#define NETWORKMANAGERQT_GENERIC_SETTING_H
+
+#include <networkmanagerqt_export.h>
+#include "setting.h"
+
+#include <QtCore/QString>
+
+namespace NetworkManager
+{
+
+class GenericSettingPrivate;
+
+/**
+ * Represents generic setting
+ */
+class NETWORKMANAGERQT_EXPORT GenericSetting : public Setting
+{
+public:
+ typedef QSharedPointer<GenericSetting> Ptr;
+ typedef QList<Ptr> List;
+ GenericSetting();
+ explicit GenericSetting(const Ptr &other);
+ ~GenericSetting();
+
+ QString name() const Q_DECL_OVERRIDE;
+
+ void fromMap(const QVariantMap &setting) Q_DECL_OVERRIDE;
+
+ QVariantMap toMap() const Q_DECL_OVERRIDE;
+
+protected:
+ GenericSettingPrivate *d_ptr;
+
+private:
+ Q_DECLARE_PRIVATE(GenericSetting)
+};
+
+NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const GenericSetting
&setting);
+
+}
+
+#endif // NETWORKMANAGERQT_GENERIC_SETTING_H
diff --git a/src/settings/genericsetting_p.h b/src/settings/genericsetting_p.h
new file mode 100644
index 0000000..9f59861
--- /dev/null
+++ b/src/settings/genericsetting_p.h
@@ -0,0 +1,39 @@
+/*
+ Copyright 2015 Jan Grulich <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see
<http://www.gnu.org/licenses/>.
+*/
+
+#ifndef NETWORKMANAGERQT_GENERIC_SETTING_P_H
+#define NETWORKMANAGERQT_GENERIC_SETTING_P_H
+
+#include <QtCore/QString>
+
+namespace NetworkManager
+{
+
+class GenericSettingPrivate
+{
+public:
+ GenericSettingPrivate();
+
+ QString name;
+};
+
+}
+
+#endif // NETWORKMANAGERQT_GENERIC_SETTING_P_H
diff --git a/src/settings/setting.cpp b/src/settings/setting.cpp
index e25972b..a0b6c38 100644
--- a/src/settings/setting.cpp
+++ b/src/settings/setting.cpp
@@ -38,6 +38,7 @@
#include <nm-setting-serial.h>
#if NM_CHECK_VERSION(0, 9, 10)
#include <nm-setting-team.h>
+#include <nm-setting-generic.h>
#endif
#include <nm-setting-vlan.h>
#include <nm-setting-vpn.h>
@@ -136,6 +137,9 @@ QString
NetworkManager::Setting::typeAsString(NetworkManager::Setting::SettingTy
case Team:
typeString = QLatin1String(NM_SETTING_TEAM_SETTING_NAME);
break;
+ case NetworkManager::Setting::Generic:
+ typeString = QLatin1String(NM_SETTING_GENERIC_SETTING_NAME);
+ break;
#endif
default:
break;
@@ -187,6 +191,8 @@ NetworkManager::Setting::SettingType
NetworkManager::Setting::typeFromString(con
#if NM_CHECK_VERSION(0, 9, 10)
} else if (typeString == QLatin1String(NM_SETTING_TEAM_SETTING_NAME)) {
type = Team;
+ } else if (typeString == QLatin1String(NM_SETTING_GENERIC_SETTING_NAME)) {
+ type = Generic;
#endif
}
diff --git a/src/settings/setting.h b/src/settings/setting.h
index 53dc3af..b725118 100644
--- a/src/settings/setting.h
+++ b/src/settings/setting.h
@@ -44,7 +44,7 @@ public:
typedef QSharedPointer<Setting> Ptr;
typedef QList<Ptr> List;
enum SettingType {Adsl, Cdma, Gsm, Infiniband, Ipv4, Ipv6, Ppp, Pppoe,
Security8021x, Serial,
- Vpn, Wired, Wireless, WirelessSecurity, Bluetooth,
OlpcMesh, Vlan, Wimax, Bond, Bridge, BridgePort, Team
+ Vpn, Wired, Wireless, WirelessSecurity, Bluetooth,
OlpcMesh, Vlan, Wimax, Bond, Bridge, BridgePort, Team, Generic
};
enum SecretFlagType {None = 0, AgentOwned = 0x01, NotSaved = 0x02,
NotRequired = 0x04};
Q_DECLARE_FLAGS(SecretFlags, SecretFlagType)
diff --git a/src/settings/template.cpp b/src/settings/template.cpp
index 0e8c7b1..8f23e1c 100644
--- a/src/settings/template.cpp
+++ b/src/settings/template.cpp
@@ -1,5 +1,5 @@
/*
- Copyright 2012-2013 Jan Grulich <[email protected]>
+ Copyright 2012-2015 Jan Grulich <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -24,13 +24,11 @@
// TODO: Uncomment and replace the template with the setting that you want to
implement
//#include <nm-setting-template.h>
-#include <QtCore/QDebug>
-
-NetworkManager::Settings::TemplateSettingPrivate::TemplateSettingPrivate()
- : name(QString("template"))
+NetworkManager::TemplateSettingPrivate::TemplateSettingPrivate()
+// : name(NM_SETTING_TEMPLATE_SETTING_NAME)
{ }
-NetworkManager::Settings::TemplateSetting::TemplateSetting():
+NetworkManager::TemplateSetting::TemplateSetting():
/* TODO: Uncomment and replace the template with the setting that you want to
implement
* This setting must also be added into the enum in base class
*/
@@ -38,8 +36,8 @@ NetworkManager::Settings::TemplateSetting::TemplateSetting():
d_ptr(new TemplateSettingPrivate())
{ }
-NetworkManager::Settings::TemplateSetting::TemplateSetting(TemplateSetting
*setting)
- : Setting(setting)
+NetworkManager::TemplateSetting::TemplateSetting(const Ptr &other)
+ : Setting(other)
, d_ptr(new TemplateSettingPrivate())
{
/*
@@ -48,19 +46,19 @@
NetworkManager::Settings::TemplateSetting::TemplateSetting(TemplateSetting *sett
*/
}
-NetworkManager::Settings::TemplateSetting::~TemplateSetting()
+NetworkManager::TemplateSetting::~TemplateSetting()
{
delete d_ptr;
}
-QString NetworkManager::Settings::TemplateSetting::name() const
+QString NetworkManager::TemplateSetting::name() const
{
Q_D(const TemplateSetting);
return d->name;
}
-void NetworkManager::Settings::TemplateSetting::fromMap(const QVariantMap
&setting)
+void NetworkManager::TemplateSetting::fromMap(const QVariantMap &setting)
{
/*
* if (setting.contains(QLatin1String(NM_SETTING_TEMPLATE_FOO))) {
@@ -70,7 +68,7 @@ void NetworkManager::Settings::TemplateSetting::fromMap(const
QVariantMap &setti
*/
}
-QVariantMap NetworkManager::Settings::TemplateSetting::toMap() const
+QVariantMap NetworkManager::TemplateSetting::toMap() const
{
QVariantMap setting;
@@ -84,12 +82,10 @@ QVariantMap
NetworkManager::Settings::TemplateSetting::toMap() const
return setting;
}
-void NetworkManager::Settings::TemplateSetting::printSetting()
+QDebug NetworkManager::operator <<(QDebug dbg, const
NetworkManager::TemplateSetting &setting)
{
- NetworkManager::Settings::Setting::printSetting();
+ dbg.nospace() << "type: " << setting.typeAsString(setting.type()) << '\n';
+ dbg.nospace() << "initialized: " << !setting.isNull() << '\n';
- /*
- * qCDebug(NMQT) << "FOO - " << foo();
- *
- */
+ return dbg.maybeSpace();
}
diff --git a/src/settings/template.h b/src/settings/template.h
index 91d1516..4f9f680 100644
--- a/src/settings/template.h
+++ b/src/settings/template.h
@@ -1,5 +1,5 @@
/*
- Copyright 2012-2013 Jan Grulich <[email protected]>
+ Copyright 2012-2015 Jan Grulich <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -22,31 +22,32 @@
#define NETWORKMANAGERQT_TEMPLATE_SETTING_H
#include <networkmanagerqt_export.h>
-#include "generictypes.h"
#include "setting.h"
#include <QtCore/QString>
namespace NetworkManager
{
-namespace Settings
-{
+
class TemplateSettingPrivate;
+/**
+ * Represents generic setting
+ */
class NETWORKMANAGERQT_EXPORT TemplateSetting : public Setting
{
public:
+ typedef QSharedPointer<TemplateSetting> Ptr;
+ typedef QList<Ptr> List;
TemplateSetting();
- explicit TemplateSetting(TemplateSetting *);
+ explicit TemplateSetting(const Ptr &other);
~TemplateSetting();
- QString name() const;
-
- void fromMap(const QVariantMap &setting);
+ QString name() const Q_DECL_OVERRIDE;
- QVariantMap toMap() const;
+ void fromMap(const QVariantMap &setting) Q_DECL_OVERRIDE;
- void printSetting();
+ QVariantMap toMap() const Q_DECL_OVERRIDE;
protected:
TemplateSettingPrivate *d_ptr;
@@ -54,7 +55,9 @@ protected:
private:
Q_DECLARE_PRIVATE(TemplateSetting)
};
-}
+
+NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const TemplateSetting
&setting);
+
}
#endif // NETWORKMANAGERQT_TEMPLATE_SETTING_H
diff --git a/src/settings/template_p.h b/src/settings/template_p.h
index cc952a5..579f17b 100644
--- a/src/settings/template_p.h
+++ b/src/settings/template_p.h
@@ -1,5 +1,5 @@
/*
- Copyright 2012-2013 Jan Grulich <[email protected]>
+ Copyright 2012-2015 Jan Grulich <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -25,8 +25,7 @@
namespace NetworkManager
{
-namespace Settings
-{
+
class TemplateSettingPrivate
{
public:
@@ -34,7 +33,7 @@ public:
QString name;
};
-}
+
}
#endif // NETWORKMANAGERQT_TEMPLATE_SETTING_P_H
diff --git a/src/settings/vpnsetting.cpp b/src/settings/vpnsetting.cpp
index 6078114..210093b 100644
--- a/src/settings/vpnsetting.cpp
+++ b/src/settings/vpnsetting.cpp
@@ -121,7 +121,9 @@ void NetworkManager::VpnSetting::secretsFromMap(const
QVariantMap &secrets)
QVariantMap NetworkManager::VpnSetting::secretsToMap() const
{
QVariantMap secretsMap;
- secretsMap.insert(QLatin1String(NM_SETTING_VPN_SECRETS),
QVariant::fromValue<NMStringMap>(secrets()));
+ if (!secrets().isEmpty()) {
+ secretsMap.insert(QLatin1String(NM_SETTING_VPN_SECRETS),
QVariant::fromValue<NMStringMap>(secrets()));
+ }
// qCDebug(NMQT) << secretsMap;
return secretsMap;
@@ -171,15 +173,19 @@ QVariantMap NetworkManager::VpnSetting::toMap() const
void NetworkManager::VpnSetting::secretsFromStringMap(const NMStringMap &map)
{
+ Q_D(VpnSetting);
+
if (map.contains(QLatin1String("VpnSecrets"))) {
const QStringList list =
map.value(QLatin1String("VpnSecrets")).split("%SEP%");
NMStringMap map;
if (list.count() % 2 == 0) {
for (int i = 0; i < list.count(); i += 2) {
- map.insert(list[i], list[i + 1]);
+ if (d->secrets.contains(list[i])) {
+ d->secrets.remove(list[i]);
+ }
+ d->secrets.insert(list[i], list[i + 1]);
}
}
- setSecrets(map);
}
}
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]