From 6508b4f13fd056e6a4ddf1b9845829452a7c3599 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 3 Nov 2009 11:39:43 +0200 Subject: Fixed potencial bug in People Panel. --HG-- branch : product-engine --- indra/newview/llpanelpeople.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelpeople.cpp') diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 4580eeb336..0d16b0a041 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -797,14 +797,15 @@ void LLPanelPeople::reSelectedCurrentTab() void LLPanelPeople::onFilterEdit(const std::string& search_string) { - if (mFilterSubString == search_string) - return; + std::string search_upper = search_string; + // Searches are case-insensitive + LLStringUtil::toUpper(search_upper); + LLStringUtil::trimHead(search_upper); - mFilterSubString = search_string; + if (mFilterSubString == search_upper) + return; - // Searches are case-insensitive - LLStringUtil::toUpper(mFilterSubString); - LLStringUtil::trimHead(mFilterSubString); + mFilterSubString = search_upper; // Apply new filter. mNearbyList->setNameFilter(mFilterSubString); -- cgit v1.2.3 From 4fa120feb419f7ab99998466623696584b7b282d Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 3 Nov 2009 14:58:31 +0200 Subject: Fixed low bug EXT-1620 - Collapsed accordion panels should expand while filtering if they contain matched items. --HG-- branch : product-engine --- indra/newview/llpanelpeople.cpp | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'indra/newview/llpanelpeople.cpp') diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 0d16b0a041..2f8fae0f5d 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -42,6 +42,7 @@ #include "llpanelpeople.h" // newview +#include "llaccordionctrl.h" #include "llaccordionctrltab.h" #include "llagent.h" #include "llavataractions.h" @@ -516,6 +517,9 @@ BOOL LLPanelPeople::postBuild() // call this method in case some list is empty and buttons can be in inconsistent state updateButtons(); + mOnlineFriendList->setRefreshCompleteCallback(boost::bind(&LLPanelPeople::onFriendListRefreshComplete, this, _1, _2)); + mAllFriendList->setRefreshCompleteCallback(boost::bind(&LLPanelPeople::onFriendListRefreshComplete, this, _1, _2)); + return TRUE; } @@ -560,6 +564,8 @@ void LLPanelPeople::updateFriendList() mOnlineFriendList->setDirty(); mAllFriendList->setDirty(); + + showFriendsAccordionsIfNeeded(); } void LLPanelPeople::updateNearbyList() @@ -813,6 +819,8 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) mAllFriendList->setNameFilter(mFilterSubString); mRecentList->setNameFilter(mFilterSubString); mGroupList->setNameFilter(mFilterSubString); + + showFriendsAccordionsIfNeeded(); } void LLPanelPeople::onTabSelected(const LLSD& param) @@ -1125,3 +1133,49 @@ void LLPanelPeople::onOpen(const LLSD& key) else reSelectedCurrentTab(); } + +void LLPanelPeople::showAccordion(const std::string name, bool show) +{ + if(name.empty()) + { + llwarns << "No name provided" << llendl; + return; + } + + LLAccordionCtrlTab* tab = getChild(name); + tab->setVisible(show); + if(show) + { + // expand accordion + tab->changeOpenClose(false); + } +} + +void LLPanelPeople::showFriendsAccordionsIfNeeded() +{ + if(FRIENDS_TAB_NAME == getActiveTabName()) + { + // Expand and show accordions if needed, else - hide them + showAccordion("tab_online", mOnlineFriendList->filterHasMatches()); + showAccordion("tab_all", mAllFriendList->filterHasMatches()); + + // Rearrange accordions + LLAccordionCtrl* accordion = getChild("friends_accordion"); + accordion->arrange(); + } +} + +void LLPanelPeople::onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param) +{ + if(ctrl == mOnlineFriendList) + { + showAccordion("tab_online", param.asInteger()); + } + else if(ctrl == mAllFriendList) + { + showAccordion("tab_all", param.asInteger()); + } + + LLAccordionCtrl* accordion = getChild("friends_accordion"); + accordion->arrange(); +} -- cgit v1.2.3