Scott Lawrence avatar Scott Lawrence committed 6a35dd7

fix error notices to be more prominent for invalid list names and keywords

Comments (0)

Files changed (4)

indra/newview/llautoreplace.cpp

 			}
 			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;
 	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();
 			{
 				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();
 			}
 	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;
 
 		{
 			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;
 			}
 		}
 				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)

indra/newview/llautoreplace.h

 	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);

indra/newview/llfloaterautoreplacesettings.cpp

 		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();
 	{
 		LLNotificationsUtil::add("InvalidAutoReplaceEntry");
 		LL_WARNS("AutoReplace")<<"invalid entry "
-							   << "keyword '" << keyword
-							   << "' replacement '" << replacement
+							   << "keyword '" << wstring_to_utf8str(keyword)
+							   << "' replacement '" << wstring_to_utf8str(replacement)
 							   << "'" << LL_ENDL;
 	}
 }

indra/newview/skins/default/xui/en/notifications.xml

   </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>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.