File specify-default-config-entries.patch of Package sddm
Index: sddm-0.13.0/src/common/ConfigReader.cpp
===================================================================
--- sddm-0.13.0.orig/src/common/ConfigReader.cpp
+++ sddm-0.13.0/src/common/ConfigReader.cpp
@@ -186,17 +186,17 @@ namespace SDDM {
* Initialization of the map of nondefault values to be saved
*/
if (section) {
- if (entry && !entry->isDefault())
+ if (entry && !entry->matchesDefault())
remainingEntries.insert(section, entry);
else
for (const ConfigEntryBase *b : section->entries().values())
- if (!b->isDefault())
+ if (!b->matchesDefault())
remainingEntries.insert(section, b);
}
else {
for (const ConfigSection *s : m_sections)
for (const ConfigEntryBase *b : s->entries().values())
- if (!b->isDefault())
+ if (!b->matchesDefault())
remainingEntries.insert(s, b);
}
Index: sddm-0.13.0/src/common/ConfigReader.h
===================================================================
--- sddm-0.13.0.orig/src/common/ConfigReader.h
+++ sddm-0.13.0/src/common/ConfigReader.h
@@ -77,6 +77,7 @@ namespace SDDM {
virtual void setValue(const QString &str) = 0;
virtual QString toConfigShort() const = 0;
virtual QString toConfigFull() const = 0;
+ virtual bool matchesDefault() const = 0;
virtual bool isDefault() const = 0;
};
@@ -107,6 +108,7 @@ namespace SDDM {
m_description(description),
m_default(value),
m_value(value),
+ m_isDefault(true),
m_parent(parent) {
m_parent->m_entries[name] = this;
}
@@ -117,13 +119,19 @@ namespace SDDM {
void set(const T val) {
m_value = val;
+ m_isDefault = false;
}
- bool isDefault() const {
+ bool matchesDefault() const {
return m_value == m_default;
}
+ bool isDefault() const {
+ return m_isDefault;
+ }
+
bool setDefault() {
+ m_isDefault = true;
if (m_value == m_default)
return false;
m_value = m_default;
@@ -147,6 +155,7 @@ namespace SDDM {
// specialised for QString
void setValue(const QString &str) {
+ m_isDefault = false;
QTextStream in(qPrintable(str));
in >> m_value;
}
@@ -167,6 +176,7 @@ namespace SDDM {
const QString m_description;
T m_default;
T m_value;
+ bool m_isDefault;
ConfigSection *m_parent;
};