File indexing completed on 2024-11-24 04:44:30

0001 /*
0002     SPDX-FileCopyrightText: 2018 Daniel Vrátil <dvratil@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include <Akonadi/AgentConfigurationBase>
0008 
0009 #include "configwidget.h"
0010 #include "settings.h"
0011 
0012 class OpenXChangeConfig : public Akonadi::AgentConfigurationBase
0013 {
0014     Q_OBJECT
0015 public:
0016     OpenXChangeConfig(const KSharedConfigPtr &config, QWidget *parent, const QVariantList &args)
0017         : Akonadi::AgentConfigurationBase(config, parent, args)
0018     {
0019         Settings::instance(config);
0020         mSettings.reset(Settings::self());
0021         mWidget.reset(new ConfigWidget(mSettings.data(), parent));
0022     }
0023 
0024     void load() override
0025     {
0026         Akonadi::AgentConfigurationBase::load();
0027         mWidget->load();
0028     }
0029 
0030     [[nodiscard]] bool save() const override
0031     {
0032         mWidget->save();
0033         return Akonadi::AgentConfigurationBase::save();
0034     }
0035 
0036     QScopedPointer<Settings> mSettings;
0037     QScopedPointer<ConfigWidget> mWidget;
0038 };
0039 
0040 AKONADI_AGENTCONFIG_FACTORY(OpenXChangeConfigFactory, "openxchangeconfig.json", OpenXChangeConfig)
0041 
0042 #include "openxchangeconfig.moc"