Fixed critical bug EXT-4663 ([BSI] Inviting Residents to groups produces error 100% of time).

Overriden LLScrollListItem::getUUID() in LLNameListCtrl so that you can get correct ID of a name list item.

--HG--
branch : product-engine
master
Vadim Savchuk 2010-01-26 20:17:45 +02:00
parent 5344f82e28
commit dfad0f4e67
6 changed files with 41 additions and 22 deletions

View File

@ -2760,9 +2760,13 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& element, EAddPosition
LLScrollListItem* LLScrollListCtrl::addRow(const LLScrollListItem::Params& item_p, EAddPosition pos)
{
if (!item_p.validateBlock()) return NULL;
LLScrollListItem *new_item = new LLScrollListItem(item_p);
return addRow(new_item, item_p, pos);
}
LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLScrollListItem::Params& item_p, EAddPosition pos)
{
if (!item_p.validateBlock() || !new_item) return NULL;
new_item->setNumColumns(mColumns.size());
// Add any columns we don't already have

View File

@ -148,6 +148,7 @@ public:
// "columns" => [ "column" => column name, "value" => value, "type" => type, "font" => font, "font-style" => style ], "id" => uuid
// Creates missing columns automatically.
virtual LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
virtual LLScrollListItem* addRow(LLScrollListItem *new_item, const LLScrollListItem::Params& value, EAddPosition pos = ADD_BOTTOM);
virtual LLScrollListItem* addRow(const LLScrollListItem::Params& value, EAddPosition pos = ADD_BOTTOM);
// Simple add element. Takes a single array of:
// [ "value" => value, "font" => font, "font-style" => style ]

View File

@ -95,7 +95,7 @@ public:
void setUserdata( void* userdata ) { mUserdata = userdata; }
void* getUserdata() const { return mUserdata; }
LLUUID getUUID() const { return mItemValue.asUUID(); }
virtual LLUUID getUUID() const { return mItemValue.asUUID(); }
LLSD getValue() const { return mItemValue; }
void setRect(LLRect rect) { mRectangle = rect; }

View File

@ -148,7 +148,7 @@ BOOL LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask)
&& column_index == mNameColumnIndex)
{
// ...this is the column with the avatar name
LLUUID avatar_id = getItemId(hit_item);
LLUUID avatar_id = hit_item->getUUID();
if (avatar_id.notNull())
{
// ...valid avatar id
@ -230,14 +230,15 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(
std::string& suffix)
{
LLUUID id = name_item.value().asUUID();
LLScrollListItem* item = NULL;
LLNameListItem* item = NULL;
// Store item type so that we can invoke the proper inspector.
// *TODO Vadim: Is there a more proper way of storing additional item data?
{
LLNameListCtrl::NameItem name_item_(name_item);
name_item_.value = LLSD().with("uuid", id).with("is_group", name_item.target() == GROUP);
item = LLScrollListCtrl::addRow(name_item_, pos);
LLNameListCtrl::NameItem item_p(name_item);
item_p.value = LLSD().with("uuid", id).with("is_group", name_item.target() == GROUP);
item = new LLNameListItem(item_p);
LLScrollListCtrl::addRow(item, item_p, pos);
}
if (!item) return NULL;
@ -298,7 +299,7 @@ void LLNameListCtrl::removeNameItem(const LLUUID& agent_id)
for (item_list::iterator it = getItemList().begin(); it != getItemList().end(); it++)
{
LLScrollListItem* item = *it;
if (getItemId(item) == agent_id)
if (item->getUUID() == agent_id)
{
idx = getItemIndex(item);
break;
@ -335,7 +336,7 @@ void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first,
for (iter = getItemList().begin(); iter != getItemList().end(); iter++)
{
LLScrollListItem* item = *iter;
if (getItemId(item) == id)
if (item->getUUID() == id)
{
LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(0);
cell = item->getColumn(mNameColumnIndex);
@ -375,9 +376,3 @@ void LLNameListCtrl::updateColumns()
}
}
}
// static
LLUUID LLNameListCtrl::getItemId(LLScrollListItem* item)
{
return item->getValue()["uuid"].asUUID();
}

View File

@ -122,7 +122,6 @@ public:
/*virtual*/ void updateColumns();
private:
void showInspector(const LLUUID& avatar_id, bool is_group);
static LLUUID getItemId(LLScrollListItem* item);
private:
S32 mNameColumnIndex;
@ -130,4 +129,24 @@ private:
BOOL mAllowCallingCardDrop;
};
/**
* LLNameListCtrl item
*
* We don't use LLScrollListItem to be able to override getUUID(), which is needed
* because the name list item value is not simply an UUID but a map (uuid, is_group).
*/
class LLNameListItem : public LLScrollListItem
{
public:
LLUUID getUUID() const { return getValue()["uuid"].asUUID(); }
protected:
friend class LLNameListCtrl;
LLNameListItem( const LLScrollListItem::Params& p )
: LLScrollListItem(p)
{
}
};
#endif

View File

@ -867,7 +867,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
for (itor = selection.begin();
itor != selection.end(); ++itor)
{
LLUUID member_id = (*itor)->getValue()["uuid"];
LLUUID member_id = (*itor)->getUUID();
selected_members.push_back( member_id );
// Get this member's power mask including any unsaved changes
@ -1093,7 +1093,7 @@ void LLPanelGroupMembersSubTab::handleEjectMembers()
for (itor = selection.begin() ;
itor != selection.end(); ++itor)
{
LLUUID member_id = (*itor)->getValue()["uuid"];
LLUUID member_id = (*itor)->getUUID();
selected_members.push_back( member_id );
}
@ -1151,7 +1151,7 @@ void LLPanelGroupMembersSubTab::handleRoleCheck(const LLUUID& role_id,
itor != selection.end(); ++itor)
{
member_id = (*itor)->getValue()["uuid"];
member_id = (*itor)->getUUID();
//see if we requested a change for this member before
if ( mMemberRoleChangeData.find(member_id) == mMemberRoleChangeData.end() )
@ -1242,7 +1242,7 @@ void LLPanelGroupMembersSubTab::handleMemberDoubleClick()
LLScrollListItem* selected = mMembersList->getFirstSelected();
if (selected)
{
LLUUID member_id = selected->getValue()["uuid"];
LLUUID member_id = selected->getUUID();
LLAvatarActions::showProfile( member_id );
}
}
@ -1632,7 +1632,7 @@ void LLPanelGroupMembersSubTab::updateMembers()
LLScrollListItem* member = mMembersList->addElement(row);//, ADD_SORTED);
LLUUID id = member->getValue()["uuid"];
LLUUID id = member->getUUID();
mHasMatch = TRUE;
}
}