File indexing completed on 2024-11-17 05:01:25
0001 /* 0002 0003 SPDX-FileCopyrightText: 2014 David Edmundson <davidedmundson@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 0007 */ 0008 0009 #pragma once 0010 0011 #include <KConfigGroup> 0012 #include <KSharedConfig> 0013 #include <Kdelibs4Migration> 0014 0015 class Kdelibs4SharedConfig 0016 { 0017 public: 0018 static void syncConfigGroup(const QLatin1String &sourceGroup, const QString &fileName) 0019 { 0020 Kdelibs4Migration migration; 0021 QString configDirPath = migration.saveLocation("config"); 0022 KSharedConfigPtr kde4Config = KSharedConfig::openConfig(configDirPath + '/' + fileName); 0023 KSharedConfigPtr simpleConfig = KSharedConfig::openConfig(fileName, KConfig::SimpleConfig); 0024 KConfigGroup simpleConfigGroup(simpleConfig, sourceGroup); 0025 KConfigGroup kde4ConfigGroup = kde4Config->group(sourceGroup); 0026 simpleConfigGroup.copyTo(&kde4ConfigGroup); 0027 kde4ConfigGroup.sync(); 0028 } 0029 };