summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-12-13 17:15:18 -0800
committerMerov Linden <merov@lindenlab.com>2012-12-13 17:15:18 -0800
commit569701cfc898091a414dad0650f89471b1962d49 (patch)
tree3c8bc31445472747a66d27543b8862ebed511f52 /indra
parent0e4c3070cb6cfb389d708ca459ed2c721c1cc28a (diff)
CHUI-574, CHUI-575 : Fixed inventory regressions : select the first filtered item when searching the inventory, simply made the folder selection secondary to item selection.
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llfolderview.h16
-rw-r--r--indra/newview/llinventoryfunctions.cpp10
2 files changed, 18 insertions, 8 deletions
diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h
index 525efe425a..d4a1434c73 100644
--- a/indra/llui/llfolderview.h
+++ b/indra/llui/llfolderview.h
@@ -341,16 +341,28 @@ public:
virtual void doItem(LLFolderViewItem* item) = 0;
};
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLSelectFirstFilteredItem
+//
+// This will select the first *item* found in the hierarchy. If no item can be
+// selected, the first matching folder will.
+// Since doFolder() is done first but we prioritize item selection, we let the
+// first filtered folder set the selection and raise a folder flag.
+// The selection might be overridden by the first filtered item in doItem()
+// which checks an item flag. Since doFolder() checks the item flag too, the first
+// item will still be selected if items were to be done first and folders second.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLSelectFirstFilteredItem : public LLFolderViewFunctor
{
public:
- LLSelectFirstFilteredItem() : mItemSelected(FALSE) {}
+ LLSelectFirstFilteredItem() : mItemSelected(FALSE), mFolderSelected(FALSE) {}
virtual ~LLSelectFirstFilteredItem() {}
virtual void doFolder(LLFolderViewFolder* folder);
virtual void doItem(LLFolderViewItem* item);
- BOOL wasItemSelected() { return mItemSelected; }
+ BOOL wasItemSelected() { return mItemSelected || mFolderSelected; }
protected:
BOOL mItemSelected;
+ BOOL mFolderSelected;
};
class LLOpenFilteredFolders : public LLFolderViewFunctor
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 1426567196..6474d56414 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1031,14 +1031,12 @@ void LLSelectFirstFilteredItem::doItem(LLFolderViewItem *item)
void LLSelectFirstFilteredItem::doFolder(LLFolderViewFolder* folder)
{
- if (folder->LLFolderViewItem::passedFilter() && !mItemSelected)
+ // Skip if folder or item already found, if not filtered or if no parent (root folder is not selectable)
+ if (!mFolderSelected && !mItemSelected && folder->LLFolderViewItem::passedFilter() && folder->getParentFolder())
{
folder->getRoot()->setSelection(folder, FALSE, FALSE);
- if (folder->getParentFolder())
- {
- folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
- }
- mItemSelected = TRUE;
+ folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ mFolderSelected = TRUE;
}
}