From 96d5f52624d68768592893ee0b27a0589b0f6222 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Wed, 9 Dec 2009 14:47:52 -0500
Subject: [PATCH] EXT-3274 : Landmarks or Favorites accordion panel shows up as
 empty EXT-1609 : Strange behavior for accordions in Places panel, Landmarks
 tab

Forcing top-level folders open when accordion is active.  Removed logic that was saving and restoring initial folder state.

--HG--
branch : avatar-pipeline
---
 indra/newview/llfolderview.cpp     | 10 ++++++++++
 indra/newview/llfolderview.h       |  1 +
 indra/newview/llinventorypanel.h   |  1 +
 indra/newview/llpanellandmarks.cpp | 20 ++++++--------------
 4 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 7cf01040755..1c5d7ae9b99 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -357,6 +357,16 @@ void LLFolderView::openFolder(const std::string& foldername)
 	}
 }
 
+void LLFolderView::openTopLevelFolders()
+{
+	for (folders_t::iterator iter = mFolders.begin();
+		 iter != mFolders.end();)
+	{
+		folders_t::iterator fit = iter++;
+		(*fit)->setOpen(TRUE);
+	}
+}
+
 void LLFolderView::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse)
 {
 	// call base class to do proper recursion
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index 4adf6c2fbf9..d18ba385d82 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -127,6 +127,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	// Close all folders in the view
 	void closeAllFolders();
 	void openFolder(const std::string& foldername);
+	void openTopLevelFolders();
 
 	virtual void toggleOpen() {};
 	virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse);
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index cbbd433c1db..4f7f0a79f64 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -192,6 +192,7 @@ class LLInventoryPanel : public LLPanel
 public:
 	BOOL 				getIsViewsInitialized() const { return mViewsInitialized; }
 	const LLUUID&		getStartFolderID() const { return mStartFolderID; }
+	const std::string&  getStartFolderString() { return mStartFolderString; }
 protected:
 	// Builds the UI.  Call this once the inventory is usable.
 	void 				initializeViews();
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 975219458f0..c85fab20921 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -389,10 +389,6 @@ void LLLandmarksPanel::initLandmarksPanel(LLInventorySubTreePanel* inventory_lis
 	}
 
 	root_folder->setParentLandmarksPanel(this);
-
-	// save initial folder state to avoid incorrect work while switching between Landmarks & Teleport History tabs
-	// See EXT-1609.
-	inventory_list->saveFolderState();
 }
 
 void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLInventorySubTreePanel* inventory_list)
@@ -995,12 +991,13 @@ void LLLandmarksPanel::doCreatePick(LLLandmark* landmark)
 //////////////////////////////////////////////////////////////////////////
 static void filter_list(LLInventorySubTreePanel* inventory_list, const std::string& string)
 {
+	// Open the immediate children of the root folder, since those
+	// are invisible in the UI and thus must always be open.
+	inventory_list->getRootFolder()->openTopLevelFolders();
+
 	if (string == "")
 	{
 		inventory_list->setFilterSubString(LLStringUtil::null);
-
-		// re-open folders that were initially open
-		inventory_list->restoreFolderState();
 	}
 
 	if (inventory_list->getFilterSubString().empty() && string.empty())
@@ -1009,13 +1006,8 @@ static void filter_list(LLInventorySubTreePanel* inventory_list, const std::stri
 		return;
 	}
 
-	// save current folder open state if no filter currently applied
-	if (inventory_list->getRootFolder()->getFilterSubString().empty())
-	{
-		inventory_list->saveFolderState();
-	}
-
-	// set new filter string
+	// Set new filter string
 	inventory_list->setFilterSubString(string);
+
 }
 // EOF
-- 
GitLab