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
This commit is contained in:
Nicolas Fella 2018-05-10 18:36:06 +02:00
parent c6ebdbe89b
commit 68d0c5d143
3 changed files with 12 additions and 2 deletions

View file

@ -8,7 +8,7 @@ set(KDECONNECT_VERSION_PATCH 0)
set(KDECONNECT_VERSION "${KDECONNECT_VERSION_MAJOR}.${KDECONNECT_VERSION_MINOR}.${KDECONNECT_VERSION_PATCH}") set(KDECONNECT_VERSION "${KDECONNECT_VERSION_MAJOR}.${KDECONNECT_VERSION_MINOR}.${KDECONNECT_VERSION_PATCH}")
set(QT_MIN_VERSION "5.7.0") 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) find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake)

View file

@ -35,6 +35,7 @@
#include <KPluginFactory> #include <KPluginFactory>
#include <KAboutData> #include <KAboutData>
#include <KLocalizedString> #include <KLocalizedString>
#include <kcmutils_version.h>
#include "ui_kcm.h" #include "ui_kcm.h"
#include "interfaces/dbusinterfaces.h" #include "interfaces/dbusinterfaces.h"
@ -116,6 +117,8 @@ KdeConnectKcm::KdeConnectKcm(QWidget* parent, const QVariantList& args)
daemon->acquireDiscoveryMode(createId()); daemon->acquireDiscoveryMode(createId());
#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 45, 0)
if (!args.isEmpty() && args.first().type() == QVariant::String) { if (!args.isEmpty() && args.first().type() == QVariant::String) {
const QString input = args.first().toString(); const QString input = args.first().toString();
const auto colonIdx = input.indexOf(QLatin1Char(':')); const auto colonIdx = input.indexOf(QLatin1Char(':'));
@ -134,6 +137,8 @@ KdeConnectKcm::KdeConnectKcm(QWidget* parent, const QVariantList& args)
disconnect(devicesModel, &DevicesModel::rowsInserted, this, nullptr); disconnect(devicesModel, &DevicesModel::rowsInserted, this, nullptr);
}); });
} }
#endif
} }
void KdeConnectKcm::renameShow() void KdeConnectKcm::renameShow()

View file

@ -29,6 +29,7 @@
#include <QSettings> #include <QSettings>
#include <QJsonDocument> #include <QJsonDocument>
#include <KShell> #include <KShell>
#include <kcmutils_version.h>
#include <core/networkpacket.h> #include <core/networkpacket.h>
#include <core/device.h> #include <core/device.h>
@ -85,7 +86,11 @@ void RunCommandPlugin::sendConfig()
{ {
QString commands = config()->get<QString>(QStringLiteral("commands"),QStringLiteral("{}")); QString commands = config()->get<QString>(QStringLiteral("commands"),QStringLiteral("{}"));
NetworkPacket np(PACKET_TYPE_RUNCOMMAND, {{"commandList", commands}}); NetworkPacket np(PACKET_TYPE_RUNCOMMAND, {{"commandList", commands}});
#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 45, 0)
np.set<bool>(QStringLiteral("canAddCommand"), true); np.set<bool>(QStringLiteral("canAddCommand"), true);
#endif
sendPacket(np); sendPacket(np);
} }