From 35a450f3663bb643765abf347616832ab781247e Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Thu, 20 Jul 2023 17:22:29 +0300 Subject: [PATCH] Port to new PMF connect syntax This way we catch missing methods/mismatching arguments at compile and not at runtime. This fixes some Qt6 regressions due to the removal of deprecated methods. --- plugins/clipboard/clipboard_config.cpp | 4 ++-- plugins/clipboard/clipboard_config.h | 3 +-- plugins/pausemusic/pausemusic_config.cpp | 10 +++++----- plugins/runcommand/runcommand_config.h | 3 +-- .../sendnotifications/sendnotifications_config.cpp | 12 ++++++------ plugins/share/shareplugin.cpp | 2 +- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/plugins/clipboard/clipboard_config.cpp b/plugins/clipboard/clipboard_config.cpp index d3c955fe2..72f50d394 100644 --- a/plugins/clipboard/clipboard_config.cpp +++ b/plugins/clipboard/clipboard_config.cpp @@ -17,8 +17,8 @@ ClipboardConfig::ClipboardConfig(QObject *parent, const QVariantList &args) { m_ui->setupUi(widget()); - connect(m_ui->check_autoshare, SIGNAL(toggled(bool)), this, SLOT(autoShareChanged())); - connect(m_ui->check_password, SIGNAL(toggled(bool)), this, SLOT(changed())); + connect(m_ui->check_autoshare, &QCheckBox::toggled, this, &ClipboardConfig::autoShareChanged); + connect(m_ui->check_password, &QCheckBox::toggled, this, &ClipboardConfig::markAsChanged); } ClipboardConfig::~ClipboardConfig() diff --git a/plugins/clipboard/clipboard_config.h b/plugins/clipboard/clipboard_config.h index 1252c10e4..e30a98b29 100644 --- a/plugins/clipboard/clipboard_config.h +++ b/plugins/clipboard/clipboard_config.h @@ -24,10 +24,9 @@ public: void save() override; void load() override; void defaults() override; -public Q_SLOTS: - void autoShareChanged(); private: + void autoShareChanged(); Ui::ClipboardConfigUi *m_ui; }; diff --git a/plugins/pausemusic/pausemusic_config.cpp b/plugins/pausemusic/pausemusic_config.cpp index 4cab94c4f..397ac89f6 100644 --- a/plugins/pausemusic/pausemusic_config.cpp +++ b/plugins/pausemusic/pausemusic_config.cpp @@ -17,11 +17,11 @@ PauseMusicConfig::PauseMusicConfig(QObject *parent, const QVariantList &args) { m_ui->setupUi(widget()); - connect(m_ui->rad_ringing, SIGNAL(toggled(bool)), this, SLOT(changed())); - connect(m_ui->rad_talking, SIGNAL(toggled(bool)), this, SLOT(changed())); - connect(m_ui->check_pause, SIGNAL(toggled(bool)), this, SLOT(changed())); - connect(m_ui->check_mute, SIGNAL(toggled(bool)), this, SLOT(changed())); - connect(m_ui->check_resume, SIGNAL(toggled(bool)), this, SLOT(changed())); + connect(m_ui->rad_ringing, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged); + connect(m_ui->rad_talking, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged); + connect(m_ui->check_pause, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged); + connect(m_ui->check_mute, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged); + connect(m_ui->check_resume, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged); } PauseMusicConfig::~PauseMusicConfig() diff --git a/plugins/runcommand/runcommand_config.h b/plugins/runcommand/runcommand_config.h index 17fa745e9..8d1429614 100644 --- a/plugins/runcommand/runcommand_config.h +++ b/plugins/runcommand/runcommand_config.h @@ -22,12 +22,11 @@ public: void load() override; void defaults() override; -private Q_SLOTS: +private: void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); void exportCommands(); void importCommands(); -private: void addSuggestedCommand(QMenu *menu, const QString &name, const QString &command); void insertRow(int i, const QString &name, const QString &command); void insertEmptyRow(); diff --git a/plugins/sendnotifications/sendnotifications_config.cpp b/plugins/sendnotifications/sendnotifications_config.cpp index 74312bfdb..2ab9ba7be 100644 --- a/plugins/sendnotifications/sendnotifications_config.cpp +++ b/plugins/sendnotifications/sendnotifications_config.cpp @@ -33,14 +33,14 @@ SendNotificationsConfig::SendNotificationsConfig(QObject *parent, const QVariant for (int i = 0; i < 3; i++) m_ui->appList->resizeColumnToContents(i); - connect(m_ui->appList->horizontalHeader(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), m_ui->appList, SLOT(sortByColumn(int))); + connect(m_ui->appList->horizontalHeader(), &QHeaderView::sortIndicatorChanged, m_ui->appList, &QTableView::sortByColumn); - connect(m_ui->check_persistent, SIGNAL(toggled(bool)), this, SLOT(changed())); - connect(m_ui->spin_urgency, SIGNAL(editingFinished()), this, SLOT(changed())); - connect(m_ui->check_body, SIGNAL(toggled(bool)), this, SLOT(changed())); - connect(m_ui->check_icons, SIGNAL(toggled(bool)), this, SLOT(changed())); + connect(m_ui->check_persistent, &QCheckBox::toggled, this, &SendNotificationsConfig::markAsChanged); + connect(m_ui->spin_urgency, &QSpinBox::editingFinished, this, &SendNotificationsConfig::markAsChanged); + connect(m_ui->check_body, &QCheckBox::toggled, this, &SendNotificationsConfig::markAsChanged); + connect(m_ui->check_icons, &QCheckBox::toggled, this, &SendNotificationsConfig::markAsChanged); - connect(appModel, SIGNAL(applicationsChanged()), this, SLOT(changed())); + connect(appModel, &NotifyingApplicationModel::applicationsChanged, this, &SendNotificationsConfig::markAsChanged); connect(config(), &KdeConnectPluginConfig::configChanged, this, &SendNotificationsConfig::loadApplications); } diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp index 7de6e1706..8d4a711a4 100644 --- a/plugins/share/shareplugin.cpp +++ b/plugins/share/shareplugin.cpp @@ -174,7 +174,7 @@ bool SharePlugin::receivePacket(const NetworkPacket &np) if (defaultApp == QLatin1String("org.kde.kate") || defaultApp == QLatin1String("org.kde.kwrite")) { QProcess *proc = new QProcess(); - connect(proc, SIGNAL(finished(int)), proc, SLOT(deleteLater())); + connect(proc, &QProcess::finished, proc, &QObject::deleteLater); proc->start(defaultApp.section(QStringLiteral("."), 2, 2), QStringList(QStringLiteral("--stdin"))); proc->write(text.toUtf8()); proc->closeWriteChannel();