diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 2d84791b1..04c635f2a 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -312,12 +312,12 @@ std::vector LLScrollListCtrl::getAllSelected() const uuid_vec_t LLScrollListCtrl::getSelectedIDs() { - LLUUID selected_id; uuid_vec_t ids; - std::vector selected = this->getAllSelected(); - for(std::vector::iterator itr = selected.begin(); itr != selected.end(); ++itr) + if (!getCanSelect()) return ids; + + for(const auto& item : mItemList) { - ids.push_back((*itr)->getUUID()); + if (item->getSelected()) ids.push_back(item->getUUID()); } return ids; } @@ -400,6 +400,17 @@ std::vector LLScrollListCtrl::getAllData() const return ret; } +uuid_vec_t LLScrollListCtrl::getAllIDs() const +{ + uuid_vec_t ret; + ret.reserve(mItemList.size()); //Optimization + for(const auto& item : mItemList) + { + ret.push_back(item->getUUID()); + } + return ret; +} + // returns first matching item LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const { diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 3a2adf5c6..d5ffb9df9 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -207,6 +207,7 @@ public: LLScrollListItem* getFirstData() const; LLScrollListItem* getLastData() const; std::vector getAllData() const; + uuid_vec_t getAllIDs() const; //Helper. Much like getAllData, but just provides a LLUUID vec LLScrollListItem* getItem(const LLSD& sd) const;