From c3201e74c2cb9b951afb95c720e0059765aa0ff9 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Thu, 11 Nov 2021 11:01:17 +0100 Subject: [PATCH] Drop now unneeded QOverload statements By defining the KF_DISABLE_DEPRECATED_BEFORE_AND_AT value, the deprecated overloads are hidden. This way we only have the un-deprecated one visible. --- applets/kicker/plugin/appentry.cpp | 2 +- applets/kicker/plugin/appsmodel.cpp | 2 +- .../widgetexplorer/plasmaappletitemmodel.cpp | 2 +- dataengines/apps/appsengine.cpp | 2 +- dataengines/weather/weatherengine.cpp | 2 +- freespacenotifier/freespacenotifier.cpp | 2 +- kcms/colors/colors.cpp | 2 +- kcms/feedback/feedback.cpp | 4 +-- kcms/icons/main.cpp | 31 +++++++++---------- kcms/krdb/krdb.cpp | 2 +- kcms/translations/language.cpp | 2 +- libtaskmanager/launchertasksmodel.cpp | 3 +- libtaskmanager/xwindowtasksmodel.cpp | 3 +- runners/kill/killrunner_config.cpp | 2 +- runners/webshortcuts/webshortcutrunner.cpp | 2 +- shell/shellcorona.cpp | 2 +- startkde/plasma-session/sessiontrack.cpp | 2 +- startkde/plasma-session/startup.cpp | 2 +- startkde/startplasma.cpp | 17 +++++----- 19 files changed, 38 insertions(+), 48 deletions(-) diff --git a/applets/kicker/plugin/appentry.cpp b/applets/kicker/plugin/appentry.cpp index 192779c85..249c18f47 100644 --- a/applets/kicker/plugin/appentry.cpp +++ b/applets/kicker/plugin/appentry.cpp @@ -52,7 +52,7 @@ AppEntry::AppEntry(AbstractModel *owner, const QString &id) if (url.scheme() == QLatin1String("preferred")) { m_service = defaultAppByName(url.host()); m_id = id; - m_con = QObject::connect(KSycoca::self(), QOverload<>::of(&KSycoca::databaseChanged), owner, [this, owner, id]() { + m_con = QObject::connect(KSycoca::self(), &KSycoca::databaseChanged, owner, [this, owner, id]() { KSharedConfig::openConfig()->reparseConfiguration(); m_service = defaultAppByName(QUrl(id).host()); if (m_service) { diff --git a/applets/kicker/plugin/appsmodel.cpp b/applets/kicker/plugin/appsmodel.cpp index 6315b59c2..1d48abb0c 100644 --- a/applets/kicker/plugin/appsmodel.cpp +++ b/applets/kicker/plugin/appsmodel.cpp @@ -549,7 +549,7 @@ void AppsModel::refreshInternal() m_changeTimer->setInterval(100); connect(m_changeTimer, SIGNAL(timeout()), this, SLOT(refresh())); - connect(KSycoca::self(), QOverload<>::of(&KSycoca::databaseChanged), this, [this]() { + connect(KSycoca::self(), &KSycoca::databaseChanged, this, [this]() { m_changeTimer->start(); }); } else { diff --git a/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp b/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp index 51c04a35b..9aefa6d84 100644 --- a/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp +++ b/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp @@ -218,7 +218,7 @@ PlasmaAppletItemModel::PlasmaAppletItemModel(QObject *parent) : QStandardItemModel(parent) , m_startupCompleted(false) { - connect(KSycoca::self(), QOverload<>::of(&KSycoca::databaseChanged), this, &PlasmaAppletItemModel::populateModel); + connect(KSycoca::self(), &KSycoca::databaseChanged, this, &PlasmaAppletItemModel::populateModel); setSortRole(Qt::DisplayRole); } diff --git a/dataengines/apps/appsengine.cpp b/dataengines/apps/appsengine.cpp index 12f987fb6..0fc3fa831 100644 --- a/dataengines/apps/appsengine.cpp +++ b/dataengines/apps/appsengine.cpp @@ -23,7 +23,7 @@ AppsEngine::~AppsEngine() void AppsEngine::init() { addGroup(KServiceGroup::root()); - connect(KSycoca::self(), QOverload<>::of(&KSycoca::databaseChanged), this, [this]() { + connect(KSycoca::self(), &KSycoca::databaseChanged, this, [this]() { removeAllSources(); addGroup(KServiceGroup::root()); }); diff --git a/dataengines/weather/weatherengine.cpp b/dataengines/weather/weatherengine.cpp index 4685159ad..f561a3c10 100644 --- a/dataengines/weather/weatherengine.cpp +++ b/dataengines/weather/weatherengine.cpp @@ -28,7 +28,7 @@ WeatherEngine::WeatherEngine(QObject *parent, const QVariantList &args) connect(&m_networkConfigurationManager, &QNetworkConfigurationManager::onlineStateChanged, this, &WeatherEngine::onOnlineStateChanged); // Get the list of available plugins but don't load them - connect(KSycoca::self(), static_cast(&KSycoca::databaseChanged), this, &WeatherEngine::updateIonList); + connect(KSycoca::self(), &KSycoca::databaseChanged, this, &WeatherEngine::updateIonList); updateIonList(); } diff --git a/freespacenotifier/freespacenotifier.cpp b/freespacenotifier/freespacenotifier.cpp index aa82478ce..377a67d21 100644 --- a/freespacenotifier/freespacenotifier.cpp +++ b/freespacenotifier/freespacenotifier.cpp @@ -100,7 +100,7 @@ void FreeSpaceNotifier::checkFreeDiskSpace() m_notification->setActions(actions); - connect(m_notification, QOverload::of(&KNotification::activated), this, [this](uint actionId) { + connect(m_notification, &KNotification::activated, this, [this](uint actionId) { if (actionId == 1) { exploreDrive(); // TODO once we have "configure" action support in KNotification, wire it up instead of a button diff --git a/kcms/colors/colors.cpp b/kcms/colors/colors.cpp index ec92e5b1f..1333a25c5 100644 --- a/kcms/colors/colors.cpp +++ b/kcms/colors/colors.cpp @@ -276,7 +276,7 @@ void KCMColors::editScheme(const QString &schemeName, QQuickItem *ctx) QModelIndex idx = m_model->index(m_model->indexOfScheme(schemeName), 0); m_editDialogProcess = new QProcess(this); - connect(m_editDialogProcess, QOverload::of(&QProcess::finished), this, [this](int exitCode, QProcess::ExitStatus exitStatus) { + connect(m_editDialogProcess, &QProcess::finished, this, [this](int exitCode, QProcess::ExitStatus exitStatus) { Q_UNUSED(exitCode); Q_UNUSED(exitStatus); diff --git a/kcms/feedback/feedback.cpp b/kcms/feedback/feedback.cpp index 75dbaccaa..033ca4af7 100644 --- a/kcms/feedback/feedback.cpp +++ b/kcms/feedback/feedback.cpp @@ -42,8 +42,6 @@ Feedback::Feedback(QObject *parent, const KPluginMetaData &data, const QVariantL // UserFeedback.conf is used by KUserFeedback which uses QSettings and won't go through globals , m_data(new FeedbackData(this)) { - Q_UNUSED(args) - qmlRegisterAnonymousType("org.kde.userfeedback.kcm", 1); setAboutData(new KAboutData(QStringLiteral("kcm_feedback"), @@ -58,7 +56,7 @@ Feedback::Feedback(QObject *parent, const KPluginMetaData &data, const QVariantL p->setProgram(exec); p->setArguments({QStringLiteral("--feedback")}); p->start(); - connect(p, QOverload::of(&QProcess::finished), this, &Feedback::programFinished); + connect(p, &QProcess::finished, this, &Feedback::programFinished); processes << p; } } diff --git a/kcms/icons/main.cpp b/kcms/icons/main.cpp index 06e74c6fd..84173fe4f 100644 --- a/kcms/icons/main.cpp +++ b/kcms/icons/main.cpp @@ -280,23 +280,20 @@ void IconModule::exportToKDE4() kde4config.sync(); QProcess *cachePathProcess = new QProcess(this); - connect(cachePathProcess, - QOverload::of(&QProcess::finished), - this, - [cachePathProcess](int exitCode, QProcess::ExitStatus status) { - if (status == QProcess::NormalExit && exitCode == 0) { - QString path = cachePathProcess->readAllStandardOutput().trimmed(); - path.append(QLatin1String("icon-cache.kcache")); - QFile::remove(path); - } - - // message kde4 apps that icon theme has changed - for (int i = 0; i < KIconLoader::LastGroup; ++i) { - notifyKcmChange(GlobalChangeType::IconChanged, KIconLoader::Group(i)); - } - - cachePathProcess->deleteLater(); - }); + connect(cachePathProcess, &QProcess::finished, this, [cachePathProcess](int exitCode, QProcess::ExitStatus status) { + if (status == QProcess::NormalExit && exitCode == 0) { + QString path = cachePathProcess->readAllStandardOutput().trimmed(); + path.append(QLatin1String("icon-cache.kcache")); + QFile::remove(path); + } + + // message kde4 apps that icon theme has changed + for (int i = 0; i < KIconLoader::LastGroup; ++i) { + notifyKcmChange(GlobalChangeType::IconChanged, KIconLoader::Group(i)); + } + + cachePathProcess->deleteLater(); + }); cachePathProcess->start(QStringLiteral("kde4-config"), {QStringLiteral("--path"), QStringLiteral("cache")}); } diff --git a/kcms/krdb/krdb.cpp b/kcms/krdb/krdb.cpp index 39069ce82..d325a065d 100644 --- a/kcms/krdb/krdb.cpp +++ b/kcms/krdb/krdb.cpp @@ -501,7 +501,7 @@ void runRdb(uint flags) PropModeReplace, (unsigned char *)stamp.buffer().data(), stamp.buffer().size()); - QApplication::flush(); + qApp->processEvents(); } #endif } diff --git a/kcms/translations/language.cpp b/kcms/translations/language.cpp index def5553fb..8d06bf058 100644 --- a/kcms/translations/language.cpp +++ b/kcms/translations/language.cpp @@ -103,7 +103,7 @@ public: { proc.setProgram("/usr/bin/check-language-support"); proc.setArguments({"--language", m_languageCode.left(m_languageCode.indexOf(QLatin1Char('@')))}); - connect(&proc, qOverload(&QProcess::finished), this, [this] { + connect(&proc, &QProcess::finished, this, [this] { const QString output = QString::fromUtf8(proc.readAllStandardOutput().simplified()); // Whenever we don't get packages back simply pretend the language is complete as we can't // give any useful information on what's wrong anyway. diff --git a/libtaskmanager/launchertasksmodel.cpp b/libtaskmanager/launchertasksmodel.cpp index 1cd68d596..94c0da27f 100644 --- a/libtaskmanager/launchertasksmodel.cpp +++ b/libtaskmanager/launchertasksmodel.cpp @@ -103,8 +103,7 @@ void LauncherTasksModel::Private::init() AbstractTasksModel::LauncherUrlWithoutIcon}); }); - void (KSycoca::*myDatabaseChangeSignal)() = &KSycoca::databaseChanged; - QObject::connect(KSycoca::self(), myDatabaseChangeSignal, q, [this]() { + QObject::connect(KSycoca::self(), &KSycoca::databaseChanged, q, [this]() { sycocaChangeTimer.start(); }); } diff --git a/libtaskmanager/xwindowtasksmodel.cpp b/libtaskmanager/xwindowtasksmodel.cpp index 56a669231..b3a86a8ee 100644 --- a/libtaskmanager/xwindowtasksmodel.cpp +++ b/libtaskmanager/xwindowtasksmodel.cpp @@ -121,8 +121,7 @@ void XWindowTasksModel::Private::init() QObject::connect(&sycocaChangeTimer, &QTimer::timeout, q, clearCacheAndRefresh); - void (KSycoca::*myDatabaseChangeSignal)() = &KSycoca::databaseChanged; - QObject::connect(KSycoca::self(), myDatabaseChangeSignal, q, [this]() { + QObject::connect(KSycoca::self(), &KSycoca::databaseChanged, q, [this]() { sycocaChangeTimer.start(); }); diff --git a/runners/kill/killrunner_config.cpp b/runners/kill/killrunner_config.cpp index e869aa823..f9f343287 100644 --- a/runners/kill/killrunner_config.cpp +++ b/runners/kill/killrunner_config.cpp @@ -35,7 +35,7 @@ KillRunnerConfig::KillRunnerConfig(QWidget *parent, const QVariantList &args) connect(m_ui->useTriggerWord, &QCheckBox::stateChanged, this, &KillRunnerConfig::markAsChanged); connect(m_ui->triggerWord, &KLineEdit::textChanged, this, &KillRunnerConfig::markAsChanged); - connect(m_ui->sorting, QOverload::of(&QComboBox::currentIndexChanged), this, &KillRunnerConfig::markAsChanged); + connect(m_ui->sorting, &QComboBox::currentIndexChanged, this, &KillRunnerConfig::markAsChanged); load(); } diff --git a/runners/webshortcuts/webshortcutrunner.cpp b/runners/webshortcuts/webshortcutrunner.cpp index 606088ec3..5c3d9baf5 100644 --- a/runners/webshortcuts/webshortcutrunner.cpp +++ b/runners/webshortcuts/webshortcutrunner.cpp @@ -31,7 +31,7 @@ WebshortcutRunner::WebshortcutRunner(QObject *parent, const KPluginMetaData &met sessionDbus.connect(QString(), QStringLiteral("/"), QStringLiteral("org.kde.KUriFilterPlugin"), QStringLiteral("configure"), this, SLOT(loadSyntaxes())); loadSyntaxes(); configurePrivateBrowsingActions(); - connect(KSycoca::self(), QOverload<>::of(&KSycoca::databaseChanged), this, &WebshortcutRunner::configurePrivateBrowsingActions); + connect(KSycoca::self(), &KSycoca::databaseChanged, this, &WebshortcutRunner::configurePrivateBrowsingActions); setMinLetterCount(3); } diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp index 1bb5583e8..39820baff 100644 --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -153,7 +153,7 @@ void ShellCorona::init() KGlobalAccel::self()->setGlobalShortcut(dashboardAction, Qt::CTRL | Qt::Key_F12); checkAddPanelAction(); - connect(KSycoca::self(), QOverload<>::of(&KSycoca::databaseChanged), this, &ShellCorona::checkAddPanelAction); + connect(KSycoca::self(), &KSycoca::databaseChanged, this, &ShellCorona::checkAddPanelAction); // Activity stuff QAction *activityAction = actions()->addAction(QStringLiteral("manage activities")); diff --git a/startkde/plasma-session/sessiontrack.cpp b/startkde/plasma-session/sessiontrack.cpp index 3d2c821c5..850422066 100644 --- a/startkde/plasma-session/sessiontrack.cpp +++ b/startkde/plasma-session/sessiontrack.cpp @@ -22,7 +22,7 @@ SessionTrack::SessionTrack(const QVector &processes) }); for (auto process : std::as_const(m_processes)) { - connect(process, QOverload::of(&QProcess::finished), this, [this] { + connect(process, &QProcess::finished, this, [this] { m_processes.removeAll(static_cast(sender())); }); } diff --git a/startkde/plasma-session/startup.cpp b/startkde/plasma-session/startup.cpp index fa7231abe..50ea86741 100644 --- a/startkde/plasma-session/startup.cpp +++ b/startkde/plasma-session/startup.cpp @@ -419,7 +419,7 @@ StartProcessJob::StartProcessJob(const QString &process, const QStringList &args env.insert(additionalEnv); m_process->setProcessEnvironment(env); - connect(m_process, QOverload::of(&QProcess::finished), [this](int exitCode) { + connect(m_process, &QProcess::finished, [this](int exitCode) { qCInfo(PLASMA_SESSION) << "process job " << m_process->program() << "finished with exit code " << exitCode; emitResult(); }); diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp index eaaa1cb49..97081efda 100644 --- a/startkde/startplasma.cpp +++ b/startkde/startplasma.cpp @@ -598,16 +598,13 @@ bool startPlasmaSession(bool wayland) } startPlasmaSession->setProcessChannelMode(QProcess::ForwardedChannels); - QObject::connect(startPlasmaSession.data(), - QOverload::of(&QProcess::finished), - &e, - [&rc](int exitCode, QProcess::ExitStatus) { - if (exitCode == 255) { - // Startup error - messageBox(QStringLiteral("startkde: Could not start plasma_session. Check your installation.\n")); - rc = false; - } - }); + QObject::connect(startPlasmaSession.data(), &QProcess::finished, &e, [&rc](int exitCode, QProcess::ExitStatus) { + if (exitCode == 255) { + // Startup error + messageBox(QStringLiteral("startkde: Could not start plasma_session. Check your installation.\n")); + rc = false; + } + }); startPlasmaSession->start(QStringLiteral(CMAKE_INSTALL_FULL_BINDIR "/plasma_session"), plasmaSessionOptions); } else {