From 63a857f0c7f09c45eca9034c41ca1fdfc1ae95b5 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 28 Jul 2011 19:09:48 -0700
Subject: EXP-1054 FIX Entering search term in search box in Viewer UI does not
 produce search results if search window is already open use new parameters
 when opening existing floater

---
 indra/llui/llfloaterreg.cpp       |  2 +-
 indra/newview/llfloatersearch.cpp | 24 +++++++++++-------------
 indra/newview/llfloatersearch.h   | 11 ++++++++---
 3 files changed, 20 insertions(+), 17 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 1463d0bfbb..fc7dcfcc4e 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -214,7 +214,7 @@ LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key,
 	LLFloater* instance = getInstance(name, key); 
 	if (instance) 
 	{
-		instance->openFloater(instance->mKey);
+		instance->openFloater(key);
 		if (focus)
 			instance->setFocus(TRUE);
 	}
diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp
index ce0bba802d..2a946b1edf 100644
--- a/indra/newview/llfloatersearch.cpp
+++ b/indra/newview/llfloatersearch.cpp
@@ -71,8 +71,8 @@ public:
 
 		// create the LLSD arguments for the search floater
 		LLFloaterSearch::Params p;
-		p.category = category;
-		p.query = LLURI::unescape(search_text);
+		p.search.category = category;
+		p.search.query = LLURI::unescape(search_text);
 
 		// open the search floater and perform the requested search
 		LLFloaterReg::showInstance("search", p);
@@ -81,14 +81,10 @@ public:
 };
 LLSearchHandler gSearchHandler;
 
-LLFloaterSearch::_Params::_Params()
+LLFloaterSearch::SearchQuery::SearchQuery()
 :	category("category", ""),
 	query("query")
-{
-	trusted_content = true;
-	allow_address_entry = false;
-}
-
+{}
 
 LLFloaterSearch::LLFloaterSearch(const Params& key) :
 	LLFloaterWebContent(key),
@@ -117,8 +113,12 @@ BOOL LLFloaterSearch::postBuild()
 
 void LLFloaterSearch::onOpen(const LLSD& key)
 {
-	LLFloaterWebContent::onOpen(key);
-	search(key);
+	Params p(key);
+	p.trusted_content = true;
+	p.allow_address_entry = false;
+
+	LLFloaterWebContent::onOpen(p);
+	search(p.search);
 }
 
 void LLFloaterSearch::onClose(bool app_quitting)
@@ -141,10 +141,8 @@ void LLFloaterSearch::godLevelChanged(U8 godlevel)
 	//getChildView("refresh_search")->setVisible( (godlevel != mSearchGodLevel));
 }
 
-void LLFloaterSearch::search(const LLSD &key)
+void LLFloaterSearch::search(const SearchQuery &p)
 {
-	Params p(key);
-	
 	if (! mWebBrowser || !p.validateBlock())
 	{
 		return;
diff --git a/indra/newview/llfloatersearch.h b/indra/newview/llfloatersearch.h
index a4043b2353..35b268e1b2 100644
--- a/indra/newview/llfloatersearch.h
+++ b/indra/newview/llfloatersearch.h
@@ -46,12 +46,17 @@ class LLFloaterSearch :
 	public LLFloaterWebContent
 {
 public:
-	struct _Params : public LLInitParam::Block<_Params, LLFloaterWebContent::Params>
+	struct SearchQuery : public LLInitParam::Block<SearchQuery>
 	{
 		Optional<std::string> category;
 		Optional<std::string> query;
 
-		_Params();
+		SearchQuery();
+	};
+
+	struct _Params : public LLInitParam::Block<_Params, LLFloaterWebContent::Params>
+	{
+		Optional<SearchQuery> search;
 	};
 
 	typedef LLSDParamAdapter<_Params> Params;
@@ -69,7 +74,7 @@ public:
 	///  - "id": specifies the text phrase to search for
 	///  - "category": one of "all" (default), "people", "places",
 	///    "events", "groups", "wiki", "destinations", "classifieds"
-	void search(const LLSD &key);
+	void search(const SearchQuery &query);
 
 	/// changing godmode can affect the search results that are
 	/// returned by the search website - use this method to tell the
-- 
cgit v1.2.3