Skip to content
Snippets Groups Projects
Commit d0eff207 authored by Oz Linden's avatar Oz Linden
Browse files

merge changes for DRTVWR-267

parents c4c73fbc b7ac7a07
Branches
Tags
No related merge requests found
...@@ -373,3 +373,4 @@ c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257 ...@@ -373,3 +373,4 @@ c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257
452ce96d4046dc05a3ecaecc203e2cc8ddd72e76 DRTVWR-259 452ce96d4046dc05a3ecaecc203e2cc8ddd72e76 DRTVWR-259
daca610d840625b5bebb966a57cb49581852c417 DRTVWR-265 daca610d840625b5bebb966a57cb49581852c417 DRTVWR-265
9afbdc4e24cc04feacfb2b7a10b78a64f780901a DRTVWR-266 9afbdc4e24cc04feacfb2b7a10b78a64f780901a DRTVWR-266
73280db02501f5ad041fc18b1eba68e73a81996c DRTVWR-267
...@@ -536,6 +536,46 @@ LLAutoReplaceSettings::AddListResult LLAutoReplaceSettings::addList(const LLSD& ...@@ -536,6 +536,46 @@ LLAutoReplaceSettings::AddListResult LLAutoReplaceSettings::addList(const LLSD&
return result; 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 "<<search_index<<LL_ENDL;
mLists.erase(search_index);
mLists.insert(search_index, newList);
listFound = true;
result = AddListOk;
}
}
}
if ( ! listFound )
{
LL_WARNS("AutoReplace") << "attempt to replace unconfigured list" << LL_ENDL;
}
}
else
{
LL_WARNS("AutoReplace") << "attempt to add invalid list" << LL_ENDL;
}
return result;
}
bool LLAutoReplaceSettings::removeReplacementList(std::string listName) bool LLAutoReplaceSettings::removeReplacementList(std::string listName)
{ {
bool found = false; bool found = false;
......
...@@ -67,6 +67,9 @@ class LLAutoReplaceSettings ...@@ -67,6 +67,9 @@ class LLAutoReplaceSettings
/// Inserts a new list at the end of the priority order /// Inserts a new list at the end of the priority order
AddListResult addList(const LLSD& newList); AddListResult addList(const LLSD& newList);
/// Inserts a list in place of an existing list of the same name
AddListResult replaceList(const LLSD& newList);
/// Removes the named list, @returns false if not found /// Removes the named list, @returns false if not found
bool removeReplacementList(std::string listName); bool removeReplacementList(std::string listName);
......
...@@ -478,14 +478,25 @@ bool LLFloaterAutoReplaceSettings::callbackNewListName(const LLSD& notification, ...@@ -478,14 +478,25 @@ bool LLFloaterAutoReplaceSettings::callbackNewListName(const LLSD& notification,
bool LLFloaterAutoReplaceSettings::callbackListNameConflict(const LLSD& notification, const LLSD& response) bool LLFloaterAutoReplaceSettings::callbackListNameConflict(const LLSD& notification, const LLSD& response)
{ {
LLSD newList = notification["payload"]["list"]; LLSD newList = notification["payload"]["list"];
std::string listName = LLAutoReplaceSettings::getListName(newList);
S32 option = LLNotificationsUtil::getSelectedOption(notification, response); S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
switch ( option ) switch ( option )
{ {
case 0: case 0:
// Replace current list // Replace current list
LL_INFOS("AutoReplace")<<"option 'replace current list' selected"<<LL_ENDL; if ( LLAutoReplaceSettings::AddListOk == mSettings.replaceList(newList) )
{
LL_INFOS("AutoReplace") << "replaced list '"<<listName<<"'"<<LL_ENDL;
mSelectedListName = listName;
updateListNames();
updateListNamesControls();
updateReplacementsList();
}
else
{
LL_WARNS("AutoReplace")<<"failed to replace list '"<<listName<<"'"<<LL_ENDL;
}
break; break;
case 1: case 1:
...@@ -503,15 +514,28 @@ bool LLFloaterAutoReplaceSettings::callbackListNameConflict(const LLSD& notifica ...@@ -503,15 +514,28 @@ bool LLFloaterAutoReplaceSettings::callbackListNameConflict(const LLSD& notifica
void LLFloaterAutoReplaceSettings::onDeleteList() void LLFloaterAutoReplaceSettings::onDeleteList()
{ {
std::string listName= mListNames->getFirstSelected()->getColumn(0)->getValue().asString(); std::string listName = mListNames->getSelectedValue().asString();
mSettings.removeReplacementList(listName); // remove from the copy of settings if ( ! listName.empty() )
{
if ( mSettings.removeReplacementList(listName) )
{
LL_INFOS("AutoReplace")<<"deleted list '"<<listName<<"'"<<LL_ENDL;
mReplacementsList->deleteSelectedItems(); // remove from the scrolling list mReplacementsList->deleteSelectedItems(); // remove from the scrolling list
mSelectedListName.clear(); mSelectedListName.clear();
updateListNames(); updateListNames();
updateListNamesControls(); updateListNamesControls();
updateReplacementsList(); updateReplacementsList();
} }
else
{
LL_WARNS("AutoReplace")<<"failed to delete list '"<<listName<<"'"<<LL_ENDL;
}
}
else
{
LL_DEBUGS("AutoReplace")<<"no list selected for delete"<<LL_ENDL;
}
}
void LLFloaterAutoReplaceSettings::onExportList() void LLFloaterAutoReplaceSettings::onExportList()
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment