From 66fee67397d17f03ac5492a903735e2e6eef9f1f Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 12 Dec 2012 09:22:14 -0500 Subject: MAINT-2051: Implement replacement of an existing autoreplace list --- indra/newview/llautoreplace.cpp | 40 ++++++++++++++++++++++++++ indra/newview/llautoreplace.h | 3 ++ indra/newview/llfloaterautoreplacesettings.cpp | 17 +++++++++-- 3 files changed, 57 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp index 0f1ce2bcd0..d71cf290d6 100644 --- a/indra/newview/llautoreplace.cpp +++ b/indra/newview/llautoreplace.cpp @@ -536,6 +536,46 @@ LLAutoReplaceSettings::AddListResult LLAutoReplaceSettings::addList(const LLSD& return result; } +LLAutoReplaceSettings::AddListResult LLAutoReplaceSettings::replaceList(const LLSD& newList) +{ + AddListResult result = AddListInvalidList; + if ( listIsValid( newList ) ) + { + std::string listName = newList[AUTOREPLACE_LIST_NAME].asString(); + bool listFound = false; + S32 search_index; + LLSD targetList; + // The following is working around the fact that LLSD arrays containing maps also seem to have undefined entries... see LLSD-30 + for ( search_index = 0, targetList = mLists[0]; + !listFound && search_index < mLists.size(); + search_index += 1, targetList = mLists[search_index] + ) + { + if ( targetList.isMap() ) + { + if ( listNameMatches( targetList, listName) ) + { + LL_DEBUGS("AutoReplace")<<"list to replace found at "< Date: Wed, 12 Dec 2012 10:53:13 -0500 Subject: MAINT-2082: fix deletion of an autoreplace list --- indra/newview/llfloaterautoreplacesettings.cpp | 29 +++++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterautoreplacesettings.cpp b/indra/newview/llfloaterautoreplacesettings.cpp index 5dcdded744..6e56e929df 100644 --- a/indra/newview/llfloaterautoreplacesettings.cpp +++ b/indra/newview/llfloaterautoreplacesettings.cpp @@ -514,14 +514,27 @@ bool LLFloaterAutoReplaceSettings::callbackListNameConflict(const LLSD& notifica void LLFloaterAutoReplaceSettings::onDeleteList() { - std::string listName= mListNames->getFirstSelected()->getColumn(0)->getValue().asString(); - mSettings.removeReplacementList(listName); // remove from the copy of settings - mReplacementsList->deleteSelectedItems(); // remove from the scrolling list - - mSelectedListName.clear(); - updateListNames(); - updateListNamesControls(); - updateReplacementsList(); + std::string listName = mListNames->getSelectedValue().asString(); + if ( ! listName.empty() ) + { + if ( mSettings.removeReplacementList(listName) ) + { + LL_INFOS("AutoReplace")<<"deleted list '"<deleteSelectedItems(); // remove from the scrolling list + mSelectedListName.clear(); + updateListNames(); + updateListNamesControls(); + updateReplacementsList(); + } + else + { + LL_WARNS("AutoReplace")<<"failed to delete list '"<