Browse Source

Settings : add resetToDefault for a section

This is needed for webclient to clear its settings
LongChair 7 years ago
parent
commit
bba77f74b1
2 changed files with 10 additions and 0 deletions
  1. 9 0
      src/settings/SettingsComponent.cpp
  2. 1 0
      src/settings/SettingsComponent.h

+ 9 - 0
src/settings/SettingsComponent.cpp

@@ -356,6 +356,15 @@ void SettingsComponent::removeValue(const QString &sectionOrKey)
   }
 }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+void SettingsComponent::resetToDefault(const QString &sectionID)
+{
+  SettingsSection* section = getSection(sectionID);
+
+  if (section)
+    section->resetToDefault();
+}
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 void SettingsComponent::resetToDefault()
 {

+ 1 - 0
src/settings/SettingsComponent.h

@@ -50,6 +50,7 @@ public:
   Q_INVOKABLE QVariant allValues(const QString& section = "");
   Q_INVOKABLE void removeValue(const QString& sectionOrKey);
   Q_INVOKABLE void resetToDefault();
+  Q_INVOKABLE void resetToDefault(const QString& sectionID);
   Q_INVOKABLE QVariantList settingDescriptions();
   Q_INVOKABLE QString getWebClientUrl();