summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llinventoryfilter.cpp50
1 files changed, 43 insertions, 7 deletions
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 901a570487..c90919e8fd 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -41,6 +41,7 @@
#include "llinventorymodelbackgroundfetch.h"
#include "llviewercontrol.h"
#include "llfolderview.h"
+#include "llinventorybridge.h"
// linden library includes
#include "lltrans.h"
@@ -54,7 +55,8 @@ LLInventoryFilter::FilterOps::FilterOps() :
mShowFolderState(SHOW_NON_EMPTY_FOLDERS),
mPermissions(PERM_NONE),
mFilterTypes(FILTERTYPE_OBJECT),
- mFilterUUID(LLUUID::null)
+ mFilterUUID(LLUUID::null),
+ mIncludeLinks(TRUE)
{
}
@@ -97,23 +99,23 @@ BOOL LLInventoryFilter::check(const LLFolderViewItem* item)
return TRUE;
}
- const LLFolderViewEventListener* listener = item->getListener();
mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos;
const BOOL passed_filtertype = checkAgainstFilterType(item);
- const BOOL passed = passed_filtertype &&
- (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos) &&
- ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions);
+ const BOOL passed_permissions = checkAgainstPermissions(item);
+ const BOOL passed = (passed_filtertype &&
+ passed_permissions &&
+ (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos));
return passed;
}
-BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item)
+BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) const
{
const LLFolderViewEventListener* listener = item->getListener();
if (!listener) return FALSE;
- const LLInventoryType::EType object_type = listener->getInventoryType();
+ LLInventoryType::EType object_type = listener->getInventoryType();
const LLUUID object_id = listener->getUUID();
const LLInventoryObject *object = gInventory.getObject(object_id);
@@ -128,7 +130,9 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item)
if (object_type == LLInventoryType::IT_NONE)
{
if (object && object->getIsLinkType())
+ {
return FALSE;
+ }
}
else if ((1LL << object_type & mFilterOps.mFilterObjectTypes) == U64(0))
{
@@ -203,6 +207,22 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item)
return TRUE;
}
+BOOL LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) const
+{
+ const LLFolderViewEventListener* listener = item->getListener();
+ if (!listener) return FALSE;
+
+ PermissionMask perm = listener->getPermissionMask();
+ const LLInvFVBridge *bridge = dynamic_cast<const LLInvFVBridge *>(item->getListener());
+ if (bridge && bridge->isLink())
+ {
+ const LLUUID& linked_uuid = gInventory.getLinkedItemID(bridge->getUUID());
+ const LLViewerInventoryItem *linked_item = gInventory.getItem(linked_uuid);
+ if (linked_item)
+ perm = linked_item->getPermissionMask();
+ }
+ return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions;
+}
const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const
{
@@ -451,6 +471,18 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
}
+void LLInventoryFilter::setIncludeLinks(BOOL include_links)
+{
+ if (mFilterOps.mIncludeLinks != include_links)
+ {
+ if (!mFilterOps.mIncludeLinks)
+ setModified(FILTER_LESS_RESTRICTIVE);
+ else
+ setModified(FILTER_MORE_RESTRICTIVE);
+ }
+ mFilterOps.mIncludeLinks = include_links;
+}
+
void LLInventoryFilter::setShowFolderState(EFolderShow state)
{
if (mFilterOps.mShowFolderState != state)
@@ -826,6 +858,10 @@ U32 LLInventoryFilter::getHoursAgo() const
{
return mFilterOps.mHoursAgo;
}
+BOOL LLInventoryFilter::getIncludeLinks() const
+{
+ return mFilterOps.mIncludeLinks;
+}
LLInventoryFilter::EFolderShow LLInventoryFilter::getShowFolderState() const
{
return mFilterOps.mShowFolderState;