diff options
author | andreykproductengine <akleshchev@productengine.com> | 2014-07-29 17:55:06 +0300 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2014-07-29 17:55:06 +0300 |
commit | 7d8b90ce98e0b88cf8cfb5c6f6d4e0ce31eaaf64 (patch) | |
tree | d02cd7a741e2ed6994170ab3dad47da583448f2c /indra/llui | |
parent | 906e2024580cd824e10e8c6799f13453fb2acd89 (diff) |
MAINT-4289 FIXED [BEAR] Recent Items "Reset Filters" not working correctly
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfolderviewitem.cpp | 36 | ||||
-rw-r--r-- | indra/llui/llfolderviewitem.h | 1 |
2 files changed, 25 insertions, 12 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 9a14d0e419..e3ec333e21 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -256,6 +256,24 @@ BOOL LLFolderViewItem::passedFilter(S32 filter_generation) return getViewModelItem()->passedFilter(filter_generation); } +BOOL LLFolderViewItem::isPotentiallyVisible(S32 filter_generation) +{ + // Item should be visible if: + // 1. item passed current filter + // 2. item was updated (gen < 0) but has descendants that passed filter + // 3. item was recently updated and was visible before update + + LLFolderViewModelItem* model = getViewModelItem(); + if (model->getLastFilterGeneration() < 0) + { + return model->descendantsPassedFilter(filter_generation) || getVisible(); + } + else + { + return model->passedFilter(filter_generation); + } +} + void LLFolderViewItem::refresh() { LLFolderViewModelItem& vmi = *getViewModelItem(); @@ -970,9 +988,8 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) LL_RECORD_BLOCK_TIME(FTM_ARRANGE); // evaluate mHasVisibleChildren - bool default_filter = getRoot()->getFolderViewModel()->getFilter().isDefault(); - mHasVisibleChildren = default_filter && (mItems.size() || mFolders.size()); - if (!default_filter && getViewModelItem()->descendantsPassedFilter()) + mHasVisibleChildren = false; + if (getViewModelItem()->descendantsPassedFilter()) { // We have to verify that there's at least one child that's not filtered out bool found = false; @@ -980,7 +997,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) for (items_t::iterator iit = mItems.begin(); iit != mItems.end(); ++iit) { LLFolderViewItem* itemp = (*iit); - found = itemp->passedFilter(); + found = itemp->isPotentiallyVisible(); if (found) break; } @@ -990,7 +1007,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) for (folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit) { LLFolderViewFolder* folderp = (*fit); - found = folderp->passedFilter(); + found = folderp->isPotentiallyVisible(); if (found) break; } @@ -1023,12 +1040,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) for(folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit) { LLFolderViewFolder* folderp = (*fit); - - // passedFilter() will show everything that passed filter or has descendants that passed filter - // also it will hide all filter-pending folders (they will be shown later if needed). - // but since refreshed folders are 'pending', they can be rendered invisible by passedFilter() - // even if we are not using filter at the moment, default_filter is used to prevent it - folderp->setVisible(default_filter || folderp->passedFilter()); + folderp->setVisible(folderp->isPotentiallyVisible()); if (folderp->getVisible()) { @@ -1047,7 +1059,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) iit != mItems.end(); ++iit) { LLFolderViewItem* itemp = (*iit); - itemp->setVisible(default_filter || itemp->passedFilter()); + itemp->setVisible(itemp->isPotentiallyVisible()); if (itemp->getVisible()) { diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index a9b0201236..0cd20a0f2d 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -254,6 +254,7 @@ public: S32 getIndentation() { return mIndentation; } virtual BOOL passedFilter(S32 filter_generation = -1); + virtual BOOL isPotentiallyVisible(S32 filter_generation = -1); // refresh information from the object being viewed. virtual void refresh(); |