From 8fd2d69fdf47e0f586c6010c589411e251967038 Mon Sep 17 00:00:00 2001
From: Paul ProductEngine <pguslisty@productengine.com>
Date: Tue, 27 Sep 2011 22:51:43 +0300
Subject: [PATCH] EXP-1224 FIXED (Create and register a floater for People side
 tab)

- Added a floater for People side tab.
- Replaced calls to LLSideTray with LLFloaterSidePanelContainer.
---
 indra/newview/llbottomtray.cpp                |  3 +-
 indra/newview/llchathistory.cpp               |  3 +-
 indra/newview/llfloaterpreference.cpp         |  3 +-
 indra/newview/llfloatersidepanelcontainer.cpp | 25 ++++++++++-
 indra/newview/llfloatersidepanelcontainer.h   | 26 ++++++++++-
 indra/newview/llgroupactions.cpp              | 15 ++++---
 indra/newview/llnearbychat.cpp                |  3 +-
 indra/newview/llpanelblockedlist.cpp          |  3 +-
 indra/newview/llpanelgroup.cpp                |  5 ++-
 indra/newview/llpanelpeople.cpp               | 13 ++++++
 indra/newview/llpanelpicks.cpp                |  3 +-
 indra/newview/llviewerfloaterreg.cpp          |  1 +
 .../skins/default/xui/en/floater_people.xml   | 45 +++++++++++++++++++
 .../xui/en/menu_people_friends_view_sort.xml  |  2 +-
 .../xui/en/menu_people_nearby_view_sort.xml   |  2 +-
 .../xui/en/menu_people_recent_view_sort.xml   |  2 +-
 16 files changed, 133 insertions(+), 21 deletions(-)
 create mode 100644 indra/newview/skins/default/xui/en/floater_people.xml

diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 79e6c7b66bd..e6448d38eec 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -31,6 +31,7 @@
 
 // library includes
 #include "llfloaterreg.h"
+#include "llfloatersidepanelcontainer.h"
 #include "llflyoutbutton.h"
 #include "lllayoutstack.h"
 #include "llnotifications.h"
@@ -856,7 +857,7 @@ void LLBottomTray::draw()
 	}
 	getChild<LLButton>("show_profile_btn")->setToggleState(LLAvatarActions::profileVisible(gAgent.getID()));
 
-	LLPanel* panel = LLSideTray::getInstance()->getPanel("panel_people");
+	LLPanel* panel = LLFloaterSidePanelContainer::getPanel("people", "panel_people");
 	if (panel && panel->isInVisibleChain())
 	{
 		getChild<LLButton>("show_people_button")->setToggleState(true);
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index c0c9ea14516..d6773b8b295 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -42,6 +42,7 @@
 #include "llavataractions.h"
 #include "lltrans.h"
 #include "llfloaterreg.h"
+#include "llfloatersidepanelcontainer.h"
 #include "llmutelist.h"
 #include "llstylemap.h"
 #include "llslurl.h"
@@ -144,7 +145,7 @@ class LLChatHistoryHeader: public LLPanel
 		{
 			LLMuteList::getInstance()->add(LLMute(getAvatarId(), mFrom, LLMute::OBJECT));
 
-			LLSideTray::getInstance()->showPanel("panel_block_list_sidetray", LLSD().with("blocked_to_select", getAvatarId()));
+			LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD().with("blocked_to_select", getAvatarId()));
 		}
 	}
 
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index d65928e3859..d8b6b2e966e 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -50,6 +50,7 @@
 #include "llfloaterreg.h"
 #include "llfloaterabout.h"
 #include "llfloaterhardwaresettings.h"
+#include "llfloatersidepanelcontainer.h"
 #include "llimfloater.h"
 #include "llkeyboard.h"
 #include "llmodaldialog.h"
@@ -1499,7 +1500,7 @@ void LLFloaterPreference::onClickBlockList()
 	// don't create side tray on demand
 	if (LLSideTray::instanceCreated())
 	{
-		LLSideTray::getInstance()->showPanel("panel_block_list_sidetray");
+		LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD());
 	}
 }
 
diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp
index cf66fd1792d..d77232a8887 100644
--- a/indra/newview/llfloatersidepanelcontainer.cpp
+++ b/indra/newview/llfloatersidepanelcontainer.cpp
@@ -77,11 +77,32 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na
 	return panel;
 }
 
-void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const LLSD& panel_name)
+LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name, const std::string& panel_name)
+{
+	LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
+
+	if (floaterp)
+	{
+		return floaterp->findChild<LLPanel>(panel_name, true);
+	}
+
+	return NULL;
+}
+
+void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const LLSD& key)
+{
+	LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
+	if (floaterp)
+	{
+		floaterp->openChildPanel("main_panel", key);
+	}
+}
+
+void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const std::string& panel_name, const LLSD& key)
 {
 	LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
 	if (floaterp)
 	{
-		floaterp->openChildPanel("main_panel", panel_name);
+		floaterp->openChildPanel(panel_name, key);
 	}
 }
diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h
index 7b4e7643aed..a5ea1a23fbe 100644
--- a/indra/newview/llfloatersidepanelcontainer.h
+++ b/indra/newview/llfloatersidepanelcontainer.h
@@ -42,6 +42,9 @@
  */
 class LLFloaterSidePanelContainer : public LLFloater
 {
+private:
+	static const std::string sMainPanelName;
+
 public:
 	LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams());
 	~LLFloaterSidePanelContainer();
@@ -50,7 +53,28 @@ class LLFloaterSidePanelContainer : public LLFloater
 
 	LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params);
 
-	static void showPanel(const std::string& floater_name, const LLSD& panel_name);
+	static LLPanel* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName);
+
+	static void showPanel(const std::string& floater_name, const LLSD& key);
+
+	static void showPanel(const std::string& floater_name, const std::string& panel_name, const LLSD& key);
+
+	/**
+	 * Gets the panel of given type T (doesn't show it or do anything else with it).
+	 *
+	 * @param panel_name a string specifying a child panel to get.
+	 * @returns a pointer to the panel of given type T.
+	 */
+	template <typename T>
+	static T* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName)
+	{
+		T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name));
+		if (!panel)
+		{
+			llwarns << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << llendl;
+		}
+		return panel;
+	}
 };
 
 #endif // LL_LLFLOATERSIDEPANELCONTAINER_H
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index 97fa5514417..cbbd66d8684 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -34,6 +34,7 @@
 #include "llagent.h"
 #include "llcommandhandler.h"
 #include "llfloaterreg.h"
+#include "llfloatersidepanelcontainer.h"
 #include "llgroupmgr.h"
 #include "llimview.h" // for gIMMgr
 #include "llnotificationsutil.h"
@@ -83,7 +84,7 @@ class LLGroupHandler : public LLCommandHandler
 			{
 				LLSD params;
 				params["people_panel_tab_name"] = "groups_panel";
-				LLSideTray::getInstance()->showPanel("panel_people", params);
+				LLFloaterSidePanelContainer::showPanel("people", "panel_people", params);
 				return true;
 			}
             return false;
@@ -243,7 +244,7 @@ static bool isGroupUIVisible()
 {
 	static LLPanel* panel = 0;
 	if(!panel)
-		panel = LLSideTray::getInstance()->getPanel("panel_group_info_sidetray");
+		panel = LLFloaterSidePanelContainer::getPanel("people", "panel_group_info_sidetray");
 	if(!panel)
 		return false;
 	return panel->isInVisibleChain();
@@ -265,7 +266,7 @@ void LLGroupActions::show(const LLUUID& group_id)
 	params["group_id"] = group_id;
 	params["open_tab_name"] = "panel_group_info_sidetray";
 
-	LLSideTray::getInstance()->showPanel("panel_group_info_sidetray", params);
+	LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
 }
 
 void LLGroupActions::refresh_notices()
@@ -278,7 +279,7 @@ void LLGroupActions::refresh_notices()
 	params["open_tab_name"] = "panel_group_info_sidetray";
 	params["action"] = "refresh_notices";
 
-	LLSideTray::getInstance()->showPanel("panel_group_info_sidetray", params);
+	LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
 }
 
 //static 
@@ -292,7 +293,7 @@ void LLGroupActions::refresh(const LLUUID& group_id)
 	params["open_tab_name"] = "panel_group_info_sidetray";
 	params["action"] = "refresh";
 
-	LLSideTray::getInstance()->showPanel("panel_group_info_sidetray", params);
+	LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
 }
 
 //static 
@@ -303,7 +304,7 @@ void LLGroupActions::createGroup()
 	params["open_tab_name"] = "panel_group_info_sidetray";
 	params["action"] = "create";
 
-	LLSideTray::getInstance()->showPanel("panel_group_info_sidetray", params);
+	LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
 
 }
 //static
@@ -317,7 +318,7 @@ void LLGroupActions::closeGroup(const LLUUID& group_id)
 	params["open_tab_name"] = "panel_group_info_sidetray";
 	params["action"] = "close";
 
-	LLSideTray::getInstance()->showPanel("panel_group_info_sidetray", params);
+	LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
 }
 
 
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 03ebc344f17..44c29fe05ef 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -33,6 +33,7 @@
 //#include "llchatitemscontainerctrl.h"
 #include "lliconctrl.h"
 #include "llsidetray.h"
+#include "llfloatersidepanelcontainer.h"
 #include "llfocusmgr.h"
 #include "llresizebar.h"
 #include "llresizehandle.h"
@@ -203,7 +204,7 @@ void LLNearbyChat::onNearbySpeakers()
 {
 	LLSD param;
 	param["people_panel_tab_name"] = "nearby_panel";
-	LLSideTray::getInstance()->showPanel("panel_people",param);
+	LLFloaterSidePanelContainer::showPanel("people", "panel_people", param);
 }
 
 
diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp
index 81e199d85b5..856dabb6b78 100644
--- a/indra/newview/llpanelblockedlist.cpp
+++ b/indra/newview/llpanelblockedlist.cpp
@@ -37,6 +37,7 @@
 
 // project include
 #include "llfloateravatarpicker.h"
+#include "llfloatersidepanelcontainer.h"
 #include "llsidetray.h"
 #include "llsidetraypanelcontainer.h"
 
@@ -99,7 +100,7 @@ void LLPanelBlockedList::selectBlocked(const LLUUID& mute_id)
 
 void LLPanelBlockedList::showPanelAndSelect(const LLUUID& idToSelect)
 {
-	LLSideTray::getInstance()->showPanel("panel_block_list_sidetray", LLSD().with(BLOCKED_PARAM_NAME, idToSelect));
+	LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD().with(BLOCKED_PARAM_NAME, idToSelect));
 }
 
 
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index 76b85d5bec3..70dcf61d7d9 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -29,6 +29,7 @@
 
 // Library includes
 #include "llbutton.h"
+#include "llfloatersidepanelcontainer.h"
 #include "lltabcontainer.h"
 #include "lltextbox.h"
 #include "lluictrlfactory.h"
@@ -597,7 +598,7 @@ void LLPanelGroup::showNotice(const std::string& subject,
 //static
 void LLPanelGroup::refreshCreatedGroup(const LLUUID& group_id)
 {
-	LLPanelGroup* panel = LLSideTray::getInstance()->getPanel<LLPanelGroup>("panel_group_info_sidetray");
+	LLPanelGroup* panel = LLFloaterSidePanelContainer::getPanel<LLPanelGroup>("people", "panel_group_info_sidetray");
 	if(!panel)
 		return;
 	panel->setGroupID(group_id);
@@ -612,7 +613,7 @@ void LLPanelGroup::showNotice(const std::string& subject,
 					   const std::string& inventory_name,
 					   LLOfferInfo* inventory_offer)
 {
-	LLPanelGroup* panel = LLSideTray::getInstance()->getPanel<LLPanelGroup>("panel_group_info_sidetray");
+	LLPanelGroup* panel = LLFloaterSidePanelContainer::getPanel<LLPanelGroup>("people", "panel_group_info_sidetray");
 	if(!panel)
 		return;
 
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index e3a7b749ea6..8d63ced53a3 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -29,6 +29,7 @@
 // libs
 #include "llavatarname.h"
 #include "llfloaterreg.h"
+#include "llfloatersidepanelcontainer.h"
 #include "llmenubutton.h"
 #include "llmenugl.h"
 #include "llnotificationsutil.h"
@@ -1283,6 +1284,10 @@ void LLPanelPeople::onFriendsViewSortMenuItemClicked(const LLSD& userdata)
 		mAllFriendList->showPermissions(show_permissions);
 		mOnlineFriendList->showPermissions(show_permissions);
 	}
+	else if (chosen_item == "panel_block_list_sidetray")
+	{
+		LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD());
+	}
 }
 
 void LLPanelPeople::onGroupsViewSortMenuItemClicked(const LLSD& userdata)
@@ -1315,6 +1320,10 @@ void LLPanelPeople::onNearbyViewSortMenuItemClicked(const LLSD& userdata)
 	{
 		setSortOrder(mNearbyList, E_SORT_BY_DISTANCE);
 	}
+	else if (chosen_item == "panel_block_list_sidetray")
+	{
+		LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD());
+	}
 }
 
 bool LLPanelPeople::onNearbyViewSortMenuItemCheck(const LLSD& userdata)
@@ -1348,6 +1357,10 @@ void LLPanelPeople::onRecentViewSortMenuItemClicked(const LLSD& userdata)
 	{
 		mRecentList->toggleIcons();
 	}
+	else if (chosen_item == "panel_block_list_sidetray")
+	{
+		LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD());
+	}
 }
 
 bool LLPanelPeople::onFriendsViewSortMenuItemCheck(const LLSD& userdata) 
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
index ddce83c616d..12217a7db43 100755
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -35,6 +35,7 @@
 #include "lldispatcher.h"
 #include "llflatlistview.h"
 #include "llfloaterreg.h"
+#include "llfloatersidepanelcontainer.h"
 #include "llfloaterworldmap.h"
 #include "llnotificationsutil.h"
 #include "lltexturectrl.h"
@@ -270,7 +271,7 @@ class LLClassifiedHandler :
 			params["classified_name"] = c_info->name;
 			params["classified_desc"] = c_info->description;
 			params["from_search"] = true;
-			LLSideTray::getInstance()->showPanel("panel_profile_view", params);
+			LLFloaterSidePanelContainer::showPanel("people", "panel_profile_view", params);
 		}
 		else if (mRequestVerb == "edit")
 		{
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index b28373c6d50..10aa58f266a 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -231,6 +231,7 @@ void LLViewerFloaterReg::registerFloaters()
 	LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutgoingCallDialog>);
 	LLFloaterPayUtil::registerFloater();
 
+	LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
 	LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
 	LLFloaterReg::add("postcard", "floater_postcard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPostcard>);
 	LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
diff --git a/indra/newview/skins/default/xui/en/floater_people.xml b/indra/newview/skins/default/xui/en/floater_people.xml
new file mode 100644
index 00000000000..6ccf81c846d
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_people.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+
+<floater
+  legacy_header_height="18"
+  can_close="true"
+  can_resize="true"
+  height="588"
+  min_width="333"
+  min_height="440"
+  layout="topleft"
+  name="floater_people"
+  save_rect="true"
+  single_instance="true"
+  title="PEOPLE"
+  width="333">
+    <panel_container
+      default_panel_name="panel_people"
+      follows="all"
+      layout="topleft"
+      name="main_panel"
+      top="18"
+      width="333"
+      height="570">
+      <panel
+        class="panel_people"
+        name="panel_people"
+        filename="panel_people.xml"/>
+      <panel
+        class="panel_profile_view"
+        name="panel_profile_view"
+        filename="panel_profile_view.xml"/>
+      <panel
+        class="panel_group_info_sidetray"
+        name="panel_group_info_sidetray"
+        filename="panel_group_info_sidetray.xml"
+        label="Group Profile"
+        font="SansSerifBold"/>
+      <panel
+        class="panel_block_list_sidetray"
+        name="panel_block_list_sidetray"
+        filename="panel_block_list_sidetray.xml"
+        label="Blocked Residents &amp; Objects"
+        font="SansSerifBold"/>
+    </panel_container>
+</floater>
diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
index 29eeb93ac15..b452f96e7a9 100644
--- a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
@@ -42,6 +42,6 @@
   </menu_item_check>
   <menu_item_separator layout="topleft" />
   <menu_item_call name="show_blocked_list" label="Show Blocked Residents &amp; Objects">
-    <menu_item_call.on_click function="SideTray.ShowPanel" parameter="panel_block_list_sidetray" />
+    <menu_item_call.on_click function="People.Friends.ViewSort.Action" parameter="panel_block_list_sidetray" />
   </menu_item_call>
 </toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml
index 65bd2793b60..614dd693c57 100644
--- a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml
@@ -52,6 +52,6 @@
   </menu_item_check>
   <menu_item_separator layout="topleft" />
   <menu_item_call name="show_blocked_list" label="Show Blocked Residents &amp; Objects">
-    <menu_item_call.on_click function="SideTray.ShowPanel" userdata="panel_block_list_sidetray" />
+    <menu_item_call.on_click function="People.Nearby.ViewSort.Action" userdata="panel_block_list_sidetray" />
   </menu_item_call>
 </toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
index 0634e3bd3b7..485a5a658ca 100644
--- a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
@@ -34,6 +34,6 @@
   </menu_item_check>
   <menu_item_separator layout="topleft" />
   <menu_item_call name="show_blocked_list" label="Show Blocked Residents &amp; Objects">
-    <menu_item_call.on_click function="SideTray.ShowPanel" userdata="panel_block_list_sidetray" />
+    <menu_item_call.on_click function="People.Recent.ViewSort.Action" userdata="panel_block_list_sidetray" />
   </menu_item_call>
 </toggleable_menu>
-- 
GitLab