From 6bd03d160d3235f5d314e182c86474cfb0d62548 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 17 Feb 2012 17:19:27 -0500 Subject: STORM-1738 Initial support for adding new entries warn-on-failure:open-license --- indra/newview/llautocorrectfloater.cpp | 21 ++++---- indra/newview/llautocorrectfloater.h | 3 ++ .../skins/default/xui/en/floater_autocorrect.xml | 57 +++++++++++++++------- 3 files changed, 53 insertions(+), 28 deletions(-) diff --git a/indra/newview/llautocorrectfloater.cpp b/indra/newview/llautocorrectfloater.cpp index 97170fc65c..1cbb08cc1e 100644 --- a/indra/newview/llautocorrectfloater.cpp +++ b/indra/newview/llautocorrectfloater.cpp @@ -74,6 +74,8 @@ BOOL AutoCorrectFloater::postBuild(void) namesList = getChild("ac_list_name"); entryList = getChild("ac_list_entry"); + mOldText = getChild("ac_old_text"); + mNewText = getChild("ac_new_text"); childSetCommitCallback("ac_enable",onBoxCommitEnabled,this); @@ -273,7 +275,7 @@ void AutoCorrectFloater::deleteEntry(void* data) if((self->entryList->getAllSelected().size())>0) { std::string wrong= self->entryList->getFirstSelected()->getColumn(0)->getValue().asString(); - AutoCorrect::getInstance()->removeEntryFromList(wrong,listName); + AutoCorrect::getInstance()->removeEntryFromList(wrong,listName); self->updateItemsList(); AutoCorrect::getInstance()->save(); } @@ -348,17 +350,16 @@ void AutoCorrectFloater::addEntry(void* data) if ( self ) { std::string listName= self->namesList->getFirstSelected()->getColumn(0)->getValue().asString(); - LLChat chat; - chat.mText ="To add an entry, please type in chat \""+gSavedSettings.getString("CmdLineAutocorrect")+" "+listName+"|wrongWord|rightWord\""; - - chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLSD args; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); - + std::string wrong = self->mOldText->getText(); + std::string right = self->mNewText->getText(); + if(wrong != "" && right != "") + { + AutoCorrect::getInstance()->addEntryToList(wrong, right, listName); + self->updateItemsList(); + AutoCorrect::getInstance()->save(); + } } } - } AutoCorrectFloater* AutoCorrectFloater::showFloater() { diff --git a/indra/newview/llautocorrectfloater.h b/indra/newview/llautocorrectfloater.h index bec7161d1a..6c932a3a1d 100644 --- a/indra/newview/llautocorrectfloater.h +++ b/indra/newview/llautocorrectfloater.h @@ -24,6 +24,7 @@ #include "llfloater.h" #include "llmediactrl.h" #include "llscrolllistctrl.h" +#include "lllineeditor.h" #include "llviewerinventory.h" #include @@ -47,6 +48,8 @@ public: LLScrollListCtrl *namesList; LLScrollListCtrl *entryList; + LLLineEditor* mOldText; + LLLineEditor* mNewText; //LLPanel * empanel; private: //static JCInvDropTarget* mNotecardDropTarget; diff --git a/indra/newview/skins/default/xui/en/floater_autocorrect.xml b/indra/newview/skins/default/xui/en/floater_autocorrect.xml index 05683c9907..7e54798d80 100644 --- a/indra/newview/skins/default/xui/en/floater_autocorrect.xml +++ b/indra/newview/skins/default/xui/en/floater_autocorrect.xml @@ -6,7 +6,7 @@ bottom="400" left="300" can_resize="false" - height="430" + height="500" width="400" name="ac_floater" title="Autocorrect Settings"> @@ -237,7 +237,7 @@ mouse_opaque="false" name="divisor3"/>