summaryrefslogtreecommitdiff
path: root/indra/newview/llgrouplist.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2009-08-05 16:10:15 -0400
committerNat Goodspeed <nat@lindenlab.com>2009-08-05 16:10:15 -0400
commit07129bf928f79246849e66b396fab44a7a228216 (patch)
treee4e19b342540450ff84dad75f90d5acb5b3d6269 /indra/newview/llgrouplist.cpp
parent03ebc43132331b9a8dcb3c418ec9c319a6beddda (diff)
parentdc62495da6e5c153c0df57fdbce6b0f40c0208f2 (diff)
Merge recent changes
Diffstat (limited to 'indra/newview/llgrouplist.cpp')
-rw-r--r--indra/newview/llgrouplist.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index 5d0bcab07a..278fd5b9f6 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -34,17 +34,32 @@
#include "llgrouplist.h"
+// libs
+#include "lltrans.h"
+
// newview
#include "llagent.h"
-static LLDefaultWidgetRegistry::Register<LLGroupList> r("group_list");
+static LLDefaultChildRegistry::Register<LLGroupList> r("group_list");
+
+LLGroupList::Params::Params()
+{
+ // Prevent the active group from being always first in the list.
+ online_go_first = false;
+}
LLGroupList::LLGroupList(const Params& p)
: LLAvatarList(p)
{
}
-BOOL LLGroupList::updateList()
+static bool findInsensitive(std::string haystack, const std::string& needle_upper)
+{
+ LLStringUtil::toUpper(haystack);
+ return haystack.find(needle_upper) != std::string::npos;
+}
+
+BOOL LLGroupList::update(const std::string& name_filter)
{
LLCtrlListInterface *group_list = getListInterface();
const LLUUID& highlight_id = gAgent.getGroupID();
@@ -58,12 +73,17 @@ BOOL LLGroupList::updateList()
// *TODO: check powers mask?
id = gAgent.mGroups.get(i).mID;
const LLGroupData& group_data = gAgent.mGroups.get(i);
+ if (name_filter != LLStringUtil::null && !findInsensitive(group_data.mName, name_filter))
+ continue;
addItem(id, group_data.mName, highlight_id == id, ADD_BOTTOM);
}
// add "none" to list at top
- //name = LLTrans::getString("GroupsNone")
- addItem(LLUUID::null, std::string("none"), highlight_id.isNull(), ADD_TOP); // *TODO: localize
+ {
+ std::string loc_none = LLTrans::getString("GroupsNone");
+ if (name_filter == LLStringUtil::null || findInsensitive(loc_none, name_filter))
+ addItem(LLUUID::null, loc_none, highlight_id.isNull(), ADD_TOP);
+ }
group_list->selectByValue(highlight_id);
return TRUE;