summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2014-07-29 17:55:06 +0300
committerandreykproductengine <akleshchev@productengine.com>2014-07-29 17:55:06 +0300
commit0ea34fba7347987d95926ef5ef20019a6e3bcf86 (patch)
tree86aabca51ac8d9d7d735306c4a972de40a32ddb6
parent32e6df586db4d9f64c3e57bab42e9d8e99a38299 (diff)
MAINT-4289 FIXED [BEAR] Recent Items "Reset Filters" not working correctly
reverted and remade MAINT-4218
-rw-r--r--indra/llui/llfolderviewitem.cpp38
-rw-r--r--indra/llui/llfolderviewitem.h1
-rwxr-xr-xindra/newview/llfolderviewmodelinventory.cpp4
3 files changed, 27 insertions, 16 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 9a14d0e419..b9593e745d 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();
@@ -968,11 +986,10 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height )
getRoot()->getFolderViewModel()->sort(this);
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();
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp
index 11d49ff784..7615c12043 100755
--- a/indra/newview/llfolderviewmodelinventory.cpp
+++ b/indra/newview/llfolderviewmodelinventory.cpp
@@ -129,15 +129,13 @@ void LLFolderViewModelItemInventory::requestSort()
void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size)
{
- bool init_state = getLastFilterGeneration() < 0;
LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size);
bool before = mPrevPassedAllFilters;
mPrevPassedAllFilters = passedFilter(filter_generation);
- if (before != mPrevPassedAllFilters || (init_state && before && !mFolderViewItem->getVisible()))
+ if (before != mPrevPassedAllFilters)
{
// Need to rearrange the folder if the filtered state of the item changed
- // or folder was hidden during update as filter-dirty (MAINT-4218)
LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder();
if (parent_folder)
{