Warning, file /pim/kdepim-runtime/resources/shared/singlefileresource/singlefileresourceconfigbase.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2018 Daniel Vrátil <dvratil@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <Akonadi/AgentConfigurationBase> 0010 0011 #include "akonadi-singlefileresource_export.h" 0012 #include "singlefileresourceconfigwidget.h" 0013 0014 template<typename Settings> 0015 class SingleFileResourceConfigBase : public Akonadi::AgentConfigurationBase 0016 { 0017 public: 0018 explicit SingleFileResourceConfigBase(const KSharedConfigPtr &config, QWidget *parent, const QVariantList &list) 0019 : Akonadi::AgentConfigurationBase(config, parent, list) 0020 , mSettings(new Settings(config)) 0021 , mWidget(new Akonadi::SingleFileResourceConfigWidget<Settings>(parent, mSettings.data())) 0022 { 0023 } 0024 0025 ~SingleFileResourceConfigBase() override = default; 0026 0027 void load() override 0028 { 0029 mWidget->load(); 0030 Akonadi::AgentConfigurationBase::load(); 0031 } 0032 0033 bool save() const override 0034 { 0035 if (!mWidget->save()) { 0036 return false; 0037 } 0038 return Akonadi::AgentConfigurationBase::save(); 0039 } 0040 0041 protected: 0042 QScopedPointer<Settings> mSettings; 0043 QScopedPointer<Akonadi::SingleFileResourceConfigWidget<Settings>> mWidget; 0044 };