summaryrefslogtreecommitdiff
path: root/indra/newview/llpanellandmarks.cpp
diff options
context:
space:
mode:
authorMike Antipov <mantipov@productengine.com>2009-10-28 18:00:00 +0200
committerMike Antipov <mantipov@productengine.com>2009-10-28 18:00:00 +0200
commitc70214f941b128d88e66d435438fe0db36404765 (patch)
tree7b00ffe0cd2b55ba67a3072062fb8b3879b7b18d /indra/newview/llpanellandmarks.cpp
parente2a15bc7b8ce60cf2a62aae621184eb26560a9a3 (diff)
Fixed normal bug EXT-1619 (Accodion panel should be hidden if it has no content matches filter)
- added processing a count of visibled items in accordion tabs. --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llpanellandmarks.cpp')
-rw-r--r--indra/newview/llpanellandmarks.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 4650c0eab4..3d0db71045 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -38,10 +38,12 @@
#include "llsdutil.h"
#include "llsdutil_math.h"
+#include "llaccordionctrl.h"
#include "llaccordionctrltab.h"
#include "llagent.h"
#include "llagentpicksinfo.h"
#include "llagentui.h"
+#include "llcallbacklist.h"
#include "lldndbutton.h"
#include "llfloaterworldmap.h"
#include "llfolderviewitem.h"
@@ -75,6 +77,7 @@ LLLandmarksPanel::LLLandmarksPanel()
, mListCommands(NULL)
, mGearFolderMenu(NULL)
, mGearLandmarkMenu(NULL)
+ , mDirtyFilter(false)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_landmarks.xml");
}
@@ -98,16 +101,37 @@ BOOL LLLandmarksPanel::postBuild()
initMyInventroyPanel();
initLibraryInventroyPanel();
+ gIdleCallbacks.addFunction(LLLandmarksPanel::doIdle, this);
return TRUE;
}
// virtual
void LLLandmarksPanel::onSearchEdit(const std::string& string)
{
+ static std::string prev_string("");
+
+ if (prev_string == string) return;
+
+ // show all folders in Landmarks Accordion for empty filter
+ mLandmarksInventoryPanel->setShowFolderState(string.empty() ?
+ LLInventoryFilter::SHOW_ALL_FOLDERS :
+ LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS
+ );
+
filter_list(mFavoritesInventoryPanel, string);
filter_list(mLandmarksInventoryPanel, string);
filter_list(mMyInventoryPanel, string);
filter_list(mLibraryInventoryPanel, string);
+
+ prev_string = string;
+ mDirtyFilter = true;
+
+ // 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)
+ {
+ LLAccordionCtrlTab* tab = *iter;
+ tab->setVisible(true);
+ }
}
// virtual
@@ -391,6 +415,7 @@ void LLLandmarksPanel::initLandmarksPanel(LLInventorySubTreePanel* inventory_lis
void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLInventorySubTreePanel* inventory_list)
{
LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>(accordion_tab_name);
+ mAccordionTabs.push_back(accordion_tab);
accordion_tab->setDropDownStateChangedCallback(
boost::bind(&LLLandmarksPanel::onAccordionExpandedCollapsed, this, _2, inventory_list));
}
@@ -859,6 +884,43 @@ bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType carg
}
+void LLLandmarksPanel::doIdle(void* landmarks_panel)
+{
+ LLLandmarksPanel* panel = (LLLandmarksPanel* ) landmarks_panel;
+
+ if (panel->mDirtyFilter)
+ {
+ panel->updateFilteredAccordions();
+ }
+
+}
+
+void LLLandmarksPanel::updateFilteredAccordions()
+{
+ LLInventoryPanel* inventory_list = NULL;
+ LLAccordionCtrlTab* accordion_tab = NULL;
+ for (accordion_tabs_t::const_iterator iter = mAccordionTabs.begin(); iter != mAccordionTabs.end(); ++iter)
+ {
+ accordion_tab = *iter;
+ inventory_list = dynamic_cast<LLInventorySubTreePanel*> (accordion_tab->getAccordionView());
+ if (NULL == inventory_list) continue;
+ LLFolderView* fv = inventory_list->getRootFolder();
+
+ bool has_visible_children = fv->hasVisibleChildren();
+
+ accordion_tab->setVisible(has_visible_children);
+ }
+
+ // we have to arrange accordion tabs for cases when filter string is less restrictive but
+ // all items are still filtered.
+ static LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion");
+ accordion->arrange();
+
+ // now filter state is applied to accordion tabs
+ mDirtyFilter = false;
+}
+
+
//////////////////////////////////////////////////////////////////////////
// HELPER FUNCTIONS
//////////////////////////////////////////////////////////////////////////