diff options
author | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2009-11-25 16:52:45 +0200 |
---|---|---|
committer | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2009-11-25 16:52:45 +0200 |
commit | 5e44bb810ce1385da632d751b58c99446b998d24 (patch) | |
tree | f42e3b41296ff3afef7939d6fb0dacfb63f35f27 /indra/newview | |
parent | b70c87313398080671bab5fd3de3309a35a00f43 (diff) |
Fix for normal bug EXT-2321 - Collapsed accordion panels in teleport history should expand while filtering if they contain matched items.
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpanelteleporthistory.cpp | 53 | ||||
-rw-r--r-- | indra/newview/llpanelteleporthistory.h | 4 |
2 files changed, 55 insertions, 2 deletions
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 67d0e13786..debb133573 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -51,6 +51,8 @@ // Used to limit time spent for items list update per frame. static const U32 ADD_LIMIT = 50; +static const std::string COLLAPSED_BY_USER = "collapsed_by_user"; + class LLTeleportHistoryFlatItem : public LLPanel { public: @@ -253,6 +255,10 @@ BOOL LLTeleportHistoryPanel::postBuild() LLAccordionCtrlTab* tab = (LLAccordionCtrlTab*)*iter; tab->setRightMouseDownCallback(boost::bind(&LLTeleportHistoryPanel::onAccordionTabRightClick, this, _1, _2, _3, _4)); tab->setDisplayChildren(false); + tab->setDropDownStateChangedCallback(boost::bind(&LLTeleportHistoryPanel::onAccordionExpand, this, _1, _2)); + + // All accordion tabs are collapsed initially + setAccordionCollapsedByUser(tab, true); mItemContainers.put(tab); @@ -269,10 +275,18 @@ BOOL LLTeleportHistoryPanel::postBuild() // Open first 2 accordion tabs if (mItemContainers.size() > 1) - mItemContainers.get(mItemContainers.size() - 1)->setDisplayChildren(true); + { + LLAccordionCtrlTab* tab = mItemContainers.get(mItemContainers.size() - 1); + tab->setDisplayChildren(true); + setAccordionCollapsedByUser(tab, false); + } if (mItemContainers.size() > 2) - mItemContainers.get(mItemContainers.size() - 2)->setDisplayChildren(true); + { + LLAccordionCtrlTab* tab = mItemContainers.get(mItemContainers.size() - 2); + tab->setDisplayChildren(true); + setAccordionCollapsedByUser(tab, false); + } } getChild<LLPanel>("bottom_panel")->childSetAction("gear_btn",boost::bind(&LLTeleportHistoryPanel::onGearButtonClicked, this)); @@ -490,6 +504,18 @@ void LLTeleportHistoryPanel::refresh() LLAccordionCtrlTab* tab = mItemContainers.get(mItemContainers.size() - 1 - tab_idx); tab->setVisible(true); + // Expand all accordion tabs when filtering + if(!mFilterSubString.empty()) + { + tab->setDisplayChildren(true); + } + // Restore each tab's expand state when not filtering + else + { + bool collapsed = isAccordionCollapsedByUser(tab); + tab->setDisplayChildren(!collapsed); + } + curr_flat_view = getFlatListViewFromTab(tab); } @@ -774,3 +800,26 @@ void LLTeleportHistoryPanel::onGearButtonClicked() LLMenuGL::showPopup(this, menu, menu_x, menu_y); } +void LLTeleportHistoryPanel::setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapsed) +{ + LLSD param = acc_tab->getValue(); + param[COLLAPSED_BY_USER] = collapsed; + acc_tab->setValue(param); +} + +bool LLTeleportHistoryPanel::isAccordionCollapsedByUser(LLUICtrl* acc_tab) +{ + LLSD param = acc_tab->getValue(); + if(!param.has("acc_collapsed")) + { + return false; + } + return param[COLLAPSED_BY_USER].asBoolean(); +} + +void LLTeleportHistoryPanel::onAccordionExpand(LLUICtrl* ctrl, const LLSD& param) +{ + bool expanded = param.asBoolean(); + // Save accordion tab state to restore it in refresh() + setAccordionCollapsedByUser(ctrl, !expanded); +} diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h index a31ff34cb6..f646fea355 100644 --- a/indra/newview/llpanelteleporthistory.h +++ b/indra/newview/llpanelteleporthistory.h @@ -98,6 +98,10 @@ private: LLFlatListView* getFlatListViewFromTab(LLAccordionCtrlTab *); void onGearButtonClicked(); + void setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapsed); + bool isAccordionCollapsedByUser(LLUICtrl* acc_tab); + void onAccordionExpand(LLUICtrl* ctrl, const LLSD& param); + LLTeleportHistoryStorage* mTeleportHistory; LLAccordionCtrl* mHistoryAccordion; |