Awesomize buddy search
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* @file llfloaterfriends.cpp
|
||||
* @author Phoenix
|
||||
* @date 2005-01-13
|
||||
@@ -310,17 +310,16 @@ void LLPanelFriends::categorizeContacts()
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanelFriends::filterContacts()
|
||||
void LLPanelFriends::filterContacts(const std::string& search_name)
|
||||
{
|
||||
std::string friend_name;
|
||||
std::string search_name;
|
||||
|
||||
search_name = LLPanelFriends::getChild<LLLineEditor>("buddy_search_lineedit")->getValue().asString();
|
||||
|
||||
if ((search_name != "" /*&& search_name != mLastContactSearch*/))
|
||||
{
|
||||
mLastContactSearch = search_name;
|
||||
refreshNames(LLFriendObserver::ADD);
|
||||
if (search_name.find(mLastContactSearch) == std::string::npos)
|
||||
{
|
||||
refreshNames(LLFriendObserver::ADD);
|
||||
}
|
||||
|
||||
std::vector<LLScrollListItem*> vFriends = mFriendsList->getAllData(); // all of it.
|
||||
for (std::vector<LLScrollListItem*>::iterator itr = vFriends.begin(); itr != vFriends.end(); ++itr)
|
||||
@@ -337,17 +336,16 @@ void LLPanelFriends::filterContacts()
|
||||
refreshUI();
|
||||
}
|
||||
else if (search_name == "" && search_name != mLastContactSearch) refreshNames(LLFriendObserver::ADD);
|
||||
mLastContactSearch = search_name;
|
||||
}
|
||||
|
||||
void LLPanelFriends::onContactSearchKeystroke(LLLineEditor* caller, void* user_data)
|
||||
//static
|
||||
void LLPanelFriends::onContactSearchEdit(const std::string& search_string, void* user_data)
|
||||
{
|
||||
if (caller)
|
||||
LLPanelFriends* panelp = (LLPanelFriends*)user_data;
|
||||
if (panelp)
|
||||
{
|
||||
LLPanelFriends* panelp = (LLPanelFriends*)caller->getParent();
|
||||
if (panelp)
|
||||
{
|
||||
panelp->filterContacts();
|
||||
}
|
||||
panelp->filterContacts(search_string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,10 +375,10 @@ BOOL LLPanelFriends::postBuild()
|
||||
// <dogmode>
|
||||
// Contact search and group system.
|
||||
// 09/05/2010 - Charley Levenque
|
||||
LLLineEditor* contact = getChild<LLLineEditor>("buddy_search_lineedit");
|
||||
LLSearchEditor* contact = getChild<LLSearchEditor>("buddy_search_lineedit");
|
||||
if (contact)
|
||||
{
|
||||
contact->setKeystrokeCallback(&onContactSearchKeystroke);
|
||||
contact->setSearchCallback(&onContactSearchEdit, this);
|
||||
}
|
||||
|
||||
getChild<LLTextBox>("s_num")->setValue("0");
|
||||
|
||||
Reference in New Issue
Block a user