summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelcontents.cpp
diff options
context:
space:
mode:
authorAlexander Gavriliuk <alexandrgproductengine@lindenlab.com>2024-09-03 18:05:45 +0200
committerGuru <alexandrgproductengine@lindenlab.com>2024-09-08 00:11:56 +0200
commit2b7b81fbdbaaaa8698828af9529f9693692da2a2 (patch)
treea5c5fdfea2b228c347e3fe7b5c8e4fe2e854babf /indra/newview/llpanelcontents.cpp
parent2e886b7cfef14d087c2167e3384e9e19dcb3ff63 (diff)
#459 Filters on object inventory
Diffstat (limited to 'indra/newview/llpanelcontents.cpp')
-rw-r--r--indra/newview/llpanelcontents.cpp41
1 files changed, 39 insertions, 2 deletions
diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp
index 7b78ad2934..dbf56c2b6d 100644
--- a/indra/newview/llpanelcontents.cpp
+++ b/indra/newview/llpanelcontents.cpp
@@ -31,6 +31,7 @@
// linden library includes
#include "llerror.h"
+#include "llfiltereditor.h"
#include "llfloaterreg.h"
#include "llfontgl.h"
#include "llinventorydefines.h"
@@ -83,8 +84,14 @@ bool LLPanelContents::postBuild()
childSetAction("button new script",&LLPanelContents::onClickNewScript, this);
childSetAction("button permissions",&LLPanelContents::onClickPermissions, this);
+ mFilterEditor = getChild<LLFilterEditor>("contents_filter");
+ mFilterEditor->setCommitCallback([&](LLUICtrl*, const LLSD&) { onFilterEdit(); });
+
mPanelInventoryObject = getChild<LLPanelObjectInventory>("contents_inventory");
+ // update permission filter once UI is fully initialized
+ mSavedFolderState.setApply(false);
+
return true;
}
@@ -129,6 +136,38 @@ void LLPanelContents::getState(LLViewerObject *objectp )
mPanelInventoryObject->setEnabled(!objectp->isPermanentEnforced());
}
+void LLPanelContents::onFilterEdit()
+{
+ const std::string& filter_substring = mFilterEditor->getText();
+ if (filter_substring.empty())
+ {
+ if (mPanelInventoryObject->getFilter().getFilterSubString().empty())
+ {
+ // The current filter and the new filter are empty, nothing to do
+ return;
+ }
+
+ mSavedFolderState.setApply(true);
+ mPanelInventoryObject->getRootFolder()->applyFunctorRecursively(mSavedFolderState);
+
+ // Add a folder with the current item to the list of previously opened folders
+ LLOpenFoldersWithSelection opener;
+ mPanelInventoryObject->getRootFolder()->applyFunctorRecursively(opener);
+ mPanelInventoryObject->getRootFolder()->scrollToShowSelection();
+ }
+ else if (mPanelInventoryObject->getFilter().getFilterSubString().empty())
+ {
+ // The first letter in search term, save existing folder open state
+ if (!mPanelInventoryObject->getFilter().isNotDefault())
+ {
+ mSavedFolderState.setApply(false);
+ mPanelInventoryObject->getRootFolder()->applyFunctorRecursively(mSavedFolderState);
+ }
+ }
+
+ mPanelInventoryObject->getFilter().setFilterSubString(filter_substring);
+}
+
void LLPanelContents::refresh()
{
const bool children_ok = true;
@@ -149,7 +188,6 @@ void LLPanelContents::clearContents()
}
}
-
//
// Static functions
//
@@ -199,7 +237,6 @@ void LLPanelContents::onClickNewScript(void *userdata)
}
}
-
// static
void LLPanelContents::onClickPermissions(void *userdata)
{