summaryrefslogtreecommitdiff
path: root/indra/newview/llpanellandmarks.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-12-11 16:01:44 -0500
committerLoren Shih <seraph@lindenlab.com>2009-12-11 16:01:44 -0500
commit99590047eb322d76a90c417bf0e6b2ec0e189d52 (patch)
treeeaab40ba586d097bf5c1dd4b6ef673c1284ff477 /indra/newview/llpanellandmarks.cpp
parentd2b72fe0184fb92f4a79eebd242825fbcc5f32e9 (diff)
parent1f3a55470919bf451f9c45b454d9bbf815a3e88a (diff)
automated merge avp->avp
--HG-- branch : avatar-pipeline
Diffstat (limited to 'indra/newview/llpanellandmarks.cpp')
-rw-r--r--indra/newview/llpanellandmarks.cpp62
1 files changed, 55 insertions, 7 deletions
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 4b5ff1732d..e56ed00dcb 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -66,6 +66,30 @@ static const std::string TRASH_BUTTON_NAME = "trash_btn";
// helper functions
static void filter_list(LLInventorySubTreePanel* inventory_list, const std::string& string);
+static void save_folder_state_if_no_filter(LLInventorySubTreePanel* inventory_list);
+
+/**
+ * Bridge to support knowing when the inventory has changed to update folder (open/close) state
+ * for landmarks panels.
+ *
+ * Due to Inventory data are loaded in background we need to save folder state each time
+ * next level is loaded. See EXT-3094.
+ */
+class LLLandmarksPanelObserver : public LLInventoryObserver
+{
+public:
+ LLLandmarksPanelObserver(LLLandmarksPanel* lp) : mLP(lp) {}
+ virtual ~LLLandmarksPanelObserver() {}
+ /*virtual*/ void changed(U32 mask);
+
+private:
+ LLLandmarksPanel* mLP;
+};
+
+void LLLandmarksPanelObserver::changed(U32 mask)
+{
+ mLP->saveFolderStateIfNoFilter();
+}
LLLandmarksPanel::LLLandmarksPanel()
: LLPanelPlacesTab()
@@ -78,11 +102,18 @@ LLLandmarksPanel::LLLandmarksPanel()
, mGearFolderMenu(NULL)
, mGearLandmarkMenu(NULL)
{
+ mInventoryObserver = new LLLandmarksPanelObserver(this);
+ gInventory.addObserver(mInventoryObserver);
+
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_landmarks.xml");
}
LLLandmarksPanel::~LLLandmarksPanel()
{
+ if (gInventory.containsObserver(mInventoryObserver))
+ {
+ gInventory.removeObserver(mInventoryObserver);
+ }
}
BOOL LLLandmarksPanel::postBuild()
@@ -226,6 +257,14 @@ void LLLandmarksPanel::onSelectorButtonClicked()
}
}
+void LLLandmarksPanel::saveFolderStateIfNoFilter()
+{
+ save_folder_state_if_no_filter(mFavoritesInventoryPanel);
+ save_folder_state_if_no_filter(mLandmarksInventoryPanel);
+ save_folder_state_if_no_filter(mMyInventoryPanel);
+ save_folder_state_if_no_filter(mLibraryInventoryPanel);
+}
+
//////////////////////////////////////////////////////////////////////////
// PROTECTED METHODS
//////////////////////////////////////////////////////////////////////////
@@ -745,7 +784,7 @@ void LLLandmarksPanel::updateFilteredAccordions()
{
LLInventoryPanel* inventory_list = NULL;
LLAccordionCtrlTab* accordion_tab = NULL;
-// bool needs_arrange = false;
+ bool needs_arrange = false;
for (accordion_tabs_t::const_iterator iter = mAccordionTabs.begin(); iter != mAccordionTabs.end(); ++iter)
{
@@ -757,7 +796,7 @@ void LLLandmarksPanel::updateFilteredAccordions()
if (NULL == inventory_list) continue;
// This doesn't seem to work correctly. Disabling for now. -Seraph
- /*
+ // Enabled to show/hide accordions with/without landmarks. See EXT-2346. (Seth PE)
LLFolderView* fv = inventory_list->getRootFolder();
// arrange folder view contents to draw its descendants if it has any
@@ -768,17 +807,17 @@ void LLLandmarksPanel::updateFilteredAccordions()
needs_arrange = true;
accordion_tab->setVisible(has_descendants);
- */
- accordion_tab->setVisible(TRUE);
+
+ //accordion_tab->setVisible(TRUE);
}
// we have to arrange accordion tabs for cases when filter string is less restrictive but
// all items are still filtered.
-// if (needs_arrange)
-// {
+ if (needs_arrange)
+ {
static LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion");
accordion->arrange();
-// }
+ }
}
/*
@@ -1021,4 +1060,13 @@ static void filter_list(LLInventorySubTreePanel* inventory_list, const std::stri
inventory_list->setFilterSubString(string);
}
+
+static void save_folder_state_if_no_filter(LLInventorySubTreePanel* inventory_list)
+{
+ // save current folder open state if no filter currently applied
+ if (inventory_list->getRootFolder() && inventory_list->getRootFolder()->getFilterSubString().empty())
+ {
+ // inventory_list->saveFolderState(); // *TODO: commented out to fix build
+ }
+}
// EOF