浏览代码

Settings : add resetToDefault for a section

This is needed for webclient to clear its settings
LongChair 7 年之前
父节点
当前提交
bba77f74b1
共有 2 个文件被更改,包括 10 次插入0 次删除
  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();