diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpersonmodelcommon.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llpersonmodelcommon.h | 14 |
2 files changed, 32 insertions, 10 deletions
diff --git a/indra/newview/llpersonmodelcommon.cpp b/indra/newview/llpersonmodelcommon.cpp index 6b4c71faa2..9fefc17345 100644 --- a/indra/newview/llpersonmodelcommon.cpp +++ b/indra/newview/llpersonmodelcommon.cpp @@ -48,6 +48,7 @@ LLPersonModelCommon::LLPersonModelCommon(LLFolderViewModelInterface& root_view_m LLFolderViewModelItemCommon(root_view_model), mName(""), mSearchableName(""), + mPrevPassedAllFilters(false), mID(LLUUID().generateNewID()) { } @@ -103,11 +104,11 @@ bool LLPersonModelCommon::filter( LLFolderViewFilter& filter) llinfos << "Merov : LLPersonModelCommon::filter, exit, no modif" << llendl; return true; } -*/ + */ if (!mChildren.empty()) { // If the current instance has children, it's a "person folder" and always passes filters (we do not filter out empty folders) - setPassedFilter(1, -1); + setPassedFilter(1, filter.getCurrentGeneration()); // Call filter recursively on all children for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); iter != end_iter; @@ -121,13 +122,31 @@ bool LLPersonModelCommon::filter( LLFolderViewFilter& filter) { // If there's no children, the current instance is a person and we check and set the passed filter flag on it const bool passed_filter = filter.check(this); - setPassedFilter(passed_filter, -1, filter.getStringMatchOffset(this), filter.getFilterStringSize()); + setPassedFilter(passed_filter, filter.getCurrentGeneration(), filter.getStringMatchOffset(this), filter.getFilterStringSize()); } filter.clearModified(); return true; } +void LLPersonModelCommon::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size) +{ + LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size); + bool before = mPrevPassedAllFilters; + mPrevPassedAllFilters = passedFilter(filter_generation); + + if (before != mPrevPassedAllFilters) + { + // Need to rearrange the folder if the filtered state of the item changed + LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder(); + if (parent_folder) + { + parent_folder->requestArrange(); + } + } +} + + // // LLPersonTabModel // @@ -217,7 +236,8 @@ LLPersonViewFilter::LLPersonViewFilter() : mEmptyLookupMessage(""), mFilterSubString(""), mName(""), - mFilterModified(FILTER_NONE) + mFilterModified(FILTER_NONE), + mCurrentGeneration(0) { } diff --git a/indra/newview/llpersonmodelcommon.h b/indra/newview/llpersonmodelcommon.h index f44f619d18..1b8197cf6a 100644 --- a/indra/newview/llpersonmodelcommon.h +++ b/indra/newview/llpersonmodelcommon.h @@ -75,7 +75,7 @@ public: virtual bool filter( LLFolderViewFilter& filter); virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; } -// virtual void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { } + virtual void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0); virtual bool passedFilter(S32 filter_generation = -1) { return mPassedFilter; } // The action callbacks @@ -102,6 +102,7 @@ protected: std::string mName; // Name of the person std::string mSearchableName; // Name used in string matching for this person + bool mPrevPassedAllFilters; LLUUID mID; }; @@ -172,7 +173,7 @@ public: void clearModified(); const std::string& getName() const { return mName; } const std::string& getFilterText() { return mName; } - void setModified(EFilterModified behavior = FILTER_RESTART) { mFilterModified = behavior; } + void setModified(EFilterModified behavior = FILTER_RESTART) { mFilterModified = behavior; mCurrentGeneration++; } // +-------------------------------------------------------------------+ // + Time @@ -193,10 +194,10 @@ public: // +-------------------------------------------------------------------+ // + Generation // +-------------------------------------------------------------------+ - // Note : unclear if we have to take tab on generation at that point - S32 getCurrentGeneration() const { return 0; } - S32 getFirstSuccessGeneration() const { return 0; } - S32 getFirstRequiredGeneration() const { return 0; } + // Note : For the moment, we do not support restrictive filtering so all generation indexes are pointing to the current generation + S32 getCurrentGeneration() const { return mCurrentGeneration; } + S32 getFirstSuccessGeneration() const { return mCurrentGeneration; } + S32 getFirstRequiredGeneration() const { return mCurrentGeneration; } // Non Virtual Methods (i.e. specific to this class) void setFilterSubString(const std::string& string); @@ -206,6 +207,7 @@ private: std::string mEmptyLookupMessage; std::string mFilterSubString; EFilterModified mFilterModified; + S32 mCurrentGeneration; }; class LLPersonViewSort |