fixed EXT-4753 Just arrived avatars aren't sorted by name in VCP

added requesting a list to resort when avatar list item gets updated with avatar name from the name cache

--HG--
branch : product-engine
master
Igor Borovkov 2010-03-23 16:13:59 +02:00
parent eb119c2268
commit 60d680f2eb
4 changed files with 22 additions and 2 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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();

View File

@ -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",