diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2022-07-20 19:46:57 +0300 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2022-07-20 19:46:57 +0300 |
commit | d7b4a15a12b4097cc400317ac8e53e6135832196 (patch) | |
tree | 677bdb453eaf5cffea97dd29805afc2bd0698339 | |
parent | 5d13ae64338f759c66ed4275cd407a461541b14f (diff) |
SL-17569 restore previous list of ignored notifications after pressing the Cancel button
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.h | 5 |
2 files changed, 33 insertions, 0 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 8d19aa36bb..2bbf3b751f 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -513,6 +513,7 @@ void LLFloaterPreference::saveSettings() if (panel) panel->saveSettings(); } + saveIgnoredNotifications(); } void LLFloaterPreference::apply() @@ -629,6 +630,8 @@ void LLFloaterPreference::cancel() gSavedSettings.setString("PresetGraphicActive", mSavedGraphicsPreset); LLPresetsManager::getInstance()->triggerChangeSignal(); } + + restoreIgnoredNotifications(); } void LLFloaterPreference::onOpen(const LLSD& key) @@ -3637,3 +3640,28 @@ void LLFloaterPreference::collectSearchableItems() } mSearchDataDirty = false; } + +void LLFloaterPreference::saveIgnoredNotifications() +{ + for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); + iter != LLNotifications::instance().templatesEnd(); + ++iter) + { + LLNotificationTemplatePtr templatep = iter->second; + LLNotificationFormPtr formp = templatep->mForm; + + LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType(); + if (ignore <= LLNotificationForm::IGNORE_NO) + continue; + + mIgnorableNotifs[templatep->mName] = !formp->getIgnored(); + } +} + +void LLFloaterPreference::restoreIgnoredNotifications() +{ + for (std::map<std::string, bool>::iterator it = mIgnorableNotifs.begin(); it != mIgnorableNotifs.end(); ++it) + { + LLUI::getInstance()->mSettingGroups["ignores"]->setBOOL(it->first, it->second); + } +} diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 5ef2ca68d3..5797f7be8d 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -144,6 +144,9 @@ public: // cancel() can restore them. void saveSettings(); + void saveIgnoredNotifications(); + void restoreIgnoredNotifications(); + void setCacheLocation(const LLStringExplicit& location); void onClickSetCache(); @@ -224,6 +227,8 @@ private: void onUpdateFilterTerm( bool force = false ); void collectSearchableItems(); + + std::map<std::string, bool> mIgnorableNotifs; }; class LLPanelPreference : public LLPanel |