From dfad0f4e67821670cfc806dd2f8fcdf9a0d96530 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Tue, 26 Jan 2010 20:17:45 +0200 Subject: 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 --- indra/newview/llnamelistctrl.cpp | 21 ++++++++------------- indra/newview/llnamelistctrl.h | 21 ++++++++++++++++++++- indra/newview/llpanelgrouproles.cpp | 10 +++++----- 3 files changed, 33 insertions(+), 19 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 6375362ae2..9f04558d50 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -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(); -} diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index 192a3a5afa..23b1cb6897 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -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 diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 45f0381d6f..c6287472fe 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -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; } } -- cgit v1.2.3