From e29df040bc1ee68fe37599eb80de237fcf4cd768 Mon Sep 17 00:00:00 2001 From: Cinders Date: Mon, 20 May 2013 09:30:11 -0600 Subject: [PATCH] Potential fix for FIRE-10338, commit spellcheck settings immediately, not on closing the floater --- indra/newview/llfloaterspellchecksettings.cpp | 48 +++++++++++-------- indra/newview/llfloaterspellchecksettings.h | 3 ++ 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/indra/newview/llfloaterspellchecksettings.cpp b/indra/newview/llfloaterspellchecksettings.cpp index 5ecdd11918..048e1135f3 100644 --- a/indra/newview/llfloaterspellchecksettings.cpp +++ b/indra/newview/llfloaterspellchecksettings.cpp @@ -96,6 +96,8 @@ void LLFloaterSpellCheckerSettings::onBtnMove(const std::string& from, const std to_ctrl->setSelectedByValue( (*sel_it)->getValue(), true ); } from_ctrl->deleteSelectedItems(); + + commitChanges(); } void LLFloaterSpellCheckerSettings::onClose(bool app_quitting) @@ -107,26 +109,7 @@ void LLFloaterSpellCheckerSettings::onClose(bool app_quitting) } LLFloaterReg::hideInstance("prefs_spellchecker_import"); - std::list list_dict; - - LLComboBox* dict_combo = findChild("spellcheck_main_combo"); - const std::string dict_name = dict_combo->getSelectedItemLabel(); - if (!dict_name.empty()) - { - list_dict.push_back(dict_name); - - LLScrollListCtrl* list_ctrl = findChild("spellcheck_active_list"); - std::vector list_items = list_ctrl->getAllData(); - for (std::vector::const_iterator item_it = list_items.begin(); item_it != list_items.end(); ++item_it) - { - const std::string language = (*item_it)->getValue().asString(); - if (LLSpellChecker::hasDictionary(language, true)) - { - list_dict.push_back(language); - } - } - } - gSavedSettings.setString("SpellCheckDictionary", boost::join(list_dict, ",")); + commitChanges(); } void LLFloaterSpellCheckerSettings::onOpen(const LLSD& key) @@ -237,6 +220,31 @@ void LLFloaterSpellCheckerSettings::refreshDictionaries(bool from_settings) } } avail_ctrl->sortByColumnIndex(0, true); + commitChanges(); +} + +void LLFloaterSpellCheckerSettings::commitChanges() +{ + std::list list_dict; + + LLComboBox* dict_combo = findChild("spellcheck_main_combo"); + const std::string dict_name = dict_combo->getSelectedItemLabel(); + if (!dict_name.empty()) + { + list_dict.push_back(dict_name); + + LLScrollListCtrl* list_ctrl = findChild("spellcheck_active_list"); + std::vector list_items = list_ctrl->getAllData(); + for (std::vector::const_iterator item_it = list_items.begin(); item_it != list_items.end(); ++item_it) + { + const std::string language = (*item_it)->getValue().asString(); + if (LLSpellChecker::hasDictionary(language, true)) + { + list_dict.push_back(language); + } + } + } + gSavedSettings.setString("SpellCheckDictionary", boost::join(list_dict, ",")); } ///---------------------------------------------------------------------------- diff --git a/indra/newview/llfloaterspellchecksettings.h b/indra/newview/llfloaterspellchecksettings.h index eded3a9133..3b198ddbdf 100644 --- a/indra/newview/llfloaterspellchecksettings.h +++ b/indra/newview/llfloaterspellchecksettings.h @@ -45,6 +45,9 @@ protected: void onBtnRemove(); void onSpellCheckSettingsChange(); void refreshDictionaries(bool from_settings); + +private: + void commitChanges(); }; class LLFloaterSpellCheckerImport : public LLFloater