Commit 17769c45 authored by Janet Blackquill's avatar Janet Blackquill 🌈
Browse files

Port to KConfigXT

parent ea7dbf1a
......@@ -20,8 +20,6 @@ find_package(KF5I18n)
find_package(KF5Config)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
set(DefaultPermissions
OWNER_WRITE OWNER_READ OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
......
......@@ -22,11 +22,12 @@ target_compile_definitions(org.kde.initialsystemsetup
target_link_libraries(org.kde.initialsystemsetup
PRIVATE
Qt5::Core Qt5::Widgets Qt5::Quick Qt5::QuickControls2 Qt5::DBus
KF5::I18n KF5::ConfigCore
PkgConfig::GIO
KF5::I18n KF5::ConfigCore KF5::ConfigGui
crack
)
kconfig_add_kcfg_files(org.kde.initialsystemsetup initialsystemsetup.kcfgc)
configure_file(org.kde.initialsystemsetup.service.in org.kde.initialsystemsetup.service @ONLY)
install(
......@@ -34,13 +35,6 @@ install(
DESTINATION ${KDE_INSTALL_SYSTEMDUNITDIR}/system
)
install(
FILES org.kde.initialsystemsetup.gschema.xml
DESTINATION ${KDE_INSTALL_DATADIR}/glib-2.0/schemas
)
install(CODE "execute_process(COMMAND glib-compile-schemas ${KDE_INSTALL_FULL_DATADIR}/glib-2.0/schemas)")
install(TARGETS org.kde.initialsystemsetup
PERMISSIONS ${DefaultPermissions} SETUID
DESTINATION ${KDE_INSTALL_BINDIR}
......
File=org.kde.initialsystemsetup.kcfg
ClassName=Config
Mutators=true
DefaultValueGetters=true
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<kcfg
xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<schemalist>
<kcfgfile name="org_kde_initialsystemsetuprc" />
<enum id="org.kde.initialsystemsetup.DisplayManagers">
<value nick="sddm" value="1" />
</enum>
<schema path="/org/kde/initialsystemsetup/" id="org.kde.initialsystemsetup">
<key name='display-manager-backend' enum='org.kde.initialsystemsetup.DisplayManagers'>
<default>'sddm'</default>
<summary>Display manager being used</summary>
<description>
<group name="General">
<entry name="DisplayManagerBackend" type="Enum">
<label>
This tells KISS which display manager is being used on the system.
This allows it to figure out which display manager to enable, and
how to launch a user session.
</description>
</key>
<key name="desktop-session" type="s">
<default>'plasmawayland.desktop'</default>
<summary>Which session to start after setup</summary>
<description>
</label>
<default>SDDM</default>
<choices>
<choice name="SDDM"></choice>
</choices>
</entry>
<entry name="DesktopSession" type="String">
<default>plasmawayland.desktop</default>
<label>
This tells KISS which desktop file corresponding to an X11 or a
Wayland session should be started after initial system setup is
completed.
</description>
</key>
<key name="stages" type="as">
<default>['UserPage']</default>
<summary>Which pages of the initial setup to show, and in which order.</summary>
<description>
</label>
</entry>
<entry name="Stages" type="StringList">
<default>UserPage</default>
<label>
This tells KISS which pages it should show. The language selection page
is always shown first, and the ready page is always shown last. The user
page is required to be in the list of vendor-provided pages, and KISS will
abort if it is not found.
</description>
</key>
</schema>
</label>
</entry>
</group>
</schemalist>
</kcfg>
......@@ -3,35 +3,25 @@
//
// SPDX-License-Identifier: GPL-2.0-or-later
#include "initialsystemsetup.h"
#include "settings.h"
Settings::Settings()
struct Settings::Private
{
m_settings = g_settings_new("org.kde.initialsystemsetup");
QScopedPointer<Config> cfg;
};
GVariantIter *iter;
gchar *str;
m_pages << "LocalePage";
g_settings_get(m_settings, "stages", "as", &iter);
while (g_variant_iter_loop (iter, "s", &str))
m_pages << QString::fromLocal8Bit(str);
m_pages << "ReadyPage";
g_variant_iter_free(iter);
auto session = g_settings_get_string(m_settings, "desktop-session");
m_session = QString::fromLocal8Bit(session);
g_free(session);
Settings::Settings() : d(new Private)
{
d->cfg.reset(new Config());
auto dm = g_settings_get_string(m_settings, "display-manager-backend");
m_dm = QString::fromLocal8Bit(dm);
g_free(dm);
m_pages = d->cfg->stages();
m_pages.prepend("LocalePage");
m_pages.append("ReadyPage");
}
Settings::~Settings()
{
g_free(m_settings);
}
Settings *Settings::instance()
......@@ -45,12 +35,17 @@ Settings *Settings::instance()
QString Settings::displayManager() const
{
return m_dm;
switch (d->cfg->displayManagerBackend()) {
case Config::EnumDisplayManagerBackend::SDDM:
return "sddm";
default:
Q_UNREACHABLE();
}
}
QString Settings::session() const
{
return m_session;
return d->cfg->desktopSession();
}
QStringList Settings::pages() const
......
......@@ -5,10 +5,9 @@
#pragma once
#undef signals
#include <gio/gio.h>
#include <QString>
#include <QStringList>
#include <QScopedPointer>
/// Settings for KISS
class Settings
......@@ -17,6 +16,9 @@ private:
Settings();
~Settings();
struct Private;
QScopedPointer<Private> d;
public:
static Settings *instance();
QString displayManager() const;
......@@ -24,8 +26,6 @@ public:
QStringList pages() const;
private:
GSettings* m_settings;
QStringList m_pages;
QString m_dm;
QString m_session;
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment