Commit 22df6ab4 authored by Cyril Rossi's avatar Cyril Rossi

KCM Desktop Session bugfix general settings now enable the Apply button

BUG: 430744
Restore highlight non default settings at module level
Fix Default state, typo
parent ba2b6f4c
......@@ -3,6 +3,14 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kcm_smserver\")
set(kcm_smserver_PART_SRCS kcmsmserver.cpp)
kcmutils_generate_module_data(
kcm_smserver_PART_SRCS
MODULE_DATA_HEADER smserverdata.h
MODULE_DATA_CLASS_NAME SMServerData
SETTINGS_HEADERS smserversettings.h
SETTINGS_CLASSES SMServerSettings
)
qt5_add_dbus_interface(kcm_smserver_PART_SRCS org.freedesktop.login1.Manager.xml login1_manager)
kconfig_add_kcfg_files(kcm_smserver_PART_SRCS smserversettings.kcfgc GENERATE_MOC)
......
......@@ -26,7 +26,6 @@
#include <QDBusConnection>
#include <QDBusPendingCallWatcher>
#include <QDBusPendingReply>
#include <QCheckBox>
#include <QFileInfo>
#include <kworkspace.h>
......@@ -38,6 +37,7 @@
#include "kcmsmserver.h"
#include "smserversettings.h"
#include "smserverdata.h"
#include <KAboutData>
#include <KLocalizedString>
......@@ -46,7 +46,7 @@
#include "login1_manager.h"
K_PLUGIN_CLASS_WITH_JSON(SMServerConfig, "metadata.json")
K_PLUGIN_FACTORY_WITH_JSON(SMServerConfigFactory, "metadata.json", registerPlugin<SMServerConfig>(); registerPlugin<SMServerData>();)
SMServerConfig::SMServerConfig(QObject *parent, const QVariantList &args)
: KQuickAddons::ManagedConfigModule(parent, args)
......@@ -79,9 +79,9 @@ SMServerConfig::SMServerConfig(QObject *parent, const QVariantList &args)
setAboutData(about);
setButtons(Help | Apply | Default);
const QString canFirmareSetup = m_login1Manager->CanRebootToFirmwareSetup().value();
if (canFirmareSetup == QLatin1String("yes") || canFirmareSetup == QLatin1String("challenge")) {
m_canFirmareSetup = true;
const QString canFirmwareSetup = m_login1Manager->CanRebootToFirmwareSetup().value();
if (canFirmwareSetup == QLatin1String("yes") || canFirmwareSetup == QLatin1String("challenge")) {
m_canFirmwareSetup = true;
// now check whether we're UEFI to provide a more descriptive button label
if (QFileInfo(QStringLiteral("/sys/firmware/efi")).isDir()) {
m_isUefi = true;
......@@ -172,9 +172,9 @@ void SMServerConfig::checkFirmwareSetupRequested()
Q_EMIT restartInSetupScreenChanged();
}
bool SMServerConfig::canFirmareSetup() const
bool SMServerConfig::canFirmwareSetup() const
{
return m_canFirmareSetup;
return m_canFirmwareSetup;
}
bool SMServerConfig::isSaveNeeded() const
......@@ -184,7 +184,7 @@ bool SMServerConfig::isSaveNeeded() const
bool SMServerConfig::isDefaults() const
{
return m_restartInSetupScreen;
return !m_restartInSetupScreen;
}
void SMServerConfig::defaults()
......
......@@ -46,7 +46,7 @@ class SMServerConfig : public KQuickAddons::ManagedConfigModule
Q_PROPERTY(QString error READ error NOTIFY errorChanged)
/// Can setup the firmware
Q_PROPERTY(bool canFirmareSetup READ canFirmareSetup CONSTANT)
Q_PROPERTY(bool canFirmwareSetup READ canFirmwareSetup CONSTANT)
public:
explicit SMServerConfig(QObject *parent = nullptr, const QVariantList &list = QVariantList());
......@@ -59,7 +59,7 @@ public:
QString error() const;
bool canFirmareSetup() const;
bool canFirmwareSetup() const;
/// Tell the computer to reboot.
Q_INVOKABLE void reboot();
......@@ -82,6 +82,6 @@ private:
bool m_isUefi = false;
bool m_restartInSetupScreen = false;
bool m_restartInSetupScreenInitial = false;
bool m_canFirmareSetup = false;
bool m_canFirmwareSetup = false;
QString m_error;
};
......@@ -51,7 +51,7 @@ KCM.SimpleKCM {
Kirigami.FormData.label: i18n("General:")
text: i18n("Confirm logout")
checked: Settings.confirmLogout
onToggled: Settings.confirmLogout = true
onToggled: Settings.confirmLogout = checked
KCM.SettingStateBinding {
configObject: Settings
settingName: "confirmLogout"
......@@ -60,7 +60,7 @@ KCM.SimpleKCM {
CheckBox {
text: i18n("Offer shutdown options")
checked: Settings.offerShutdown
onToggled: Settings.offerShutdown = true
onToggled: Settings.offerShutdown = checked
KCM.SettingStateBinding {
configObject: Settings
settingName: "offerShutdown"
......@@ -167,7 +167,7 @@ KCM.SimpleKCM {
CheckBox {
id: uefi
text: i18n("Enter firmware setup screen on next restart")
visible: kcm.canFirmareSetup
visible: kcm.canFirmwareSetup
checked: kcm.restartInSetupScreen
onToggled: kcm.restartInSetupScreen = checked
}
......
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