summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-12-07 17:19:21 -0500
committerLoren Shih <seraph@lindenlab.com>2009-12-07 17:19:21 -0500
commit25695cc0b5070d617f14602aea9476745c04c875 (patch)
tree516bab557bc2e79f111958708747ea74eabef563
parent1d60a4c67817292a1e0b32d96fa8effbac2f6285 (diff)
EXT-3125 : INFRASTRUCTURE : Cleanup LLInventoryFilter to disambiguate various filter options
EXT-3124 : Add lookup for finding all linked items to an item Specifying date range now is explicitly tracked as a filter type. --HG-- branch : avatar-pipeline
-rw-r--r--indra/newview/llinventoryfilter.cpp60
-rw-r--r--indra/newview/llinventoryfilter.h3
2 files changed, 47 insertions, 16 deletions
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 4c5e4d5607..8907bf4c1c 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -95,26 +95,14 @@ BOOL LLInventoryFilter::check(const LLFolderViewItem* item)
return TRUE;
}
- const U16 HOURS_TO_SECONDS = 3600;
- time_t earliest = time_corrected() - mFilterOps.mHoursAgo * HOURS_TO_SECONDS;
- if (mFilterOps.mMinDate > time_min() && mFilterOps.mMinDate < earliest)
- {
- earliest = mFilterOps.mMinDate;
- }
- else if (!mFilterOps.mHoursAgo)
- {
- earliest = 0;
- }
-
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) &&
- (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate);
-
+ ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions);
+
return passed;
}
@@ -131,6 +119,8 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item)
const U32 filterTypes = mFilterOps.mFilterTypes;
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_OBJECT
// Pass if this item's type is of the correct filter type
if (filterTypes & FILTERTYPE_OBJECT)
{
@@ -143,7 +133,12 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item)
if ((1LL << object_type & mFilterOps.mFilterObjectTypes) == U64(0))
return FALSE;
}
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_CATEGORY
// Pass if this item is a category of the filter type, or
// if its parent is a category of the filter type.
if (filterTypes & FILTERTYPE_CATEGORY)
@@ -159,13 +154,43 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item)
if ((1LL << cat->getPreferredType() & mFilterOps.mFilterCategoryTypes) == U64(0))
return FALSE;
}
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_UUID
// Pass if this item is the target UUID or if it links to the target UUID
if (filterTypes & FILTERTYPE_UUID)
{
if (object->getLinkedUUID() != mFilterOps.mFilterUUID)
return FALSE;
}
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_DATE
+ // Pass if this item is within the date range.
+ if (filterTypes & FILTERTYPE_DATE)
+ {
+ const U16 HOURS_TO_SECONDS = 3600;
+ time_t earliest = time_corrected() - mFilterOps.mHoursAgo * HOURS_TO_SECONDS;
+ if (mFilterOps.mMinDate > time_min() && mFilterOps.mMinDate < earliest)
+ {
+ earliest = mFilterOps.mMinDate;
+ }
+ else if (!mFilterOps.mHoursAgo)
+ {
+ earliest = 0;
+ }
+ if (listener->getCreationDate() < earliest ||
+ listener->getCreationDate() > mFilterOps.mMaxDate)
+ return FALSE;
+ }
+ //
+ ////////////////////////////////////////////////////////////////////////////////
return TRUE;
}
@@ -359,6 +384,7 @@ void LLInventoryFilter::setDateRange(time_t min_date, time_t max_date)
mFilterOps.mMaxDate = llmax(mFilterOps.mMinDate, max_date);
setModified();
}
+ mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
}
void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl)
@@ -373,12 +399,14 @@ void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl)
setDateRange(0, time_max());
setModified();
}
+ mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
}
BOOL LLInventoryFilter::isSinceLogoff() const
{
return (mFilterOps.mMinDate == (time_t)mLastLogoff) &&
- (mFilterOps.mMaxDate == time_max());
+ (mFilterOps.mMaxDate == time_max()) &&
+ (mFilterOps.mFilterTypes & FILTERTYPE_DATE);
}
void LLInventoryFilter::clearModified()
@@ -410,7 +438,9 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
setModified(FILTER_RESTART);
}
}
+ mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
}
+
void LLInventoryFilter::setShowFolderState(EFolderShow state)
{
if (mFilterOps.mShowFolderState != state)
diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h
index d65fb8f27c..8cac173fd8 100644
--- a/indra/newview/llinventoryfilter.h
+++ b/indra/newview/llinventoryfilter.h
@@ -61,7 +61,8 @@ public:
FILTERTYPE_NONE = 0,
FILTERTYPE_OBJECT = 1, // normal default search-by-object-type
FILTERTYPE_CATEGORY = 2, // search by folder type
- FILTERTYPE_UUID = 4 // find the object with UUID and any links to it
+ FILTERTYPE_UUID = 4, // find the object with UUID and any links to it
+ FILTERTYPE_DATE = 8 // search by date range
};
// REFACTOR: Change this to an enum.