summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul ProductEngine <pguslisty@productengine.com>2011-04-14 18:09:49 +0300
committerPaul ProductEngine <pguslisty@productengine.com>2011-04-14 18:09:49 +0300
commit8785c7077633e8cfe46f4aea2d861bfa813d79b7 (patch)
tree051e3f7d22b0342b8c600bda7f522437ece04e4f
parent88a7262340f2fc5085f4ac6600790518d01292d6 (diff)
STORM-898 Filter settings do not reset after unchecking 'Since Logoff' checkbox
- Corrected logic in inventory filter. Calculation of whether filter is more or less restrictive depending on time parameters was wrong.
-rw-r--r--indra/newview/llinventoryfilter.cpp10
-rw-r--r--indra/newview/llpanelmaininventory.cpp22
2 files changed, 9 insertions, 23 deletions
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index e22363c2f6..dee15a1efd 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -510,9 +510,15 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
{
if (mFilterOps.mHoursAgo != hours)
{
+ bool are_date_limits_valid = mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max();
+
+ bool is_increasing = hours > mFilterOps.mHoursAgo;
+ bool is_increasing_from_zero = is_increasing && !mFilterOps.mHoursAgo;
+
// *NOTE: need to cache last filter time, in case filter goes stale
- BOOL less_restrictive = (mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max() && hours > mFilterOps.mHoursAgo);
- BOOL more_restrictive = (mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max() && hours <= mFilterOps.mHoursAgo);
+ 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);
+
mFilterOps.mHoursAgo = hours;
mFilterOps.mMinDate = time_min();
mFilterOps.mMaxDate = time_max();
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 0c3f2f3e31..90617b7dc7 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -81,7 +81,6 @@ public:
BOOL getCheckSinceLogoff();
static void onTimeAgo(LLUICtrl*, void *);
- static void onCheckSinceLogoff(LLUICtrl*, void *);
static void onCloseBtn(void* user_data);
static void selectAllTypes(void* user_data);
static void selectNoTypes(void* user_data);
@@ -619,20 +618,6 @@ LLFloaterInventoryFinder::LLFloaterInventoryFinder(LLPanelMainInventory* invento
updateElementsFromFilter();
}
-
-void LLFloaterInventoryFinder::onCheckSinceLogoff(LLUICtrl *ctrl, void *user_data)
-{
- LLFloaterInventoryFinder *self = (LLFloaterInventoryFinder *)user_data;
- if (!self) return;
-
- bool since_logoff= self->getChild<LLUICtrl>("check_since_logoff")->getValue();
-
- if (!since_logoff &&
- !( self->mSpinSinceDays->get() || self->mSpinSinceHours->get() ) )
- {
- self->mSpinSinceHours->set(1.0f);
- }
-}
BOOL LLFloaterInventoryFinder::postBuild()
{
const LLRect& viewrect = mPanelMainInventory->getRect();
@@ -647,9 +632,6 @@ BOOL LLFloaterInventoryFinder::postBuild()
mSpinSinceDays = getChild<LLSpinCtrl>("spin_days_ago");
childSetCommitCallback("spin_days_ago", onTimeAgo, this);
- // mCheckSinceLogoff = getChild<LLSpinCtrl>("check_since_logoff");
- childSetCommitCallback("check_since_logoff", onCheckSinceLogoff, this);
-
childSetAction("Close", onCloseBtn, this);
updateElementsFromFilter();
@@ -660,12 +642,10 @@ void LLFloaterInventoryFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data)
LLFloaterInventoryFinder *self = (LLFloaterInventoryFinder *)user_data;
if (!self) return;
- bool since_logoff=true;
if ( self->mSpinSinceDays->get() || self->mSpinSinceHours->get() )
{
- since_logoff = false;
+ self->getChild<LLUICtrl>("check_since_logoff")->setValue(false);
}
- self->getChild<LLUICtrl>("check_since_logoff")->setValue(since_logoff);
}
void LLFloaterInventoryFinder::changeFilter(LLInventoryFilter* filter)