summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMike Antipov <mantipov@productengine.com>2009-12-09 09:56:34 +0200
committerMike Antipov <mantipov@productengine.com>2009-12-09 09:56:34 +0200
commitb1b9ef14f5bf323b2d4caaa4b88d9727f6197567 (patch)
treea795ca78ca95565ab23fd7f7caf16c6859c3d226 /indra/newview
parent25b8258d811ce2f89fa9b1b31192796cf2567968 (diff)
Fixed critical bug EXT-3094 (Content of accordions disappears after collapsing all folders in My "Landmarks" tab and switching to "Teleport history" tab and back)
Reason: Folder state of loaded folders was not saved before switching to Teleport history and back Due to inventory loading was changed to fetch items in background it is impossible to save folder state while initializing of an Inventory panel. Inventory observer was implemented to save folder states for Inventory Panels in all accordions. Reviwed by Seth ProductEngine --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanellandmarks.cpp48
-rw-r--r--indra/newview/llpanellandmarks.h6
2 files changed, 54 insertions, 0 deletions
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index e87b70f6a5..faa0aa95b9 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
//////////////////////////////////////////////////////////////////////////
@@ -1020,4 +1059,13 @@ static void filter_list(LLInventorySubTreePanel* inventory_list, const std::stri
// set new filter string
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();
+ }
+}
// EOF
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index bee141d051..b0e537f647 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -67,6 +67,11 @@ public:
mCurrentSelectedList = inventory_list;
}
+ /**
+ * Saves folder state for all Inventory Panels if there are no applied filter.
+ */
+ void saveFolderStateIfNoFilter();
+
protected:
/**
* @return true - if current selected panel is not null and selected item is a landmark
@@ -151,6 +156,7 @@ private:
LLMenuGL* mGearFolderMenu;
LLMenuGL* mMenuAdd;
LLInventorySubTreePanel* mCurrentSelectedList;
+ LLInventoryObserver* mInventoryObserver;
LLPanel* mListCommands;
bool mSortByDate;