kde-workspace/kcontrol/spellchecking/spellchecking.cpp

72 lines
2 KiB
C++
Raw Permalink Normal View History

/* This file is part of the KDE project
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
2014-11-15 03:14:34 +02:00
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2, as published by the Free Software Foundation.
2014-11-15 03:14:34 +02:00
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
2014-11-15 03:14:34 +02:00
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
2014-11-15 03:14:34 +02:00
*/
#include "spellchecking.h"
#include <kpluginfactory.h>
K_PLUGIN_FACTORY(SpellFactory, registerPlugin<SpellCheckingModule>();)
K_EXPORT_PLUGIN(SpellFactory("kcmspellchecking"))
2014-11-15 03:14:34 +02:00
SpellCheckingModule::SpellCheckingModule(QWidget *parent, const QVariantList &args)
: KCModule(SpellFactory::componentData(), parent, args),
m_layout(nullptr),
m_configWidget(nullptr),
m_config(nullptr)
2014-11-15 03:14:34 +02:00
{
Q_UNUSED(args);
m_layout = new QVBoxLayout(this);
m_layout->setMargin(0);
m_config = new KConfig("kdeglobals");
2014-11-15 03:14:34 +02:00
}
SpellCheckingModule::~SpellCheckingModule()
2014-11-15 03:14:34 +02:00
{
delete m_config;
2014-11-15 03:14:34 +02:00
}
void SpellCheckingModule::load()
{
if (m_configWidget) {
delete m_configWidget;
}
m_configWidget = new KSpellConfigWidget(m_config, this);
m_layout->addWidget(m_configWidget);
connect(m_configWidget, SIGNAL(configChanged()), this, SLOT(slotConfigChanged()));
emit changed(false);
}
void SpellCheckingModule::save()
2014-11-15 03:14:34 +02:00
{
m_configWidget->save();
emit changed(false);
2014-11-15 03:14:34 +02:00
}
void SpellCheckingModule::defaults()
2014-11-15 03:14:34 +02:00
{
m_configWidget->slotDefault();
}
void SpellCheckingModule::slotConfigChanged()
{
emit changed(true);
}
2015-02-27 09:28:46 +00:00
#include "moc_spellchecking.cpp"