From 28cdee4e0833c96f4b0c707092814f6ed0bbfd96 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 12 Jul 2018 20:35:01 +0300 Subject: MAINT-8566 Access lists search implementation --- indra/newview/llfloaterregioninfo.cpp | 45 ++++++++++++ indra/newview/llfloaterregioninfo.h | 5 ++ .../skins/default/xui/en/panel_region_access.xml | 80 ++++++++++++++++++++-- 3 files changed, 123 insertions(+), 7 deletions(-) diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 4f1c26d793..4babff69c2 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3267,6 +3267,7 @@ BOOL LLPanelEstateAccess::postBuild() avatar_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); } + getChild("allowed_search_input")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onAllowedSearchEdit, this, _2)); childSetAction("add_allowed_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickAddAllowedAgent, this)); childSetAction("remove_allowed_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveAllowedAgent, this)); @@ -3278,6 +3279,7 @@ BOOL LLPanelEstateAccess::postBuild() group_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); } + getChild("allowed_group_search_input")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onAllowedGroupsSearchEdit, this, _2)); getChild("add_allowed_group_btn")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onClickAddAllowedGroup, this)); childSetAction("remove_allowed_group_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveAllowedGroup, this)); @@ -3289,6 +3291,7 @@ BOOL LLPanelEstateAccess::postBuild() banned_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); } + getChild("banned_search_input")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onBannedSearchEdit, this, _2)); childSetAction("add_banned_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickAddBannedAgent, this)); childSetAction("remove_banned_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveBannedAgent, this)); @@ -4064,3 +4067,45 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url) panel->updateControls(gAgent.getRegion()); } +//--------------------------------------------------------------------------- +// Access lists search +//--------------------------------------------------------------------------- +void LLPanelEstateAccess::onAllowedSearchEdit(const std::string& search_string) +{ + LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess(); + if (!panel) return; + LLNameListCtrl* allowed_agent_name_list = panel->getChild("allowed_avatar_name_list"); + searchAgent(allowed_agent_name_list, search_string); +} + +void LLPanelEstateAccess::onAllowedGroupsSearchEdit(const std::string& search_string) +{ + LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess(); + if (!panel) return; + LLNameListCtrl* allowed_group_name_list = panel->getChild("allowed_group_name_list"); + searchAgent(allowed_group_name_list, search_string); +} + +void LLPanelEstateAccess::onBannedSearchEdit(const std::string& search_string) +{ + LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess(); + if (!panel) return; + LLNameListCtrl* banned_agent_name_list = panel->getChild("banned_avatar_name_list"); + searchAgent(banned_agent_name_list, search_string); +} + +void LLPanelEstateAccess::searchAgent(LLNameListCtrl* listCtrl, const std::string& search_string) +{ + if (!listCtrl) return; + + if (!search_string.empty()) + { + listCtrl->setSearchColumn(0); // name column + listCtrl->selectItemByPrefix(search_string, FALSE); + } + else + { + listCtrl->deselectAllItems(TRUE); + } +} + diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 941c81fbec..70971c119f 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -508,6 +508,9 @@ private: void onClickRemoveBannedAgent(); void onClickAddEstateManager(); void onClickRemoveEstateManager(); + void onAllowedSearchEdit(const std::string& search_string); + void onAllowedGroupsSearchEdit(const std::string& search_string); + void onBannedSearchEdit(const std::string& search_string); // Group picker callback is different, can't use core methods below bool addAllowedGroup(const LLSD& notification, const LLSD& response); @@ -529,6 +532,8 @@ private: static void requestEstateGetAccessCoro(std::string url); + void searchAgent(LLNameListCtrl* listCtrl, const std::string& search_string); + bool mPendingUpdate; }; diff --git a/indra/newview/skins/default/xui/en/panel_region_access.xml b/indra/newview/skins/default/xui/en/panel_region_access.xml index 84967f466c..4a78cdacf0 100644 --- a/indra/newview/skins/default/xui/en/panel_region_access.xml +++ b/indra/newview/skins/default/xui/en/panel_region_access.xml @@ -113,6 +113,28 @@ name="allowed_panel" right="-1" top="0"> + + + + top="0"> + + + + + +