summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelmaininventory.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2014-11-05 10:52:23 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2014-11-05 10:52:23 -0500
commit13b4909a3ca066105695afc174642409daa46df2 (patch)
treef12b1c2d32fda122bcd1f6f79ebfe2226325d9a8 /indra/newview/llpanelmaininventory.cpp
parent52ed6ac28697ffcfd7300602aec34db8eafc171a (diff)
parent02e2235277a90f2e291557a429ae4e5de3e0d3b6 (diff)
merge
Diffstat (limited to 'indra/newview/llpanelmaininventory.cpp')
-rwxr-xr-xindra/newview/llpanelmaininventory.cpp49
1 files changed, 45 insertions, 4 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index b02298090a..a7c9dbdf7b 100755
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -55,6 +55,7 @@
#include "llviewertexturelist.h"
#include "llsidepanelinventory.h"
#include "llfolderview.h"
+#include "llradiogroup.h"
const std::string FILTERS_FILENAME("filters.xml");
@@ -82,6 +83,7 @@ public:
void updateElementsFromFilter();
BOOL getCheckShowEmpty();
BOOL getCheckSinceLogoff();
+ U32 getDateSearchDirection();
static void onTimeAgo(LLUICtrl*, void *);
static void onCloseBtn(void* user_data);
@@ -382,9 +384,11 @@ BOOL LLPanelMainInventory::filtersVisible(void* user_data)
void LLPanelMainInventory::onClearSearch()
{
+ BOOL initially_active = FALSE;
LLFloater *finder = getFinder();
if (mActivePanel)
{
+ initially_active = mActivePanel->getFilter().isNotDefault();
mActivePanel->setFilterSubString(LLStringUtil::null);
mActivePanel->setFilterTypes(0xffffffffffffffffULL);
mActivePanel->setFilterLinks(LLInventoryFilter::FILTERLINK_INCLUDE_LINKS);
@@ -395,8 +399,8 @@ void LLPanelMainInventory::onClearSearch()
LLFloaterInventoryFinder::selectAllTypes(finder);
}
- // re-open folders that were initially open
- if (mActivePanel)
+ // re-open folders that were initially open in case filter was active
+ if (mActivePanel && (mFilterSubString.size() || initially_active))
{
mSavedFolderState->setApply(TRUE);
mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
@@ -700,6 +704,30 @@ void LLFloaterInventoryFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data)
if ( self->mSpinSinceDays->get() || self->mSpinSinceHours->get() )
{
self->getChild<LLUICtrl>("check_since_logoff")->setValue(false);
+
+ U32 days = (U32)self->mSpinSinceDays->get();
+ U32 hours = (U32)self->mSpinSinceHours->get();
+ if (hours >= 24)
+ {
+ // Try to handle both cases of spinner clicking and text input in a sensible fashion as best as possible.
+ // There is no way to tell if someone has clicked the spinner to get to 24 or input 24 manually, so in
+ // this case add to days. Any value > 24 means they have input the hours manually, so do not add to the
+ // current day value.
+ if (24 == hours) // Got to 24 via spinner clicking or text input of 24
+ {
+ days = days + hours / 24;
+ }
+ else // Text input, so do not add to days
+ {
+ days = hours / 24;
+ }
+ hours = (U32)hours % 24;
+ self->mSpinSinceHours->setFocus(false);
+ self->mSpinSinceDays->setFocus(false);
+ self->mSpinSinceDays->set((F32)days);
+ self->mSpinSinceHours->set((F32)hours);
+ self->mSpinSinceHours->setFocus(true);
+ }
}
}
@@ -719,6 +747,7 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
std::string filter_string = mFilter->getFilterSubString();
LLInventoryFilter::EFolderShow show_folders = mFilter->getShowFolderState();
U32 hours = mFilter->getHoursAgo();
+ U32 date_search_direction = mFilter->getDateSearchDirection();
// update the ui elements
setTitle(mFilter->getName());
@@ -740,6 +769,7 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
getChild<LLUICtrl>("check_since_logoff")->setValue(mFilter->isSinceLogoff());
mSpinSinceHours->set((F32)(hours % 24));
mSpinSinceDays->set((F32)(hours / 24));
+ getChild<LLRadioGroup>("date_search_direction")->setSelectedIndex(date_search_direction);
}
void LLFloaterInventoryFinder::draw()
@@ -840,17 +870,23 @@ void LLFloaterInventoryFinder::draw()
}
U32 days = (U32)mSpinSinceDays->get();
U32 hours = (U32)mSpinSinceHours->get();
- if (hours > 24)
+ if (hours >= 24)
{
- days += hours / 24;
+ days = hours / 24;
hours = (U32)hours % 24;
+ // A UI element that has focus will not display a new value set to it
+ mSpinSinceHours->setFocus(false);
+ mSpinSinceDays->setFocus(false);
mSpinSinceDays->set((F32)days);
mSpinSinceHours->set((F32)hours);
+ mSpinSinceHours->setFocus(true);
}
hours += days * 24;
+
mPanelMainInventory->getPanel()->setHoursAgo(hours);
mPanelMainInventory->getPanel()->setSinceLogoff(getCheckSinceLogoff());
mPanelMainInventory->setFilterTextFromFilter();
+ mPanelMainInventory->getPanel()->setDateSearchDirection(getDateSearchDirection());
LLPanel::draw();
}
@@ -865,6 +901,11 @@ BOOL LLFloaterInventoryFinder::getCheckSinceLogoff()
return getChild<LLUICtrl>("check_since_logoff")->getValue();
}
+U32 LLFloaterInventoryFinder::getDateSearchDirection()
+{
+ return getChild<LLRadioGroup>("date_search_direction")->getSelectedIndex();
+}
+
void LLFloaterInventoryFinder::onCloseBtn(void* user_data)
{
LLFloaterInventoryFinder* finderp = (LLFloaterInventoryFinder*)user_data;