Awesomize buddy search

This commit is contained in:
Siana Gearz
2012-02-02 12:18:35 +01:00
parent 2526d04397
commit 7b6ff27c4b
3 changed files with 17 additions and 19 deletions

View File

@@ -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");

View File

@@ -105,7 +105,7 @@ private:
typedef std::map<LLUUID, S32> rights_map_t;
void refreshNames(U32 changed_mask);
// <dogmode> Contacts search and group system
void filterContacts();
void filterContacts(const std::string& search_name);
void categorizeContacts();
void setContactGroup(std::string contact_grp);
std::string cleanFileName(std::string filename);
@@ -136,7 +136,7 @@ private:
static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data);
static void onMaximumSelect(void* user_data);
static void onContactSearchKeystroke(LLLineEditor* caller, void* user_data);
static void onContactSearchEdit(const std::string& search_string, void* user_data);
static void onClickIM(void* user_data);
static void onClickAssign(void* user_data);
static void onClickExpand(void* user_data);

View File

@@ -40,7 +40,7 @@
All
</combo_item>
</combo_box-->
<line_editor bottom_delta="0" enabled="true" follows="right|top" font="SansSerif"
<search_editor bottom_delta="0" enabled="true" follows="right|top" font="SansSerif"
height="18" left="-255" name="buddy_search_lineedit"
tool_tip="The friend name you want to search for" width="130" />
<button bottom_delta="-3" follows="top|right" height="22" label="0"