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 #include <KAboutData>
12 #include <QSize>
13 
14 namespace Akonadi
15 {
16 class AgentConfigurationBasePrivate
17 {
18 public:
19  AgentConfigurationBasePrivate(const KSharedConfigPtr &config, QWidget *parentWidget, const QVariantList &args)
20  : config(config)
21  , parentWidget(parentWidget)
22  {
23  Q_ASSERT(!args.empty());
24  if (args.empty()) {
25  qCCritical(AKONADICORE_LOG, "AgentConfigurationBase instantiated with invalid arguments");
26  return;
27  }
28  identifier = args.at(0).toString();
29  }
30 
31  KSharedConfigPtr config;
32  QString identifier;
34  QWidget *const parentWidget;
35 };
36 } // namespace Akonadi
37 
38 using namespace Akonadi;
39 
40 AgentConfigurationBase::AgentConfigurationBase(const KSharedConfigPtr &config, QWidget *parentWidget, const QVariantList &args)
41  : QObject(reinterpret_cast<QObject *>(parentWidget))
42  , d(new AgentConfigurationBasePrivate(config, parentWidget, args))
43 {
44 }
45 
46 AgentConfigurationBase::~AgentConfigurationBase()
47 {
48 }
49 
50 KSharedConfigPtr AgentConfigurationBase::config() const
51 {
52  return d->config;
53 }
54 
56 {
57  return d->identifier;
58 }
59 
61 {
62  d->config->reparseConfiguration();
63 }
64 
66 {
67  d->config->sync();
68  d->config->reparseConfiguration();
69  return true;
70 }
71 
72 QWidget *AgentConfigurationBase::parentWidget() const
73 {
74  return d->parentWidget;
75 }
76 
78 {
79  d->aboutData.reset(new KAboutData(aboutData));
80 }
81 
83 {
84  return d->aboutData.data();
85 }
86 
88 {
89  return {};
90 }
91 
92 void AgentConfigurationBase::saveDialogSize(const QSize & /*unused*/) // clazy:exclude=function-args-by-value
93 {
94 }
95 
96 QDialogButtonBox::StandardButtons AgentConfigurationBase::standardButtons() const
97 {
99 }
QString identifier() const
Returns identifier of the Akonadi agent instance currently being configured.
KAboutData * aboutData() const
Returns about data for the currently configured component.
KSharedConfigPtr config() const
Returns KConfig object belonging to the current Akonadi agent instance.
virtual void load()
Reimplement to load settings from the configuration object into widgets.
virtual void saveDialogSize(const QSize &size)
Reimplement to save dialog size.
void setKAboutData(const KAboutData &aboutData)
When KAboutData is provided the dialog will also contain KHelpMenu with access to user help etc.
KSharedConfigPtr config()
typedef StandardButtons
virtual bool save() const
Reimplement to save new settings into the configuration object.
virtual QSize restoreDialogSize() const
Reimplement to restore dialog size.
AgentConfigurationBase(const KSharedConfigPtr &config, QWidget *parentWidget, const QVariantList &args)
Creates a new AgentConfigurationBase objects.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jul 2 2022 06:41:46 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.