Akonadi

config.cpp
1 /*
2  SPDX-FileCopyrightText: 2020 Daniel Vr├ítil <[email protected]>
3  SPDX-License-Identifier: LGPL-2.0-or-later
4 */
5 
6 #include "config_p.h"
7 #include "private/instance_p.h"
8 
9 #include <KConfigGroup>
10 #include <KSharedConfig>
11 
12 using namespace Akonadi;
13 
14 Q_GLOBAL_STATIC(Config, sConfig) // NOLINT(readability-redundant-member-init)
15 
16 namespace
17 {
18 QString getConfigName()
19 {
20  if (Instance::hasIdentifier()) {
21  return QStringLiteral("akonadi_%1rc").arg(Instance::identifier());
22  } else {
23  return QStringLiteral("akonadirc");
24  }
25 }
26 
27 static constexpr char group_PayloadCompression[] = "PayloadCompression";
28 
29 // Payload compression
30 static constexpr char key_PC_Enabled[] = "enabled";
31 
32 } // namespace
33 
34 Config::Config()
35 {
36  auto config = KSharedConfig::openConfig(getConfigName());
37 
38  {
39  const auto group = config->group(group_PayloadCompression);
40  payloadCompression.enabled = group.readEntry(key_PC_Enabled, payloadCompression.enabled);
41  }
42 }
43 
44 const Config &Config::get()
45 {
46  return *sConfig;
47 }
static KSharedConfig::Ptr openConfig(const QString &fileName=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation)
Q_GLOBAL_STATIC(Internal::StaticControl, s_instance) class ControlPrivate
Definition: control.cpp:28
KSharedConfigPtr config()
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
virtual QVariant get(ScriptableExtension *callerPrincipal, quint64 objId, const QString &propName)
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:00:31 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.