summaryrefslogtreecommitdiff
path: root/indra/llui/llspellcheck.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llspellcheck.cpp')
-rw-r--r--indra/llui/llspellcheck.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp
index 65207144f8..46df44cdba 100644
--- a/indra/llui/llspellcheck.cpp
+++ b/indra/llui/llspellcheck.cpp
@@ -41,6 +41,7 @@ static const std::string DICT_DIR = "dictionaries";
static const std::string DICT_CUSTOM_SUFFIX = "_custom";
static const std::string DICT_IGNORE_SUFFIX = "_ignore";
+LLSD LLSpellChecker::sDictMap;
LLSpellChecker::settings_change_signal_t LLSpellChecker::sSettingsChangeSignal;
LLSpellChecker::LLSpellChecker()
@@ -86,9 +87,10 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vector<std::str
return suggestions.size();
}
-const LLSD LLSpellChecker::getDictionaryData(const std::string& dict_name) const
+// static
+const LLSD LLSpellChecker::getDictionaryData(const std::string& dict_name)
{
- for (LLSD::array_const_iterator it = mDictMap.beginArray(); it != mDictMap.endArray(); ++it)
+ for (LLSD::array_const_iterator it = sDictMap.beginArray(); it != sDictMap.endArray(); ++it)
{
const LLSD& dict_entry = *it;
if (dict_name == dict_entry["language"].asString())
@@ -97,6 +99,7 @@ const LLSD LLSpellChecker::getDictionaryData(const std::string& dict_name) const
return LLSD();
}
+// static
void LLSpellChecker::refreshDictionaryMap()
{
const std::string app_path = getDictionaryAppPath();
@@ -104,16 +107,16 @@ void LLSpellChecker::refreshDictionaryMap()
// Load dictionary information (file name, friendly name, ...)
llifstream user_map(user_path + "dictionaries.xml", std::ios::binary);
- if ( (!user_map.is_open()) || (0 == LLSDSerialize::fromXMLDocument(mDictMap, user_map)) || (0 == mDictMap.size()) )
+ if ( (!user_map.is_open()) || (0 == LLSDSerialize::fromXMLDocument(sDictMap, user_map)) || (0 == sDictMap.size()) )
{
llifstream app_map(app_path + "dictionaries.xml", std::ios::binary);
- if ( (!app_map.is_open()) || (0 == LLSDSerialize::fromXMLDocument(mDictMap, app_map)) || (0 == mDictMap.size()) )
+ if ( (!app_map.is_open()) || (0 == LLSDSerialize::fromXMLDocument(sDictMap, app_map)) || (0 == sDictMap.size()) )
return;
}
// Look for installed dictionaries
std::string tmp_app_path, tmp_user_path;
- for (LLSD::array_iterator it = mDictMap.beginArray(); it != mDictMap.endArray(); ++it)
+ for (LLSD::array_iterator it = sDictMap.beginArray(); it != sDictMap.endArray(); ++it)
{
LLSD& sdDict = *it;
tmp_app_path = (sdDict.has("name")) ? app_path + sdDict["name"].asString() : LLStringUtil::null;
@@ -343,3 +346,10 @@ void LLSpellChecker::setUseSpellCheck(const std::string& dict_name)
LLSpellChecker::instance().initHunspell(dict_name);
}
}
+
+// static
+void LLSpellChecker::initClass()
+{
+ if (sDictMap.isUndefined())
+ refreshDictionaryMap();
+}