From 1ee75463e057e6a050449681d9c55cff72bcf897 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Fri, 21 Jul 2023 12:49:04 +0300 Subject: [PATCH] Get rid of QOverload/static_cast for overloaded signals By exclusing deprecated API in the KF5 build, the deprecated signal no longer cause an ambiguity --- CMakeLists.txt | 8 ++++++-- core/backends/lan/compositeuploadjob.cpp | 2 +- core/backends/lan/lanlinkprovider.cpp | 4 ++-- core/backends/lan/mdnsdiscovery.cpp | 6 +++--- daemon/kdeconnectd.cpp | 2 +- plugins/notifications/notification.cpp | 2 +- plugins/sftp/mounter.cpp | 4 ++-- plugins/share/share_config.cpp | 2 +- plugins/virtualmonitor/virtualmonitorplugin.cpp | 2 +- 9 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86021033a..14a1e4f7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ include(KDEClangFormat) include(KDEGitCommitHooks) include(ECMQmlModule) include(ECMQMLModules) +include(ECMDeprecationSettings) include(KDEConnectMacros.cmake) @@ -48,6 +49,10 @@ else() set(QTQUICK_FILEDIALOG_FOLDER "folder") endif() +ecm_set_disabled_deprecation_versions( + QT ${QT_MIN_VERSION} + KF ${KF5_MIN_VERSION} +) # Make the version header available by linking against kdeconnectversion add_library(kdeconnectversion INTERFACE) @@ -58,7 +63,7 @@ set(Qca_LIBRARY qca-qt${QT_MAJOR_VERSION}) set(KF5_REQUIRED_COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils Service Solid Kirigami2 People WindowSystem GuiAddons DocTools) -set_package_properties(KF5Kirigami2 PROPERTIES +set_package_properties(KF${QT_MAJOR_VERSION}Kirigami2 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/" @@ -71,7 +76,6 @@ if(UNIX AND NOT APPLE) else() set(WITH_X11 OFF) set(WITH_PULSEAUDIO OFF) - endif() if(UNIX AND NOT APPLE) diff --git a/core/backends/lan/compositeuploadjob.cpp b/core/backends/lan/compositeuploadjob.cpp index c406b5f13..c501f4166 100644 --- a/core/backends/lan/compositeuploadjob.cpp +++ b/core/backends/lan/compositeuploadjob.cpp @@ -133,7 +133,7 @@ void CompositeUploadJob::newConnection() connect(m_socket, &QSslSocket::disconnected, this, &CompositeUploadJob::socketDisconnected); connect(m_socket, &QAbstractSocket::errorOccurred, this, &CompositeUploadJob::socketError); - connect(m_socket, QOverload &>::of(&QSslSocket::sslErrors), this, &CompositeUploadJob::sslError); + connect(m_socket, &QSslSocket::sslErrors, this, &CompositeUploadJob::sslError); connect(m_socket, &QSslSocket::encrypted, this, &CompositeUploadJob::encrypted); LanLinkProvider::configureSslSocket(m_socket, m_deviceId, true); diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp index 2466fe6c2..5ce46beb2 100644 --- a/core/backends/lan/lanlinkprovider.cpp +++ b/core/backends/lan/lanlinkprovider.cpp @@ -359,7 +359,7 @@ void LanLinkProvider::tcpSocketConnected() connect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted); - connect(socket, QOverload &>::of(&QSslSocket::sslErrors), this, &LanLinkProvider::sslErrors); + connect(socket, &QSslSocket::sslErrors, this, &LanLinkProvider::sslErrors); socket->startServerEncryption(); } else { @@ -502,7 +502,7 @@ void LanLinkProvider::dataReceived() connect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted); if (isDeviceTrusted) { - connect(socket, QOverload &>::of(&QSslSocket::sslErrors), this, &LanLinkProvider::sslErrors); + connect(socket, &QSslSocket::sslErrors, this, &LanLinkProvider::sslErrors); } socket->startClientEncryption(); diff --git a/core/backends/lan/mdnsdiscovery.cpp b/core/backends/lan/mdnsdiscovery.cpp index 218e15277..cefddb5e1 100644 --- a/core/backends/lan/mdnsdiscovery.cpp +++ b/core/backends/lan/mdnsdiscovery.cpp @@ -10,9 +10,9 @@ #include "kdeconnectconfig.h" #include "lanlinkprovider.h" -#include -#include -#include +#include +#include +#include const QString kServiceName = QStringLiteral("_kdeconnect._udp"); diff --git a/daemon/kdeconnectd.cpp b/daemon/kdeconnectd.cpp index 77a989be6..3df378900 100644 --- a/daemon/kdeconnectd.cpp +++ b/daemon/kdeconnectd.cpp @@ -65,7 +65,7 @@ public: oc.openConfiguration(deviceId); }; connect(notification, &KNotification::action3Activated, openSettings); - connect(notification, QOverload::of(&KNotification::activated), openSettings); + connect(notification, &KNotification::activated, openSettings); notification->sendEvent(); } diff --git a/plugins/notifications/notification.cpp b/plugins/notifications/notification.cpp index ded40ed20..3c49abeb6 100644 --- a/plugins/notifications/notification.cpp +++ b/plugins/notifications/notification.cpp @@ -48,7 +48,7 @@ Notification::Notification(const NetworkPacket &np, const Device *device, QObjec parseNetworkPacket(np); createKNotification(np); - connect(m_notification, QOverload::of(&KNotification::activated), this, [this](unsigned int actionIndex) { + connect(m_notification, &KNotification::activated, this, [this](unsigned int actionIndex) { // Since 5.81 we use KNotification's inline reply instead of our own action #if KNOTIFICATIONS_VERSION < QT_VERSION_CHECK(5, 81, 0) // Do nothing for our own reply action diff --git a/plugins/sftp/mounter.cpp b/plugins/sftp/mounter.cpp index 518213ecd..8c04ac0c9 100644 --- a/plugins/sftp/mounter.cpp +++ b/plugins/sftp/mounter.cpp @@ -92,7 +92,7 @@ void Mounter::onPackageReceived(const NetworkPacket &np) connect(m_proc, &QProcess::started, this, &Mounter::onStarted); connect(m_proc, &QProcess::errorOccurred, this, &Mounter::onError); - connect(m_proc, QOverload::of(&QProcess::finished), this, &Mounter::onFinished); + connect(m_proc, &QProcess::finished, this, &Mounter::onFinished); QDir().mkpath(m_mountPoint); @@ -217,7 +217,7 @@ void Mounter::unmount(bool finished) auto proc = m_proc; m_proc = nullptr; - connect(proc, static_cast(&QProcess::finished), [proc]() { + connect(proc, &QProcess::finished, [proc]() { qCDebug(KDECONNECT_PLUGIN_SFTP) << "Free" << proc; proc->deleteLater(); }); diff --git a/plugins/share/share_config.cpp b/plugins/share/share_config.cpp index ba615bcf4..53cc7badb 100644 --- a/plugins/share/share_config.cpp +++ b/plugins/share/share_config.cpp @@ -23,7 +23,7 @@ ShareConfig::ShareConfig(QObject *parent, const QVariantList &args) m_ui->commentLabel->setTextFormat(Qt::RichText); m_ui->commentLabel->setText(i18n("%1 in the path will be replaced with the specific device name.")); - connect(m_ui->kurlrequester, SIGNAL(textChanged(QString)), this, SLOT(changed())); + connect(m_ui->kurlrequester, &KUrlRequester::textChanged, this, &ShareConfig::markAsChanged); } ShareConfig::~ShareConfig() diff --git a/plugins/virtualmonitor/virtualmonitorplugin.cpp b/plugins/virtualmonitor/virtualmonitorplugin.cpp index 86db27e93..2de97f40d 100644 --- a/plugins/virtualmonitor/virtualmonitorplugin.cpp +++ b/plugins/virtualmonitor/virtualmonitorplugin.cpp @@ -115,7 +115,7 @@ bool VirtualMonitorPlugin::requestVirtualMonitor() uuid.toString(), QS("--port"), port}); - connect(m_process, QOverload::of(&QProcess::finished), this, [this](int exitCode, QProcess::ExitStatus exitStatus) { + connect(m_process, &QProcess::finished, this, [this](int exitCode, QProcess::ExitStatus exitStatus) { qCWarning(KDECONNECT_PLUGIN_VIRTUALMONITOR) << "virtual display finished with" << device()->name() << m_process->readAllStandardError(); if (m_retries < 5 && (exitCode == 1 || exitStatus == QProcess::CrashExit)) {