summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelcontents.cpp
diff options
context:
space:
mode:
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)
{