Qt6 build fixes in plugins and KCM
This commit is contained in:
parent
a5a375d7d9
commit
5dcb60eb99
15 changed files with 58 additions and 90 deletions
33
kcm/kcm.cpp
33
kcm/kcm.cpp
|
@ -27,32 +27,19 @@ static QString createId()
|
||||||
return QStringLiteral("kcm") + QString::number(QCoreApplication::applicationPid());
|
return QStringLiteral("kcm") + QString::number(QCoreApplication::applicationPid());
|
||||||
}
|
}
|
||||||
|
|
||||||
KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList &args)
|
KdeConnectKcm::KdeConnectKcm(QObject *parent, const QVariantList &args)
|
||||||
: KCModule(parent)
|
: KCModule(parent)
|
||||||
, kcmUi(new Ui::KdeConnectKcmUi())
|
, kcmUi(new Ui::KdeConnectKcmUi())
|
||||||
, daemon(new DaemonDbusInterface(this))
|
, daemon(new DaemonDbusInterface(this))
|
||||||
, devicesModel(new DevicesModel(this))
|
, devicesModel(new DevicesModel(this))
|
||||||
, currentDevice(nullptr)
|
, 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
|
#ifdef Q_OS_WIN
|
||||||
KColorSchemeManager manager;
|
KColorSchemeManager manager;
|
||||||
QApplication::setStyle(QStringLiteral("breeze"));
|
QApplication::setStyle(QStringLiteral("breeze"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
kcmUi->setupUi(this);
|
kcmUi->setupUi(widget());
|
||||||
|
|
||||||
sortProxyModel = new DevicesSortProxyModel(devicesModel);
|
sortProxyModel = new DevicesSortProxyModel(devicesModel);
|
||||||
|
|
||||||
|
@ -95,8 +82,6 @@ KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList &args)
|
||||||
|
|
||||||
daemon->acquireDiscoveryMode(createId());
|
daemon->acquireDiscoveryMode(createId());
|
||||||
|
|
||||||
#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 45, 0)
|
|
||||||
|
|
||||||
if (!args.isEmpty() && args.first().type() == QVariant::String) {
|
if (!args.isEmpty() && args.first().type() == QVariant::String) {
|
||||||
const QString input = args.first().toString();
|
const QString input = args.first().toString();
|
||||||
const auto colonIdx = input.indexOf(QLatin1Char(':'));
|
const auto colonIdx = input.indexOf(QLatin1Char(':'));
|
||||||
|
@ -115,8 +100,6 @@ KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList &args)
|
||||||
disconnect(devicesModel, &DevicesModel::rowsInserted, this, nullptr);
|
disconnect(devicesModel, &DevicesModel::rowsInserted, this, nullptr);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KdeConnectKcm::renameShow()
|
void KdeConnectKcm::renameShow()
|
||||||
|
@ -251,7 +234,7 @@ void KdeConnectKcm::resetDeviceView()
|
||||||
|
|
||||||
KSharedConfigPtr deviceConfig = KSharedConfig::openConfig(currentDevice->pluginsConfigFile());
|
KSharedConfigPtr deviceConfig = KSharedConfig::openConfig(currentDevice->pluginsConfigFile());
|
||||||
kcmUi->pluginSelector->clear();
|
kcmUi->pluginSelector->clear();
|
||||||
kcmUi->pluginSelector->setConfigurationArguments(QStringList(currentDevice->id()));
|
kcmUi->pluginSelector->setConfigurationArguments({currentDevice->id()});
|
||||||
kcmUi->pluginSelector->addPlugins(availablePluginInfo, i18n("Available plugins"));
|
kcmUi->pluginSelector->addPlugins(availablePluginInfo, i18n("Available plugins"));
|
||||||
kcmUi->pluginSelector->setConfig(deviceConfig->group("Plugins"));
|
kcmUi->pluginSelector->setConfig(deviceConfig->group("Plugins"));
|
||||||
connect(kcmUi->pluginSelector, &KPluginWidget::changed, this, &KdeConnectKcm::pluginsConfigChanged);
|
connect(kcmUi->pluginSelector, &KPluginWidget::changed, this, &KdeConnectKcm::pluginsConfigChanged);
|
||||||
|
@ -362,15 +345,5 @@ void KdeConnectKcm::sendPing()
|
||||||
currentDevice->pluginCall(QStringLiteral("ping"), QStringLiteral("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 "kcm.moc"
|
||||||
#include "moc_kcm.cpp"
|
#include "moc_kcm.cpp"
|
||||||
|
|
|
@ -25,13 +25,11 @@ class KdeConnectKcm : public KCModule
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
KdeConnectKcm(QWidget *parent, const QVariantList &);
|
KdeConnectKcm(QObject *parent, const QVariantList &);
|
||||||
~KdeConnectKcm() override;
|
~KdeConnectKcm() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void save() override;
|
void save() override;
|
||||||
QSize sizeHint() const override;
|
|
||||||
QSize minimumSizeHint() const override;
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void deviceSelected(const QModelIndex ¤t);
|
void deviceSelected(const QModelIndex ¤t);
|
||||||
|
|
|
@ -4,12 +4,12 @@ add_library(kdeconnectpluginkcm kdeconnectpluginkcm.cpp)
|
||||||
target_link_libraries(kdeconnectpluginkcm
|
target_link_libraries(kdeconnectpluginkcm
|
||||||
PUBLIC
|
PUBLIC
|
||||||
kdeconnectcore
|
kdeconnectcore
|
||||||
|
KF${QT_MAJOR_VERSION}::KCMUtils
|
||||||
PRIVATE
|
PRIVATE
|
||||||
Qt::DBus
|
Qt::DBus
|
||||||
Qt::Gui
|
Qt::Gui
|
||||||
KF${QT_MAJOR_VERSION}::I18n
|
KF${QT_MAJOR_VERSION}::I18n
|
||||||
KF${QT_MAJOR_VERSION}::ConfigCore
|
KF${QT_MAJOR_VERSION}::ConfigCore
|
||||||
KF${QT_MAJOR_VERSION}::KCMUtils
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(kdeconnectpluginkcm PROPERTIES
|
set_target_properties(kdeconnectpluginkcm PROPERTIES
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct KdeConnectPluginKcmPrivate {
|
||||||
KdeConnectPluginConfig *m_config = nullptr;
|
KdeConnectPluginConfig *m_config = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
KdeConnectPluginKcm::KdeConnectPluginKcm(QWidget *parent, const QVariantList &args, const QString &pluginName)
|
KdeConnectPluginKcm::KdeConnectPluginKcm(QObject *parent, const QVariantList &args, const QString &pluginName)
|
||||||
: KCModule(parent, args)
|
: KCModule(parent, args)
|
||||||
, d(new KdeConnectPluginKcmPrivate())
|
, d(new KdeConnectPluginKcmPrivate())
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,7 @@ class KDECONNECTPLUGINKCM_EXPORT KdeConnectPluginKcm : public KCModule
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KdeConnectPluginKcm(QWidget *parent, const QVariantList &args, const QString &componentName);
|
KdeConnectPluginKcm(QObject *parent, const QVariantList &args, const QString &componentName);
|
||||||
~KdeConnectPluginKcm() override;
|
~KdeConnectPluginKcm() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
|
|
||||||
K_PLUGIN_FACTORY(ClipboardConfigFactory, registerPlugin<ClipboardConfig>();)
|
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"))
|
: KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_clipboard"))
|
||||||
, m_ui(new Ui::ClipboardConfigUi())
|
, m_ui(new Ui::ClipboardConfigUi())
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(widget());
|
||||||
|
|
||||||
connect(m_ui->check_unknown, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
connect(m_ui->check_unknown, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||||
connect(m_ui->check_password, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
connect(m_ui->check_password, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||||
|
@ -31,7 +31,7 @@ void ClipboardConfig::defaults()
|
||||||
KCModule::defaults();
|
KCModule::defaults();
|
||||||
m_ui->check_unknown->setChecked(true);
|
m_ui->check_unknown->setChecked(true);
|
||||||
m_ui->check_password->setChecked(true);
|
m_ui->check_password->setChecked(true);
|
||||||
Q_EMIT changed(true);
|
markAsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClipboardConfig::load()
|
void ClipboardConfig::load()
|
||||||
|
@ -41,8 +41,6 @@ void ClipboardConfig::load()
|
||||||
bool password = config()->getBool(QStringLiteral("sendPassword"), true);
|
bool password = config()->getBool(QStringLiteral("sendPassword"), true);
|
||||||
m_ui->check_unknown->setChecked(unknown);
|
m_ui->check_unknown->setChecked(unknown);
|
||||||
m_ui->check_password->setChecked(password);
|
m_ui->check_password->setChecked(password);
|
||||||
|
|
||||||
Q_EMIT changed(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClipboardConfig::save()
|
void ClipboardConfig::save()
|
||||||
|
@ -50,7 +48,6 @@ void ClipboardConfig::save()
|
||||||
config()->set(QStringLiteral("sendUnknown"), m_ui->check_unknown->isChecked());
|
config()->set(QStringLiteral("sendUnknown"), m_ui->check_unknown->isChecked());
|
||||||
config()->set(QStringLiteral("sendPassword"), m_ui->check_password->isChecked());
|
config()->set(QStringLiteral("sendPassword"), m_ui->check_password->isChecked());
|
||||||
KCModule::save();
|
KCModule::save();
|
||||||
Q_EMIT changed(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "clipboard_config.moc"
|
#include "clipboard_config.moc"
|
||||||
|
|
|
@ -9,16 +9,16 @@
|
||||||
|
|
||||||
#include "kcmplugin/kdeconnectpluginkcm.h"
|
#include "kcmplugin/kdeconnectpluginkcm.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
class ClipboardConfigUi;
|
{
|
||||||
|
class ClipboardConfigUi;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ClipboardConfig
|
class ClipboardConfig : public KdeConnectPluginKcm
|
||||||
: public KdeConnectPluginKcm
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ClipboardConfig(QWidget *parent, const QVariantList&);
|
ClipboardConfig(QObject *parent, const QVariantList &);
|
||||||
~ClipboardConfig() override;
|
~ClipboardConfig() override;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
@ -28,7 +28,6 @@ public Q_SLOTS:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ClipboardConfigUi *m_ui;
|
Ui::ClipboardConfigUi *m_ui;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
#include "runcommand_config.h"
|
#include "runcommand_config.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QFileDialog>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QFileDialog>
|
#include <QJsonDocument>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
K_PLUGIN_FACTORY(ShareConfigFactory, registerPlugin<RunCommandConfig>();)
|
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"))
|
: KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_runcommand"))
|
||||||
{
|
{
|
||||||
// The qdbus executable name is different on some systems
|
// The qdbus executable name is different on some systems
|
||||||
|
@ -35,7 +35,7 @@ RunCommandConfig::RunCommandConfig(QWidget *parent, const QVariantList &args)
|
||||||
qdbusExe = QStringLiteral("qdbus");
|
qdbusExe = QStringLiteral("qdbus");
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu *defaultMenu = new QMenu(this);
|
QMenu *defaultMenu = new QMenu(widget());
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
addSuggestedCommand(defaultMenu, i18n("Schedule a shutdown"), QStringLiteral("shutdown /s /t 60"));
|
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));
|
QStringLiteral("%0 org.kde.kded5 /modules/plasmavault forceCloseAllVaults").arg(qdbusExe));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QTableView *table = new QTableView(this);
|
QTableView *table = new QTableView(widget());
|
||||||
table->horizontalHeader()->setStretchLastSection(true);
|
table->horizontalHeader()->setStretchLastSection(true);
|
||||||
table->verticalHeader()->setVisible(false);
|
table->verticalHeader()->setVisible(false);
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(widget());
|
||||||
layout->addWidget(table);
|
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);
|
button->setMenu(defaultMenu);
|
||||||
layout->addWidget(button);
|
layout->addWidget(button);
|
||||||
|
|
||||||
QHBoxLayout *importExportLayout = new QHBoxLayout(this);
|
QHBoxLayout *importExportLayout = new QHBoxLayout(widget());
|
||||||
QPushButton *exportButton = new QPushButton(i18n("Export"), this);
|
QPushButton *exportButton = new QPushButton(i18n("Export"), widget());
|
||||||
importExportLayout->addWidget(exportButton);
|
importExportLayout->addWidget(exportButton);
|
||||||
connect(exportButton, &QPushButton::clicked, this, &RunCommandConfig::exportCommands);
|
connect(exportButton, &QPushButton::clicked, this, &RunCommandConfig::exportCommands);
|
||||||
QPushButton *importButton = new QPushButton(i18n("Import"), this);
|
QPushButton *importButton = new QPushButton(i18n("Import"), widget());
|
||||||
importExportLayout->addWidget(importButton);
|
importExportLayout->addWidget(importButton);
|
||||||
connect(importButton, &QPushButton::clicked, this, &RunCommandConfig::importCommands);
|
connect(importButton, &QPushButton::clicked, this, &RunCommandConfig::importCommands);
|
||||||
layout->addLayout(importExportLayout);
|
layout->addLayout(importExportLayout);
|
||||||
|
|
||||||
setLayout(layout);
|
widget()->setLayout(layout);
|
||||||
|
|
||||||
m_entriesModel = new QStandardItemModel(this);
|
m_entriesModel = new QStandardItemModel(this);
|
||||||
table->setModel(m_entriesModel);
|
table->setModel(m_entriesModel);
|
||||||
|
@ -99,7 +99,7 @@ RunCommandConfig::~RunCommandConfig()
|
||||||
|
|
||||||
void RunCommandConfig::exportCommands()
|
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())
|
if (filePath.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ void RunCommandConfig::exportCommands()
|
||||||
|
|
||||||
void RunCommandConfig::importCommands()
|
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())
|
if (filePath.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ void RunCommandConfig::importCommands()
|
||||||
insertRow(m_entriesModel->rowCount(), name, command);
|
insertRow(m_entriesModel->rowCount(), name, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT changed(true);
|
markAsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunCommandConfig::addSuggestedCommand(QMenu *menu, const QString &name, const QString &command)
|
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);
|
auto action = new QAction(name);
|
||||||
connect(action, &QAction::triggered, action, [this, name, command]() {
|
connect(action, &QAction::triggered, action, [this, name, command]() {
|
||||||
insertRow(0, name, command);
|
insertRow(0, name, command);
|
||||||
Q_EMIT changed(true);
|
markAsChanged();
|
||||||
});
|
});
|
||||||
menu->addAction(action);
|
menu->addAction(action);
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ void RunCommandConfig::defaults()
|
||||||
KCModule::defaults();
|
KCModule::defaults();
|
||||||
m_entriesModel->removeRows(0, m_entriesModel->rowCount());
|
m_entriesModel->removeRows(0, m_entriesModel->rowCount());
|
||||||
|
|
||||||
Q_EMIT changed(true);
|
markAsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunCommandConfig::load()
|
void RunCommandConfig::load()
|
||||||
|
@ -201,12 +201,11 @@ void RunCommandConfig::load()
|
||||||
|
|
||||||
insertEmptyRow();
|
insertEmptyRow();
|
||||||
connect(m_entriesModel, &QAbstractItemModel::dataChanged, this, &RunCommandConfig::onDataChanged);
|
connect(m_entriesModel, &QAbstractItemModel::dataChanged, this, &RunCommandConfig::onDataChanged);
|
||||||
|
|
||||||
Q_EMIT changed(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunCommandConfig::save()
|
void RunCommandConfig::save()
|
||||||
{
|
{
|
||||||
|
KCModule::save();
|
||||||
QJsonObject jsonConfig;
|
QJsonObject jsonConfig;
|
||||||
for (int i = 0; i < m_entriesModel->rowCount(); i++) {
|
for (int i = 0; i < m_entriesModel->rowCount(); i++) {
|
||||||
QString key = m_entriesModel->item(i, 0)->data().toString();
|
QString key = m_entriesModel->item(i, 0)->data().toString();
|
||||||
|
@ -229,10 +228,6 @@ void RunCommandConfig::save()
|
||||||
QJsonDocument document;
|
QJsonDocument document;
|
||||||
document.setObject(jsonConfig);
|
document.setObject(jsonConfig);
|
||||||
config()->set(QStringLiteral("commands"), document.toJson(QJsonDocument::Compact));
|
config()->set(QStringLiteral("commands"), document.toJson(QJsonDocument::Compact));
|
||||||
|
|
||||||
KCModule::save();
|
|
||||||
|
|
||||||
Q_EMIT changed(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunCommandConfig::insertEmptyRow()
|
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)
|
void RunCommandConfig::onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||||
{
|
{
|
||||||
Q_EMIT changed(true);
|
markAsChanged();
|
||||||
Q_UNUSED(topLeft);
|
Q_UNUSED(topLeft);
|
||||||
if (bottomRight.row() == m_entriesModel->rowCount() - 1) {
|
if (bottomRight.row() == m_entriesModel->rowCount() - 1) {
|
||||||
// TODO check both entries are still empty
|
// TODO check both entries are still empty
|
||||||
|
|
|
@ -16,7 +16,7 @@ class RunCommandConfig : public KdeConnectPluginKcm
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
RunCommandConfig(QWidget *parent, const QVariantList &);
|
RunCommandConfig(QObject *parent, const QVariantList &);
|
||||||
~RunCommandConfig() override;
|
~RunCommandConfig() override;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
|
@ -13,14 +13,16 @@
|
||||||
|
|
||||||
K_PLUGIN_FACTORY(SendNotificationsConfigFactory, registerPlugin<SendNotificationsConfig>();)
|
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"))
|
: KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_sendnotifications"))
|
||||||
, m_ui(new Ui::SendNotificationsConfigUi())
|
, m_ui(new Ui::SendNotificationsConfigUi())
|
||||||
, appModel(new NotifyingApplicationModel)
|
, appModel(new NotifyingApplicationModel)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
qRegisterMetaTypeStreamOperators<NotifyingApplication>("NotifyingApplication");
|
qRegisterMetaTypeStreamOperators<NotifyingApplication>("NotifyingApplication");
|
||||||
|
#endif
|
||||||
|
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(widget());
|
||||||
m_ui->appList->setIconSize(QSize(32, 32));
|
m_ui->appList->setIconSize(QSize(32, 32));
|
||||||
|
|
||||||
m_ui->appList->setModel(appModel);
|
m_ui->appList->setModel(appModel);
|
||||||
|
@ -55,7 +57,7 @@ void SendNotificationsConfig::defaults()
|
||||||
m_ui->spin_urgency->setValue(0);
|
m_ui->spin_urgency->setValue(0);
|
||||||
m_ui->check_body->setChecked(true);
|
m_ui->check_body->setChecked(true);
|
||||||
m_ui->check_icons->setChecked(true);
|
m_ui->check_icons->setChecked(true);
|
||||||
Q_EMIT changed(true);
|
markAsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendNotificationsConfig::loadApplications()
|
void SendNotificationsConfig::loadApplications()
|
||||||
|
@ -83,11 +85,11 @@ void SendNotificationsConfig::load()
|
||||||
m_ui->spin_urgency->setValue(urgency);
|
m_ui->spin_urgency->setValue(urgency);
|
||||||
|
|
||||||
loadApplications();
|
loadApplications();
|
||||||
Q_EMIT changed(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendNotificationsConfig::save()
|
void SendNotificationsConfig::save()
|
||||||
{
|
{
|
||||||
|
KCModule::save();
|
||||||
config()->set(QStringLiteral("generalPersistent"), m_ui->check_persistent->isChecked());
|
config()->set(QStringLiteral("generalPersistent"), m_ui->check_persistent->isChecked());
|
||||||
config()->set(QStringLiteral("generalIncludeBody"), m_ui->check_body->isChecked());
|
config()->set(QStringLiteral("generalIncludeBody"), m_ui->check_body->isChecked());
|
||||||
config()->set(QStringLiteral("generalSynchronizeIcons"), m_ui->check_icons->isChecked());
|
config()->set(QStringLiteral("generalSynchronizeIcons"), m_ui->check_icons->isChecked());
|
||||||
|
@ -100,8 +102,6 @@ void SendNotificationsConfig::save()
|
||||||
list.append(QVariant::fromValue<NotifyingApplication>(a));
|
list.append(QVariant::fromValue<NotifyingApplication>(a));
|
||||||
}
|
}
|
||||||
config()->setList(QStringLiteral("applications"), list);
|
config()->setList(QStringLiteral("applications"), list);
|
||||||
KCModule::save();
|
|
||||||
Q_EMIT changed(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "sendnotifications_config.moc"
|
#include "sendnotifications_config.moc"
|
||||||
|
|
|
@ -20,7 +20,7 @@ class SendNotificationsConfig : public KdeConnectPluginKcm
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SendNotificationsConfig(QWidget *parent, const QVariantList &);
|
SendNotificationsConfig(QObject *parent, const QVariantList &);
|
||||||
~SendNotificationsConfig() override;
|
~SendNotificationsConfig() override;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
|
@ -124,7 +124,13 @@ bool SftpPlugin::startBrowsing()
|
||||||
|
|
||||||
bool SftpPlugin::receivePacket(const NetworkPacket &np)
|
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
|
// packet is invalid
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
|
|
||||||
K_PLUGIN_FACTORY(ShareConfigFactory, registerPlugin<ShareConfig>();)
|
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"))
|
: KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_share"))
|
||||||
, m_ui(new Ui::ShareConfigUi())
|
, m_ui(new Ui::ShareConfigUi())
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(widget());
|
||||||
// xgettext:no-c-format
|
// xgettext:no-c-format
|
||||||
m_ui->commentLabel->setTextFormat(Qt::RichText);
|
m_ui->commentLabel->setTextFormat(Qt::RichText);
|
||||||
m_ui->commentLabel->setText(i18n("%1 in the path will be replaced with the specific device name."));
|
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));
|
m_ui->kurlrequester->setText(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
||||||
|
|
||||||
Q_EMIT changed(true);
|
markAsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShareConfig::load()
|
void ShareConfig::load()
|
||||||
|
@ -46,17 +46,12 @@ void ShareConfig::load()
|
||||||
|
|
||||||
const auto standardPath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
const auto standardPath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
||||||
m_ui->kurlrequester->setText(config()->getString(QStringLiteral("incoming_path"), standardPath));
|
m_ui->kurlrequester->setText(config()->getString(QStringLiteral("incoming_path"), standardPath));
|
||||||
|
|
||||||
Q_EMIT changed(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShareConfig::save()
|
void ShareConfig::save()
|
||||||
{
|
{
|
||||||
config()->set(QStringLiteral("incoming_path"), m_ui->kurlrequester->text());
|
|
||||||
|
|
||||||
KCModule::save();
|
KCModule::save();
|
||||||
|
config()->set(QStringLiteral("incoming_path"), m_ui->kurlrequester->text());
|
||||||
Q_EMIT changed(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "share_config.moc"
|
#include "share_config.moc"
|
||||||
|
|
|
@ -18,7 +18,7 @@ class ShareConfig : public KdeConnectPluginKcm
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ShareConfig(QWidget *parent, const QVariantList &);
|
ShareConfig(QObject *parent, const QVariantList &);
|
||||||
~ShareConfig() override;
|
~ShareConfig() override;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
|
@ -28,3 +28,8 @@ target_link_libraries(kdeconnect_sms
|
||||||
KF${QT_MAJOR_VERSION}::Notifications
|
KF${QT_MAJOR_VERSION}::Notifications
|
||||||
Qt::Widgets
|
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