void LLGroupList::refresh()
{
	const LLUUID& 		highlight_id	= gAgent.getGroupID();
	S32					count			= gAgent.mGroups.count();
	LLUUID				id;
	bool				have_filter		= !mNameFilter.empty();

	// set no items message depend on filter state & total count of groups
	if (have_filter)
	{
		// groups were filtered
		setNoItemsCommentText(mNoFilteredGroupsMsg);
	}
	else if (0 == count)
	{
		// user is not a member of any group
		setNoItemsCommentText(mNoGroupsMsg);
	}

	clear();

	for(S32 i = 0; i < count; ++i)
	{
		id = gAgent.mGroups.get(i).mID;
		const LLGroupData& group_data = gAgent.mGroups.get(i);
		if (have_filter && !findInsensitive(group_data.mName, mNameFilter))
			continue;
		addNewItem(id, group_data.mName, group_data.mInsigniaID, ADD_BOTTOM);
	}

	// Sort the list.
	sort();

	// Add "none" to list at top if filter not set (what's the point of filtering "none"?).
	// but only if some real groups exists. EXT-4838
	if (!have_filter && count > 0)
	{
		std::string loc_none = LLTrans::getString("GroupsNone");
		addNewItem(LLUUID::null, loc_none, LLUUID::null, ADD_TOP);
	}

	selectItemByUUID(highlight_id);

	setDirty(false);
	onCommit();
}
Exemple #2
0
void LLFlatListViewEx::updateNoItemsMessage(const std::string& filter_string)
{
	bool items_filtered = !filter_string.empty();
	if (items_filtered)
	{
		// items were filtered
		LLStringUtil::format_map_t args;
		args["[SEARCH_TERM]"] = LLURI::escape(filter_string);
		std::string text = mNoFilteredItemsMsg;
		LLStringUtil::format(text, args);
		setNoItemsCommentText(text);
	}
	else
	{
		// list does not contain any items at all
		setNoItemsCommentText(mNoItemsMsg);
	}

}