summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDmitry Zaporozhan <dzaporozhan@productengine.com>2009-11-03 14:58:31 +0200
committerDmitry Zaporozhan <dzaporozhan@productengine.com>2009-11-03 14:58:31 +0200
commit4fa120feb419f7ab99998466623696584b7b282d (patch)
treeb089439a0b654e472b692b0b88ceb11f9843d572 /indra
parent5f30904db45c8cd3eec5506503128eaf3df4e429 (diff)
Fixed low bug EXT-1620 - Collapsed accordion panels should expand while filtering if they contain matched items.
--HG-- branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llavatarlist.cpp35
-rw-r--r--indra/newview/llavatarlist.h7
-rw-r--r--indra/newview/llpanelpeople.cpp54
-rw-r--r--indra/newview/llpanelpeople.h6
4 files changed, 102 insertions, 0 deletions
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 7b2dc02864..8609ba8b1c 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -239,11 +239,46 @@ void LLAvatarList::refresh()
bool dirty = add_limit_exceeded || (have_filter && !have_names);
setDirty(dirty);
+ // Refreshed all items, lets send refresh_complete signal.
+ if(!dirty)
+ {
+ std::vector<LLSD> cur_values;
+ getValues(cur_values);
+ mRefreshCompleteSignal(this, LLSD((S32)cur_values.size()));
+ }
+
// Commit if we've added/removed items.
if (modified)
onCommit();
}
+bool LLAvatarList::filterHasMatches()
+{
+ uuid_vector_t values = getIDs();
+
+ for (uuid_vector_t::const_iterator it=values.begin(); it != values.end(); it++)
+ {
+ std::string name;
+ const LLUUID& buddy_id = *it;
+ BOOL have_name = gCacheName->getFullName(buddy_id, name);
+
+ // If name has not been loaded yet we consider it as a match.
+ // When the name will be loaded the filter will be applied again(in refresh()).
+
+ if (have_name && !findInsensitive(name, mNameFilter))
+ {
+ continue;
+ }
+
+ return true;
+ }
+ return false;
+}
+
+boost::signals2::connection LLAvatarList::setRefreshCompleteCallback(const commit_signal_t::slot_type& cb)
+{
+ return mRefreshCompleteSignal.connect(cb);
+}
void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos)
{
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h
index 51d3760d39..195d9e5b55 100644
--- a/indra/newview/llavatarlist.h
+++ b/indra/newview/llavatarlist.h
@@ -82,6 +82,11 @@ public:
const std::string getIconParamName() const{return mIconParamName;}
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ // Return true if filter has at least one match.
+ bool filterHasMatches();
+
+ boost::signals2::connection setRefreshCompleteCallback(const commit_signal_t::slot_type& cb);
+
protected:
void refresh();
@@ -107,6 +112,8 @@ private:
uuid_vector_t mIDs;
LLAvatarListItem::ContextMenu* mContextMenu;
+
+ commit_signal_t mRefreshCompleteSignal;
};
/** Abstract comparator for avatar items */
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<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();
+}
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index dc0aaeb70f..9bf9befe90 100644
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -124,6 +124,12 @@ private:
void onFriendsAccordionExpandedCollapsed(const LLSD& param, LLAvatarList* avatar_list);
+ void showAccordion(const std::string name, bool show);
+
+ void showFriendsAccordionsIfNeeded();
+
+ void onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param);
+
LLFilterEditor* mFilterEditor;
LLTabContainer* mTabContainer;
LLAvatarList* mOnlineFriendList;