From 52b6d57942c86f59c29408f7b7e97797c384cc26 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Mon, 17 Apr 2023 19:10:08 +0200 Subject: [PATCH] Qt6 build fixes in plugins and KCM --- core/pluginloader.cpp | 2 +- kcm/kcm.cpp | 35 ++---------------- kcm/kcm.h | 12 ++++-- kcmplugin/CMakeLists.txt | 2 +- kcmplugin/kdeconnectpluginkcm.cpp | 8 +++- kcmplugin/kdeconnectpluginkcm.h | 10 ++++- plugins/clipboard/clipboard_config.cpp | 9 ++--- plugins/clipboard/clipboard_config.h | 2 +- .../findthisdevice/findthisdevice_config.cpp | 11 ++---- .../findthisdevice/findthisdevice_config.h | 2 +- plugins/pausemusic/pausemusic_config.cpp | 9 ++--- plugins/pausemusic/pausemusic_config.h | 2 +- plugins/runcommand/runcommand_config.cpp | 37 ++++++++----------- plugins/runcommand/runcommand_config.h | 2 +- .../sendnotifications_config.cpp | 12 +++--- .../sendnotifications_config.h | 2 +- plugins/sftp/sftpplugin.cpp | 8 +++- plugins/share/share_config.cpp | 13 ++----- plugins/share/share_config.h | 2 +- plugins/sms/CMakeLists.txt | 5 +++ 20 files changed, 84 insertions(+), 101 deletions(-) diff --git a/core/pluginloader.cpp b/core/pluginloader.cpp index a99064b03..990ed7745 100644 --- a/core/pluginloader.cpp +++ b/core/pluginloader.cpp @@ -108,7 +108,7 @@ QSet PluginLoader::pluginsForCapabilities(const QSet &incoming if (!supportedDeviceTypes.isEmpty()) { if (!supportedDeviceTypes.contains(myDeviceType)) { qCDebug(KDECONNECT_CORE) << "Not loading plugin" << service.pluginId() << "because this device of type" << myDeviceType - << "is not supported. Supports:" << supportedDeviceTypes.toList().join(QStringLiteral(", ")); + << "is not supported. Supports:" << supportedDeviceTypes.join(QStringLiteral(", ")); continue; } } diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp index d58bbb73f..7b5a1497d 100644 --- a/kcm/kcm.cpp +++ b/kcm/kcm.cpp @@ -27,32 +27,19 @@ static QString createId() return QStringLiteral("kcm") + QString::number(QCoreApplication::applicationPid()); } -KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList &args) - : KCModule(parent) +KdeConnectKcm::KdeConnectKcm(QObject *parent, const QVariantList &args) + : KCModule(qobject_cast(parent)) , kcmUi(new Ui::KdeConnectKcmUi()) , daemon(new DaemonDbusInterface(this)) , devicesModel(new DevicesModel(this)) , currentDevice(nullptr) { - KAboutData *about = new KAboutData(QStringLiteral("kdeconnect-kcm"), - i18n("KDE Connect Settings"), - QStringLiteral(KDECONNECT_VERSION_STRING), - i18n("KDE Connect Settings module"), - KAboutLicense::KAboutLicense::GPL_V2, - i18n("(C) 2015 Albert Vaca Cintora"), - QString(), - QStringLiteral("https://community.kde.org/KDEConnect")); - about->addAuthor(i18n("Albert Vaca Cintora")); - about->setProgramLogo(QIcon(QStringLiteral(":/icons/kdeconnect/kdeconnect.svg"))); - - setAboutData(about); - #ifdef Q_OS_WIN KColorSchemeManager manager; QApplication::setStyle(QStringLiteral("breeze")); #endif - kcmUi->setupUi(this); + kcmUi->setupUi(widget()); sortProxyModel = new DevicesSortProxyModel(devicesModel); @@ -95,8 +82,6 @@ KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList &args) connect(kcmUi->renameShow_button, &QAbstractButton::clicked, this, &KdeConnectKcm::renameShow); connect(kcmUi->pluginSelector, &KPluginWidget::changed, this, &KdeConnectKcm::pluginsConfigChanged); -#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 45, 0) - if (!args.isEmpty() && args.first().type() == QVariant::String) { const QString input = args.first().toString(); const auto colonIdx = input.indexOf(QLatin1Char(':')); @@ -115,8 +100,6 @@ KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList &args) disconnect(devicesModel, &DevicesModel::rowsInserted, this, nullptr); }); } - -#endif } void KdeConnectKcm::renameShow() @@ -226,7 +209,7 @@ void KdeConnectKcm::resetDeviceView() KSharedConfigPtr deviceConfig = KSharedConfig::openConfig(currentDevice->pluginsConfigFile()); kcmUi->pluginSelector->clear(); - kcmUi->pluginSelector->setConfigurationArguments(QStringList(currentDevice->id())); + kcmUi->pluginSelector->setConfigurationArguments({currentDevice->id()}); kcmUi->pluginSelector->addPlugins(availablePluginInfo, i18n("Available plugins")); kcmUi->pluginSelector->setConfig(deviceConfig->group("Plugins")); } @@ -328,15 +311,5 @@ void KdeConnectKcm::sendPing() currentDevice->pluginCall(QStringLiteral("ping"), QStringLiteral("sendPing")); } -QSize KdeConnectKcm::sizeHint() const -{ - return QSize(890, 550); // Golden ratio :D -} - -QSize KdeConnectKcm::minimumSizeHint() const -{ - return QSize(500, 300); -} - #include "kcm.moc" #include "moc_kcm.cpp" diff --git a/kcm/kcm.h b/kcm/kcm.h index 4a459b6ba..6527c5dfb 100644 --- a/kcm/kcm.h +++ b/kcm/kcm.h @@ -9,6 +9,7 @@ #include #include +#include #include @@ -27,13 +28,18 @@ class KdeConnectKcm : public KCModule { Q_OBJECT public: - KdeConnectKcm(QWidget *parent, const QVariantList &); + KdeConnectKcm(QObject *parent, const QVariantList &); ~KdeConnectKcm() override; +#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 105, 0) + QWidget *widget() + { + return this; + } +#endif + private: void save() override; - QSize sizeHint() const override; - QSize minimumSizeHint() const override; private Q_SLOTS: void deviceSelected(const QModelIndex ¤t); diff --git a/kcmplugin/CMakeLists.txt b/kcmplugin/CMakeLists.txt index 266e091a2..8646233a6 100644 --- a/kcmplugin/CMakeLists.txt +++ b/kcmplugin/CMakeLists.txt @@ -4,12 +4,12 @@ add_library(kdeconnectpluginkcm kdeconnectpluginkcm.cpp) target_link_libraries(kdeconnectpluginkcm PUBLIC kdeconnectcore + KF${QT_MAJOR_VERSION}::KCMUtils PRIVATE Qt::DBus Qt::Gui KF${QT_MAJOR_VERSION}::I18n KF${QT_MAJOR_VERSION}::ConfigCore - KF${QT_MAJOR_VERSION}::KCMUtils ) set_target_properties(kdeconnectpluginkcm PROPERTIES diff --git a/kcmplugin/kdeconnectpluginkcm.cpp b/kcmplugin/kdeconnectpluginkcm.cpp index 99a525c2a..b4b3cdd12 100644 --- a/kcmplugin/kdeconnectpluginkcm.cpp +++ b/kcmplugin/kdeconnectpluginkcm.cpp @@ -15,8 +15,12 @@ struct KdeConnectPluginKcmPrivate { KdeConnectPluginConfig *m_config = nullptr; }; -KdeConnectPluginKcm::KdeConnectPluginKcm(QWidget *parent, const QVariantList &args, const QString &pluginName) - : KCModule(parent, args) +KdeConnectPluginKcm::KdeConnectPluginKcm(QObject *parent, const QVariantList &args, const QString &pluginName) +#if QT_VERSION_MAJOR < 6 + : KCModule(qobject_cast(parent), args) +#else + : KCModule(parent) +#endif , d(new KdeConnectPluginKcmPrivate()) { d->m_deviceId = args.at(0).toString(); diff --git a/kcmplugin/kdeconnectpluginkcm.h b/kcmplugin/kdeconnectpluginkcm.h index 15f692120..7c34b7d45 100644 --- a/kcmplugin/kdeconnectpluginkcm.h +++ b/kcmplugin/kdeconnectpluginkcm.h @@ -8,6 +8,7 @@ #define KDECONNECTPLUGINKCM_H #include +#include #include "core/kdeconnectpluginconfig.h" #include "kdeconnectpluginkcm_export.h" @@ -23,7 +24,7 @@ class KDECONNECTPLUGINKCM_EXPORT KdeConnectPluginKcm : public KCModule Q_OBJECT public: - KdeConnectPluginKcm(QWidget *parent, const QVariantList &args, const QString &componentName); + KdeConnectPluginKcm(QObject *parent, const QVariantList &args, const QString &componentName); ~KdeConnectPluginKcm() override; /** @@ -36,6 +37,13 @@ public: */ KdeConnectPluginConfig *config() const; +#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 105, 0) + QWidget *widget() + { + return this; + } +#endif + private: QScopedPointer d; }; diff --git a/plugins/clipboard/clipboard_config.cpp b/plugins/clipboard/clipboard_config.cpp index 2fd9f4fe7..d3c955fe2 100644 --- a/plugins/clipboard/clipboard_config.cpp +++ b/plugins/clipboard/clipboard_config.cpp @@ -11,11 +11,11 @@ K_PLUGIN_FACTORY(ClipboardConfigFactory, registerPlugin();) -ClipboardConfig::ClipboardConfig(QWidget *parent, const QVariantList &args) +ClipboardConfig::ClipboardConfig(QObject *parent, const QVariantList &args) : KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_clipboard")) , m_ui(new Ui::ClipboardConfigUi()) { - m_ui->setupUi(this); + 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())); @@ -29,7 +29,7 @@ ClipboardConfig::~ClipboardConfig() void ClipboardConfig::autoShareChanged() { m_ui->check_password->setEnabled(m_ui->check_autoshare->isChecked()); - Q_EMIT changed(); + markAsChanged(); } void ClipboardConfig::defaults() @@ -37,7 +37,7 @@ void ClipboardConfig::defaults() KCModule::defaults(); m_ui->check_autoshare->setChecked(true); m_ui->check_password->setChecked(true); - Q_EMIT changed(true); + markAsChanged(); } void ClipboardConfig::load() @@ -56,7 +56,6 @@ void ClipboardConfig::save() config()->set(QStringLiteral("autoShare"), m_ui->check_autoshare->isChecked()); config()->set(QStringLiteral("sendPassword"), m_ui->check_password->isChecked()); KCModule::save(); - Q_EMIT changed(false); } #include "clipboard_config.moc" diff --git a/plugins/clipboard/clipboard_config.h b/plugins/clipboard/clipboard_config.h index 626ece4d2..601aa4f6a 100644 --- a/plugins/clipboard/clipboard_config.h +++ b/plugins/clipboard/clipboard_config.h @@ -18,7 +18,7 @@ class ClipboardConfig : public KdeConnectPluginKcm { Q_OBJECT public: - ClipboardConfig(QWidget *parent, const QVariantList &); + ClipboardConfig(QObject *parent, const QVariantList &); ~ClipboardConfig() override; public Q_SLOTS: diff --git a/plugins/findthisdevice/findthisdevice_config.cpp b/plugins/findthisdevice/findthisdevice_config.cpp index 5fb932044..fa18827a1 100644 --- a/plugins/findthisdevice/findthisdevice_config.cpp +++ b/plugins/findthisdevice/findthisdevice_config.cpp @@ -17,11 +17,11 @@ K_PLUGIN_FACTORY(FindThisDeviceConfigFactory, registerPlugin();) -FindThisDeviceConfig::FindThisDeviceConfig(QWidget *parent, const QVariantList &args) +FindThisDeviceConfig::FindThisDeviceConfig(QObject *parent, const QVariantList &args) : KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_findthisdevice")) , m_ui(new Ui::FindThisDeviceConfigUi()) { - m_ui->setupUi(this); + m_ui->setupUi(widget()); const QStringList soundDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("sounds"), QStandardPaths::LocateDirectory); if (!soundDirs.isEmpty()) { @@ -42,8 +42,7 @@ void FindThisDeviceConfig::defaults() KCModule::defaults(); m_ui->soundFileRequester->setText(defaultSound()); - - Q_EMIT changed(true); + markAsChanged(); } void FindThisDeviceConfig::load() @@ -52,8 +51,6 @@ void FindThisDeviceConfig::load() const QString ringTone = config()->getString(QStringLiteral("ringtone"), defaultSound()); m_ui->soundFileRequester->setText(ringTone); - - Q_EMIT changed(false); } void FindThisDeviceConfig::save() @@ -61,8 +58,6 @@ void FindThisDeviceConfig::save() config()->set(QStringLiteral("ringtone"), m_ui->soundFileRequester->text()); KCModule::save(); - - Q_EMIT changed(false); } void FindThisDeviceConfig::playSound() diff --git a/plugins/findthisdevice/findthisdevice_config.h b/plugins/findthisdevice/findthisdevice_config.h index ff3ec7f49..6f8d669e2 100644 --- a/plugins/findthisdevice/findthisdevice_config.h +++ b/plugins/findthisdevice/findthisdevice_config.h @@ -18,7 +18,7 @@ class FindThisDeviceConfig : public KdeConnectPluginKcm { Q_OBJECT public: - FindThisDeviceConfig(QWidget *parent, const QVariantList &); + FindThisDeviceConfig(QObject *parent, const QVariantList &); ~FindThisDeviceConfig() override; public Q_SLOTS: diff --git a/plugins/pausemusic/pausemusic_config.cpp b/plugins/pausemusic/pausemusic_config.cpp index f44aea815..4cab94c4f 100644 --- a/plugins/pausemusic/pausemusic_config.cpp +++ b/plugins/pausemusic/pausemusic_config.cpp @@ -11,11 +11,11 @@ K_PLUGIN_FACTORY(PauseMusicConfigFactory, registerPlugin();) -PauseMusicConfig::PauseMusicConfig(QWidget *parent, const QVariantList &args) +PauseMusicConfig::PauseMusicConfig(QObject *parent, const QVariantList &args) : KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_pausemusic")) , m_ui(new Ui::PauseMusicConfigUi()) { - m_ui->setupUi(this); + 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())); @@ -37,7 +37,7 @@ void PauseMusicConfig::defaults() m_ui->check_pause->setChecked(true); m_ui->check_mute->setChecked(false); m_ui->check_resume->setChecked(true); - Q_EMIT changed(true); + markAsChanged(); } void PauseMusicConfig::load() @@ -54,8 +54,6 @@ void PauseMusicConfig::load() const bool autoResume = config()->getBool(QStringLiteral("actionResume"), true); m_ui->check_resume->setChecked(autoResume); - - Q_EMIT changed(false); } void PauseMusicConfig::save() @@ -65,7 +63,6 @@ void PauseMusicConfig::save() config()->set(QStringLiteral("actionMute"), m_ui->check_mute->isChecked()); config()->set(QStringLiteral("actionResume"), m_ui->check_resume->isChecked()); KCModule::save(); - Q_EMIT changed(false); } #include "pausemusic_config.moc" diff --git a/plugins/pausemusic/pausemusic_config.h b/plugins/pausemusic/pausemusic_config.h index b4bf17591..371381ddb 100644 --- a/plugins/pausemusic/pausemusic_config.h +++ b/plugins/pausemusic/pausemusic_config.h @@ -18,7 +18,7 @@ class PauseMusicConfig : public KdeConnectPluginKcm { Q_OBJECT public: - PauseMusicConfig(QWidget *parent, const QVariantList &); + PauseMusicConfig(QObject *parent, const QVariantList &); ~PauseMusicConfig() override; public Q_SLOTS: diff --git a/plugins/runcommand/runcommand_config.cpp b/plugins/runcommand/runcommand_config.cpp index 9b102633b..bead9f3c7 100644 --- a/plugins/runcommand/runcommand_config.cpp +++ b/plugins/runcommand/runcommand_config.cpp @@ -26,7 +26,7 @@ K_PLUGIN_FACTORY(ShareConfigFactory, registerPlugin();) -RunCommandConfig::RunCommandConfig(QWidget *parent, const QVariantList &args) +RunCommandConfig::RunCommandConfig(QObject *parent, const QVariantList &args) : KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_runcommand")) { // The qdbus executable name is different on some systems @@ -35,7 +35,7 @@ RunCommandConfig::RunCommandConfig(QWidget *parent, const QVariantList &args) qdbusExe = QStringLiteral("qdbus"); } - QMenu *defaultMenu = new QMenu(this); + QMenu *defaultMenu = new QMenu(widget()); #ifdef Q_OS_WIN addSuggestedCommand(defaultMenu, i18n("Schedule a shutdown"), QStringLiteral("shutdown /s /t 60")); @@ -67,25 +67,25 @@ RunCommandConfig::RunCommandConfig(QWidget *parent, const QVariantList &args) QStringLiteral("%0 org.kde.kded5 /modules/plasmavault forceCloseAllVaults").arg(qdbusExe)); #endif - QTableView *table = new QTableView(this); + QTableView *table = new QTableView(widget()); table->horizontalHeader()->setStretchLastSection(true); table->verticalHeader()->setVisible(false); - QVBoxLayout *layout = new QVBoxLayout(this); + QVBoxLayout *layout = new QVBoxLayout(widget()); layout->addWidget(table); - QPushButton *button = new QPushButton(QIcon::fromTheme(QStringLiteral("list-add")), i18n("Sample commands"), this); + QPushButton *button = new QPushButton(QIcon::fromTheme(QStringLiteral("list-add")), i18n("Sample commands"), widget()); button->setMenu(defaultMenu); layout->addWidget(button); - QHBoxLayout *importExportLayout = new QHBoxLayout(this); - QPushButton *exportButton = new QPushButton(i18n("Export"), this); + QHBoxLayout *importExportLayout = new QHBoxLayout(widget()); + QPushButton *exportButton = new QPushButton(i18n("Export"), widget()); importExportLayout->addWidget(exportButton); connect(exportButton, &QPushButton::clicked, this, &RunCommandConfig::exportCommands); - QPushButton *importButton = new QPushButton(i18n("Import"), this); + QPushButton *importButton = new QPushButton(i18n("Import"), widget()); importExportLayout->addWidget(importButton); connect(importButton, &QPushButton::clicked, this, &RunCommandConfig::importCommands); layout->addLayout(importExportLayout); - setLayout(layout); + widget()->setLayout(layout); m_entriesModel = new QStandardItemModel(this); table->setModel(m_entriesModel); @@ -99,7 +99,7 @@ RunCommandConfig::~RunCommandConfig() void RunCommandConfig::exportCommands() { - QString filePath = QFileDialog::getSaveFileName(this, i18n("Export Commands"), QDir::homePath(), QStringLiteral("JSON (*.json)")); + QString filePath = QFileDialog::getSaveFileName(widget(), i18n("Export Commands"), QDir::homePath(), QStringLiteral("JSON (*.json)")); if (filePath.isEmpty()) return; @@ -124,7 +124,7 @@ void RunCommandConfig::exportCommands() void RunCommandConfig::importCommands() { - QString filePath = QFileDialog::getOpenFileName(this, i18n("Import Commands"), QDir::homePath(), QStringLiteral("JSON (*.json)")); + QString filePath = QFileDialog::getOpenFileName(widget(), i18n("Import Commands"), QDir::homePath(), QStringLiteral("JSON (*.json)")); if (filePath.isEmpty()) return; @@ -155,7 +155,7 @@ void RunCommandConfig::importCommands() insertRow(m_entriesModel->rowCount(), name, command); } - Q_EMIT changed(true); + markAsChanged(); } void RunCommandConfig::addSuggestedCommand(QMenu *menu, const QString &name, const QString &command) @@ -163,7 +163,7 @@ void RunCommandConfig::addSuggestedCommand(QMenu *menu, const QString &name, con auto action = new QAction(name); connect(action, &QAction::triggered, action, [this, name, command]() { insertRow(0, name, command); - Q_EMIT changed(true); + markAsChanged(); }); menu->addAction(action); } @@ -173,7 +173,7 @@ void RunCommandConfig::defaults() KCModule::defaults(); m_entriesModel->removeRows(0, m_entriesModel->rowCount()); - Q_EMIT changed(true); + markAsChanged(); } void RunCommandConfig::load() @@ -201,12 +201,11 @@ void RunCommandConfig::load() insertEmptyRow(); connect(m_entriesModel, &QAbstractItemModel::dataChanged, this, &RunCommandConfig::onDataChanged); - - Q_EMIT changed(false); } void RunCommandConfig::save() { + KCModule::save(); QJsonObject jsonConfig; for (int i = 0; i < m_entriesModel->rowCount(); i++) { QString key = m_entriesModel->item(i, 0)->data().toString(); @@ -229,10 +228,6 @@ void RunCommandConfig::save() QJsonDocument document; document.setObject(jsonConfig); config()->set(QStringLiteral("commands"), document.toJson(QJsonDocument::Compact)); - - KCModule::save(); - - Q_EMIT changed(false); } void RunCommandConfig::insertEmptyRow() @@ -252,7 +247,7 @@ void RunCommandConfig::insertRow(int i, const QString &name, const QString &comm void RunCommandConfig::onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) { - Q_EMIT changed(true); + markAsChanged(); Q_UNUSED(topLeft); if (bottomRight.row() == m_entriesModel->rowCount() - 1) { // TODO check both entries are still empty diff --git a/plugins/runcommand/runcommand_config.h b/plugins/runcommand/runcommand_config.h index fdef808d9..72ba0c0f2 100644 --- a/plugins/runcommand/runcommand_config.h +++ b/plugins/runcommand/runcommand_config.h @@ -16,7 +16,7 @@ class RunCommandConfig : public KdeConnectPluginKcm { Q_OBJECT public: - RunCommandConfig(QWidget *parent, const QVariantList &); + RunCommandConfig(QObject *parent, const QVariantList &); ~RunCommandConfig() override; public Q_SLOTS: diff --git a/plugins/sendnotifications/sendnotifications_config.cpp b/plugins/sendnotifications/sendnotifications_config.cpp index ed9ebc2f2..74312bfdb 100644 --- a/plugins/sendnotifications/sendnotifications_config.cpp +++ b/plugins/sendnotifications/sendnotifications_config.cpp @@ -13,14 +13,16 @@ K_PLUGIN_FACTORY(SendNotificationsConfigFactory, registerPlugin();) -SendNotificationsConfig::SendNotificationsConfig(QWidget *parent, const QVariantList &args) +SendNotificationsConfig::SendNotificationsConfig(QObject *parent, const QVariantList &args) : KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_sendnotifications")) , m_ui(new Ui::SendNotificationsConfigUi()) , appModel(new NotifyingApplicationModel) { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) qRegisterMetaTypeStreamOperators("NotifyingApplication"); +#endif - m_ui->setupUi(this); + m_ui->setupUi(widget()); m_ui->appList->setIconSize(QSize(32, 32)); m_ui->appList->setModel(appModel); @@ -55,7 +57,7 @@ void SendNotificationsConfig::defaults() m_ui->spin_urgency->setValue(0); m_ui->check_body->setChecked(true); m_ui->check_icons->setChecked(true); - Q_EMIT changed(true); + markAsChanged(); } void SendNotificationsConfig::loadApplications() @@ -83,11 +85,11 @@ void SendNotificationsConfig::load() m_ui->spin_urgency->setValue(urgency); loadApplications(); - Q_EMIT changed(false); } void SendNotificationsConfig::save() { + KCModule::save(); config()->set(QStringLiteral("generalPersistent"), m_ui->check_persistent->isChecked()); config()->set(QStringLiteral("generalIncludeBody"), m_ui->check_body->isChecked()); config()->set(QStringLiteral("generalSynchronizeIcons"), m_ui->check_icons->isChecked()); @@ -100,8 +102,6 @@ void SendNotificationsConfig::save() list.append(QVariant::fromValue(a)); } config()->setList(QStringLiteral("applications"), list); - KCModule::save(); - Q_EMIT changed(false); } #include "sendnotifications_config.moc" diff --git a/plugins/sendnotifications/sendnotifications_config.h b/plugins/sendnotifications/sendnotifications_config.h index e101211a6..d7989e355 100644 --- a/plugins/sendnotifications/sendnotifications_config.h +++ b/plugins/sendnotifications/sendnotifications_config.h @@ -20,7 +20,7 @@ class SendNotificationsConfig : public KdeConnectPluginKcm { Q_OBJECT public: - SendNotificationsConfig(QWidget *parent, const QVariantList &); + SendNotificationsConfig(QObject *parent, const QVariantList &); ~SendNotificationsConfig() override; public Q_SLOTS: diff --git a/plugins/sftp/sftpplugin.cpp b/plugins/sftp/sftpplugin.cpp index 8a76c43b3..f98e45d83 100644 --- a/plugins/sftp/sftpplugin.cpp +++ b/plugins/sftp/sftpplugin.cpp @@ -123,7 +123,13 @@ bool SftpPlugin::startBrowsing() bool SftpPlugin::receivePacket(const NetworkPacket &np) { - if (!(fields_c - np.body().keys().toSet()).isEmpty() && !np.has(QStringLiteral("errorMessage"))) { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + const auto keys = np.body().keys().toSet(); +#else + const QStringList keysList = np.body().keys(); + const auto keys = QSet(keysList.begin(), keysList.end()); +#endif + if (!(fields_c - keys).isEmpty() && !np.has(QStringLiteral("errorMessage"))) { // packet is invalid return false; } diff --git a/plugins/share/share_config.cpp b/plugins/share/share_config.cpp index 41462c294..ba615bcf4 100644 --- a/plugins/share/share_config.cpp +++ b/plugins/share/share_config.cpp @@ -14,11 +14,11 @@ K_PLUGIN_FACTORY(ShareConfigFactory, registerPlugin();) -ShareConfig::ShareConfig(QWidget *parent, const QVariantList &args) +ShareConfig::ShareConfig(QObject *parent, const QVariantList &args) : KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_share")) , m_ui(new Ui::ShareConfigUi()) { - m_ui->setupUi(this); + m_ui->setupUi(widget()); // xgettext:no-c-format m_ui->commentLabel->setTextFormat(Qt::RichText); m_ui->commentLabel->setText(i18n("%1 in the path will be replaced with the specific device name.")); @@ -37,7 +37,7 @@ void ShareConfig::defaults() m_ui->kurlrequester->setText(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)); - Q_EMIT changed(true); + markAsChanged(); } void ShareConfig::load() @@ -46,17 +46,12 @@ void ShareConfig::load() const auto standardPath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation); m_ui->kurlrequester->setText(config()->getString(QStringLiteral("incoming_path"), standardPath)); - - Q_EMIT changed(false); } void ShareConfig::save() { - config()->set(QStringLiteral("incoming_path"), m_ui->kurlrequester->text()); - KCModule::save(); - - Q_EMIT changed(false); + config()->set(QStringLiteral("incoming_path"), m_ui->kurlrequester->text()); } #include "share_config.moc" diff --git a/plugins/share/share_config.h b/plugins/share/share_config.h index 3249d3c70..92436d9d0 100644 --- a/plugins/share/share_config.h +++ b/plugins/share/share_config.h @@ -18,7 +18,7 @@ class ShareConfig : public KdeConnectPluginKcm { Q_OBJECT public: - ShareConfig(QWidget *parent, const QVariantList &); + ShareConfig(QObject *parent, const QVariantList &); ~ShareConfig() override; public Q_SLOTS: diff --git a/plugins/sms/CMakeLists.txt b/plugins/sms/CMakeLists.txt index 6aaff1292..5ae050d17 100644 --- a/plugins/sms/CMakeLists.txt +++ b/plugins/sms/CMakeLists.txt @@ -28,3 +28,8 @@ target_link_libraries(kdeconnect_sms KF${QT_MAJOR_VERSION}::Notifications Qt::Widgets ) + +if (QT_MAJOR_VERSION STREQUAL "6") + find_package(Qt6 REQUIRED COMPONENTS Core5Compat) + target_link_libraries(kdeconnect_sms Qt::Core5Compat) # for QTextCodec +endif()