From 68d0c5d14326114c8aa10467d55c2d01c9817a3c Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Thu, 10 May 2018 18:36:06 +0200 Subject: [PATCH] Do not require Frameworks 5.45 Summary: Ifdef for old KF5 as discussed in D11684. Test Plan: Can still use feature when above 5.45 Reviewers: apol Reviewed By: apol Subscribers: kdeconnect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D12810 --- CMakeLists.txt | 2 +- kcm/kcm.cpp | 5 +++++ plugins/runcommand/runcommandplugin.cpp | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 499f6452d..3e4fed27c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set(KDECONNECT_VERSION_PATCH 0) set(KDECONNECT_VERSION "${KDECONNECT_VERSION_MAJOR}.${KDECONNECT_VERSION_MINOR}.${KDECONNECT_VERSION_PATCH}") set(QT_MIN_VERSION "5.7.0") -set(KF5_MIN_VERSION "5.45.0") +set(KF5_MIN_VERSION "5.42.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/kcm/kcm.cpp b/kcm/kcm.cpp index 9e59719e7..2d6411b49 100644 --- a/kcm/kcm.cpp +++ b/kcm/kcm.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include "ui_kcm.h" #include "interfaces/dbusinterfaces.h" @@ -116,6 +117,8 @@ KdeConnectKcm::KdeConnectKcm(QWidget* parent, const QVariantList& args) daemon->acquireDiscoveryMode(createId()); + #if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 45, 0) + if (!args.isEmpty() && args.first().type() == QVariant::String) { const QString input = args.first().toString(); const auto colonIdx = input.indexOf(QLatin1Char(':')); @@ -134,6 +137,8 @@ KdeConnectKcm::KdeConnectKcm(QWidget* parent, const QVariantList& args) disconnect(devicesModel, &DevicesModel::rowsInserted, this, nullptr); }); } + + #endif } void KdeConnectKcm::renameShow() diff --git a/plugins/runcommand/runcommandplugin.cpp b/plugins/runcommand/runcommandplugin.cpp index 482501e46..c5f24e052 100644 --- a/plugins/runcommand/runcommandplugin.cpp +++ b/plugins/runcommand/runcommandplugin.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -85,7 +86,11 @@ void RunCommandPlugin::sendConfig() { QString commands = config()->get(QStringLiteral("commands"),QStringLiteral("{}")); NetworkPacket np(PACKET_TYPE_RUNCOMMAND, {{"commandList", commands}}); - np.set(QStringLiteral("canAddCommand"), true); + + #if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 45, 0) + np.set(QStringLiteral("canAddCommand"), true); + #endif + sendPacket(np); }