summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llautoreplace.cpp12
-rw-r--r--indra/newview/llautoreplace.h2
-rw-r--r--indra/newview/llfloaterautoreplacesettings.cpp13
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml8
4 files changed, 18 insertions, 17 deletions
diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp
index 641e354605..0f1ce2bcd0 100644
--- a/indra/newview/llautoreplace.cpp
+++ b/indra/newview/llautoreplace.cpp
@@ -64,6 +64,7 @@ void LLAutoReplace::autoreplaceCallback(LLUIString& inputText, S32& cursorPos)
}
if (haveWord)
{
+ // wordEnd points to the end of a word, now find the start of the word
std::string word;
S32 wordStart = wordEnd;
for ( S32 backOne = wordStart - 1;
@@ -650,6 +651,7 @@ std::string LLAutoReplaceSettings::replaceWord(const std::string currentWord)
static LLCachedControl<bool> autoreplace_enabled(gSavedSettings, "AutoReplace");
if ( autoreplace_enabled )
{
+ LL_DEBUGS("AutoReplace")<<"checking '"<<currentWord<<"'"<< LL_ENDL;
//loop through lists in order
bool found = false;
for( LLSD::array_const_iterator list = mLists.beginArray(), endLists = mLists.endArray();
@@ -664,8 +666,8 @@ std::string LLAutoReplaceSettings::replaceWord(const std::string currentWord)
{
found = true;
LL_DEBUGS("AutoReplace")
- << "found in list '" << checkList[AUTOREPLACE_LIST_NAME].asString() << "' : '"
- << currentWord << "' => '" << replacements[currentWord].asString() << "'"
+ << " found in list '" << checkList[AUTOREPLACE_LIST_NAME].asString()
+ << " => '" << replacements[currentWord].asString() << "'"
<< LL_ENDL;
returnedWord = replacements[currentWord].asString();
}
@@ -674,7 +676,7 @@ std::string LLAutoReplaceSettings::replaceWord(const std::string currentWord)
return returnedWord;
}
-bool LLAutoReplaceSettings::addEntryToList(std::string keyword, std::string replacement, std::string listName)
+bool LLAutoReplaceSettings::addEntryToList(LLWString keyword, LLWString replacement, std::string listName)
{
bool added = false;
@@ -685,7 +687,7 @@ bool LLAutoReplaceSettings::addEntryToList(std::string keyword, std::string repl
{
if ( ! LLWStringUtil::isPartOfWord(keyword[character]) )
{
- LL_WARNS("AutoReplace") << "keyword '" << keyword << "' not a single word" << LL_ENDL;
+ LL_WARNS("AutoReplace") << "keyword '" << wstring_to_utf8str(keyword) << "' not a single word (len "<<keyword.size()<<" '"<<character<<"')" << LL_ENDL;
isOneWord = false;
}
}
@@ -701,7 +703,7 @@ bool LLAutoReplaceSettings::addEntryToList(std::string keyword, std::string repl
if ( listNameMatches(*list, listName) )
{
listFound = true;
- (*list)[AUTOREPLACE_LIST_REPLACEMENTS][keyword]=replacement;
+ (*list)[AUTOREPLACE_LIST_REPLACEMENTS][wstring_to_utf8str(keyword)]=wstring_to_utf8str(replacement);
}
}
if (listFound)
diff --git a/indra/newview/llautoreplace.h b/indra/newview/llautoreplace.h
index c097e96b9e..30b1fd2c65 100644
--- a/indra/newview/llautoreplace.h
+++ b/indra/newview/llautoreplace.h
@@ -114,7 +114,7 @@ class LLAutoReplaceSettings
std::string replacementFor(std::string keyword, std::string listName);
/// Adds a keywword/replacement pair to the named list
- bool addEntryToList(std::string keyword, std::string replacement, std::string listName);
+ bool addEntryToList(LLWString keyword, LLWString replacement, std::string listName);
/// Removes the keywword and its replacement from the named list
bool removeEntryFromList(std::string keyword, std::string listName);
diff --git a/indra/newview/llfloaterautoreplacesettings.cpp b/indra/newview/llfloaterautoreplacesettings.cpp
index 64b3b09276..1449c88820 100644
--- a/indra/newview/llfloaterautoreplacesettings.cpp
+++ b/indra/newview/llfloaterautoreplacesettings.cpp
@@ -550,16 +550,15 @@ void LLFloaterAutoReplaceSettings::onSaveEntry()
mSettings.removeEntryFromList( mPreviousKeyword, mSelectedListName );
}
- // @TODO should all these be LLWStrings ?
- std::string keyword = mKeyword->getValue().asString();
- std::string replacement = mReplacement->getValue().asString();
+ LLWString keyword = mKeyword->getWText();
+ LLWString replacement = mReplacement->getWText();
if ( mSettings.addEntryToList(keyword, replacement, mSelectedListName) )
{
// insert the new keyword->replacement pair
LL_INFOS("AutoReplace")
<< "list '" << mSelectedListName << "' "
- << "added '" << keyword
- << "' -> '" << replacement
+ << "added '" << wstring_to_utf8str(keyword)
+ << "' -> '" << wstring_to_utf8str(replacement)
<< "'" << LL_ENDL;
updateReplacementsList();
@@ -568,8 +567,8 @@ void LLFloaterAutoReplaceSettings::onSaveEntry()
{
LLNotificationsUtil::add("InvalidAutoReplaceEntry");
LL_WARNS("AutoReplace")<<"invalid entry "
- << "keyword '" << keyword
- << "' replacement '" << replacement
+ << "keyword '" << wstring_to_utf8str(keyword)
+ << "' replacement '" << wstring_to_utf8str(replacement)
<< "'" << LL_ENDL;
}
}
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 47cf35092c..bc69e973ed 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -2381,17 +2381,17 @@ Would you be my friend?
</notification>
<notification
- icon="notify.tga"
+ icon="alertmodal.tga"
name="InvalidAutoReplaceEntry"
- type="notify">
+ type="alertmodal">
The keyword must be a single word, and the replacement may not be empty.
<tag>fail</tag>
</notification>
<notification
- icon="notify.tga"
+ icon="alertmodal.tga"
name="InvalidAutoReplaceList"
- type="notify">
+ type="alertmodal">
That replacement list is not valid.
<tag>fail</tag>
</notification>