diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index 28c79d928..7cd60cb8a 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -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("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 vFriends = mFriendsList->getAllData(); // all of it. for (std::vector::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() // // Contact search and group system. // 09/05/2010 - Charley Levenque - LLLineEditor* contact = getChild("buddy_search_lineedit"); + LLSearchEditor* contact = getChild("buddy_search_lineedit"); if (contact) { - contact->setKeystrokeCallback(&onContactSearchKeystroke); + contact->setSearchCallback(&onContactSearchEdit, this); } getChild("s_num")->setValue("0"); diff --git a/indra/newview/llfloaterfriends.h b/indra/newview/llfloaterfriends.h index acac9f590..b930d6627 100644 --- a/indra/newview/llfloaterfriends.h +++ b/indra/newview/llfloaterfriends.h @@ -105,7 +105,7 @@ private: typedef std::map rights_map_t; void refreshNames(U32 changed_mask); // 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& names, const std::vector& 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); diff --git a/indra/newview/skins/default/xui/en-us/panel_friends.xml b/indra/newview/skins/default/xui/en-us/panel_friends.xml index d4b6534cd..7fc4012c0 100644 --- a/indra/newview/skins/default/xui/en-us/panel_friends.xml +++ b/indra/newview/skins/default/xui/en-us/panel_friends.xml @@ -40,7 +40,7 @@ All -