Commit b3235218 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Port away from KSettings::PluginPage

It doesn't do much and it's the only user of this class.
parent 6f533004
......@@ -30,9 +30,10 @@
K_PLUGIN_FACTORY(KTpMessagesConfigFactory, registerPlugin<MessagesConfig>();)
MessagesConfig::MessagesConfig(QWidget* parent, const QVariantList& args)
: PluginPage(new KAboutData("ktp_chat_messages", i18n("Chat Messages"), "1.0"), parent, args)
: KCModule(parent, args)
, m_pluginSelector(new KPluginSelector(this))
{
pluginSelector()->addPlugins(
m_pluginSelector->addPlugins(
KTp::MessageFilterConfigManager::self()->allPlugins(),
KPluginSelector::ReadConfigFile,
i18n("Plugins"),
......@@ -40,17 +41,27 @@ MessagesConfig::MessagesConfig(QWidget* parent, const QVariantList& args)
KTp::MessageFilterConfigManager::self()->sharedConfig() //why won't this take a KConfigGroup?
);
//Am surprised that PluginPage() doesn't do this for me
connect(m_pluginSelector, &KPluginSelector::changed, this, &MessagesConfig::markAsChanged);
QLayout *layout = new QVBoxLayout();
layout->addWidget(pluginSelector());
layout->addWidget(m_pluginSelector);
setLayout(layout);
}
void MessagesConfig::save()
{
KSettings::PluginPage::save();
m_pluginSelector->save();
KTp::MessageFilterConfigManager::self()->reloadConfig();
}
void MessagesConfig::defaults()
{
m_pluginSelector->defaults();
}
void MessagesConfig::load()
{
m_pluginSelector->load();
}
#include "messages-config.moc"
......@@ -19,19 +19,22 @@
#ifndef KCM_MESSAGES_H
#define KCM_MESSAGES_H
#include <ksettings/pluginpage.h>
#include <KCModule>
class MessagesConfig : public KSettings::PluginPage
class KPluginSelector;
class MessagesConfig : public KCModule
{
Q_OBJECT
public:
explicit MessagesConfig(QWidget *parent = 0, const QVariantList &args = QVariantList());
explicit MessagesConfig(QWidget *parent = nullptr, const QVariantList &args = QVariantList());
virtual void save();
void save() override;
void defaults() override;
void load() override;
private:
class Private;
Private* d;
KPluginSelector *m_pluginSelector;
};
#endif // KCM_MESSAGES_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment