diff options
author | callum <none@none> | 2009-12-14 14:10:16 -0800 |
---|---|---|
committer | callum <none@none> | 2009-12-14 14:10:16 -0800 |
commit | 180daf3ab83ff9a83200c1952c0f09d20cfcb992 (patch) | |
tree | 4591d743023244614678022269d80ef6d8097f63 /indra/newview/llpanellandmarks.cpp | |
parent | 894a5006b3e5b4c725060443dab34491b0da3a4d (diff) | |
parent | 5b6e4577ae6073650d78e1181ca5b60c527a7ae7 (diff) |
Merge with Tip
Diffstat (limited to 'indra/newview/llpanellandmarks.cpp')
-rw-r--r-- | indra/newview/llpanellandmarks.cpp | 77 |
1 files changed, 63 insertions, 14 deletions
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index e87b70f6a5..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 ////////////////////////////////////////////////////////////////////////// @@ -327,6 +366,7 @@ void LLLandmarksPanel::initFavoritesInventoryPanel() mFavoritesInventoryPanel = getChild<LLInventorySubTreePanel>("favorites_list"); initLandmarksPanel(mFavoritesInventoryPanel); + mFavoritesInventoryPanel->getFilter()->setEmptyLookupMessage("FavoritesNoMatchingItems"); initAccordion("tab_favorites", mFavoritesInventoryPanel); } @@ -389,9 +429,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(); } @@ -747,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) { @@ -759,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 @@ -770,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(); -// } + } } /* @@ -995,15 +1032,17 @@ void LLLandmarksPanel::doCreatePick(LLLandmark* landmark) ////////////////////////////////////////////////////////////////////////// static void filter_list(LLInventorySubTreePanel* inventory_list, const std::string& string) { + // When search is cleared, restore the old folder state. if (string == "") { inventory_list->setFilterSubString(LLStringUtil::null); - - // re-open folders that were initially open + // Re-open folders that were open before inventory_list->restoreFolderState(); } - gInventory.startBackgroundFetch(); + // 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 (inventory_list->getFilterSubString().empty() && string.empty()) { @@ -1017,7 +1056,17 @@ static void filter_list(LLInventorySubTreePanel* inventory_list, const std::stri inventory_list->saveFolderState(); } - // set new filter string + // 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(); // *TODO: commented out to fix build + } } // EOF |