mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
kcm: Use MobileShellSettings rather than custom implementation
This commit is contained in:
parent
b905bafcb5
commit
629b10486a
5 changed files with 3 additions and 26 deletions
|
|
@ -17,7 +17,6 @@ This repository contains shell components for Plasma Mobile.
|
||||||
### Locations
|
### Locations
|
||||||
* [components/mobileshell](components/mobileshell) - private shell component library (API not guaranteed to be stable!)
|
* [components/mobileshell](components/mobileshell) - private shell component library (API not guaranteed to be stable!)
|
||||||
* [containments](containments) - shell panels (homescreen, status bar, task panel)
|
* [containments](containments) - shell panels (homescreen, status bar, task panel)
|
||||||
* [homescreens](homescreens) - homescreen packages
|
|
||||||
* [kcms](kcms) - settings modules
|
* [kcms](kcms) - settings modules
|
||||||
* [look-and-feel](look-and-feel/contents) - Plasma look-and-feel packages (ex. lockscreen, logout, etc.)
|
* [look-and-feel](look-and-feel/contents) - Plasma look-and-feel packages (ex. lockscreen, logout, etc.)
|
||||||
* [quicksettings](quicksettings) - quick settings packages for the action drawer
|
* [quicksettings](quicksettings) - quick settings packages for the action drawer
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ MobileShellSettings::MobileShellSettings(QObject *parent)
|
||||||
m_configWatcher = KConfigWatcher::create(m_config);
|
m_configWatcher = KConfigWatcher::create(m_config);
|
||||||
|
|
||||||
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) -> void {
|
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) -> void {
|
||||||
qDebug() << "config changed"; // TODO
|
|
||||||
if (group.name() == GENERAL_CONFIG_GROUP) {
|
if (group.name() == GENERAL_CONFIG_GROUP) {
|
||||||
Q_EMIT navigationPanelEnabledChanged();
|
Q_EMIT navigationPanelEnabledChanged();
|
||||||
} else if (group.name() == QUICKSETTINGS_CONFIG_GROUP) {
|
} else if (group.name() == QUICKSETTINGS_CONFIG_GROUP) {
|
||||||
|
|
|
||||||
|
|
@ -9,27 +9,10 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(KCMMobileShell, "metadata.json")
|
K_PLUGIN_CLASS_WITH_JSON(KCMMobileShell, "metadata.json")
|
||||||
|
|
||||||
const QString CONFIG_FILE = QStringLiteral("plasmamobilerc");
|
|
||||||
const QString GENERAL_CONFIG_GROUP = QStringLiteral("General");
|
|
||||||
|
|
||||||
KCMMobileShell::KCMMobileShell(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
KCMMobileShell::KCMMobileShell(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
||||||
: KQuickAddons::ManagedConfigModule(parent, data, args)
|
: KQuickAddons::ManagedConfigModule(parent, data, args)
|
||||||
, m_config{KSharedConfig::openConfig("plasmamobilerc", KConfig::SimpleConfig)}
|
|
||||||
{
|
{
|
||||||
setButtons(0);
|
setButtons(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KCMMobileShell::navigationPanelEnabled() const
|
|
||||||
{
|
|
||||||
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
|
||||||
return group.readEntry("navigationPanelEnabled", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KCMMobileShell::setNavigationPanelEnabled(bool navigationPanelEnabled)
|
|
||||||
{
|
|
||||||
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
|
||||||
group.writeEntry("navigationPanelEnabled", navigationPanelEnabled, KConfigGroup::Notify);
|
|
||||||
m_config->sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "kcm.moc"
|
#include "kcm.moc"
|
||||||
|
|
|
||||||
|
|
@ -12,15 +12,11 @@
|
||||||
class KCMMobileShell : public KQuickAddons::ManagedConfigModule
|
class KCMMobileShell : public KQuickAddons::ManagedConfigModule
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled WRITE setNavigationPanelEnabled NOTIFY navigationPanelEnabledChanged)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KCMMobileShell(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
|
KCMMobileShell(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
|
||||||
virtual ~KCMMobileShell() override = default;
|
virtual ~KCMMobileShell() override = default;
|
||||||
|
|
||||||
bool navigationPanelEnabled() const;
|
|
||||||
void setNavigationPanelEnabled(bool navigationPanelEnabled);
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void navigationPanelEnabledChanged();
|
void navigationPanelEnabledChanged();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,10 @@ KCM.SimpleKCM {
|
||||||
MobileForm.FormSwitchDelegate {
|
MobileForm.FormSwitchDelegate {
|
||||||
text: i18n("Gesture-only Mode")
|
text: i18n("Gesture-only Mode")
|
||||||
description: i18n("Whether to hide the navigation panel.")
|
description: i18n("Whether to hide the navigation panel.")
|
||||||
checked: !kcm.navigationPanelEnabled
|
checked: !MobileShell.MobileShellSettings.navigationPanelEnabled
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
if (checked != !kcm.navigationPanelEnabled) {
|
if (checked != !MobileShell.MobileShellSettings.navigationPanelEnabled) {
|
||||||
kcm.navigationPanelEnabled = !checked;
|
MobileShell.MobileShellSettings.navigationPanelEnabled = !checked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue