diff --git a/src/plugins/todo/optionspage.cpp b/src/plugins/todo/optionspage.cpp index 5c2c7d084db..d449c5b7ac7 100644 --- a/src/plugins/todo/optionspage.cpp +++ b/src/plugins/todo/optionspage.cpp @@ -70,6 +70,9 @@ void OptionsPage::apply() { Settings newSettings = m_widget->settings(); + // "apply" itself is interpreted as "use these keywords, also for other themes". + newSettings.keywordsEdited = true; + if (newSettings != m_settings) { m_settings = newSettings; emit settingsChanged(m_settings); diff --git a/src/plugins/todo/settings.cpp b/src/plugins/todo/settings.cpp index 654165b6411..b61d106812a 100644 --- a/src/plugins/todo/settings.cpp +++ b/src/plugins/todo/settings.cpp @@ -36,6 +36,9 @@ namespace Internal { void Settings::save(QSettings *settings) const { + if (!keywordsEdited) + return; + settings->beginGroup(QLatin1String(Constants::SETTINGS_GROUP)); settings->setValue(QLatin1String(Constants::SCANNING_SCOPE), scanningScope); @@ -97,6 +100,7 @@ void Settings::load(QSettings *settings) newKeywords << keyword; } keywords = newKeywords; + keywordsEdited = true; // Otherwise they wouldn't have been saved } settings->endArray(); @@ -135,12 +139,15 @@ void Settings::setDefault() keyword.iconType = IconType::Warning; keyword.color = QColor(QLatin1String(Constants::COLOR_WARNING_BG)); keywords.append(keyword); + + keywordsEdited = false; } bool Settings::equals(const Settings &other) const { return (keywords == other.keywords) - && (scanningScope == other.scanningScope); + && (scanningScope == other.scanningScope) + && (keywordsEdited == other.keywordsEdited); } bool operator ==(Settings &s1, Settings &s2) diff --git a/src/plugins/todo/settings.h b/src/plugins/todo/settings.h index 69ac06c0cca..e7bedd2cae2 100644 --- a/src/plugins/todo/settings.h +++ b/src/plugins/todo/settings.h @@ -44,6 +44,8 @@ class Settings { public: KeywordList keywords; ScanningScope scanningScope = ScanningScopeCurrentFile; + bool keywordsEdited = false; + void save(QSettings *settings) const; void load(QSettings *settings); void setDefault();