Remove upstream patches

epel9
Dan Vrátil 10 years ago
parent c209a72c4d
commit 53407005c6

@ -18,11 +18,6 @@ URL: https://projects.kde.org/projects/frameworks/networkmanager-qt
%endif
Source0: http://download.kde.org/%{stable}/frameworks/%{versiondir}/%{framework}-%{version}.tar.xz
# Upstream patches
Patch0: nm-qt-do-not-return-an-empty-map-with-secrets.patch
Patch1: nm-qt-do-not-remove-existing-secrets-when-loading-secrets.patch
Patch2: nm-qt-add-generic-setting.patch
BuildRequires: kf5-rpm-macros
BuildRequires: extra-cmake-modules
BuildRequires: qt5-qtbase-devel
@ -49,10 +44,6 @@ that use NetworkManager.
%prep
%setup -qn %{framework}-%{version}
%patch0 -p1 -b .do-not-return-an-empty-map-with-secrets
%patch1 -p1 -b .do-not-remove-existing-secrets-when-loading-secrets
%patch2 -p1 -b .add-generic-setting
%build
mkdir -p %{_target_platform}
pushd %{_target_platform}

@ -1,513 +0,0 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 21f9665..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
@@ -196,6 +197,7 @@ ecm_generate_headers(NetworkManagerQt_SETTINGS_HEADERS
CdmaSetting
ConnectionSettings
GsmSetting
+ GenericSetting
InfinibandSetting
Ipv4Setting
Ipv6Setting
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 <jgrulich@redhat.com>
+
+ 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 <jgrulich@redhat.com>
+
+ 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 <jgrulich@redhat.com>
+
+ 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 <jgrulich@redhat.com>
+ Copyright 2012-2015 Jan Grulich <jgrulich@redhat.com>
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 <jgrulich@redhat.com>
+ Copyright 2012-2015 Jan Grulich <jgrulich@redhat.com>
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 <jgrulich@redhat.com>
+ Copyright 2012-2015 Jan Grulich <jgrulich@redhat.com>
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

@ -1,42 +0,0 @@
From fec3bfe050fbb5947b807bc889eed928cb7b22c6 Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich@redhat.com>
Date: Mon, 12 Jan 2015 11:16:43 +0100
Subject: [PATCH 4/9] Do not remove existing secrets when loading secrets from
string map
E.g. when loading secrets for openconnect from plasma-nm secret agent
we want to keep secrets we already have from NetworkManager and do not
overwrite them with those secrets which are stored in KWallet
---
src/settings/vpnsetting.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/settings/vpnsetting.cpp b/src/settings/vpnsetting.cpp
index 6dd8cb7..210093b 100644
--- a/src/settings/vpnsetting.cpp
+++ b/src/settings/vpnsetting.cpp
@@ -173,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);
}
}
--
2.1.0

@ -1,36 +0,0 @@
From 4bb0e742dd9f8cede51af590c4a228656e8a73d9 Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich@redhat.com>
Date: Thu, 8 Jan 2015 13:44:19 +0100
Subject: [PATCH 1/9] Do not return an empty map with secrets
This is causing some issues in secret agent from plasma-nm, because it
always tries to store VPN secrets to KWallet even when the map is empty
and when it loads this empty map later it overwrites the secrets we get
from NetworkManager in GetSecrets method and thus when plasma-nm displays
the auth dialog it doesn't have necessary secrets available.
BUG:339296
CCBUG:309931
CCBUG:334474
---
src/settings/vpnsetting.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/settings/vpnsetting.cpp b/src/settings/vpnsetting.cpp
index 6078114..6dd8cb7 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;
--
2.1.0
Loading…
Cancel
Save