File indexing completed on 2024-12-22 04:55:31

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "kaddressbook_config_plugins.h"
0008 #include "kaddressbookconfigpluginlistwidget.h"
0009 #include <KAboutData>
0010 #include <KLocalizedString>
0011 #include <KPluginFactory>
0012 #include <PimCommon/ConfigurePluginsListWidget>
0013 #include <PimCommon/ConfigurePluginsWidget>
0014 #include <QHBoxLayout>
0015 
0016 using namespace KAddressBook;
0017 
0018 K_PLUGIN_CLASS_WITH_JSON(KCMKaddressbookPluginsConfig, "kaddressbook_config_plugins.json")
0019 
0020 KCMKaddressbookPluginsConfig::KCMKaddressbookPluginsConfig(QObject *parent, const KPluginMetaData &data)
0021     : KCModule(parent, data)
0022     , mConfigurePluginWidget(new PimCommon::ConfigurePluginsWidget(new KAddressBookConfigPluginListWidget(widget()), widget()))
0023 {
0024     auto lay = new QHBoxLayout(widget());
0025     lay->setContentsMargins({});
0026     connect(mConfigurePluginWidget, &PimCommon::ConfigurePluginsWidget::changed, this, &KCMKaddressbookPluginsConfig::slotConfigChanged);
0027     lay->addWidget(mConfigurePluginWidget);
0028 }
0029 
0030 void KCMKaddressbookPluginsConfig::slotConfigChanged()
0031 {
0032     markAsChanged();
0033 }
0034 
0035 void KCMKaddressbookPluginsConfig::save()
0036 {
0037     mConfigurePluginWidget->save();
0038 }
0039 
0040 void KCMKaddressbookPluginsConfig::load()
0041 {
0042     mConfigurePluginWidget->doLoadFromGlobalSettings();
0043 }
0044 
0045 void KCMKaddressbookPluginsConfig::defaults()
0046 {
0047     mConfigurePluginWidget->doResetToDefaultsOther();
0048 }
0049 
0050 #include "kaddressbook_config_plugins.moc"
0051 
0052 #include "moc_kaddressbook_config_plugins.cpp"