ede9e37b40
By removing the postfix we consistently use, we get exactly the same string as before However, all our pluginId logic is now done as part of the buildsystem. Before, they were in the JSON metadata, the buildsystem and the string constructor parameter KPluginFactory has the KPluginMetaData object in any case, do using it doesn't create any overhead.
61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
/**
|
|
* SPDX-FileCopyrightText: 2022 Yuchen Shi <bolshaya_schists@mail.gravitide.co>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
*/
|
|
|
|
#include "clipboard_config.h"
|
|
#include "ui_clipboard_config.h"
|
|
|
|
#include <KPluginFactory>
|
|
|
|
K_PLUGIN_FACTORY(ClipboardConfigFactory, registerPlugin<ClipboardConfig>();)
|
|
|
|
ClipboardConfig::ClipboardConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
|
: KdeConnectPluginKcm(parent, data, args)
|
|
, m_ui(new Ui::ClipboardConfigUi())
|
|
{
|
|
m_ui->setupUi(widget());
|
|
|
|
connect(m_ui->check_autoshare, &QCheckBox::toggled, this, &ClipboardConfig::autoShareChanged);
|
|
connect(m_ui->check_password, &QCheckBox::toggled, this, &ClipboardConfig::markAsChanged);
|
|
}
|
|
|
|
ClipboardConfig::~ClipboardConfig()
|
|
{
|
|
delete m_ui;
|
|
}
|
|
|
|
void ClipboardConfig::autoShareChanged()
|
|
{
|
|
m_ui->check_password->setEnabled(m_ui->check_autoshare->isChecked());
|
|
markAsChanged();
|
|
}
|
|
|
|
void ClipboardConfig::defaults()
|
|
{
|
|
KCModule::defaults();
|
|
m_ui->check_autoshare->setChecked(true);
|
|
m_ui->check_password->setChecked(true);
|
|
markAsChanged();
|
|
}
|
|
|
|
void ClipboardConfig::load()
|
|
{
|
|
KCModule::load();
|
|
// "sendUnknown" is the legacy name for this setting
|
|
bool autoShare = config()->getBool(QStringLiteral("autoShare"), config()->getBool(QStringLiteral("sendUnknown"), true));
|
|
bool password = config()->getBool(QStringLiteral("sendPassword"), true);
|
|
m_ui->check_autoshare->setChecked(autoShare);
|
|
m_ui->check_password->setChecked(password);
|
|
autoShareChanged();
|
|
}
|
|
|
|
void ClipboardConfig::save()
|
|
{
|
|
config()->set(QStringLiteral("autoShare"), m_ui->check_autoshare->isChecked());
|
|
config()->set(QStringLiteral("sendPassword"), m_ui->check_password->isChecked());
|
|
KCModule::save();
|
|
}
|
|
|
|
#include "clipboard_config.moc"
|