diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 92cb40332e5bb81714b9e6569e8fbc4881b49091..5a1ddc2c5904bb7c48f7441c1876ffdb2d1def22 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -379,11 +379,14 @@ private: void setNoItemsCommentVisible(bool visible) const; -private: +protected: /** Comparator to use when sorting the list. */ const ItemComparator* mItemComparator; + +private: + LLPanel* mItemsPanel; S32 mItemsNoScrollWidth; diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 45c540b3a3c585c9d7f4bf9a38ee65dfa38ad657..91ebe910ce27cd7fb019608b605ecf2735a97c75 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -334,6 +334,17 @@ boost::signals2::connection LLAvatarList::setItemDoubleClickCallback(const mouse return mItemDoubleClickSignal.connect(cb); } +//virtual +S32 LLAvatarList::notifyParent(const LLSD& info) +{ + if (info.has("sort") && &NAME_COMPARATOR == mItemComparator) + { + sort(); + return 1; + } + return LLFlatListView::notifyParent(info); +} + void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos) { LLAvatarListItem* item = new LLAvatarListItem(); diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index 00c72f1f9daf9e4e2ba62f5dcf52b5fe3e3b128e..b9be1d0bdc1136df79576a02514521f7312fab9e 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -96,6 +96,8 @@ public: boost::signals2::connection setItemDoubleClickCallback(const mouse_signal_t::slot_type& cb); + virtual S32 notifyParent(const LLSD& info); + protected: void refresh(); diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 9645e75e608dee8bd2910688d41cb7f274cc2e53..44f88cce297802607a590398f419ac729572ada4 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -119,8 +119,9 @@ S32 LLAvatarListItem::notifyParent(const LLSD& info) if (info.has("visibility_changed")) { updateChildren(); + return 1; } - return 0; + return LLPanel::notifyParent(info); } void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask) @@ -334,6 +335,9 @@ void LLAvatarListItem::onNameCache(const std::string& first_name, const std::str { std::string name = first_name + " " + last_name; setName(name); + + //requesting the list to resort + notifyParent(LLSD().with("sort", LLSD())); } // Convert given number of seconds to a string like "23 minutes", "15 hours" or "3 years",