2023-02-23 16:43:38 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
2024-12-20 12:59:06 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 Luis Büchi <luis.buechi@kdemail.net>
|
2023-02-23 16:43:38 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
|
|
#include <KConfigGroup>
|
2023-03-30 02:40:47 +00:00
|
|
|
#include <KConfigWatcher>
|
2023-02-23 16:43:38 +00:00
|
|
|
#include <KSharedConfig>
|
|
|
|
|
|
|
|
|
|
class Settings : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Settings(QObject *parent = nullptr);
|
2024-01-17 00:02:51 +00:00
|
|
|
static Settings &self();
|
2023-02-23 16:43:38 +00:00
|
|
|
|
|
|
|
|
// apply the configuration
|
|
|
|
|
void applyConfiguration();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// loads the saved configuration, so it can be restored on desktop
|
|
|
|
|
void loadSavedConfiguration();
|
|
|
|
|
|
|
|
|
|
// applies our mobile configuration
|
|
|
|
|
void applyMobileConfiguration();
|
|
|
|
|
|
2025-04-24 15:26:11 +00:00
|
|
|
void writeKeys(const QString &fileName, KSharedConfig::Ptr &config, const QMap<QString, QMap<QString, QVariant>> &settings);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
writeKeysAndSave(const QString &fileName, KSharedConfig::Ptr &config, const QMap<QString, QMap<QString, QVariant>> &settings, bool overwriteOnlyIfEmpty);
|
2023-02-23 16:43:38 +00:00
|
|
|
void loadKeys(const QString &fileName, KSharedConfig::Ptr &config, const QMap<QString, QMap<QString, QVariant>> &settings);
|
|
|
|
|
void saveConfigSetting(const QString &fileName, const QString &group, const QString &key, const QVariant value);
|
2023-03-30 05:43:44 +00:00
|
|
|
const QString loadSavedConfigSetting(KSharedConfig::Ptr &config, const QString &fileName, const QString &group, const QString &key, bool write = true);
|
2023-02-23 16:43:38 +00:00
|
|
|
|
|
|
|
|
void reloadKWinConfig();
|
|
|
|
|
|
|
|
|
|
// whether this is Plasma Mobile
|
|
|
|
|
bool m_isMobilePlatform;
|
|
|
|
|
|
2023-03-30 02:40:47 +00:00
|
|
|
KSharedConfig::Ptr m_mobileConfig;
|
2025-04-24 15:26:11 +00:00
|
|
|
KSharedConfig::Ptr m_kwinrcConfig; // (~/.config/kwinrc-plasma-mobile)
|
2023-02-23 16:43:38 +00:00
|
|
|
KSharedConfig::Ptr m_appBlacklistConfig;
|
|
|
|
|
KSharedConfig::Ptr m_kdeglobalsConfig;
|
2024-12-20 12:59:06 +00:00
|
|
|
KSharedConfig::Ptr m_ksmServerConfig;
|
2023-03-30 02:40:47 +00:00
|
|
|
|
2025-04-24 15:26:11 +00:00
|
|
|
// For legacy upgrade purposes (~/.config/kwinrc)
|
|
|
|
|
KSharedConfig::Ptr m_originalKwinrcConfig;
|
|
|
|
|
|
2023-03-30 02:40:47 +00:00
|
|
|
KConfigWatcher::Ptr m_configWatcher;
|
2023-02-23 16:43:38 +00:00
|
|
|
};
|