diff options
Diffstat (limited to 'indra/newview/llgrouplist.cpp')
-rw-r--r-- | indra/newview/llgrouplist.cpp | 28 |
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; |