From e918089f592da2094e6b23a146e0e30b711562dc Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Thu, 4 Feb 2010 17:04:27 +0200
Subject: Fixed critical bug (EXT-4827) [NUX] The Places Panel should default
 to the Landmarks tab with the Library expanded. - Added Library tab set open
 by default with Landmarks category fetch from Library.

--HG--
branch : product-engine
---
 indra/newview/llpanellandmarks.cpp | 22 ++++++++++++++--------
 indra/newview/llpanellandmarks.h   |  2 +-
 2 files changed, 15 insertions(+), 9 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 47feef496a..7c1b0f6234 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -171,8 +171,6 @@ BOOL LLLandmarksPanel::postBuild()
 	initLandmarksInventoryPanel();
 	initMyInventoryPanel();
 	initLibraryInventoryPanel();
-	getChild<LLAccordionCtrlTab>("tab_favorites")->setDisplayChildren(true);
-	getChild<LLAccordionCtrlTab>("tab_landmarks")->setDisplayChildren(true);
 
 	return TRUE;
 }
@@ -462,7 +460,7 @@ void LLLandmarksPanel::initFavoritesInventoryPanel()
 	initLandmarksPanel(mFavoritesInventoryPanel);
 	mFavoritesInventoryPanel->getFilter()->setEmptyLookupMessage("FavoritesNoMatchingItems");
 
-	initAccordion("tab_favorites", mFavoritesInventoryPanel);
+	initAccordion("tab_favorites", mFavoritesInventoryPanel, true);
 }
 
 void LLLandmarksPanel::initLandmarksInventoryPanel()
@@ -481,7 +479,7 @@ void LLLandmarksPanel::initLandmarksInventoryPanel()
 	// subscribe to have auto-rename functionality while creating New Folder
 	mLandmarksInventoryPanel->setSelectCallback(boost::bind(&LLInventoryPanel::onSelectionChange, mLandmarksInventoryPanel, _1, _2));
 
-	initAccordion("tab_landmarks", mLandmarksInventoryPanel);
+	initAccordion("tab_landmarks", mLandmarksInventoryPanel, true);
 }
 
 void LLLandmarksPanel::initMyInventoryPanel()
@@ -490,7 +488,7 @@ void LLLandmarksPanel::initMyInventoryPanel()
 
 	initLandmarksPanel(mMyInventoryPanel);
 
-	initAccordion("tab_inventory", mMyInventoryPanel);
+	initAccordion("tab_inventory", mMyInventoryPanel, false);
 }
 
 void LLLandmarksPanel::initLibraryInventoryPanel()
@@ -499,7 +497,15 @@ void LLLandmarksPanel::initLibraryInventoryPanel()
 
 	initLandmarksPanel(mLibraryInventoryPanel);
 
-	initAccordion("tab_library", mLibraryInventoryPanel);
+	// We want to fetch only "Landmarks" category from the library.
+	const LLUUID &landmarks_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false, true);
+	if (landmarks_cat.notNull())
+	{
+		gInventory.startBackgroundFetch(landmarks_cat);
+	}
+
+	// Expanding "Library" tab for new users who have no landmarks in "My Inventory".
+	initAccordion("tab_library", mLibraryInventoryPanel, true);
 }
 
 void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list)
@@ -526,14 +532,14 @@ void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list
 	inventory_list->saveFolderState();
 }
 
-void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLPlacesInventoryPanel* inventory_list)
+void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLPlacesInventoryPanel* inventory_list,	bool expand_tab)
 {
 	LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>(accordion_tab_name);
 
 	mAccordionTabs.push_back(accordion_tab);
 	accordion_tab->setDropDownStateChangedCallback(
 		boost::bind(&LLLandmarksPanel::onAccordionExpandedCollapsed, this, _2, inventory_list));
-	accordion_tab->setDisplayChildren(false);
+	accordion_tab->setDisplayChildren(expand_tab);
 }
 
 void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLPlacesInventoryPanel* inventory_list)
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index 96b790844c..cbbd10ac26 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -110,7 +110,7 @@ private:
 	void initMyInventoryPanel();
 	void initLibraryInventoryPanel();
 	void initLandmarksPanel(LLPlacesInventoryPanel* inventory_list);
-	void initAccordion(const std::string& accordion_tab_name, LLPlacesInventoryPanel* inventory_list);
+	void initAccordion(const std::string& accordion_tab_name, LLPlacesInventoryPanel* inventory_list, bool expand_tab);
 	void onAccordionExpandedCollapsed(const LLSD& param, LLPlacesInventoryPanel* inventory_list);
 	void deselectOtherThan(const LLPlacesInventoryPanel* inventory_list);
 
-- 
cgit v1.2.3