Qt6 build fixes in plugins and KCM
This commit is contained in:
parent
b4b4837b14
commit
52b6d57942
20 changed files with 84 additions and 101 deletions
|
@ -108,7 +108,7 @@ QSet<QString> PluginLoader::pluginsForCapabilities(const QSet<QString> &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;
|
||||
}
|
||||
}
|
||||
|
|
35
kcm/kcm.cpp
35
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<QWidget *>(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"
|
||||
|
|
12
kcm/kcm.h
12
kcm/kcm.h
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <KCModule>
|
||||
#include <QStandardItemModel>
|
||||
#include <kconfigwidgets_version.h>
|
||||
|
||||
#include <core/pairstate.h>
|
||||
|
||||
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<QWidget *>(parent), args)
|
||||
#else
|
||||
: KCModule(parent)
|
||||
#endif
|
||||
, d(new KdeConnectPluginKcmPrivate())
|
||||
{
|
||||
d->m_deviceId = args.at(0).toString();
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define KDECONNECTPLUGINKCM_H
|
||||
|
||||
#include <KCModule>
|
||||
#include <kconfigwidgets_version.h>
|
||||
|
||||
#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<KdeConnectPluginKcmPrivate> d;
|
||||
};
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
K_PLUGIN_FACTORY(ClipboardConfigFactory, registerPlugin<ClipboardConfig>();)
|
||||
|
||||
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"
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
K_PLUGIN_FACTORY(FindThisDeviceConfigFactory, registerPlugin<FindThisDeviceConfig>();)
|
||||
|
||||
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()
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
K_PLUGIN_FACTORY(PauseMusicConfigFactory, registerPlugin<PauseMusicConfig>();)
|
||||
|
||||
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"
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
K_PLUGIN_FACTORY(ShareConfigFactory, registerPlugin<RunCommandConfig>();)
|
||||
|
||||
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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -13,14 +13,16 @@
|
|||
|
||||
K_PLUGIN_FACTORY(SendNotificationsConfigFactory, registerPlugin<SendNotificationsConfig>();)
|
||||
|
||||
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>("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<NotifyingApplication>(a));
|
||||
}
|
||||
config()->setList(QStringLiteral("applications"), list);
|
||||
KCModule::save();
|
||||
Q_EMIT changed(false);
|
||||
}
|
||||
|
||||
#include "sendnotifications_config.moc"
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
K_PLUGIN_FACTORY(ShareConfigFactory, registerPlugin<ShareConfig>();)
|
||||
|
||||
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"
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue