From 22be63ae9e8acb230ac02f1754565f9e1be65a0b Mon Sep 17 00:00:00 2001 From: Albert Vaca Cintora Date: Tue, 18 Jul 2023 20:13:27 +0000 Subject: [PATCH] Remove compatibility with Qt < 5.15 In theory we support Qt 5.6 (because of SailfishOS) but in practice we are not checking that in the CI so probably we broke the compatibility long ago. Also, I don't think anyone is using this code in SailfishOS, so we can greatly simplify the code by requiring Qt 5.15 or later. --- CMakeLists.txt | 131 ++++++++---------- KDEConnectMacros.cmake | 30 +--- cli/CMakeLists.txt | 4 +- core/backends/lan/compositeuploadjob.cpp | 14 +- core/backends/lan/lanlinkprovider.cpp | 9 -- core/compositefiletransferjob.cpp | 4 - core/daemon.cpp | 3 - core/device.cpp | 3 - core/filetransferjob.cpp | 4 - core/kdeconnectconfig.cpp | 17 --- core/pluginloader.cpp | 19 --- core/pluginloader.h | 3 - core/qtcompat_p.h | 106 -------------- data/CMakeLists.txt | 4 +- .../kdeconnectdeclarativeplugin.cpp | 4 - declarativeplugin/responsewaiter.cpp | 3 - interfaces/dbusinterfaces.cpp | 2 - interfaces/notificationsmodel.cpp | 2 - interfaces/remotesinksmodel.cpp | 1 - plugins/CMakeLists.txt | 72 +++++----- plugins/pausemusic/pausemusicplugin.cpp | 2 - plugins/runcommand/CMakeLists.txt | 19 ++- plugins/runcommand/runcommandplugin.cpp | 4 - plugins/sendnotifications/CMakeLists.txt | 10 -- ...n.in => kdeconnect_sendnotifications.json} | 2 +- .../notificationslistener.cpp | 3 - 26 files changed, 108 insertions(+), 367 deletions(-) delete mode 100644 core/qtcompat_p.h rename plugins/sendnotifications/{kdeconnect_sendnotifications.json.in => kdeconnect_sendnotifications.json} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94c6bed23..20e0a40a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,15 +8,9 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE project(kdeconnect VERSION ${RELEASE_SERVICE_VERSION}) -if (SAILFISHOS) - set(KF5_MIN_VERSION "5.36.0") - set(QT_MIN_VERSION "5.6.0") -else() - set(KF5_MIN_VERSION "5.101.0") - set(QT_MIN_VERSION "5.15.2") - set(KDE_COMPILERSETTINGS_LEVEL "5.84.0") -endif() -set(KDE_COMPILERSETTINGS_LEVEL "5.82") +set(KF5_MIN_VERSION "5.101.0") +set(QT_MIN_VERSION "5.15.2") +set(KDE_COMPILERSETTINGS_LEVEL "5.84.0") set(QCA_MIN_VERSION "2.1.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) @@ -39,9 +33,7 @@ include(ECMGenerateQmlTypes) include(KDEClangFormat) include(KDEGitCommitHooks) include(ECMQmlModule) -if (NOT SAILFISHOS) - include(ECMQMLModules) -endif() +include(ECMQMLModules) include(KDEConnectMacros.cmake) @@ -54,54 +46,44 @@ ecm_setup_version(${RELEASE_SERVICE_VERSION} add_library(kdeconnectversion INTERFACE) target_include_directories(kdeconnectversion INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) -if (SAILFISHOS) - set(KF5_REQUIRED_COMPONENTS I18n CoreAddons Config) - set(KF5_OPTIONAL_COMPONENTS) +find_package(Qca-qt${QT_MAJOR_VERSION} ${QCA_MIN_VERSION} REQUIRED) +set(Qca_LIBRARY qca-qt${QT_MAJOR_VERSION}) - set(Qca_LIBRARY CONAN_PKG::Qca-qt5) +set(KF5_REQUIRED_COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils Service Solid Kirigami2 People WindowSystem GuiAddons) +set(KF5_OPTIONAL_COMPONENTS DocTools) - add_definitions(-DSAILFISHOS) -else() - find_package(Qca-qt${QT_MAJOR_VERSION} ${QCA_MIN_VERSION} REQUIRED) - set(Qca_LIBRARY qca-qt${QT_MAJOR_VERSION}) +set_package_properties(KF5Kirigami2 PROPERTIES + DESCRIPTION "QtQuick plugins to build user interfaces based on KDE UX guidelines" + PURPOSE "Required for KDE Connect's QML-based GUI applications" + URL "https://www.kde.org/products/kirigami/" + TYPE RUNTIME +) - set(KF5_REQUIRED_COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils Service Solid Kirigami2 People WindowSystem GuiAddons) - set(KF5_OPTIONAL_COMPONENTS DocTools) - - set_package_properties(KF5Kirigami2 PROPERTIES - DESCRIPTION "QtQuick plugins to build user interfaces based on KDE UX guidelines" - PURPOSE "Required for KDE Connect's QML-based GUI applications" - URL "https://www.kde.org/products/kirigami/" - TYPE RUNTIME - ) - - if(UNIX AND NOT APPLE) - find_package(KF5Package REQUIRED) - find_package(KF5PulseAudioQt) - if (QT_MAJOR_VERSION EQUAL "5") - find_package(QtWaylandScanner REQUIRED) - endif() - find_package(Wayland 1.9 REQUIRED Client) - find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS WaylandClient) - find_package(WaylandProtocols REQUIRED) - pkg_check_modules(XkbCommon IMPORTED_TARGET xkbcommon) - pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) +if(UNIX AND NOT APPLE) + find_package(KF5Package REQUIRED) + find_package(KF5PulseAudioQt) + if (QT_MAJOR_VERSION EQUAL "5") + find_package(QtWaylandScanner REQUIRED) endif() - - find_package(KF5PeopleVCard) - set_package_properties(KF5PeopleVCard PROPERTIES - PURPOSE "Read vcards from the file system" - URL "https://invent.kde.org/pim/kpeoplevcard" - TYPE RUNTIME - ) - - add_definitions(-DHAVE_KIO) - - #ecm_find_qmlmodule(org.kde.people 1.0) FIXME This results in KPeople code being called which triggers DBus calls which breaks the Windows CI - ecm_find_qmlmodule(QtQuick.Particles 2.0) - + find_package(Wayland 1.9 REQUIRED Client) + find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS WaylandClient) + find_package(WaylandProtocols REQUIRED) + pkg_check_modules(XkbCommon IMPORTED_TARGET xkbcommon) + pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) endif() +find_package(KF5PeopleVCard) +set_package_properties(KF5PeopleVCard PROPERTIES + PURPOSE "Read vcards from the file system" + URL "https://invent.kde.org/pim/kpeoplevcard" + TYPE RUNTIME +) + +add_definitions(-DHAVE_KIO) + +#ecm_find_qmlmodule(org.kde.people 1.0) FIXME This results in KPeople code being called which triggers DBus calls which breaks the Windows CI +ecm_find_qmlmodule(QtQuick.Particles 2.0) + add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII) find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus Quick QuickControls2 Network Multimedia) @@ -126,31 +108,28 @@ add_subdirectory(core) add_subdirectory(plugins) add_subdirectory(interfaces) -if (NOT SAILFISHOS) +find_package(KF5QQC2DesktopStyle ${KF5_MIN_VERSION} REQUIRED) +set_package_properties(KF5QQC2DesktopStyle PROPERTIES TYPE RUNTIME) - find_package(KF5QQC2DesktopStyle ${KF5_MIN_VERSION} REQUIRED) - set_package_properties(KF5QQC2DesktopStyle PROPERTIES TYPE RUNTIME) +add_subdirectory(icons) +add_subdirectory(data) +add_subdirectory(cli) +add_subdirectory(declarativeplugin) - add_subdirectory(icons) - add_subdirectory(data) - add_subdirectory(cli) - add_subdirectory(declarativeplugin) +add_subdirectory(kcm) +add_subdirectory(kcmplugin) +add_subdirectory(daemon) +add_subdirectory(app) +add_subdirectory(indicator) +add_subdirectory(urlhandler) +add_subdirectory(nautilus-extension) +add_subdirectory(fileitemactionplugin) +add_subdirectory(smsapp) +add_subdirectory(settings) - add_subdirectory(kcm) - add_subdirectory(kcmplugin) - add_subdirectory(daemon) - add_subdirectory(app) - add_subdirectory(indicator) - add_subdirectory(urlhandler) - add_subdirectory(nautilus-extension) - add_subdirectory(fileitemactionplugin) - add_subdirectory(smsapp) - add_subdirectory(settings) - - if(NOT WIN32 AND NOT APPLE) - add_subdirectory(kio) - add_subdirectory(plasmoid) - endif() +if(NOT WIN32 AND NOT APPLE) + add_subdirectory(kio) + add_subdirectory(plasmoid) endif() if(KF5DocTools_FOUND) diff --git a/KDEConnectMacros.cmake b/KDEConnectMacros.cmake index b4e2ef558..b4fdddd6a 100644 --- a/KDEConnectMacros.cmake +++ b/KDEConnectMacros.cmake @@ -2,27 +2,9 @@ # Redistribution and use is allowed according to the terms of the BSD license. -if (SAILFISHOS) - function(kdeconnect_add_plugin plugin) - set(options) - set(oneValueArgs JSON) - set(multiValueArgs SOURCES) - cmake_parse_arguments(KC_ADD_PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - if(NOT KC_ADD_PLUGIN_SOURCES) - message(FATAL_ERROR "kdeconnect_add_plugin called without SOURCES parameter") - endif() - get_filename_component(json "${KC_ADD_PLUGIN_JSON}" REALPATH) - - add_library(${plugin} STATIC ${KC_ADD_PLUGIN_SOURCES}) - set_property(TARGET ${plugin} APPEND PROPERTY AUTOGEN_TARGET_DEPENDS ${json}) - set_property(TARGET ${plugin} APPEND PROPERTY COMPILE_DEFINITIONS QT_STATICPLUGIN) - endfunction() -else() - function(kdeconnect_add_plugin) - kcoreaddons_add_plugin(${ARGN} INSTALL_NAMESPACE kdeconnect) - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}_config.qml") - install(FILES "${ARGV0}_config.qml" DESTINATION ${DATA_INSTALL_DIR}/kdeconnect) - endif() - endfunction() -endif() +function(kdeconnect_add_plugin) + kcoreaddons_add_plugin(${ARGN} INSTALL_NAMESPACE kdeconnect) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}_config.qml") + install(FILES "${ARGV0}_config.qml" DESTINATION ${DATA_INSTALL_DIR}/kdeconnect) + endif() +endfunction() diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index 22da853a7..817945f81 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -13,6 +13,4 @@ target_link_libraries(kdeconnect-cli install(TARGETS kdeconnect-cli ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) -if (NOT SAILFISHOS) - install(FILES kdeconnect.zsh RENAME _kdeconnect DESTINATION ${KDE_INSTALL_ZSHAUTOCOMPLETEDIR}) -endif() +install(FILES kdeconnect.zsh RENAME _kdeconnect DESTINATION ${KDE_INSTALL_ZSHAUTOCOMPLETEDIR}) diff --git a/core/backends/lan/compositeuploadjob.cpp b/core/backends/lan/compositeuploadjob.cpp index 03d5abbb0..0c8f55a27 100644 --- a/core/backends/lan/compositeuploadjob.cpp +++ b/core/backends/lan/compositeuploadjob.cpp @@ -7,7 +7,6 @@ #include "compositeuploadjob.h" #include "lanlinkprovider.h" #include "plugins/share/shareplugin.h" -#include "qtcompat_p.h" #include #include #include @@ -95,21 +94,14 @@ void CompositeUploadJob::startNextSubJob() m_currentJobSendPayloadSize = 0; emitDescription(m_currentJob->getNetworkPacket().get(QStringLiteral("filename"))); -#ifdef SAILFISHOS - connect(m_currentJob, SIGNAL(processedAmount(KJob *, KJob::Unit, qulonglong)), this, SLOT(slotProcessedAmount(KJob *, KJob::Unit, qulonglong))); -#else connect(m_currentJob, QOverload::of(&UploadJob::processedAmount), this, &CompositeUploadJob::slotProcessedAmount); -#endif + // Already done by KCompositeJob // connect(m_currentJob, &KJob::result, this, &CompositeUploadJob::slotResult); // TODO: Create a copy of the networkpacket that can be re-injected if sending via lan fails? NetworkPacket np = m_currentJob->getNetworkPacket(); -#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0) - np.setPayload({}, np.payloadSize()); -#else np.setPayload(nullptr, np.payloadSize()); -#endif np.setPayloadTransferInfo({{QStringLiteral("port"), m_port}}); np.set(QStringLiteral("numberOfFiles"), m_totalJobs); np.set(QStringLiteral("totalPayloadSize"), m_totalPayloadSize); @@ -144,11 +136,7 @@ void CompositeUploadJob::newConnection() m_currentJob->setSocket(m_socket); connect(m_socket, &QSslSocket::disconnected, this, &CompositeUploadJob::socketDisconnected); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - connect(m_socket, QOverload::of(&QAbstractSocket::error), this, &CompositeUploadJob::socketError); -#else connect(m_socket, &QAbstractSocket::errorOccurred, this, &CompositeUploadJob::socketError); -#endif connect(m_socket, QOverload &>::of(&QSslSocket::sslErrors), this, &CompositeUploadJob::sslError); connect(m_socket, &QSslSocket::encrypted, this, &CompositeUploadJob::encrypted); diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp index 3d72c6b49..7104a966f 100644 --- a/core/backends/lan/lanlinkprovider.cpp +++ b/core/backends/lan/lanlinkprovider.cpp @@ -33,7 +33,6 @@ #include "daemon.h" #include "kdeconnectconfig.h" #include "landevicelink.h" -#include "qtcompat_p.h" static const int MAX_UNPAIRED_CONNECTIONS = 42; static const int MAX_REMEMBERED_IDENTITY_PACKETS = 42; @@ -294,11 +293,7 @@ void LanLinkProvider::udpBroadcastReceived() m_receivedIdentityPackets[socket].np = receivedPacket; m_receivedIdentityPackets[socket].sender = sender; connect(socket, &QAbstractSocket::connected, this, &LanLinkProvider::tcpSocketConnected); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - connect(socket, QOverload::of(&QAbstractSocket::error), this, &LanLinkProvider::connectError); -#else connect(socket, &QAbstractSocket::errorOccurred, this, &LanLinkProvider::connectError); -#endif socket->connectToHost(sender, tcpPort); } } @@ -330,11 +325,7 @@ void LanLinkProvider::tcpSocketConnected() return; } -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - disconnect(socket, QOverload::of(&QAbstractSocket::error), this, &LanLinkProvider::connectError); -#else disconnect(socket, &QAbstractSocket::errorOccurred, this, &LanLinkProvider::connectError); -#endif configureSocket(socket); diff --git a/core/compositefiletransferjob.cpp b/core/compositefiletransferjob.cpp index 9c0208623..22fa9ab79 100644 --- a/core/compositefiletransferjob.cpp +++ b/core/compositefiletransferjob.cpp @@ -47,14 +47,10 @@ void CompositeFileTransferJob::startNextSubJob() {i18nc("The destination of a file operation", "Destination"), m_currentJob->destination().toDisplayString(QUrl::PreferLocalFile)}); m_currentJob->start(); -#ifdef SAILFISHOS - connect(m_currentJob, SIGNAL(processedAmount(KJob *, KJob::Unit, qulonglong)), this, SLOT(slotProcessedAmount(KJob *, KJob::Unit, qulonglong))); -#else connect(m_currentJob, QOverload::of(&FileTransferJob::processedAmount), this, &CompositeFileTransferJob::slotProcessedAmount); -#endif } bool CompositeFileTransferJob::addSubjob(KJob *job) diff --git a/core/daemon.cpp b/core/daemon.cpp index 6bd49e75d..ed73f06fd 100644 --- a/core/daemon.cpp +++ b/core/daemon.cpp @@ -28,9 +28,6 @@ #include "backends/loopback/loopbacklinkprovider.h" #include "device.h" -// In older Qt released, qAsConst isnt available -#include "qtcompat_p.h" - static Daemon *s_instance = nullptr; struct DaemonPrivate { diff --git a/core/device.cpp b/core/device.cpp index b6fba83a1..31426ac29 100644 --- a/core/device.cpp +++ b/core/device.cpp @@ -26,9 +26,6 @@ #include "networkpacket.h" #include "pluginloader.h" -// In older Qt released, qAsConst isnt available -#include "qtcompat_p.h" - class Device::DevicePrivate { public: diff --git a/core/filetransferjob.cpp b/core/filetransferjob.cpp index 85d047b00..9c00a9354 100644 --- a/core/filetransferjob.cpp +++ b/core/filetransferjob.cpp @@ -95,11 +95,7 @@ void FileTransferJob::startTransfer() m_written = bytesSent; }); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - connect(m_reply, static_cast(&QNetworkReply::error), this, &FileTransferJob::transferFailed); -#else connect(m_reply, &QNetworkReply::errorOccurred, this, &FileTransferJob::transferFailed); -#endif connect(m_reply, &QNetworkReply::finished, this, &FileTransferJob::transferFinished); } diff --git a/core/kdeconnectconfig.cpp b/core/kdeconnectconfig.cpp index 96c993aa8..bd5146b8b 100644 --- a/core/kdeconnectconfig.cpp +++ b/core/kdeconnectconfig.cpp @@ -47,19 +47,6 @@ struct KdeConnectConfigPrivate { static QString getDefaultDeviceName() { -#ifdef SAILFISHOS - const QString hwReleaseFile = QStringLiteral("/etc/hw-release"); - // QSettings will crash if the file does not exist or can be created, like in this case by us in /etc. - // E.g. in the SFOS SDK Emulator there is no such file, so check before to protect against the crash. - if (QFile::exists(hwReleaseFile)) { - QSettings hwRelease(hwReleaseFile, QSettings::IniFormat); - auto hwName = hwRelease.value(QStringLiteral("NAME")).toString(); - if (!hwName.isEmpty()) { - return hwName; - } - } -#endif - return QHostInfo::localHostName(); } @@ -109,9 +96,6 @@ void KdeConnectConfig::setName(const QString &name) DeviceType KdeConnectConfig::deviceType() { -#ifdef SAILFISHOS - return DeviceType::Phone; -#else const QByteArrayList platforms = qgetenv("PLASMA_PLATFORM").split(':'); if (platforms.contains("phone")) { @@ -125,7 +109,6 @@ DeviceType KdeConnectConfig::deviceType() // TODO non-Plasma mobile platforms return DeviceType::Desktop; -#endif } QString KdeConnectConfig::deviceId() diff --git a/core/pluginloader.cpp b/core/pluginloader.cpp index c9087834d..037807067 100644 --- a/core/pluginloader.cpp +++ b/core/pluginloader.cpp @@ -18,9 +18,6 @@ #include "kdeconnectconfig.h" #include "kdeconnectplugin.h" -// In older Qt released, qAsConst isnt available -#include "qtcompat_p.h" - PluginLoader *PluginLoader::instance() { static PluginLoader *instance = new PluginLoader(); @@ -29,22 +26,10 @@ PluginLoader *PluginLoader::instance() PluginLoader::PluginLoader() { -#ifdef SAILFISHOS - const QVector staticPlugins = QPluginLoader::staticPlugins(); - for (auto &staticPlugin : staticPlugins) { - QJsonObject jsonMetadata = staticPlugin.metaData().value(QStringLiteral("MetaData")).toObject(); - KPluginMetaData metadata(jsonMetadata, QString()); - if (metadata.serviceTypes().contains(QStringLiteral("KdeConnect/Plugin"))) { - plugins.insert(metadata.pluginId(), metadata); - pluginsFactories.insert(metadata.pluginId(), qobject_cast(staticPlugin.instance())); - } - } -#else const QVector data = KPluginLoader::findPlugins(QStringLiteral("kdeconnect/")); for (const KPluginMetaData &metadata : data) { plugins[metadata.pluginId()] = metadata; } -#endif } QStringList PluginLoader::getPluginList() const @@ -72,16 +57,12 @@ KdeConnectPlugin *PluginLoader::instantiatePluginForDevice(const QString &plugin return ret; } -#ifdef SAILFISHOS - KPluginFactory *factory = pluginsFactories.value(pluginName); -#else KPluginLoader loader(service.fileName()); KPluginFactory *factory = loader.factory(); if (!factory) { qCDebug(KDECONNECT_CORE) << "KPluginFactory could not load the plugin:" << service.pluginId() << loader.errorString(); return ret; } -#endif const QStringList outgoingInterfaces = KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-OutgoingPacketType")); diff --git a/core/pluginloader.h b/core/pluginloader.h index d6017f08f..b49c79a89 100644 --- a/core/pluginloader.h +++ b/core/pluginloader.h @@ -37,9 +37,6 @@ private: PluginLoader(); QHash plugins; -#ifdef SAILFISHOS - QHash pluginsFactories; -#endif }; #endif diff --git a/core/qtcompat_p.h b/core/qtcompat_p.h deleted file mode 100644 index 534a6fbf5..000000000 --- a/core/qtcompat_p.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - SPDX-FileCopyrightText: 2017 Kevin Funk - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#ifndef KDEVELOP_QTCOMPAT_P_H -#define KDEVELOP_QTCOMPAT_P_H - -#include - -#include - -#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0) -namespace QtPrivate -{ -template -struct QAddConst { - typedef const T Type; -}; -} - -// this adds const to non-const objects (like std::as_const) -template -Q_DECL_CONSTEXPR typename QtPrivate::QAddConst::Type &qAsConst(T &t) Q_DECL_NOTHROW -{ - return t; -} -// prevent rvalue arguments: -template -void qAsConst(const T &&) Q_DECL_EQ_DELETE; -#endif - -#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0) -template -struct QNonConstOverload { - template - static constexpr auto of(R (T::*func)(Args...)) noexcept -> decltype(func) - { - return func; - } -}; - -template -struct QConstOverload { - template - static constexpr auto of(R (T::*func)(Args...) const) noexcept -> decltype(func) - { - return func; - } -}; - -template -struct QOverload : QConstOverload, QNonConstOverload { - using QConstOverload::of; - using QNonConstOverload::of; - - template - static constexpr auto of(R (*func)(Args...)) noexcept -> decltype(func) - { - return func; - } -}; -#endif - -// compat for Q_FALLTHROUGH -#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0) - -#if defined(__has_cpp_attribute) -#if __has_cpp_attribute(fallthrough) -#define Q_FALLTHROUGH() [[fallthrough]] -#elif __has_cpp_attribute(clang::fallthrough) -#define Q_FALLTHROUGH() [[clang::fallthrough]] -#elif __has_cpp_attribute(gnu::fallthrough) -#define Q_FALLTHROUGH() [[gnu::fallthrough]] -#endif -#endif - -#ifndef Q_FALLTHROUGH -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 700) -#define Q_FALLTHROUGH() __attribute__((fallthrough)) -#else -#define Q_FALLTHROUGH() (void)0 -#endif -#endif - -#endif - -namespace QtCompat -{ -// TODO: Just use QDir::listSeparator once we depend on Qt 5.6 -Q_DECL_CONSTEXPR inline QChar listSeparator() Q_DECL_NOTHROW -{ -#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) -#ifdef Q_OS_WIN - return QLatin1Char(';'); -#else - return QLatin1Char(':'); -#endif -#else - return QDir::listSeparator(); -#endif -} -} - -#endif diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 6d3621f29..402313130 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -3,6 +3,4 @@ install (FILES "kdeconnect-thunar.desktop" DESTINATION ${KDE_INSTALL_DATADIR}/Th install(FILES org.kde.kdeconnect_open.desktop DESTINATION ${KDE_INSTALL_APPDIR}) install (FILES "kdeconnect-dde.desktop" DESTINATION ${KDE_INSTALL_DATADIR}/deepin/dde-file-manager/oem-menuextensions/) -if(NOT SAILFISHOS) - install(FILES org.kde.kdeconnect.metainfo.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) -endif() +install(FILES org.kde.kdeconnect.metainfo.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) diff --git a/declarativeplugin/kdeconnectdeclarativeplugin.cpp b/declarativeplugin/kdeconnectdeclarativeplugin.cpp index 60fa1e7c1..4b695bbf2 100644 --- a/declarativeplugin/kdeconnectdeclarativeplugin.cpp +++ b/declarativeplugin/kdeconnectdeclarativeplugin.cpp @@ -102,11 +102,7 @@ void KdeConnectDeclarativePlugin::registerTypes(const char *uri) return new OpenConfig; }); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) qmlRegisterAnonymousType(uri, 1); -#else - qmlRegisterType(); -#endif registerFactory(uri, "DeviceDbusInterfaceFactory"); registerFactory(uri, "DeviceBatteryDbusInterfaceFactory"); diff --git a/declarativeplugin/responsewaiter.cpp b/declarativeplugin/responsewaiter.cpp index ae59ba67d..d8a223d73 100644 --- a/declarativeplugin/responsewaiter.cpp +++ b/declarativeplugin/responsewaiter.cpp @@ -11,9 +11,6 @@ #include #include -// In older Qt released, qAsConst isnt available -#include "core/qtcompat_p.h" - Q_DECLARE_METATYPE(QDBusPendingReply<>) Q_DECLARE_METATYPE(QDBusPendingReply) Q_DECLARE_METATYPE(QDBusPendingReply) diff --git a/interfaces/dbusinterfaces.cpp b/interfaces/dbusinterfaces.cpp index a25ecf409..3ca0f54b5 100644 --- a/interfaces/dbusinterfaces.cpp +++ b/interfaces/dbusinterfaces.cpp @@ -11,12 +11,10 @@ QString DaemonDbusInterface::activatedService() { static const QString service = QStringLiteral("org.kde.kdeconnect"); -#ifndef SAILFISHOS auto reply = QDBusConnection::sessionBus().interface()->startService(service); if (!reply.isValid()) { qWarning() << "error activating kdeconnectd:" << reply.error(); } -#endif return service; } diff --git a/interfaces/notificationsmodel.cpp b/interfaces/notificationsmodel.cpp index b57bf973a..6b9312dad 100644 --- a/interfaces/notificationsmodel.cpp +++ b/interfaces/notificationsmodel.cpp @@ -11,8 +11,6 @@ #include -// In older Qt released, qAsConst isnt available -#include "core/qtcompat_p.h" #include "interfaces_debug.h" NotificationsModel::NotificationsModel(QObject *parent) diff --git a/interfaces/remotesinksmodel.cpp b/interfaces/remotesinksmodel.cpp index c0752df00..f0114ccdd 100644 --- a/interfaces/remotesinksmodel.cpp +++ b/interfaces/remotesinksmodel.cpp @@ -9,7 +9,6 @@ #include -#include #include RemoteSinksModel::RemoteSinksModel(QObject *parent) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index de05e9c12..ec4b809ba 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -20,50 +20,48 @@ endif() add_subdirectory(presenter) -if(NOT SAILFISHOS) - if((WIN32 AND MSVC AND (${CMAKE_SYSTEM_VERSION} VERSION_GREATER_EQUAL 10.0.17763.0)) OR NOT WIN32) - add_subdirectory(mpriscontrol) - endif() - add_subdirectory(photo) - add_subdirectory(mprisremote) - add_subdirectory(lockdevice) - add_subdirectory(contacts) - add_subdirectory(share) - add_subdirectory(remotekeyboard) - add_subdirectory(notifications) - add_subdirectory(findmyphone) - add_subdirectory(telephony) - add_subdirectory(mousepad) - add_subdirectory(sms) - add_subdirectory(screensaver-inhibit) - add_subdirectory(virtualmonitor) +if((WIN32 AND MSVC AND (${CMAKE_SYSTEM_VERSION} VERSION_GREATER_EQUAL 10.0.17763.0)) OR NOT WIN32) + add_subdirectory(mpriscontrol) +endif() +add_subdirectory(photo) +add_subdirectory(mprisremote) +add_subdirectory(lockdevice) +add_subdirectory(contacts) +add_subdirectory(share) +add_subdirectory(remotekeyboard) +add_subdirectory(notifications) +add_subdirectory(findmyphone) +add_subdirectory(telephony) +add_subdirectory(mousepad) +add_subdirectory(sms) +add_subdirectory(screensaver-inhibit) +add_subdirectory(virtualmonitor) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - find_package(KF5ModemManagerQt ${KF5_MIN_VERSION}) - if (TARGET KF5::ModemManagerQt) - add_subdirectory(mmtelephony) - endif() +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + find_package(KF5ModemManagerQt ${KF5_MIN_VERSION}) + if (TARGET KF5::ModemManagerQt) + add_subdirectory(mmtelephony) endif() +endif() - if(NOT WIN32 AND NOT APPLE) - add_subdirectory(sendnotifications) - endif() +if(NOT WIN32 AND NOT APPLE) + add_subdirectory(sendnotifications) +endif() - if(NOT APPLE) - add_subdirectory(sftp) - endif() +if(NOT APPLE) + add_subdirectory(sftp) +endif() - if(KF5PulseAudioQt_FOUND OR WIN32) - add_subdirectory(pausemusic) - endif() +if(KF5PulseAudioQt_FOUND OR WIN32) + add_subdirectory(pausemusic) +endif() - if(Qt5Multimedia_FOUND AND (KF5PulseAudioQt_FOUND OR WIN32)) - add_subdirectory(findthisdevice) - endif() +if(Qt5Multimedia_FOUND AND (KF5PulseAudioQt_FOUND OR WIN32)) + add_subdirectory(findthisdevice) +endif() - if (WIN32 OR APPLE OR KF5PulseAudioQt_FOUND) - add_subdirectory(systemvolume) - endif() +if (WIN32 OR APPLE OR KF5PulseAudioQt_FOUND) + add_subdirectory(systemvolume) endif() diff --git a/plugins/pausemusic/pausemusicplugin.cpp b/plugins/pausemusic/pausemusicplugin.cpp index 41d80fb2d..7ddae5a70 100644 --- a/plugins/pausemusic/pausemusicplugin.cpp +++ b/plugins/pausemusic/pausemusicplugin.cpp @@ -13,9 +13,7 @@ #include "mprisplayer.h" #include -// In older Qt released, qAsConst isnt available #include "plugin_pausemusic_debug.h" -#include "qtcompat_p.h" K_PLUGIN_CLASS_WITH_JSON(PauseMusicPlugin, "kdeconnect_pausemusic.json") diff --git a/plugins/runcommand/CMakeLists.txt b/plugins/runcommand/CMakeLists.txt index 9a4a84662..b43cae2b5 100644 --- a/plugins/runcommand/CMakeLists.txt +++ b/plugins/runcommand/CMakeLists.txt @@ -19,14 +19,11 @@ target_link_libraries(kdeconnect_runcommand KF5::I18n) #---------------------- -if(NOT SAILFISHOS) - kcoreaddons_add_plugin(kdeconnect_runcommand_config SOURCES runcommand_config.cpp INSTALL_NAMESPACE "kdeconnect/kcms") - target_link_libraries( kdeconnect_runcommand_config - kdeconnectcore - kdeconnectpluginkcm - KF5::I18n - KF5::CoreAddons - KF5::ConfigWidgets - - ) -endif() +kcoreaddons_add_plugin(kdeconnect_runcommand_config SOURCES runcommand_config.cpp INSTALL_NAMESPACE "kdeconnect/kcms") +target_link_libraries( kdeconnect_runcommand_config + kdeconnectcore + kdeconnectpluginkcm + KF5::I18n + KF5::CoreAddons + KF5::ConfigWidgets +) diff --git a/plugins/runcommand/runcommandplugin.cpp b/plugins/runcommand/runcommandplugin.cpp index 27a1edf1d..b2a00abf5 100644 --- a/plugins/runcommand/runcommandplugin.cpp +++ b/plugins/runcommand/runcommandplugin.cpp @@ -14,12 +14,8 @@ #include #include -#ifdef SAILFISHOS -#define KCMUTILS_VERSION 0 -#else #include #include -#endif #include #include diff --git a/plugins/sendnotifications/CMakeLists.txt b/plugins/sendnotifications/CMakeLists.txt index f994f7f2e..b5fad9ec2 100644 --- a/plugins/sendnotifications/CMakeLists.txt +++ b/plugins/sendnotifications/CMakeLists.txt @@ -1,10 +1,3 @@ -if (SAILFISHOS) - set(SN_PLUGIN_ENABLED_BY_DEFAULT "true") -else() - set(SN_PLUGIN_ENABLED_BY_DEFAULT "false") -endif() - -configure_file(kdeconnect_sendnotifications.json.in kdeconnect_sendnotifications.json) set(debug_file_SRCS) ecm_qt_declare_logging_category( @@ -17,7 +10,6 @@ set(kdeconnect_sendnotifications_SRCS sendnotificationsplugin.cpp notificationslistener.cpp notifyingapplication.cpp - kdeconnect_sendnotifications.json ${debug_file_SRCS} ) @@ -35,7 +27,6 @@ target_link_libraries(kdeconnect_sendnotifications ####################################### # Config -if (NOT SAILFISHOS) kcoreaddons_add_plugin(kdeconnect_sendnotifications_config INSTALL_NAMESPACE "kdeconnect/kcms") @@ -52,4 +43,3 @@ target_link_libraries( kdeconnect_sendnotifications_config KF5::I18n KF5::KCMUtils ) -endif() diff --git a/plugins/sendnotifications/kdeconnect_sendnotifications.json.in b/plugins/sendnotifications/kdeconnect_sendnotifications.json similarity index 99% rename from plugins/sendnotifications/kdeconnect_sendnotifications.json.in rename to plugins/sendnotifications/kdeconnect_sendnotifications.json index 9859b05ac..9b5f69324 100644 --- a/plugins/sendnotifications/kdeconnect_sendnotifications.json.in +++ b/plugins/sendnotifications/kdeconnect_sendnotifications.json @@ -45,7 +45,7 @@ "Description[x-test]": "xxBroadcast this computer's notifications, so they can be shown on other devices.xx", "Description[zh_CN]": "广播此计算机的通知,以被其他设备显示。", "Description[zh_TW]": "廣播此電腦的通知,這樣可以顯示在其他裝置上。", - "EnabledByDefault": ${SN_PLUGIN_ENABLED_BY_DEFAULT}, + "EnabledByDefault": false, "Icon": "preferences-desktop-notification", "Id": "kdeconnect_sendnotifications", "License": "GPL", diff --git a/plugins/sendnotifications/notificationslistener.cpp b/plugins/sendnotifications/notificationslistener.cpp index 8b5894d3d..2e005fdf1 100644 --- a/plugins/sendnotifications/notificationslistener.cpp +++ b/plugins/sendnotifications/notificationslistener.cpp @@ -28,9 +28,6 @@ #include "plugin_sendnotification_debug.h" #include "sendnotificationsplugin.h" -// In older Qt released, qAsConst isnt available -#include "qtcompat_p.h" - NotificationsListener::NotificationsListener(KdeConnectPlugin *aPlugin) : QObject(aPlugin) , m_plugin(aPlugin)