From 425fd9c6e0f68630191078a34a05bed518156efb Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Wed, 23 Dec 2009 18:35:27 +0200 Subject: Fixed normal bug EXT-3299 "Can't drag and drop landmarks into an empty favorites folder through landmarksSP" - Added drag and drop for empty inventory panel. Dropped item gets to the root folder. - Fixed issue with empty "Landmarks" inventory panel not displaying "No matching items..." message. - Removed accordion updating and hiding in idle routine. This invalidates EXT-2346 "My Landmarks accordion panels shouldn't be displayed if there are no landmarks in respective folders" --HG-- branch : product-engine --- indra/newview/llpanellandmarks.cpp | 95 +++++++++++++++----------------------- 1 file changed, 36 insertions(+), 59 deletions(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index e16bac2098..c627c60940 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -68,12 +68,13 @@ 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); +static bool category_has_descendents(LLInventorySubTreePanel* inventory_list); /** - * Bridge to support knowing when the inventory has changed to update folder (open/close) state + * 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 + * 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 @@ -90,6 +91,7 @@ private: void LLLandmarksPanelObserver::changed(U32 mask) { mLP->saveFolderStateIfNoFilter(); + mLP->updateShowFolderState(); } LLLandmarksPanel::LLLandmarksPanel() @@ -134,22 +136,12 @@ BOOL LLLandmarksPanel::postBuild() getChild("tab_favorites")->setDisplayChildren(true); getChild("tab_landmarks")->setDisplayChildren(true); - gIdleCallbacks.addFunction(LLLandmarksPanel::doIdle, this); return TRUE; } // virtual void LLLandmarksPanel::onSearchEdit(const std::string& string) { - // show all folders in Landmarks Accordion for empty filter - if (mLandmarksInventoryPanel->getFilter()) - { - mLandmarksInventoryPanel->setShowFolderState(string.empty() ? - LLInventoryFilter::SHOW_ALL_FOLDERS : - LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS - ); - } - // give FolderView a chance to be refreshed. So, made all accordions visible for (accordion_tabs_t::const_iterator iter = mAccordionTabs.begin(); iter != mAccordionTabs.end(); ++iter) { @@ -173,6 +165,10 @@ void LLLandmarksPanel::onSearchEdit(const std::string& string) if (sFilterSubString != string) sFilterSubString = string; + + // show all folders in Landmarks Accordion for empty filter + // only if Landmarks inventory folder is not empty + updateShowFolderState(); } // virtual @@ -262,6 +258,23 @@ void LLLandmarksPanel::saveFolderStateIfNoFilter() save_folder_state_if_no_filter(mLibraryInventoryPanel); } +void LLLandmarksPanel::updateShowFolderState() +{ + if (!mLandmarksInventoryPanel->getFilter()) + return; + + bool show_all_folders = mLandmarksInventoryPanel->getRootFolder()->getFilterSubString().empty(); + if (show_all_folders) + { + show_all_folders = category_has_descendents(mLandmarksInventoryPanel); + } + + mLandmarksInventoryPanel->setShowFolderState(show_all_folders ? + LLInventoryFilter::SHOW_ALL_FOLDERS : + LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS + ); +} + ////////////////////////////////////////////////////////////////////////// // PROTECTED METHODS ////////////////////////////////////////////////////////////////////////// @@ -778,46 +791,6 @@ void LLLandmarksPanel::onCustomAction(const LLSD& userdata) } } -void LLLandmarksPanel::updateFilteredAccordions() -{ - LLInventoryPanel* inventory_list = NULL; - LLAccordionCtrlTab* accordion_tab = NULL; - bool needs_arrange = false; - - for (accordion_tabs_t::const_iterator iter = mAccordionTabs.begin(); iter != mAccordionTabs.end(); ++iter) - { - accordion_tab = *iter; - - accordion_tab->setVisible(TRUE); - - inventory_list = dynamic_cast (accordion_tab->getAccordionView()); - 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 - fv->arrangeFromRoot(); - - bool has_descendants = fv->hasFilteredDescendants(); - if (!has_descendants) - needs_arrange = true; - - accordion_tab->setVisible(has_descendants); - - //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) - { - static LLAccordionCtrl* accordion = getChild("landmarks_accordion"); - accordion->arrange(); - } -} - /* Processes such actions: cut/rename/delete/paste actions @@ -926,13 +899,6 @@ bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType carg return true; } -// static -void LLLandmarksPanel::doIdle(void* landmarks_panel) -{ - LLLandmarksPanel* panel = (LLLandmarksPanel* ) landmarks_panel; - panel->updateFilteredAccordions(); -} - void LLLandmarksPanel::doShowOnMap(LLLandmark* landmark) { LLVector3d landmark_global_pos; @@ -1067,4 +1033,15 @@ static void save_folder_state_if_no_filter(LLInventorySubTreePanel* inventory_li // inventory_list->saveFolderState(); // *TODO: commented out to fix build } } + +static bool category_has_descendents(LLInventorySubTreePanel* inventory_list) +{ + LLViewerInventoryCategory* category = gInventory.getCategory(inventory_list->getStartFolderID()); + if (category) + { + return category->getDescendentCount() > 0; + } + + return false; +} // EOF -- cgit v1.2.3 From 75f6bdb469c01fbfb4b26603864d6616b70374f0 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Wed, 23 Dec 2009 18:46:28 +0200 Subject: No ticket. Removed obsolete code for saving Places/My Landmarks folders state. --HG-- branch : product-engine --- indra/newview/llpanellandmarks.cpp | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index c627c60940..7b64f7e221 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -67,15 +67,12 @@ 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); static bool category_has_descendents(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. + * Bridge to support knowing when the inventory has changed to update Landmarks tab + * ShowFolderState filter setting to show all folders when the filter string is empty and + * empty folder message when Landmarks inventory category has no children. */ class LLLandmarksPanelObserver : public LLInventoryObserver { @@ -90,7 +87,6 @@ private: void LLLandmarksPanelObserver::changed(U32 mask) { - mLP->saveFolderStateIfNoFilter(); mLP->updateShowFolderState(); } @@ -250,14 +246,6 @@ 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); -} - void LLLandmarksPanel::updateShowFolderState() { if (!mLandmarksInventoryPanel->getFilter()) @@ -1025,15 +1013,6 @@ static void filter_list(LLInventorySubTreePanel* inventory_list, const std::stri } -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 - } -} - static bool category_has_descendents(LLInventorySubTreePanel* inventory_list) { LLViewerInventoryCategory* category = gInventory.getCategory(inventory_list->getStartFolderID()); -- cgit v1.2.3 From 798ba45606b4e4affcfde157ec64e877dd39e91c Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Wed, 23 Dec 2009 18:55:35 +0200 Subject: Fixed EXT-3348 "State of all folders (expanded/collapsed) in "My Landmarks" tab isn't saved after switching to "Teleport History" tab and back" - Disabled restoring folder state when empty filter is not changed. --HG-- branch : product-engine --- indra/newview/llpanellandmarks.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 7b64f7e221..6a98210830 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -985,7 +985,7 @@ 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 == "") + if (!inventory_list->getRootFolder()->getFilterSubString().empty() && string == "") { inventory_list->setFilterSubString(LLStringUtil::null); // Re-open folders that were open before @@ -1010,7 +1010,6 @@ static void filter_list(LLInventorySubTreePanel* inventory_list, const std::stri // Set new filter string inventory_list->setFilterSubString(string); - } static bool category_has_descendents(LLInventorySubTreePanel* inventory_list) -- cgit v1.2.3 From def2fe77ce1608997696d7703887b30ca688d23c Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Wed, 23 Dec 2009 21:10:00 +0200 Subject: Fixed normal bug EXT-3689 "Places/My Landmarks: "Collapse all folders" from gear menu closes root folder in landmarks accordions" - Added reopening root folder after all folders are collapsed. --HG-- branch : product-engine --- indra/newview/llpanellandmarks.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 6a98210830..716a914306 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -661,7 +661,12 @@ void LLLandmarksPanel::onFoldingAction(const LLSD& userdata) } else if ("collapse_all" == command_name) { - root_folder->closeAllFolders(); + root_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); + + // The top level folder is invisible, it must be open to + // display its sub-folders. + root_folder->openTopLevelFolders(); + root_folder->arrangeAll(); } else if ( "sort_by_date" == command_name) { -- cgit v1.2.3 From 87aad0fe2177ab863704e5432435a0657277fb92 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 25 Dec 2009 19:43:45 +0200 Subject: Work on low task EXT-1770 ( Places - Landmarks - Inventory Panels should be refactored to use LL implementation of possibility to show specified Inventory folder) -- renamed files from llinventorysubtreepanel to llplacesinventorypanel -- renamed class LLInventorySubTreePanel to LLPlacesInventoryPanel --HG-- branch : product-engine --- indra/newview/llpanellandmarks.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 716a914306..d75744ead9 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -49,9 +49,9 @@ #include "llfloaterworldmap.h" #include "llfolderviewitem.h" #include "llinventorypanel.h" -#include "llinventorysubtreepanel.h" #include "lllandmarkactions.h" #include "llplacesinventorybridge.h" +#include "llplacesinventorypanel.h" #include "llsidetray.h" #include "llviewermenu.h" #include "llviewerregion.h" @@ -66,8 +66,8 @@ static const std::string TRASH_BUTTON_NAME = "trash_btn"; // helper functions -static void filter_list(LLInventorySubTreePanel* inventory_list, const std::string& string); -static bool category_has_descendents(LLInventorySubTreePanel* inventory_list); +static void filter_list(LLPlacesInventoryPanel* inventory_list, const std::string& string); +static bool category_has_descendents(LLPlacesInventoryPanel* inventory_list); /** * Bridge to support knowing when the inventory has changed to update Landmarks tab @@ -150,7 +150,7 @@ void LLLandmarksPanel::onSearchEdit(const std::string& string) tab->changeOpenClose(false); } - LLInventorySubTreePanel* inventory_list = dynamic_cast(tab->getAccordionView()); + LLPlacesInventoryPanel* inventory_list = dynamic_cast(tab->getAccordionView()); if (NULL == inventory_list) continue; if (inventory_list->getFilter()) @@ -218,7 +218,7 @@ void LLLandmarksPanel::updateVerbs() updateListCommands(); } -void LLLandmarksPanel::onSelectionChange(LLInventorySubTreePanel* inventory_list, const std::deque &items, BOOL user_action) +void LLLandmarksPanel::onSelectionChange(LLPlacesInventoryPanel* inventory_list, const std::deque &items, BOOL user_action) { if (user_action && (items.size() > 0)) { @@ -362,7 +362,7 @@ void LLLandmarksPanel::setErrorStatus(U32 status, const std::string& reason) void LLLandmarksPanel::initFavoritesInventoryPanel() { - mFavoritesInventoryPanel = getChild("favorites_list"); + mFavoritesInventoryPanel = getChild("favorites_list"); initLandmarksPanel(mFavoritesInventoryPanel); mFavoritesInventoryPanel->getFilter()->setEmptyLookupMessage("FavoritesNoMatchingItems"); @@ -372,7 +372,7 @@ void LLLandmarksPanel::initFavoritesInventoryPanel() void LLLandmarksPanel::initLandmarksInventoryPanel() { - mLandmarksInventoryPanel = getChild("landmarks_list"); + mLandmarksInventoryPanel = getChild("landmarks_list"); initLandmarksPanel(mLandmarksInventoryPanel); @@ -391,7 +391,7 @@ void LLLandmarksPanel::initLandmarksInventoryPanel() void LLLandmarksPanel::initMyInventoryPanel() { - mMyInventoryPanel= getChild("my_inventory_list"); + mMyInventoryPanel= getChild("my_inventory_list"); initLandmarksPanel(mMyInventoryPanel); @@ -400,14 +400,14 @@ void LLLandmarksPanel::initMyInventoryPanel() void LLLandmarksPanel::initLibraryInventoryPanel() { - mLibraryInventoryPanel = getChild("library_list"); + mLibraryInventoryPanel = getChild("library_list"); initLandmarksPanel(mLibraryInventoryPanel); initAccordion("tab_library", mLibraryInventoryPanel); } -void LLLandmarksPanel::initLandmarksPanel(LLInventorySubTreePanel* inventory_list) +void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list) { // In case of a dummy widget further we have no Folder View widget and no Filter, // so further initialization leads to crash. @@ -431,7 +431,7 @@ void LLLandmarksPanel::initLandmarksPanel(LLInventorySubTreePanel* inventory_lis inventory_list->saveFolderState(); } -void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLInventorySubTreePanel* inventory_list) +void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLPlacesInventoryPanel* inventory_list) { LLAccordionCtrlTab* accordion_tab = getChild(accordion_tab_name); @@ -441,7 +441,7 @@ void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLIn accordion_tab->setDisplayChildren(false); } -void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLInventorySubTreePanel* inventory_list) +void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLPlacesInventoryPanel* inventory_list) { bool expanded = param.asBoolean(); @@ -467,7 +467,7 @@ void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLInvento } } -void LLLandmarksPanel::deselectOtherThan(const LLInventorySubTreePanel* inventory_list) +void LLLandmarksPanel::deselectOtherThan(const LLPlacesInventoryPanel* inventory_list) { if (inventory_list != mFavoritesInventoryPanel) { @@ -987,7 +987,7 @@ void LLLandmarksPanel::doCreatePick(LLLandmark* landmark) ////////////////////////////////////////////////////////////////////////// // HELPER FUNCTIONS ////////////////////////////////////////////////////////////////////////// -static void filter_list(LLInventorySubTreePanel* inventory_list, const std::string& string) +static void filter_list(LLPlacesInventoryPanel* inventory_list, const std::string& string) { // When search is cleared, restore the old folder state. if (!inventory_list->getRootFolder()->getFilterSubString().empty() && string == "") @@ -1017,7 +1017,7 @@ static void filter_list(LLInventorySubTreePanel* inventory_list, const std::stri inventory_list->setFilterSubString(string); } -static bool category_has_descendents(LLInventorySubTreePanel* inventory_list) +static bool category_has_descendents(LLPlacesInventoryPanel* inventory_list) { LLViewerInventoryCategory* category = gInventory.getCategory(inventory_list->getStartFolderID()); if (category) -- cgit v1.2.3 From f416e4a7662d8c49a816ac764e29d8d2c2fbd062 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Sat, 26 Dec 2009 18:33:45 +0200 Subject: Fixed low bug EXT-3345 ""Expand all folders" ability is enabled while all folders are expanded in "My Landmarks" tab". - Added check for folder view's folders being in expanded or collapsed state on "My Landmarks" tab. - Added enabling/disabling of "Expand all folders" and "Collapse all folders" commands for landmark and folder "gear" menu. --HG-- branch : product-engine --- indra/newview/llpanellandmarks.cpp | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'indra/newview/llpanellandmarks.cpp') diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index d75744ead9..87abb16395 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -69,6 +69,47 @@ static const std::string TRASH_BUTTON_NAME = "trash_btn"; static void filter_list(LLPlacesInventoryPanel* inventory_list, const std::string& string); static bool category_has_descendents(LLPlacesInventoryPanel* inventory_list); +/** + * Functor counting expanded and collapsed folders in folder view tree to know + * when to enable or disable "Expand all folders" and "Collapse all folders" commands. + */ +class LLCheckFolderState : public LLFolderViewFunctor +{ +public: + LLCheckFolderState() + : mCollapsedFolders(0), + mExpandedFolders(0) + {} + virtual ~LLCheckFolderState() {} + virtual void doFolder(LLFolderViewFolder* folder); + virtual void doItem(LLFolderViewItem* item) {} + S32 getCollapsedFolders() { return mCollapsedFolders; } + S32 getExpandedFolders() { return mExpandedFolders; } + +private: + S32 mCollapsedFolders; + S32 mExpandedFolders; +}; + +// virtual +void LLCheckFolderState::doFolder(LLFolderViewFolder* folder) +{ + // Counting only folders that pass the filter. + // The listener check allow us to avoid counting the folder view + // object itself because it has no listener assigned. + if (folder->hasFilteredDescendants() && folder->getListener()) + { + if (folder->isOpen()) + { + ++mExpandedFolders; + } + else + { + ++mCollapsedFolders; + } + } +} + /** * Bridge to support knowing when the inventory has changed to update Landmarks tab * ShowFolderState filter setting to show all folders when the filter string is empty and @@ -728,6 +769,20 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const return false; } + LLCheckFolderState checker; + rootFolderView->applyFunctorRecursively(checker); + + // We assume that the root folder is always expanded so we enable "collapse_all" + // command when we have at least one more expanded folder. + if (checker.getExpandedFolders() < 2 && "collapse_all" == command_name) + { + return false; + } + + if (checker.getCollapsedFolders() < 1 && "expand_all" == command_name) + { + return false; + } if("category" == command_name) { -- cgit v1.2.3