1
0
kdeconnect-kde/0001-Fix-build-on-Leap-42.3.patch

197 lines
7.3 KiB
Diff
Raw Normal View History

From ef8d129f2ff48d04f5919dfe3ebed3630ae307ef Mon Sep 17 00:00:00 2001
From: Wolfgang Bauer <wbauer@tmo.at>
Date: Wed, 14 Nov 2018 23:01:12 +0100
Subject: [PATCH] Fix build on Leap 42.3
The KF5 requirements are just for getting additional
bugfixes/improvements.
Building against Qt < 5.7.0 required these changes:
- QAction(): the "parent" argument is only optional since Qt 5.7.0.
Fixed by passing a nullptr explicitly (which is the default value)
- qAsConst is only available in Qt 5.7.0 either, so define it where it
is used when building against lower versions.
---
CMakeLists.txt | 4 ++--
core/daemon.cpp | 9 +++++++++
core/device.cpp | 9 +++++++++
core/pluginloader.cpp | 9 +++++++++
interfaces/notificationsmodel.cpp | 9 +++++++++
plasmoid/declarativeplugin/responsewaiter.cpp | 9 +++++++++
plugins/pausemusic/pausemusicplugin.cpp | 9 +++++++++
plugins/runcommand/runcommand_config.cpp | 2 +-
plugins/sendnotifications/notificationslistener.cpp | 9 +++++++++
9 files changed, 66 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c759d11..52d13d66 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,8 +7,8 @@ set(KDECONNECT_VERSION_MINOR 3)
set(KDECONNECT_VERSION_PATCH 4)
set(KDECONNECT_VERSION "${KDECONNECT_VERSION_MAJOR}.${KDECONNECT_VERSION_MINOR}.${KDECONNECT_VERSION_PATCH}")
-set(QT_MIN_VERSION "5.7.0")
-set(KF5_MIN_VERSION "5.42.0")
+set(QT_MIN_VERSION "5.6.0")
+set(KF5_MIN_VERSION "5.32.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake)
diff --git a/core/daemon.cpp b/core/daemon.cpp
index de98076c..1c818e52 100644
--- a/core/daemon.cpp
+++ b/core/daemon.cpp
@@ -40,6 +40,15 @@
#include "backends/devicelink.h"
#include "backends/linkprovider.h"
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
+// this adds const to non-const objects (like std::as_const)
+template <typename T>
+Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
+// prevent rvalue arguments:
+template <typename T>
+void qAsConst(const T &&) Q_DECL_EQ_DELETE;
+#endif
+
static Daemon* s_instance = nullptr;
struct DaemonPrivate
diff --git a/core/device.cpp b/core/device.cpp
index fa600213..dfa6979d 100644
--- a/core/device.cpp
+++ b/core/device.cpp
@@ -37,6 +37,15 @@
#include "kdeconnectconfig.h"
#include "daemon.h"
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
+// this adds const to non-const objects (like std::as_const)
+template <typename T>
+Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
+// prevent rvalue arguments:
+template <typename T>
+void qAsConst(const T &&) Q_DECL_EQ_DELETE;
+#endif
+
static void warn(const QString& info)
{
qWarning() << "Device pairing error" << info;
diff --git a/core/pluginloader.cpp b/core/pluginloader.cpp
index 41fd09be..62797413 100644
--- a/core/pluginloader.cpp
+++ b/core/pluginloader.cpp
@@ -28,6 +28,15 @@
#include "device.h"
#include "kdeconnectplugin.h"
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
+// this adds const to non-const objects (like std::as_const)
+template <typename T>
+Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
+// prevent rvalue arguments:
+template <typename T>
+void qAsConst(const T &&) Q_DECL_EQ_DELETE;
+#endif
+
PluginLoader* PluginLoader::instance()
{
static PluginLoader* instance = new PluginLoader();
diff --git a/interfaces/notificationsmodel.cpp b/interfaces/notificationsmodel.cpp
index 5b884c56..07b02007 100644
--- a/interfaces/notificationsmodel.cpp
+++ b/interfaces/notificationsmodel.cpp
@@ -29,6 +29,15 @@
//#include "modeltest.h"
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
+// this adds const to non-const objects (like std::as_const)
+template <typename T>
+Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
+// prevent rvalue arguments:
+template <typename T>
+void qAsConst(const T &&) Q_DECL_EQ_DELETE;
+#endif
+
NotificationsModel::NotificationsModel(QObject* parent)
: QAbstractListModel(parent)
, m_dbusInterface(nullptr)
diff --git a/plasmoid/declarativeplugin/responsewaiter.cpp b/plasmoid/declarativeplugin/responsewaiter.cpp
index 6288e782..aa05e17f 100644
--- a/plasmoid/declarativeplugin/responsewaiter.cpp
+++ b/plasmoid/declarativeplugin/responsewaiter.cpp
@@ -5,6 +5,15 @@
#include <QDebug>
#include <QCoreApplication>
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
+// this adds const to non-const objects (like std::as_const)
+template <typename T>
+Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
+// prevent rvalue arguments:
+template <typename T>
+void qAsConst(const T &&) Q_DECL_EQ_DELETE;
+#endif
+
Q_DECLARE_METATYPE(QDBusPendingReply<>)
Q_DECLARE_METATYPE(QDBusPendingReply<QVariant>)
Q_DECLARE_METATYPE(QDBusPendingReply<bool>)
diff --git a/plugins/pausemusic/pausemusicplugin.cpp b/plugins/pausemusic/pausemusicplugin.cpp
index 3e68bcf0..99dc58f9 100644
--- a/plugins/pausemusic/pausemusicplugin.cpp
+++ b/plugins/pausemusic/pausemusicplugin.cpp
@@ -30,6 +30,15 @@
#include <KPluginFactory>
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
+// this adds const to non-const objects (like std::as_const)
+template <typename T>
+Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
+// prevent rvalue arguments:
+template <typename T>
+void qAsConst(const T &&) Q_DECL_EQ_DELETE;
+#endif
+
K_PLUGIN_FACTORY_WITH_JSON( KdeConnectPluginFactory, "kdeconnect_pausemusic.json", registerPlugin< PauseMusicPlugin >(); )
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_PAUSEMUSIC, "kdeconnect.plugin.pausemusic")
diff --git a/plugins/runcommand/runcommand_config.cpp b/plugins/runcommand/runcommand_config.cpp
index 8a3c7f17..cba247cc 100644
--- a/plugins/runcommand/runcommand_config.cpp
+++ b/plugins/runcommand/runcommand_config.cpp
@@ -69,7 +69,7 @@ RunCommandConfig::~RunCommandConfig()
void RunCommandConfig::addSuggestedCommand(QMenu* menu, const QString &name, const QString &command)
{
- auto action = new QAction(name);
+ auto action = new QAction(name, nullptr);
connect(action, &QAction::triggered, action, [this, name, command]() {
insertRow(0, name, command);
Q_EMIT changed(true);
diff --git a/plugins/sendnotifications/notificationslistener.cpp b/plugins/sendnotifications/notificationslistener.cpp
index c69c20ca..597640b3 100644
--- a/plugins/sendnotifications/notificationslistener.cpp
+++ b/plugins/sendnotifications/notificationslistener.cpp
@@ -39,6 +39,15 @@
#include "sendnotification_debug.h"
#include "notifyingapplication.h"
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
+// this adds const to non-const objects (like std::as_const)
+template <typename T>
+Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
+// prevent rvalue arguments:
+template <typename T>
+void qAsConst(const T &&) Q_DECL_EQ_DELETE;
+#endif
+
NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin)
: QDBusAbstractAdaptor(aPlugin),
m_plugin(aPlugin)
--
2.16.4