In the Region Tracker Floater, save all selected items when refreshing.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user