fix error notices to be more prominent for invalid list names and keywords
parent
f363292a84
commit
1acae5b291
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue