Do not make m_ui instance a ptr
By having it as a simple member variable, we do not need to take care of deleting it manually
This commit is contained in:
parent
02d97aabf4
commit
336709f093
10 changed files with 79 additions and 139 deletions
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "clipboard_config.h"
|
#include "clipboard_config.h"
|
||||||
#include "ui_clipboard_config.h"
|
|
||||||
|
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
|
|
||||||
|
@ -13,30 +12,24 @@ K_PLUGIN_CLASS(ClipboardConfig)
|
||||||
|
|
||||||
ClipboardConfig::ClipboardConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
ClipboardConfig::ClipboardConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
||||||
: KdeConnectPluginKcm(parent, data, args)
|
: KdeConnectPluginKcm(parent, data, args)
|
||||||
, m_ui(new Ui::ClipboardConfigUi())
|
|
||||||
{
|
{
|
||||||
m_ui->setupUi(widget());
|
m_ui.setupUi(widget());
|
||||||
|
|
||||||
connect(m_ui->check_autoshare, &QCheckBox::toggled, this, &ClipboardConfig::autoShareChanged);
|
connect(m_ui.check_autoshare, &QCheckBox::toggled, this, &ClipboardConfig::autoShareChanged);
|
||||||
connect(m_ui->check_password, &QCheckBox::toggled, this, &ClipboardConfig::markAsChanged);
|
connect(m_ui.check_password, &QCheckBox::toggled, this, &ClipboardConfig::markAsChanged);
|
||||||
}
|
|
||||||
|
|
||||||
ClipboardConfig::~ClipboardConfig()
|
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClipboardConfig::autoShareChanged()
|
void ClipboardConfig::autoShareChanged()
|
||||||
{
|
{
|
||||||
m_ui->check_password->setEnabled(m_ui->check_autoshare->isChecked());
|
m_ui.check_password->setEnabled(m_ui.check_autoshare->isChecked());
|
||||||
markAsChanged();
|
markAsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClipboardConfig::defaults()
|
void ClipboardConfig::defaults()
|
||||||
{
|
{
|
||||||
KCModule::defaults();
|
KCModule::defaults();
|
||||||
m_ui->check_autoshare->setChecked(true);
|
m_ui.check_autoshare->setChecked(true);
|
||||||
m_ui->check_password->setChecked(true);
|
m_ui.check_password->setChecked(true);
|
||||||
markAsChanged();
|
markAsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,15 +39,15 @@ void ClipboardConfig::load()
|
||||||
// "sendUnknown" is the legacy name for this setting
|
// "sendUnknown" is the legacy name for this setting
|
||||||
bool autoShare = config()->getBool(QStringLiteral("autoShare"), config()->getBool(QStringLiteral("sendUnknown"), true));
|
bool autoShare = config()->getBool(QStringLiteral("autoShare"), config()->getBool(QStringLiteral("sendUnknown"), true));
|
||||||
bool password = config()->getBool(QStringLiteral("sendPassword"), true);
|
bool password = config()->getBool(QStringLiteral("sendPassword"), true);
|
||||||
m_ui->check_autoshare->setChecked(autoShare);
|
m_ui.check_autoshare->setChecked(autoShare);
|
||||||
m_ui->check_password->setChecked(password);
|
m_ui.check_password->setChecked(password);
|
||||||
autoShareChanged();
|
autoShareChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClipboardConfig::save()
|
void ClipboardConfig::save()
|
||||||
{
|
{
|
||||||
config()->set(QStringLiteral("autoShare"), m_ui->check_autoshare->isChecked());
|
config()->set(QStringLiteral("autoShare"), m_ui.check_autoshare->isChecked());
|
||||||
config()->set(QStringLiteral("sendPassword"), m_ui->check_password->isChecked());
|
config()->set(QStringLiteral("sendPassword"), m_ui.check_password->isChecked());
|
||||||
KCModule::save();
|
KCModule::save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,18 +7,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "kcmplugin/kdeconnectpluginkcm.h"
|
#include "kcmplugin/kdeconnectpluginkcm.h"
|
||||||
|
#include "ui_clipboard_config.h"
|
||||||
namespace Ui
|
|
||||||
{
|
|
||||||
class ClipboardConfigUi;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ClipboardConfig : public KdeConnectPluginKcm
|
class ClipboardConfig : public KdeConnectPluginKcm
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ClipboardConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &);
|
ClipboardConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &);
|
||||||
~ClipboardConfig() override;
|
|
||||||
|
|
||||||
void save() override;
|
void save() override;
|
||||||
void load() override;
|
void load() override;
|
||||||
|
@ -26,5 +21,5 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void autoShareChanged();
|
void autoShareChanged();
|
||||||
Ui::ClipboardConfigUi *m_ui;
|
Ui::ClipboardConfigUi m_ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "findthisdevice_config.h"
|
#include "findthisdevice_config.h"
|
||||||
#include "findthisdeviceplugin.h"
|
#include "findthisdeviceplugin.h"
|
||||||
|
|
||||||
#include "ui_findthisdevice_config.h"
|
|
||||||
// KF
|
// KF
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
|
@ -23,33 +22,27 @@ K_PLUGIN_CLASS(FindThisDeviceConfig)
|
||||||
|
|
||||||
FindThisDeviceConfig::FindThisDeviceConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
FindThisDeviceConfig::FindThisDeviceConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
||||||
: KdeConnectPluginKcm(parent, data, args)
|
: KdeConnectPluginKcm(parent, data, args)
|
||||||
, m_ui(new Ui::FindThisDeviceConfigUi())
|
|
||||||
{
|
{
|
||||||
m_ui->setupUi(widget());
|
m_ui.setupUi(widget());
|
||||||
|
|
||||||
const QStringList soundDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("sounds"), QStandardPaths::LocateDirectory);
|
const QStringList soundDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("sounds"), QStandardPaths::LocateDirectory);
|
||||||
if (!soundDirs.isEmpty()) {
|
if (!soundDirs.isEmpty()) {
|
||||||
m_ui->soundFileRequester->setStartDir(QUrl::fromLocalFile(soundDirs.last()));
|
m_ui.soundFileRequester->setStartDir(QUrl::fromLocalFile(soundDirs.last()));
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(m_ui->playSoundButton, &QToolButton::clicked, this, [this]() {
|
connect(m_ui.playSoundButton, &QToolButton::clicked, this, [this]() {
|
||||||
if (const QUrl soundUrl = m_ui->soundFileRequester->url(); soundUrl.isValid()) {
|
if (const QUrl soundUrl = m_ui.soundFileRequester->url(); soundUrl.isValid()) {
|
||||||
playSound(soundUrl);
|
playSound(soundUrl);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(m_ui->soundFileRequester, &KUrlRequester::textChanged, this, &FindThisDeviceConfig::markAsChanged);
|
connect(m_ui.soundFileRequester, &KUrlRequester::textChanged, this, &FindThisDeviceConfig::markAsChanged);
|
||||||
}
|
|
||||||
|
|
||||||
FindThisDeviceConfig::~FindThisDeviceConfig()
|
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindThisDeviceConfig::defaults()
|
void FindThisDeviceConfig::defaults()
|
||||||
{
|
{
|
||||||
KCModule::defaults();
|
KCModule::defaults();
|
||||||
|
|
||||||
m_ui->soundFileRequester->setText(defaultSound());
|
m_ui.soundFileRequester->setText(defaultSound());
|
||||||
markAsChanged();
|
markAsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,12 +51,12 @@ void FindThisDeviceConfig::load()
|
||||||
KCModule::load();
|
KCModule::load();
|
||||||
|
|
||||||
const QString ringTone = config()->getString(QStringLiteral("ringtone"), defaultSound());
|
const QString ringTone = config()->getString(QStringLiteral("ringtone"), defaultSound());
|
||||||
m_ui->soundFileRequester->setText(ringTone);
|
m_ui.soundFileRequester->setText(ringTone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindThisDeviceConfig::save()
|
void FindThisDeviceConfig::save()
|
||||||
{
|
{
|
||||||
config()->set(QStringLiteral("ringtone"), m_ui->soundFileRequester->text());
|
config()->set(QStringLiteral("ringtone"), m_ui.soundFileRequester->text());
|
||||||
|
|
||||||
KCModule::save();
|
KCModule::save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,19 +6,14 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui_findthisdevice_config.h"
|
||||||
#include <kcmplugin/kdeconnectpluginkcm.h>
|
#include <kcmplugin/kdeconnectpluginkcm.h>
|
||||||
|
|
||||||
namespace Ui
|
|
||||||
{
|
|
||||||
class FindThisDeviceConfigUi;
|
|
||||||
}
|
|
||||||
|
|
||||||
class FindThisDeviceConfig : public KdeConnectPluginKcm
|
class FindThisDeviceConfig : public KdeConnectPluginKcm
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
FindThisDeviceConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &);
|
FindThisDeviceConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &);
|
||||||
~FindThisDeviceConfig() override;
|
|
||||||
|
|
||||||
void save() override;
|
void save() override;
|
||||||
void load() override;
|
void load() override;
|
||||||
|
@ -26,5 +21,5 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void playSound(const QUrl &soundUrl);
|
void playSound(const QUrl &soundUrl);
|
||||||
Ui::FindThisDeviceConfigUi *m_ui;
|
Ui::FindThisDeviceConfigUi m_ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pausemusic_config.h"
|
#include "pausemusic_config.h"
|
||||||
#include "ui_pausemusic_config.h"
|
|
||||||
|
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
|
|
||||||
|
@ -13,30 +12,24 @@ K_PLUGIN_CLASS(PauseMusicConfig)
|
||||||
|
|
||||||
PauseMusicConfig::PauseMusicConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
PauseMusicConfig::PauseMusicConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
||||||
: KdeConnectPluginKcm(parent, data, args)
|
: KdeConnectPluginKcm(parent, data, args)
|
||||||
, m_ui(new Ui::PauseMusicConfigUi())
|
|
||||||
{
|
{
|
||||||
m_ui->setupUi(widget());
|
m_ui.setupUi(widget());
|
||||||
|
|
||||||
connect(m_ui->rad_ringing, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged);
|
connect(m_ui.rad_ringing, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged);
|
||||||
connect(m_ui->rad_talking, &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_pause, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged);
|
||||||
connect(m_ui->check_mute, &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);
|
connect(m_ui.check_resume, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged);
|
||||||
}
|
|
||||||
|
|
||||||
PauseMusicConfig::~PauseMusicConfig()
|
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PauseMusicConfig::defaults()
|
void PauseMusicConfig::defaults()
|
||||||
{
|
{
|
||||||
KCModule::defaults();
|
KCModule::defaults();
|
||||||
m_ui->rad_talking->setChecked(false);
|
m_ui.rad_talking->setChecked(false);
|
||||||
m_ui->rad_ringing->setChecked(true);
|
m_ui.rad_ringing->setChecked(true);
|
||||||
m_ui->check_pause->setChecked(true);
|
m_ui.check_pause->setChecked(true);
|
||||||
m_ui->check_mute->setChecked(false);
|
m_ui.check_mute->setChecked(false);
|
||||||
m_ui->check_resume->setChecked(true);
|
m_ui.check_resume->setChecked(true);
|
||||||
markAsChanged();
|
markAsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,24 +37,24 @@ void PauseMusicConfig::load()
|
||||||
{
|
{
|
||||||
KCModule::load();
|
KCModule::load();
|
||||||
bool talking = config()->getBool(QStringLiteral("conditionTalking"), false);
|
bool talking = config()->getBool(QStringLiteral("conditionTalking"), false);
|
||||||
m_ui->rad_talking->setChecked(talking);
|
m_ui.rad_talking->setChecked(talking);
|
||||||
m_ui->rad_ringing->setChecked(!talking);
|
m_ui.rad_ringing->setChecked(!talking);
|
||||||
|
|
||||||
bool pause = config()->getBool(QStringLiteral("actionPause"), true);
|
bool pause = config()->getBool(QStringLiteral("actionPause"), true);
|
||||||
bool mute = config()->getBool(QStringLiteral("actionMute"), false);
|
bool mute = config()->getBool(QStringLiteral("actionMute"), false);
|
||||||
m_ui->check_pause->setChecked(pause);
|
m_ui.check_pause->setChecked(pause);
|
||||||
m_ui->check_mute->setChecked(mute);
|
m_ui.check_mute->setChecked(mute);
|
||||||
|
|
||||||
const bool autoResume = config()->getBool(QStringLiteral("actionResume"), true);
|
const bool autoResume = config()->getBool(QStringLiteral("actionResume"), true);
|
||||||
m_ui->check_resume->setChecked(autoResume);
|
m_ui.check_resume->setChecked(autoResume);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PauseMusicConfig::save()
|
void PauseMusicConfig::save()
|
||||||
{
|
{
|
||||||
config()->set(QStringLiteral("conditionTalking"), m_ui->rad_talking->isChecked());
|
config()->set(QStringLiteral("conditionTalking"), m_ui.rad_talking->isChecked());
|
||||||
config()->set(QStringLiteral("actionPause"), m_ui->check_pause->isChecked());
|
config()->set(QStringLiteral("actionPause"), m_ui.check_pause->isChecked());
|
||||||
config()->set(QStringLiteral("actionMute"), m_ui->check_mute->isChecked());
|
config()->set(QStringLiteral("actionMute"), m_ui.check_mute->isChecked());
|
||||||
config()->set(QStringLiteral("actionResume"), m_ui->check_resume->isChecked());
|
config()->set(QStringLiteral("actionResume"), m_ui.check_resume->isChecked());
|
||||||
KCModule::save();
|
KCModule::save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,23 +7,18 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "kcmplugin/kdeconnectpluginkcm.h"
|
#include "kcmplugin/kdeconnectpluginkcm.h"
|
||||||
|
#include "ui_pausemusic_config.h"
|
||||||
namespace Ui
|
|
||||||
{
|
|
||||||
class PauseMusicConfigUi;
|
|
||||||
}
|
|
||||||
|
|
||||||
class PauseMusicConfig : public KdeConnectPluginKcm
|
class PauseMusicConfig : public KdeConnectPluginKcm
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PauseMusicConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &);
|
PauseMusicConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &);
|
||||||
~PauseMusicConfig() override;
|
|
||||||
|
|
||||||
void save() override;
|
void save() override;
|
||||||
void load() override;
|
void load() override;
|
||||||
void defaults() override;
|
void defaults() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::PauseMusicConfigUi *m_ui;
|
Ui::PauseMusicConfigUi m_ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include "sendnotifications_config.h"
|
#include "sendnotifications_config.h"
|
||||||
#include "notifyingapplicationmodel.h"
|
#include "notifyingapplicationmodel.h"
|
||||||
#include "ui_sendnotifications_config.h"
|
|
||||||
|
|
||||||
#include <KCModule>
|
#include <KCModule>
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
|
@ -15,48 +14,42 @@ K_PLUGIN_CLASS(SendNotificationsConfig)
|
||||||
|
|
||||||
SendNotificationsConfig::SendNotificationsConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
SendNotificationsConfig::SendNotificationsConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
||||||
: KdeConnectPluginKcm(parent, data, args)
|
: KdeConnectPluginKcm(parent, data, args)
|
||||||
, m_ui(new Ui::SendNotificationsConfigUi())
|
|
||||||
, appModel(new NotifyingApplicationModel)
|
, appModel(new NotifyingApplicationModel)
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
qRegisterMetaTypeStreamOperators<NotifyingApplication>("NotifyingApplication");
|
qRegisterMetaTypeStreamOperators<NotifyingApplication>("NotifyingApplication");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_ui->setupUi(widget());
|
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);
|
||||||
|
|
||||||
m_ui->appList->horizontalHeader()->setSectionResizeMode(0, QHeaderView::QHeaderView::Fixed);
|
m_ui.appList->horizontalHeader()->setSectionResizeMode(0, QHeaderView::QHeaderView::Fixed);
|
||||||
m_ui->appList->horizontalHeader()->setSectionResizeMode(1, QHeaderView::QHeaderView::Stretch);
|
m_ui.appList->horizontalHeader()->setSectionResizeMode(1, QHeaderView::QHeaderView::Stretch);
|
||||||
m_ui->appList->horizontalHeader()->setSectionResizeMode(2, QHeaderView::QHeaderView::Stretch);
|
m_ui.appList->horizontalHeader()->setSectionResizeMode(2, QHeaderView::QHeaderView::Stretch);
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
m_ui->appList->resizeColumnToContents(i);
|
m_ui.appList->resizeColumnToContents(i);
|
||||||
|
|
||||||
connect(m_ui->appList->horizontalHeader(), &QHeaderView::sortIndicatorChanged, m_ui->appList, &QTableView::sortByColumn);
|
connect(m_ui.appList->horizontalHeader(), &QHeaderView::sortIndicatorChanged, m_ui.appList, &QTableView::sortByColumn);
|
||||||
|
|
||||||
connect(m_ui->check_persistent, &QCheckBox::toggled, this, &SendNotificationsConfig::markAsChanged);
|
connect(m_ui.check_persistent, &QCheckBox::toggled, this, &SendNotificationsConfig::markAsChanged);
|
||||||
connect(m_ui->spin_urgency, &QSpinBox::editingFinished, 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_body, &QCheckBox::toggled, this, &SendNotificationsConfig::markAsChanged);
|
||||||
connect(m_ui->check_icons, &QCheckBox::toggled, this, &SendNotificationsConfig::markAsChanged);
|
connect(m_ui.check_icons, &QCheckBox::toggled, this, &SendNotificationsConfig::markAsChanged);
|
||||||
|
|
||||||
connect(appModel, &NotifyingApplicationModel::applicationsChanged, this, &SendNotificationsConfig::markAsChanged);
|
connect(appModel, &NotifyingApplicationModel::applicationsChanged, this, &SendNotificationsConfig::markAsChanged);
|
||||||
|
|
||||||
connect(config(), &KdeConnectPluginConfig::configChanged, this, &SendNotificationsConfig::loadApplications);
|
connect(config(), &KdeConnectPluginConfig::configChanged, this, &SendNotificationsConfig::loadApplications);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendNotificationsConfig::~SendNotificationsConfig()
|
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendNotificationsConfig::defaults()
|
void SendNotificationsConfig::defaults()
|
||||||
{
|
{
|
||||||
KCModule::defaults();
|
KCModule::defaults();
|
||||||
m_ui->check_persistent->setChecked(false);
|
m_ui.check_persistent->setChecked(false);
|
||||||
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);
|
||||||
markAsChanged();
|
markAsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,13 +69,13 @@ void SendNotificationsConfig::load()
|
||||||
{
|
{
|
||||||
KCModule::load();
|
KCModule::load();
|
||||||
bool persistent = config()->getBool(QStringLiteral("generalPersistent"), false);
|
bool persistent = config()->getBool(QStringLiteral("generalPersistent"), false);
|
||||||
m_ui->check_persistent->setChecked(persistent);
|
m_ui.check_persistent->setChecked(persistent);
|
||||||
bool body = config()->getBool(QStringLiteral("generalIncludeBody"), true);
|
bool body = config()->getBool(QStringLiteral("generalIncludeBody"), true);
|
||||||
m_ui->check_body->setChecked(body);
|
m_ui.check_body->setChecked(body);
|
||||||
bool icons = config()->getBool(QStringLiteral("generalSynchronizeIcons"), true);
|
bool icons = config()->getBool(QStringLiteral("generalSynchronizeIcons"), true);
|
||||||
m_ui->check_icons->setChecked(icons);
|
m_ui.check_icons->setChecked(icons);
|
||||||
int urgency = config()->getInt(QStringLiteral("generalUrgency"), 0);
|
int urgency = config()->getInt(QStringLiteral("generalUrgency"), 0);
|
||||||
m_ui->spin_urgency->setValue(urgency);
|
m_ui.spin_urgency->setValue(urgency);
|
||||||
|
|
||||||
loadApplications();
|
loadApplications();
|
||||||
}
|
}
|
||||||
|
@ -90,10 +83,10 @@ void SendNotificationsConfig::load()
|
||||||
void SendNotificationsConfig::save()
|
void SendNotificationsConfig::save()
|
||||||
{
|
{
|
||||||
KCModule::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());
|
||||||
config()->set(QStringLiteral("generalUrgency"), m_ui->spin_urgency->value());
|
config()->set(QStringLiteral("generalUrgency"), m_ui.spin_urgency->value());
|
||||||
|
|
||||||
QVariantList list;
|
QVariantList list;
|
||||||
const auto apps = appModel->apps();
|
const auto apps = appModel->apps();
|
||||||
|
|
|
@ -7,11 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "kcmplugin/kdeconnectpluginkcm.h"
|
#include "kcmplugin/kdeconnectpluginkcm.h"
|
||||||
|
#include "ui_sendnotifications_config.h"
|
||||||
namespace Ui
|
|
||||||
{
|
|
||||||
class SendNotificationsConfigUi;
|
|
||||||
}
|
|
||||||
|
|
||||||
class NotifyingApplicationModel;
|
class NotifyingApplicationModel;
|
||||||
|
|
||||||
|
@ -20,7 +16,6 @@ class SendNotificationsConfig : public KdeConnectPluginKcm
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SendNotificationsConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &);
|
SendNotificationsConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &);
|
||||||
~SendNotificationsConfig() override;
|
|
||||||
|
|
||||||
void save() override;
|
void save() override;
|
||||||
void load() override;
|
void load() override;
|
||||||
|
@ -28,6 +23,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadApplications();
|
void loadApplications();
|
||||||
Ui::SendNotificationsConfigUi *m_ui;
|
Ui::SendNotificationsConfigUi m_ui;
|
||||||
NotifyingApplicationModel *appModel;
|
NotifyingApplicationModel *appModel;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "share_config.h"
|
#include "share_config.h"
|
||||||
#include "ui_share_config.h"
|
|
||||||
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
|
@ -16,26 +15,20 @@ K_PLUGIN_CLASS(ShareConfig)
|
||||||
|
|
||||||
ShareConfig::ShareConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
ShareConfig::ShareConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
||||||
: KdeConnectPluginKcm(parent, data, args)
|
: KdeConnectPluginKcm(parent, data, args)
|
||||||
, m_ui(new Ui::ShareConfigUi())
|
|
||||||
{
|
{
|
||||||
m_ui->setupUi(widget());
|
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."));
|
||||||
|
|
||||||
connect(m_ui->kurlrequester, &KUrlRequester::textChanged, this, &ShareConfig::markAsChanged);
|
connect(m_ui.kurlrequester, &KUrlRequester::textChanged, this, &ShareConfig::markAsChanged);
|
||||||
}
|
|
||||||
|
|
||||||
ShareConfig::~ShareConfig()
|
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShareConfig::defaults()
|
void ShareConfig::defaults()
|
||||||
{
|
{
|
||||||
KCModule::defaults();
|
KCModule::defaults();
|
||||||
|
|
||||||
m_ui->kurlrequester->setText(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
m_ui.kurlrequester->setText(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
||||||
|
|
||||||
markAsChanged();
|
markAsChanged();
|
||||||
}
|
}
|
||||||
|
@ -45,13 +38,13 @@ void ShareConfig::load()
|
||||||
KCModule::load();
|
KCModule::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));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShareConfig::save()
|
void ShareConfig::save()
|
||||||
{
|
{
|
||||||
KCModule::save();
|
KCModule::save();
|
||||||
config()->set(QStringLiteral("incoming_path"), m_ui->kurlrequester->text());
|
config()->set(QStringLiteral("incoming_path"), m_ui.kurlrequester->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_share_config.cpp"
|
#include "moc_share_config.cpp"
|
||||||
|
|
|
@ -7,23 +7,18 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "kcmplugin/kdeconnectpluginkcm.h"
|
#include "kcmplugin/kdeconnectpluginkcm.h"
|
||||||
|
#include "ui_share_config.h"
|
||||||
namespace Ui
|
|
||||||
{
|
|
||||||
class ShareConfigUi;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ShareConfig : public KdeConnectPluginKcm
|
class ShareConfig : public KdeConnectPluginKcm
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ShareConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
|
ShareConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
|
||||||
~ShareConfig() override;
|
|
||||||
|
|
||||||
void save() override;
|
void save() override;
|
||||||
void load() override;
|
void load() override;
|
||||||
void defaults() override;
|
void defaults() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ShareConfigUi *m_ui;
|
Ui::ShareConfigUi m_ui;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue