diff options
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 24 | ||||
-rw-r--r-- | indra/newview/llpersonmodelcommon.cpp | 62 | ||||
-rw-r--r-- | indra/newview/llpersonmodelcommon.h | 26 |
3 files changed, 92 insertions, 20 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 712a116873..609284cdd5 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1197,23 +1197,23 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) { // store accordion tabs opened/closed state before any manipulation with accordion tabs if (!saved_filter.empty()) - { - notifyChildren(LLSD().with("action","store_state")); - } + { + notifyChildren(LLSD().with("action","store_state")); + } mOnlineFriendList->setNameFilter(filter); mAllFriendList->setNameFilter(filter); - setAccordionCollapsedByUser("tab_online", false); - setAccordionCollapsedByUser("tab_all", false); - showFriendsAccordionsIfNeeded(); + setAccordionCollapsedByUser("tab_online", false); + setAccordionCollapsedByUser("tab_all", false); + showFriendsAccordionsIfNeeded(); // restore accordion tabs state _after_ all manipulations if(saved_filter.empty()) - { - notifyChildren(LLSD().with("action","restore_state")); - } -} + { + notifyChildren(LLSD().with("action","restore_state")); + } + } else if (cur_tab == GROUP_TAB_NAME) { mGroupList->setNameFilter(filter); @@ -1222,6 +1222,10 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) { mRecentList->setNameFilter(filter); } + else if (cur_tab == FBCTESTTWO_TAB_NAME) + { + mPersonFolderViewModel.getFilter().setFilterSubString(filter); + } } void LLPanelPeople::onTabSelected(const LLSD& param) diff --git a/indra/newview/llpersonmodelcommon.cpp b/indra/newview/llpersonmodelcommon.cpp index bea7f3d45e..4e54562f18 100644 --- a/indra/newview/llpersonmodelcommon.cpp +++ b/indra/newview/llpersonmodelcommon.cpp @@ -157,3 +157,65 @@ LLPersonModel::LLPersonModel(LLFolderViewModelInterface& root_view_model) : LLPersonModelCommon(root_view_model) { } + +// +// LLPersonViewFilter +// + +LLPersonViewFilter::LLPersonViewFilter() : + mEmpty(""), + mFilterSubString(""), + mFilterModified(FILTER_NONE) +{ +} + +void LLPersonViewFilter::setFilterSubString(const std::string& string) +{ + std::string filter_sub_string_new = string; + LLStringUtil::trimHead(filter_sub_string_new); + LLStringUtil::toUpper(filter_sub_string_new); + + if (mFilterSubString != filter_sub_string_new) + { + mFilterSubString = filter_sub_string_new; + } +} + +std::string::size_type LLPersonViewFilter::getFilterStringSize() const +{ + return mFilterSubString.size(); +} + +bool LLPersonViewFilter::check(const LLFolderViewModelItem* item) +{ + //const LLPersonModelCommon* person = dynamic_cast<const LLPersonModelCommon*>(item); + std::string::size_type string_offset = mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos; + + return (mFilterSubString.size() == 0 || string_offset != std::string::npos); +} + +bool LLPersonViewFilter::showAllResults() const +{ + return mFilterSubString.size() > 0; +} + +std::string::size_type LLPersonViewFilter::getStringMatchOffset(LLFolderViewModelItem* item) const +{ + return mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos; +} + +bool LLPersonViewFilter::isActive() const +{ + return mFilterSubString.size(); +} + +bool LLPersonViewFilter::isModified() const +{ + return isActive(); +} + +void LLPersonViewFilter::clearModified() +{ + mFilterModified = FILTER_NONE; + setFilterSubString(""); +} diff --git a/indra/newview/llpersonmodelcommon.h b/indra/newview/llpersonmodelcommon.h index f3454df53f..bdbee002e6 100644 --- a/indra/newview/llpersonmodelcommon.h +++ b/indra/newview/llpersonmodelcommon.h @@ -127,7 +127,7 @@ private: }; -//Below code is just copied and adjusted from llconversationmodel.h, will need to investigate further +// Filtering functional object class LLPersonViewFilter : public LLFolderViewFilter { @@ -143,20 +143,23 @@ public: // Default sort order is by type for sessions and by date for participants static const U32 SO_DEFAULT = (SO_SESSION_TYPE << 16) | (SO_DATE); - LLPersonViewFilter() { mEmpty = ""; } + LLPersonViewFilter(); ~LLPersonViewFilter() {} - bool check(const LLFolderViewModelItem* item) { return true; } + void setFilterSubString(const std::string& string); + std::string::size_type getFilterStringSize() const; + bool check(const LLFolderViewModelItem* item); + bool showAllResults() const; + std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const; + bool isActive() const; + bool isModified() const; + void clearModified(); + bool checkFolder(const LLFolderViewModelItem* folder) const { return true; } + void setEmptyLookupMessage(const std::string& message) { } std::string getEmptyLookupMessage() const { return mEmpty; } - bool showAllResults() const { return true; } - std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const { return std::string::npos; } - std::string::size_type getFilterStringSize() const { return 0; } - bool isActive() const { return false; } - bool isModified() const { return false; } - void clearModified() { } const std::string& getName() const { return mEmpty; } const std::string& getFilterText() { return mEmpty; } void setModified(EFilterModified behavior = FILTER_RESTART) { } @@ -173,8 +176,11 @@ public: S32 getCurrentGeneration() const { return 0; } S32 getFirstSuccessGeneration() const { return 0; } S32 getFirstRequiredGeneration() const { return 0; } + private: - std::string mEmpty; + std::string mEmpty; + std::string mFilterSubString; + EFilterModified mFilterModified; }; class LLPersonViewSort |