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
This commit is contained in:
Alexander Lohnau 2023-07-21 12:49:04 +03:00 committed by Albert Vaca Cintora
parent e97af9dc15
commit 1ee75463e0
9 changed files with 18 additions and 14 deletions

View file

@ -29,6 +29,7 @@ include(KDEClangFormat)
include(KDEGitCommitHooks) include(KDEGitCommitHooks)
include(ECMQmlModule) include(ECMQmlModule)
include(ECMQMLModules) include(ECMQMLModules)
include(ECMDeprecationSettings)
include(KDEConnectMacros.cmake) include(KDEConnectMacros.cmake)
@ -48,6 +49,10 @@ else()
set(QTQUICK_FILEDIALOG_FOLDER "folder") set(QTQUICK_FILEDIALOG_FOLDER "folder")
endif() endif()
ecm_set_disabled_deprecation_versions(
QT ${QT_MIN_VERSION}
KF ${KF5_MIN_VERSION}
)
# Make the version header available by linking against kdeconnectversion # Make the version header available by linking against kdeconnectversion
add_library(kdeconnectversion INTERFACE) 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(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" DESCRIPTION "QtQuick plugins to build user interfaces based on KDE UX guidelines"
PURPOSE "Required for KDE Connect's QML-based GUI applications" PURPOSE "Required for KDE Connect's QML-based GUI applications"
URL "https://www.kde.org/products/kirigami/" URL "https://www.kde.org/products/kirigami/"
@ -71,7 +76,6 @@ if(UNIX AND NOT APPLE)
else() else()
set(WITH_X11 OFF) set(WITH_X11 OFF)
set(WITH_PULSEAUDIO OFF) set(WITH_PULSEAUDIO OFF)
endif() endif()
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)

View file

@ -133,7 +133,7 @@ void CompositeUploadJob::newConnection()
connect(m_socket, &QSslSocket::disconnected, this, &CompositeUploadJob::socketDisconnected); connect(m_socket, &QSslSocket::disconnected, this, &CompositeUploadJob::socketDisconnected);
connect(m_socket, &QAbstractSocket::errorOccurred, this, &CompositeUploadJob::socketError); connect(m_socket, &QAbstractSocket::errorOccurred, this, &CompositeUploadJob::socketError);
connect(m_socket, QOverload<const QList<QSslError> &>::of(&QSslSocket::sslErrors), this, &CompositeUploadJob::sslError); connect(m_socket, &QSslSocket::sslErrors, this, &CompositeUploadJob::sslError);
connect(m_socket, &QSslSocket::encrypted, this, &CompositeUploadJob::encrypted); connect(m_socket, &QSslSocket::encrypted, this, &CompositeUploadJob::encrypted);
LanLinkProvider::configureSslSocket(m_socket, m_deviceId, true); LanLinkProvider::configureSslSocket(m_socket, m_deviceId, true);

View file

@ -359,7 +359,7 @@ void LanLinkProvider::tcpSocketConnected()
connect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted); connect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted);
connect(socket, QOverload<const QList<QSslError> &>::of(&QSslSocket::sslErrors), this, &LanLinkProvider::sslErrors); connect(socket, &QSslSocket::sslErrors, this, &LanLinkProvider::sslErrors);
socket->startServerEncryption(); socket->startServerEncryption();
} else { } else {
@ -502,7 +502,7 @@ void LanLinkProvider::dataReceived()
connect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted); connect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted);
if (isDeviceTrusted) { if (isDeviceTrusted) {
connect(socket, QOverload<const QList<QSslError> &>::of(&QSslSocket::sslErrors), this, &LanLinkProvider::sslErrors); connect(socket, &QSslSocket::sslErrors, this, &LanLinkProvider::sslErrors);
} }
socket->startClientEncryption(); socket->startClientEncryption();

View file

@ -10,9 +10,9 @@
#include "kdeconnectconfig.h" #include "kdeconnectconfig.h"
#include "lanlinkprovider.h" #include "lanlinkprovider.h"
#include <KDNSSD/DNSSD/PublicService> #include <KDNSSD/PublicService>
#include <KDNSSD/DNSSD/RemoteService> #include <KDNSSD/RemoteService>
#include <KDNSSD/DNSSD/ServiceBrowser> #include <KDNSSD/ServiceBrowser>
const QString kServiceName = QStringLiteral("_kdeconnect._udp"); const QString kServiceName = QStringLiteral("_kdeconnect._udp");

View file

@ -65,7 +65,7 @@ public:
oc.openConfiguration(deviceId); oc.openConfiguration(deviceId);
}; };
connect(notification, &KNotification::action3Activated, openSettings); connect(notification, &KNotification::action3Activated, openSettings);
connect(notification, QOverload<unsigned int>::of(&KNotification::activated), openSettings); connect(notification, &KNotification::activated, openSettings);
notification->sendEvent(); notification->sendEvent();
} }

View file

@ -48,7 +48,7 @@ Notification::Notification(const NetworkPacket &np, const Device *device, QObjec
parseNetworkPacket(np); parseNetworkPacket(np);
createKNotification(np); createKNotification(np);
connect(m_notification, QOverload<unsigned int>::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 // Since 5.81 we use KNotification's inline reply instead of our own action
#if KNOTIFICATIONS_VERSION < QT_VERSION_CHECK(5, 81, 0) #if KNOTIFICATIONS_VERSION < QT_VERSION_CHECK(5, 81, 0)
// Do nothing for our own reply action // Do nothing for our own reply action

View file

@ -92,7 +92,7 @@ void Mounter::onPackageReceived(const NetworkPacket &np)
connect(m_proc, &QProcess::started, this, &Mounter::onStarted); connect(m_proc, &QProcess::started, this, &Mounter::onStarted);
connect(m_proc, &QProcess::errorOccurred, this, &Mounter::onError); connect(m_proc, &QProcess::errorOccurred, this, &Mounter::onError);
connect(m_proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &Mounter::onFinished); connect(m_proc, &QProcess::finished, this, &Mounter::onFinished);
QDir().mkpath(m_mountPoint); QDir().mkpath(m_mountPoint);
@ -217,7 +217,7 @@ void Mounter::unmount(bool finished)
auto proc = m_proc; auto proc = m_proc;
m_proc = nullptr; m_proc = nullptr;
connect(proc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), [proc]() { connect(proc, &QProcess::finished, [proc]() {
qCDebug(KDECONNECT_PLUGIN_SFTP) << "Free" << proc; qCDebug(KDECONNECT_PLUGIN_SFTP) << "Free" << proc;
proc->deleteLater(); proc->deleteLater();
}); });

View file

@ -23,7 +23,7 @@ ShareConfig::ShareConfig(QObject *parent, const QVariantList &args)
m_ui->commentLabel->setTextFormat(Qt::RichText); m_ui->commentLabel->setTextFormat(Qt::RichText);
m_ui->commentLabel->setText(i18n("&percnt;1 in the path will be replaced with the specific device name.")); m_ui->commentLabel->setText(i18n("&percnt;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() ShareConfig::~ShareConfig()

View file

@ -115,7 +115,7 @@ bool VirtualMonitorPlugin::requestVirtualMonitor()
uuid.toString(), uuid.toString(),
QS("--port"), QS("--port"),
port}); port});
connect(m_process, QOverload<int, QProcess::ExitStatus>::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(); qCWarning(KDECONNECT_PLUGIN_VIRTUALMONITOR) << "virtual display finished with" << device()->name() << m_process->readAllStandardError();
if (m_retries < 5 && (exitCode == 1 || exitStatus == QProcess::CrashExit)) { if (m_retries < 5 && (exitCode == 1 || exitStatus == QProcess::CrashExit)) {