In the Region Tracker Floater, save all selected items when refreshing.

This commit is contained in:
Inusaito Sayori
2015-03-21 03:47:21 -04:00
parent 578e5b7191
commit d7c8b00d90
2 changed files with 24 additions and 3 deletions

View File

@@ -324,6 +324,23 @@ public:
BOOL hasSortOrder() const;
void clearSortOrder();
template<typename T> S32 selectMultiple(const std::vector<T>& vec)
{
size_t count = 0;
for (item_list::iterator iter = mItemList.begin(); iter != mItemList.end(); ++iter)
{
LLScrollListItem* item = *iter;
for (std::vector<T>::const_iterator titr = vec.begin(); titr != vec.end(); ++titr)
if (item->getEnabled() && static_cast<T>(item->getValue()) == (*titr))
{
selectItem(item, false);
++count;
break;
}
}
if (mCommitOnSelectionChange) commitIfChanged();
return count;
}
S32 selectMultiple( uuid_vec_t ids );
// conceptually const, but mutates mItemList
void updateSort() const;

View File

@@ -118,7 +118,11 @@ void ALFloaterRegionTracker::refresh()
return;
}
const std::string& saved_selected_value = mRegionScrollList->getSelectedValue().asString();
std::vector<const std::string> saved_selected_values;
BOOST_FOREACH(const LLScrollListItem* item, mRegionScrollList->getAllSelected())
{
saved_selected_values.push_back(item->getValue().asString());
}
mRegionScrollList->deleteAllItems();
const std::string& cur_region_name = gAgent.getRegion()->getName();
@@ -174,8 +178,8 @@ void ALFloaterRegionTracker::refresh()
mRegionScrollList->addRow(row);
}
}
if (!saved_selected_value.empty())
mRegionScrollList->selectByValue(saved_selected_value);
if (!saved_selected_values.empty())
mRegionScrollList->selectMultiple(saved_selected_values);
}
BOOL ALFloaterRegionTracker::tick()