Changeset View
Changeset View
Standalone View
Standalone View
resources/pop3/pop3config.cpp
Show All 13 Lines | 1 | /* Copyright 2018 Daniel Vrátil <dvratil@kde.org> | |||
---|---|---|---|---|---|
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to | ||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | Boston, MA 02110-1301, USA. | 17 | Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include <AkonadiCore/AgentConfigurationBase> | 20 | #include <AkonadiCore/AgentConfigurationBase> | ||
21 | 21 | | |||
22 | #include "settings.h" | | |||
23 | #include "accountwidget.h" | 22 | #include "accountwidget.h" | ||
23 | #include "settings.h" | ||||
24 | 24 | | |||
25 | class Pop3Config : public Akonadi::AgentConfigurationBase | 25 | class Pop3Config : public Akonadi::AgentConfigurationBase | ||
26 | { | 26 | { | ||
27 | Q_OBJECT | 27 | Q_OBJECT | ||
28 | public: | 28 | public: | ||
29 | Pop3Config(const KSharedConfigPtr &config, QWidget *parent, const QVariantList &args) | 29 | Pop3Config(const KSharedConfigPtr &config, QWidget *parent, const QVariantList &args) | ||
30 | : Akonadi::AgentConfigurationBase(config, parent, args) | 30 | : Akonadi::AgentConfigurationBase(config, parent, args) | ||
31 | , mSettings(new Settings(config)) | 31 | , mSettings(config, Settings::Option::NoOption) | ||
32 | , mWidget(new AccountWidget(identifier(), parent)) | 32 | , mWidget(mSettings, identifier(), parent) | ||
33 | { | 33 | { | ||
34 | connect(mWidget.data(), &AccountWidget::okEnabled, this, &Akonadi::AgentConfigurationBase::enableOkButton); | 34 | connect(&mWidget, &AccountWidget::okEnabled, this, &Akonadi::AgentConfigurationBase::enableOkButton); | ||
35 | } | 35 | } | ||
36 | 36 | | |||
37 | void load() override | 37 | void load() override | ||
38 | { | 38 | { | ||
39 | Akonadi::AgentConfigurationBase::load(); | 39 | Akonadi::AgentConfigurationBase::load(); | ||
40 | mWidget->loadSettings(); | 40 | mWidget.loadSettings(); | ||
41 | } | 41 | } | ||
42 | 42 | | |||
43 | bool save() const override | 43 | bool save() const override | ||
44 | { | 44 | { | ||
45 | mWidget->saveSettings(); | 45 | const_cast<Pop3Config*>(this)->mWidget.saveSettings(); | ||
46 | return Akonadi::AgentConfigurationBase::save(); | 46 | return Akonadi::AgentConfigurationBase::save(); | ||
47 | } | 47 | } | ||
48 | 48 | | |||
49 | QScopedPointer<Settings> mSettings; | 49 | Settings mSettings; | ||
50 | QScopedPointer<AccountWidget> mWidget; | 50 | AccountWidget mWidget; | ||
51 | }; | 51 | }; | ||
52 | 52 | | |||
53 | AKONADI_AGENTCONFIG_FACTORY(Pop3ConfigFactory, "pop3config.json", Pop3Config) | 53 | AKONADI_AGENTCONFIG_FACTORY(Pop3ConfigFactory, "pop3config.json", Pop3Config) | ||
54 | 54 | | |||
55 | #include "pop3config.moc" | 55 | #include "pop3config.moc" |