diff options
author | maksymsproductengine <maksymsproductengine@lindenlab.com> | 2014-09-09 21:42:26 +0300 |
---|---|---|
committer | maksymsproductengine <maksymsproductengine@lindenlab.com> | 2014-09-09 21:42:26 +0300 |
commit | b1c5edc5135b4ade68b0aa839506ea013dc2f40d (patch) | |
tree | 3707f94a8e5b78ca2b02f7e744c32798b8c8e20c /indra/newview/llinventoryfilter.cpp | |
parent | 19ce74567954d5b234cb931f7faa5fe58037c513 (diff) | |
parent | eef4acc5367a486b0c52c6ce5e1aba995fefd99c (diff) |
Merge viewer-release and become version 3.7.16
Diffstat (limited to 'indra/newview/llinventoryfilter.cpp')
-rwxr-xr-x | indra/newview/llinventoryfilter.cpp | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 370392b2f2..f211acedf0 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), @@ -210,6 +212,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; @@ -218,9 +221,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; + } } //////////////////////////////////////////////////////////////////////////////// @@ -642,11 +655,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(); @@ -675,6 +699,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) @@ -939,6 +977,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()); @@ -958,6 +997,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(); @@ -979,6 +1019,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); |