summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelpeople.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelpeople.cpp')
-rw-r--r--indra/newview/llpanelpeople.cpp72
1 files changed, 62 insertions, 10 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 4580eeb336..65a7b5322b 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"
@@ -453,7 +454,7 @@ BOOL LLPanelPeople::postBuild()
mNearbyList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mNearbyList));
mRecentList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mRecentList));
- mGroupList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onGroupInfoButtonClicked, this));
+ mGroupList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onChatButtonClicked, this));
mGroupList->setCommitCallback(boost::bind(&LLPanelPeople::updateButtons, this));
LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>("tab_all");
@@ -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()
@@ -797,14 +803,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);
@@ -812,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)
@@ -983,9 +992,6 @@ void LLPanelPeople::onFriendsViewSortMenuItemClicked(const LLSD& userdata)
mAllFriendList->toggleIcons();
mOnlineFriendList->toggleIcons();
}
- else if (chosen_item == "organize_offline")
- {
- }
}
void LLPanelPeople::onGroupsViewSortMenuItemClicked(const LLSD& userdata)
@@ -1124,3 +1130,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<LLAccordionCtrlTab>(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<LLAccordionCtrl>("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<LLAccordionCtrl>("friends_accordion");
+ accordion->arrange();
+}