summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-01-26 20:17:45 +0200
committerVadim Savchuk <vsavchuk@productengine.com>2010-01-26 20:17:45 +0200
commitdfad0f4e67821670cfc806dd2f8fcdf9a0d96530 (patch)
treed297bb8dfc88f523f8837488bb697d2ae0da80e3
parent5344f82e282ed4ce1c016c1e164f674f64bb78be (diff)
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
-rw-r--r--indra/llui/llscrolllistctrl.cpp8
-rw-r--r--indra/llui/llscrolllistctrl.h1
-rw-r--r--indra/llui/llscrolllistitem.h2
-rw-r--r--indra/newview/llnamelistctrl.cpp21
-rw-r--r--indra/newview/llnamelistctrl.h21
-rw-r--r--indra/newview/llpanelgrouproles.cpp10
6 files changed, 41 insertions, 22 deletions
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 71bba57584..78386220d9 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -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
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index 907dc90bea..d2d2379328 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -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 ]
diff --git a/indra/llui/llscrolllistitem.h b/indra/llui/llscrolllistitem.h
index 15b86cc945..25ce846d90 100644
--- a/indra/llui/llscrolllistitem.h
+++ b/indra/llui/llscrolllistitem.h
@@ -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; }
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;
}
}