Akonadi

agentconfigurationbase.cpp
1 /*
2  SPDX-FileCopyrightText: 2018 Daniel Vrátil <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "agentconfigurationbase.h"
8 #include "agentmanager.h"
9 #include "akonadicore_debug.h"
10 
11 
12 #include <KAboutData>
13 #include <QSize>
14 
15 namespace Akonadi {
16 class Q_DECL_HIDDEN AgentConfigurationBase::Private {
17 public:
18  Private(const KSharedConfigPtr &config, QWidget *parentWidget, const QVariantList &args)
19  : config(config)
20  , parentWidget(parentWidget)
21  {
22  Q_ASSERT(!args.empty());
23  if (args.empty()) {
24  qCCritical(AKONADICORE_LOG, "AgentConfigurationBase instantiated with invalid arguments");
25  return;
26  }
27  identifier = args.at(0).toString();
28  }
29 
30  KSharedConfigPtr config;
31  QString identifier;
33  QWidget *parentWidget = nullptr;
34 };
35 } // namespace Akonadi
36 
37 using namespace Akonadi;
38 
39 AgentConfigurationBase::AgentConfigurationBase(const KSharedConfigPtr &config,
40  QWidget *parentWidget,
41  const QVariantList &args)
42  : QObject(reinterpret_cast<QObject*>(parentWidget))
43  , d(new Private(config, parentWidget, args))
44 {
45 }
46 
47 AgentConfigurationBase::~AgentConfigurationBase()
48 {
49 }
50 
51 KSharedConfigPtr AgentConfigurationBase::config() const
52 {
53  return d->config;
54 }
55 
57 {
58  return d->identifier;
59 }
60 
62 {
63  d->config->reparseConfiguration();
64 }
65 
67 {
68  d->config->sync();
69  d->config->reparseConfiguration();
70  return true;
71 }
72 
73 QWidget *AgentConfigurationBase::parentWidget() const
74 {
75  return d->parentWidget;
76 }
77 
79 {
80  d->aboutData.reset(new KAboutData(aboutData));
81 }
82 
84 {
85  return d->aboutData.data();
86 }
87 
89 {
90  return {};
91 }
92 
93 void AgentConfigurationBase::saveDialogSize(const QSize& /*unused*/) // clazy:exclude=function-args-by-value
94 {}
95 
96 QDialogButtonBox::StandardButtons AgentConfigurationBase::standardButtons() const
97 {
99 }
QString identifier() const
Returns identifier of the Akonadi agent instance currently being configured.
virtual QSize restoreDialogSize() const
Reimplement to restore dialog size.
void setKAboutData(const KAboutData &aboutData)
When KAboutData is provided the dialog will also contain KHelpMenu with access to user help etc...
virtual void load()
Reimplement to load settings from the configuration object into widgets.
void reset(T *other)
virtual void saveDialogSize(const QSize &size)
Reimplement to save dialog size.
virtual bool save() const
Reimplement to save new settings into the configuration object.
T * data() const const
Base class for configuration UI for Akonadi agents.
typedef StandardButtons
KAboutData * aboutData() const
Returns about data for the currently configured component.
Helper integration between Akonadi and Qt.
KSharedConfigPtr config() const
Returns KConfig object belonging to the current Akonadi agent instance.
AgentConfigurationBase(const KSharedConfigPtr &config, QWidget *parentWidget, const QVariantList &args)
Creates a new AgentConfigurationBase objects.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 23 2021 07:17:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.