summaryrefslogtreecommitdiff
path: root/indra/newview/llfolderviewmodelinventory.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-07-25 18:20:54 -0700
committerRichard Linden <none@none>2012-07-25 18:20:54 -0700
commitf6dfd6bf0f3ea0e9b5f56a939867353c393539d6 (patch)
treef984a81438ce719beca9318fdc8e7a2fafe7cb48 /indra/newview/llfolderviewmodelinventory.cpp
parentc4f59fd5882d8b019830292e9e5ed1d2480f73ef (diff)
CHUI-222 FIX Selecting None in inventory filters does not update until inventory selected
Diffstat (limited to 'indra/newview/llfolderviewmodelinventory.cpp')
-rw-r--r--indra/newview/llfolderviewmodelinventory.cpp74
1 files changed, 35 insertions, 39 deletions
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp
index e8135496d5..13ca73917b 100644
--- a/indra/newview/llfolderviewmodelinventory.cpp
+++ b/indra/newview/llfolderviewmodelinventory.cpp
@@ -133,8 +133,9 @@ bool LLFolderViewModelItemInventory::passedFilter(S32 filter_generation)
filter_generation = mRootViewModel.getFilter()->getFirstSuccessGeneration();
return mPassedFolderFilter
- && mLastFilterGeneration >= filter_generation
- && (mPassedFilter || descendantsPassedFilter(filter_generation));
+ && (descendantsPassedFilter(filter_generation)
+ || (mLastFilterGeneration >= filter_generation
+ && mPassedFilter));
}
bool LLFolderViewModelItemInventory::descendantsPassedFilter(S32 filter_generation)
@@ -148,30 +149,29 @@ void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_fo
mPassedFilter = passed;
mPassedFolderFilter = passed_folder;
mLastFilterGeneration = filter_generation;
+
+ bool passed_filter_before = mPrevPassedAllFilters;
+ mPrevPassedAllFilters = passedFilter(filter_generation);
+
+ if (passed_filter_before != mPrevPassedAllFilters)
+ {
+ //TODO RN: ensure this still happens, but without dependency on folderview
+ LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder();
+ if (parent_folder)
+ {
+ parent_folder->requestArrange();
+ }
+ }
}
-bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter )
+void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter )
{
- bool passed_filter_before = item->passedFilter();
S32 filter_generation = filter.getCurrentGeneration();
- S32 must_pass_generation = filter.getFirstRequiredGeneration();
if (item->getLastFilterGeneration() < filter_generation)
{
// recursive application of the filter for child items
item->filter( filter );
-
- if (item->getLastFilterGeneration() >= must_pass_generation
- && !item->passedFilter(must_pass_generation))
- {
- // failed to pass an earlier filter that was a subset of the current one
- // go ahead and flag this item as done
- if (item->passedFilter())
- {
- llerrs << "Invalid shortcut in inventory filtering!" << llendl;
- }
- item->setPassedFilter(false, false, filter_generation);
- }
}
// track latest generation to pass any child items, for each folder up to root
@@ -184,39 +184,36 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite
view_model->mMostFilteredDescendantGeneration = filter_generation;
view_model = static_cast<LLFolderViewModelItemInventory*>(view_model->mParent);
}
-
- return !passed_filter_before;
- }
- else // !item->passedfilter()
- {
- return passed_filter_before;
}
}
-bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
+void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
{
- bool changed = false;
+ const S32 filter_generation = filter.getCurrentGeneration();
+ const S32 must_pass_generation = filter.getFirstRequiredGeneration();
+
+ if (getLastFilterGeneration() >= must_pass_generation
+ && !passedFilter(must_pass_generation))
+ {
+ // failed to pass an earlier filter that was a subset of the current one
+ // go ahead and flag this item as done
+ setPassedFilter(false, false, filter_generation);
+ return;
+ }
if(!mChildren.empty()
- && (getLastFilterGeneration() < filter.getFirstRequiredGeneration() // haven't checked descendants against minimum required generation to pass
- || descendantsPassedFilter(filter.getFirstRequiredGeneration()))) // or at least one descendant has passed the minimum requirement
+ && (getLastFilterGeneration() < must_pass_generation // haven't checked descendants against minimum required generation to pass
+ || descendantsPassedFilter(must_pass_generation))) // or at least one descendant has passed the minimum requirement
{
// now query children
- for (child_list_t::iterator iter = mChildren.begin();
- iter != mChildren.end() && filter.getFilterCount() > 0;
+ for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end();
+ iter != end_iter && filter.getFilterCount() > 0;
++iter)
{
- changed |= filterChildItem((*iter), filter);
+ filterChildItem((*iter), filter);
}
}
- if (changed)
- {
- //TODO RN: ensure this still happens, but without dependency on folderview
- LLFolderViewFolder* folder = static_cast<LLFolderViewFolder*>(mFolderViewItem);
- folder->requestArrange();
- }
-
// if we didn't use all filter iterations
// that means we filtered all of our descendants
// so filter ourselves now
@@ -229,11 +226,10 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
? filter.checkFolder(this)
: true;
- setPassedFilter(passed_filter, passed_filter_folder, filter.getCurrentGeneration());
+ setPassedFilter(passed_filter, passed_filter_folder, filter_generation);
//TODO RN: create interface for string highlighting
//mStringMatchOffset = filter.getStringMatchOffset(this);
}
- return changed;
}
LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel()