File indexing completed on 2024-10-13 04:57:25
0001 /* 0002 SPDX-FileCopyrightText: 2022 Bharadwaj Raju <bharadwaj.raju777@protonmail.com> 0003 0004 SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #include <KConfigSkeleton> 0008 #include <KConfigWatcher> 0009 0010 #pragma once 0011 0012 class GlobalConfigSkeleton : public KConfigSkeleton 0013 { 0014 public: 0015 explicit GlobalConfigSkeleton(const QString &configName = QStringLiteral("plasmaparc"), QObject *parent = nullptr) 0016 : KConfigSkeleton(configName, parent) 0017 { 0018 setupWatcher(); 0019 }; 0020 explicit GlobalConfigSkeleton(KSharedConfig::Ptr config, QObject *parent = nullptr) 0021 : KConfigSkeleton(config, parent) 0022 { 0023 setupWatcher(); 0024 }; 0025 ~GlobalConfigSkeleton() override{}; 0026 0027 private: 0028 KConfigWatcher::Ptr m_configWatcher; 0029 void setupWatcher() 0030 { 0031 m_configWatcher = KConfigWatcher::create(sharedConfig()); 0032 connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this]() { 0033 load(); 0034 }); 0035 } 0036 };