diff options
Diffstat (limited to 'indra/newview/llinventoryitemslist.cpp')
-rw-r--r-- | indra/newview/llinventoryitemslist.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp index e01f05c0f2..a6d3d4e154 100644 --- a/indra/newview/llinventoryitemslist.cpp +++ b/indra/newview/llinventoryitemslist.cpp @@ -85,6 +85,37 @@ boost::signals2::connection LLInventoryItemsList::setRefreshCompleteCallback(con return mRefreshCompleteSignal.connect(cb); } +bool LLInventoryItemsList::selectItemByValue(const LLSD& value, bool select) +{ + if (!LLFlatListView::selectItemByValue(value, select) && !value.isUndefined()) + { + mSelectTheseIDs.push_back(value); + return false; + } + return true; +} + +void LLInventoryItemsList::updateSelection() +{ + if(mSelectTheseIDs.empty()) return; + + std::vector<LLSD> cur; + getValues(cur); + + for(std::vector<LLSD>::const_iterator cur_id_it = cur.begin(); cur_id_it != cur.end() && !mSelectTheseIDs.empty(); ++cur_id_it) + { + uuid_vec_t::iterator select_ids_it = std::find(mSelectTheseIDs.begin(), mSelectTheseIDs.end(), *cur_id_it); + if(select_ids_it != mSelectTheseIDs.end()) + { + selectItemByUUID(*select_ids_it); + mSelectTheseIDs.erase(select_ids_it); + } + } + + scrollToShowFirstSelectedItem(); + mSelectTheseIDs.clear(); +} + void LLInventoryItemsList::doIdle() { if (!mNeedsRefresh) return; @@ -153,6 +184,12 @@ void LLInventoryItemsList::refresh() bool needs_refresh = add_limit_exceeded; setNeedsRefresh(needs_refresh); setForceRefresh(needs_refresh); + + // After list building completed, select items that had been requested to select before list was build + if(!needs_refresh) + { + updateSelection(); + } } void LLInventoryItemsList::computeDifference( |