File indexing completed on 2024-11-10 04:40:39
0001 /* 0002 SPDX-FileCopyrightText: 2020 Daniel Vrátil <dvratil@kde.org> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 #include "config_p.h" 0007 #include "private/instance_p.h" 0008 0009 #include <KConfigGroup> 0010 #include <KSharedConfig> 0011 0012 using namespace Akonadi; 0013 0014 Q_GLOBAL_STATIC(Config, sConfig) // NOLINT(readability-redundant-member-init) 0015 0016 namespace 0017 { 0018 QString getConfigName() 0019 { 0020 if (Instance::hasIdentifier()) { 0021 return QStringLiteral("akonadi_%1rc").arg(Instance::identifier()); 0022 } else { 0023 return QStringLiteral("akonadirc"); 0024 } 0025 } 0026 0027 static constexpr char group_PayloadCompression[] = "PayloadCompression"; 0028 0029 // Payload compression 0030 static constexpr char key_PC_Enabled[] = "enabled"; 0031 0032 } // namespace 0033 0034 Config::Config() 0035 { 0036 auto config = KSharedConfig::openConfig(getConfigName()); 0037 0038 { 0039 const auto group = config->group(QLatin1StringView(group_PayloadCompression)); 0040 payloadCompression.enabled = group.readEntry(key_PC_Enabled, payloadCompression.enabled); 0041 } 0042 } 0043 0044 const Config &Config::get() 0045 { 0046 return *sConfig; 0047 }