Akonadi

config.cpp
1/*
2 SPDX-FileCopyrightText: 2020 Daniel Vrátil <dvratil@kde.org>
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
12using namespace Akonadi;
13
14Q_GLOBAL_STATIC(Config, sConfig) // NOLINT(readability-redundant-member-init)
15
16namespace
17{
18QString getConfigName()
19{
20 if (Instance::hasIdentifier()) {
21 return QStringLiteral("akonadi_%1rc").arg(Instance::identifier());
22 } else {
23 return QStringLiteral("akonadirc");
24 }
25}
26
27static constexpr char group_PayloadCompression[] = "PayloadCompression";
28
29// Payload compression
30static constexpr char key_PC_Enabled[] = "enabled";
31
32} // namespace
33
34Config::Config()
35{
36 auto config = KSharedConfig::openConfig(getConfigName());
37
38 {
39 const auto group = config->group(QLatin1StringView(group_PayloadCompression));
40 payloadCompression.enabled = group.readEntry(key_PC_Enabled, payloadCompression.enabled);
41 }
42}
43
44const Config &Config::get()
45{
46 return *sConfig;
47}
static KSharedConfig::Ptr openConfig(const QString &fileName=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation)
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:00:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.