From 3ad0981d2f80a053a4bc22d659a129b3640852d4 Mon Sep 17 00:00:00 2001
From: Vladimir Pchelko <pchelko@productengine.com>
Date: Wed, 16 Jun 2010 19:43:24 +0300
Subject: [PATCH] EXT-7823 FIXED Accordion widget was improved to show
 different message when no_matched_tabs  in panel or no_visible_tabs in panel.

Added "no_matched" and "no_visible" text for TeleportHistory.
+ Added "no_visible" text for My Outfit list.
+ Fixed filtering in TeleportHistory.

Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/591/

--HG--
branch : product-engine
---
 indra/llui/llaccordionctrl.cpp                         |  7 ++++---
 indra/llui/llaccordionctrl.h                           |  8 ++++++--
 indra/newview/llpanelpeople.cpp                        |  2 +-
 indra/newview/llpanelteleporthistory.cpp               | 10 +++++++---
 .../skins/default/xui/en/panel_outfits_list.xml        |  3 ++-
 indra/newview/skins/default/xui/en/panel_people.xml    |  1 -
 .../skins/default/xui/en/panel_teleport_history.xml    |  6 ++++--
 .../newview/skins/default/xui/en/widgets/accordion.xml |  8 ++++++--
 8 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index 3a1e9f19faf..237d42090ff 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -68,8 +68,9 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params)
  , mSelectedTab( NULL )
  , mTabComparator( NULL )
  , mNoVisibleTabsHelpText(NULL)
+ , mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString())
 {
-	initNoTabsWidget(params.empty_accordion_text);
+	initNoTabsWidget(params.no_matched_tabs_text);
 
 	mSingleExpansion = params.single_expansion;
 	if(mFitParent && !mSingleExpansion)
@@ -379,7 +380,7 @@ void	LLAccordionCtrl::initNoTabsWidget(const LLTextBox::Params& tb_params)
 {
 	LLTextBox::Params tp = tb_params;
 	tp.rect(getLocalRect());
-	mNoVisibleTabsOrigString = tp.initial_value().asString();
+	mNoMatchedTabsOrigString = tp.initial_value().asString();
 	mNoVisibleTabsHelpText = LLUICtrlFactory::create<LLTextBox>(tp, this);
 }
 
@@ -820,7 +821,7 @@ void	LLAccordionCtrl::setFilterSubString(const std::string& filter_string)
 {
 	LLStringUtil::format_map_t args;
 	args["[SEARCH_TERM]"] = LLURI::escape(filter_string);
-	std::string text = filter_string.empty() ? LLStringUtil::null : mNoVisibleTabsOrigString;
+	std::string text = filter_string.empty() ? mNoVisibleTabsOrigString : mNoMatchedTabsOrigString;
 	LLStringUtil::format(text, args);
 
 	mNoVisibleTabsHelpText->setValue(text);
diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h
index 677b598a322..3ad52740855 100644
--- a/indra/llui/llaccordionctrl.h
+++ b/indra/llui/llaccordionctrl.h
@@ -78,12 +78,14 @@ class LLAccordionCtrl: public LLPanel
 								accordion tabs are responsible for scrolling their content.
 								*NOTE fit_parent works best when combined with single_expansion.
 								Accordion view should implement getRequiredRect() and provide valid height*/
-		Optional<LLTextBox::Params>	empty_accordion_text;
+		Optional<LLTextBox::Params>	no_matched_tabs_text;
+		Optional<LLTextBox::Params>	no_visible_tabs_text;
 
 		Params()
 			: single_expansion("single_expansion",false)
 			, fit_parent("fit_parent", false)
-			, empty_accordion_text("empty_accordion_text")
+			, no_matched_tabs_text("no_matched_tabs_text")
+			, no_visible_tabs_text("no_visible_tabs_text")
 		{};
 	};
 
@@ -180,6 +182,8 @@ class LLAccordionCtrl: public LLPanel
 	bool			mAutoScrolling;
 	F32				mAutoScrollRate;
 	LLTextBox*		mNoVisibleTabsHelpText;
+
+	std::string		mNoMatchedTabsOrigString;
 	std::string		mNoVisibleTabsOrigString;
 
 	LLAccordionCtrlTab*		mSelectedTab;
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index f16d1d8fda6..6dd800c0c6a 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -1450,7 +1450,7 @@ void LLPanelPeople::showFriendsAccordionsIfNeeded()
 		LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion");
 		accordion->arrange();
 
-		// *TODO: new empty_accordion_text attribute was implemented in accordion (EXT-7368).
+		// *TODO: new no_matched_tabs_text attribute was implemented in accordion (EXT-7368).
 		// this code should be refactored to use it
 		// keep help text in a synchronization with accordions visibility.
 		updateFriendListHelpText();
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 494cba8c6f7..1048e3fcc01 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -648,16 +648,18 @@ void LLTeleportHistoryPanel::refresh()
 	LLDate tab_boundary_date =  LLDate::now();
 
 	LLFlatListView* curr_flat_view = NULL;
+	std::string filter_string = sFilterSubString;
+	LLStringUtil::toUpper(filter_string);
 
 	U32 added_items = 0;
 	while (mCurrentItem >= 0)
 	{
 		// Filtering
-		if (!sFilterSubString.empty())
+		if (!filter_string.empty())
 		{
 			std::string landmark_title(items[mCurrentItem].mTitle);
 			LLStringUtil::toUpper(landmark_title);
-			if( std::string::npos == landmark_title.find(sFilterSubString) )
+			if( std::string::npos == landmark_title.find(filter_string) )
 			{
 				mCurrentItem--;
 				continue;
@@ -706,7 +708,7 @@ void LLTeleportHistoryPanel::refresh()
 				.getFlatItemForPersistentItem(&mContextMenu,
 											  items[mCurrentItem],
 											  mCurrentItem,
-											  sFilterSubString);
+											  filter_string);
 			if ( !curr_flat_view->addItem(item, LLUUID::null, ADD_BOTTOM, false) )
 				llerrs << "Couldn't add flat item to teleport history." << llendl;
 			if (mLastSelectedItemIndex == mCurrentItem)
@@ -729,6 +731,8 @@ void LLTeleportHistoryPanel::refresh()
 		}
 	}
 
+	mHistoryAccordion->setFilterSubString(sFilterSubString);
+
 	mHistoryAccordion->arrange();
 
 	updateVerbs();
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_list.xml b/indra/newview/skins/default/xui/en/panel_outfits_list.xml
index 5c9ae51a483..d0c44c43289 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_list.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_list.xml
@@ -14,7 +14,8 @@
      background_visible="true"
      bg_alpha_color="DkGray2"
      bg_opaque_color="DkGray2"
-     empty_accordion_text.value="Didn't find what you're looking for? Try [secondlife:///app/search/all/[SEARCH_TERM] Search]."
+     no_matched_tabs_text.value="Didn't find what you're looking for? Try [secondlife:///app/search/all/[SEARCH_TERM] Search]."
+     no_visible_tabs_text.value="There are no any outfits. Try [secondlife:///app/search/all/ Search]."
      follows="all"
      height="400"
      layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml
index da28773c74c..b79ef1e287b 100644
--- a/indra/newview/skins/default/xui/en/panel_people.xml
+++ b/indra/newview/skins/default/xui/en/panel_people.xml
@@ -173,7 +173,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
        		 background_visible="true"
        		 bg_alpha_color="DkGray2"
        		 bg_opaque_color="DkGray2"
-             empty_accordion_text.value=""
              follows="all"
              height="356"
              layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_teleport_history.xml b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
index 21addb8e6fe..daa4356c836 100644
--- a/indra/newview/skins/default/xui/en/panel_teleport_history.xml
+++ b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
@@ -5,14 +5,16 @@
      background_visible="true"
      bg_alpha_color="DkGray">     
     <accordion
+     no_matched_tabs_text.value="Didn't find what you're looking for? Try [secondlife:///app/search/places/[SEARCH_TERM] Search]."
+     no_visible_tabs_text.value="Teleport history is empty. Try [secondlife:///app/search/places/ Search]."
      follows="left|top|right|bottom"
      height="373"
      layout="topleft"
      left="3"
      top="0"
      name="history_accordion"
-   background_visible="true"
-   bg_alpha_color="DkGray2"
+     background_visible="true"
+     bg_alpha_color="DkGray2"
      width="307">
 	    <accordion_tab
          layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/widgets/accordion.xml b/indra/newview/skins/default/xui/en/widgets/accordion.xml
index 05d7447a6f8..19f8234389d 100644
--- a/indra/newview/skins/default/xui/en/widgets/accordion.xml
+++ b/indra/newview/skins/default/xui/en/widgets/accordion.xml
@@ -3,12 +3,16 @@
  height="100"
  name="accordion"
  width="200">
-    <empty_accordion_text
+    <no_matched_tabs_text
      follows="all"
      height="100"
      h_pad="10"
-     name="no_visible_items_msg"
+     name="no_matched_tabs_msg"
      v_pad="15"
      width="200"
      wrap="true "/>
+    <!-- This widget will not be created in viewer. Only its value will be used for empty accordion without filter. -->
+    <no_visible_tabs_text
+     name="no_visible_tabs_msg"
+     visible="false"/>
 </accordion>
-- 
GitLab