Fixed folder collapse state not being properly restored after clearing search string.

Updated inventory filter classes.
LLInventoryView renamed to LLPanelMainInventory for easier diffing.
This commit is contained in:
Shyotl
2016-05-26 02:22:19 -05:00
parent f89a5aaa27
commit 899ba7fded
29 changed files with 483 additions and 448 deletions

View File

@@ -404,7 +404,38 @@ void LLInventoryPanel::setFilterWorn(bool worn)
void LLInventoryPanel::setFilterSubString(const std::string& string)
{
getFilter()->setFilterSubString(string);
if (!getRootFolder())
return;
std::string uppercase_search_string = string;
LLStringUtil::toUpper(uppercase_search_string);
const std::string prior_search_string = getFilterSubString();
if (prior_search_string == uppercase_search_string)
{
// current filter and new filter match, do nothing
return;
}
if (string.empty())
{
// Unlike v3, do not clear other filters. Text is independent.
getFilter()->setFilterSubString(LLStringUtil::null);
getRootFolder()->restoreFolderState();
LLOpenFoldersWithSelection opener;
getRootFolder()->applyFunctorRecursively(opener);
getRootFolder()->scrollToShowSelection();
}
else
{
if (prior_search_string.empty())
{
// save current folder open state if no filter currently applied
getRootFolder()->saveFolderState();
}
// set new filter string
getFilter()->setFilterSubString(string);
}
}
const std::string LLInventoryPanel::getFilterSubString()
@@ -412,7 +443,6 @@ const std::string LLInventoryPanel::getFilterSubString()
return mFolderRoot.get()->getFilterSubString();
}
void LLInventoryPanel::setSortOrder(U32 order)
{
getFilter()->setSortOrder(order);
@@ -1081,7 +1111,7 @@ void LLInventoryPanel::dumpSelectionInformation(void* user_data)
LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
{
LLInventoryPanel* res = NULL;
LLInventoryView* floater_inventory = LLInventoryView::getActiveInventory();
LLPanelMainInventory* floater_inventory = LLPanelMainInventory::getActiveInventory();
if (!floater_inventory)
{
LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL;