summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryfilter.cpp
diff options
context:
space:
mode:
authorGeenz <geenz@geenzo.com>2014-09-11 17:48:08 -0400
committerGeenz <geenz@geenzo.com>2014-09-11 17:48:08 -0400
commit57b17c2dcf78712db66b0b0c84997920e204262a (patch)
treec01b50ecbff124974529c1a55381d662eca07b63 /indra/newview/llinventoryfilter.cpp
parent5974a8eae5c76ac27fe1879145f764294af46ab8 (diff)
parenteef4acc5367a486b0c52c6ce5e1aba995fefd99c (diff)
Merged with latest viewer-release.
Diffstat (limited to 'indra/newview/llinventoryfilter.cpp')
-rwxr-xr-xindra/newview/llinventoryfilter.cpp51
1 files changed, 46 insertions, 5 deletions
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 000eee3317..0bbb4aeeff 100755
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -37,6 +37,7 @@
#include "llfolderview.h"
#include "llinventorybridge.h"
#include "llviewerfoldertype.h"
+#include "llradiogroup.h"
// linden library includes
#include "llclipboard.h"
@@ -51,6 +52,7 @@ LLInventoryFilter::FilterOps::FilterOps(const Params& p)
mMinDate(p.date_range.min_date),
mMaxDate(p.date_range.max_date),
mHoursAgo(p.hours_ago),
+ mDateSearchDirection(p.date_search_direction),
mShowFolderState(p.show_folder_state),
mPermissions(p.permissions),
mFilterTypes(p.types),
@@ -209,6 +211,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent
{
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;
@@ -217,9 +220,19 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent
{
earliest = 0;
}
- if (listener->getCreationDate() < earliest ||
- listener->getCreationDate() > mFilterOps.mMaxDate)
- return FALSE;
+
+ if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection || isSinceLogoff())
+ {
+ if (listener->getCreationDate() < earliest ||
+ listener->getCreationDate() > mFilterOps.mMaxDate)
+ return FALSE;
+ }
+ else
+ {
+ if (listener->getCreationDate() > earliest ||
+ listener->getCreationDate() > mFilterOps.mMaxDate)
+ return FALSE;
+ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -629,11 +642,22 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
bool are_date_limits_valid = mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max();
bool is_increasing = hours > mFilterOps.mHoursAgo;
+ bool is_decreasing = hours < mFilterOps.mHoursAgo;
bool is_increasing_from_zero = is_increasing && !mFilterOps.mHoursAgo && !isSinceLogoff();
// *NOTE: need to cache last filter time, in case filter goes stale
- BOOL less_restrictive = (are_date_limits_valid && ((is_increasing && mFilterOps.mHoursAgo)) || !hours);
- BOOL more_restrictive = (are_date_limits_valid && (!is_increasing && hours) || is_increasing_from_zero);
+ BOOL less_restrictive;
+ BOOL more_restrictive;
+ if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection)
+ {
+ less_restrictive = (are_date_limits_valid && ((is_increasing && mFilterOps.mHoursAgo)) || !hours);
+ more_restrictive = (are_date_limits_valid && (!is_increasing && hours) || is_increasing_from_zero);
+ }
+ else
+ {
+ less_restrictive = (are_date_limits_valid && ((is_decreasing && mFilterOps.mHoursAgo)) || !hours);
+ more_restrictive = (are_date_limits_valid && (!is_decreasing && hours) || is_increasing_from_zero);
+ }
mFilterOps.mHoursAgo = hours;
mFilterOps.mMinDate = time_min();
@@ -662,6 +686,20 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
}
}
+void LLInventoryFilter::setDateSearchDirection(U32 direction)
+{
+ if (direction != mFilterOps.mDateSearchDirection)
+ {
+ mFilterOps.mDateSearchDirection = direction;
+ setModified(FILTER_RESTART);
+ }
+}
+
+U32 LLInventoryFilter::getDateSearchDirection() const
+{
+ return mFilterOps.mDateSearchDirection;
+}
+
void LLInventoryFilter::setFilterLinks(U64 filter_links)
{
if (mFilterOps.mFilterLinks != filter_links)
@@ -926,6 +964,7 @@ LLInventoryFilter& LLInventoryFilter::operator=( const LLInventoryFilter& othe
setFilterObjectTypes(other.getFilterObjectTypes());
setDateRange(other.getMinDate(), other.getMaxDate());
setHoursAgo(other.getHoursAgo());
+ setDateSearchDirection(other.getDateSearchDirection());
setShowFolderState(other.getShowFolderState());
setFilterPermissions(other.getFilterPermissions());
setFilterSubString(other.getFilterSubString());
@@ -945,6 +984,7 @@ void LLInventoryFilter::toParams(Params& params) const
params.filter_ops.date_range.min_date = getMinDate();
params.filter_ops.date_range.max_date = getMaxDate();
params.filter_ops.hours_ago = getHoursAgo();
+ params.filter_ops.date_search_direction = getDateSearchDirection();
params.filter_ops.show_folder_state = getShowFolderState();
params.filter_ops.permissions = getFilterPermissions();
params.substring = getFilterSubString();
@@ -966,6 +1006,7 @@ void LLInventoryFilter::fromParams(const Params& params)
}
setDateRange(params.filter_ops.date_range.min_date, params.filter_ops.date_range.max_date);
setHoursAgo(params.filter_ops.hours_ago);
+ setDateSearchDirection(params.filter_ops.date_search_direction);
setShowFolderState(params.filter_ops.show_folder_state);
setFilterPermissions(params.filter_ops.permissions);
setFilterSubString(params.substring);