From 0a938d395c6bde13ead4f789056e7f9067e4dbd0 Mon Sep 17 00:00:00 2001
From: Seth ProductEngine <slitovchuk@productengine.com>
Date: Tue, 28 Sep 2010 19:40:31 +0300
Subject: STORM-266 FIXED displaying group notices in detached People SP. Fixed
 failure getting pointers to some child panels of LLSideTray while parent side
 panels are detached.

---
 indra/newview/llgroupactions.cpp   |  2 +-
 indra/newview/llpanelgroup.cpp     |  4 ++--
 indra/newview/llpanellandmarks.cpp |  7 ++++++-
 indra/newview/llsidetray.h         | 16 ++++++++++++++++
 indra/newview/llviewermessage.cpp  |  4 ++--
 5 files changed, 27 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index c42b397252..5393678a6b 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -235,7 +235,7 @@ static bool isGroupUIVisible()
 {
 	static LLPanel* panel = 0;
 	if(!panel)
-		panel = LLSideTray::getInstance()->findChild<LLPanel>("panel_group_info_sidetray");
+		panel = LLSideTray::getInstance()->getPanel("panel_group_info_sidetray");
 	if(!panel)
 		return false;
 	return panel->isInVisibleChain();
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index 62ed7acb15..76b85d5bec 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -597,7 +597,7 @@ void LLPanelGroup::showNotice(const std::string& subject,
 //static
 void LLPanelGroup::refreshCreatedGroup(const LLUUID& group_id)
 {
-	LLPanelGroup* panel = LLSideTray::getInstance()->findChild<LLPanelGroup>("panel_group_info_sidetray");
+	LLPanelGroup* panel = LLSideTray::getInstance()->getPanel<LLPanelGroup>("panel_group_info_sidetray");
 	if(!panel)
 		return;
 	panel->setGroupID(group_id);
@@ -612,7 +612,7 @@ void LLPanelGroup::showNotice(const std::string& subject,
 					   const std::string& inventory_name,
 					   LLOfferInfo* inventory_offer)
 {
-	LLPanelGroup* panel = LLSideTray::getInstance()->findChild<LLPanelGroup>("panel_group_info_sidetray");
+	LLPanelGroup* panel = LLSideTray::getInstance()->getPanel<LLPanelGroup>("panel_group_info_sidetray");
 	if(!panel)
 		return;
 
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index b09360a2d6..c4a484d368 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -1245,7 +1245,12 @@ void LLLandmarksPanel::doProcessParcelInfo(LLLandmark* landmark,
 	landmark->getGlobalPos(landmark_global_pos);
 
 	// let's toggle pick panel into  panel places
-	LLPanel* panel_places =  LLSideTray::getInstance()->getChild<LLPanel>("panel_places");//-> sidebar_places
+	LLPanel* panel_places =  LLSideTray::getInstance()->getPanel("panel_places");//-> sidebar_places
+	if (!panel_places)
+	{
+		llassert(NULL != panel_places);
+		return;
+	}
 	panel_places->addChild(panel_pick);
 	LLRect paren_rect(panel_places->getRect());
 	panel_pick->reshape(paren_rect.getWidth(),paren_rect.getHeight(), TRUE);
diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h
index 4e79007c13..4c23a1920b 100644
--- a/indra/newview/llsidetray.h
+++ b/indra/newview/llsidetray.h
@@ -109,6 +109,22 @@ public:
     LLPanel*	getPanel		(const std::string& panel_name);
     LLPanel*	getActivePanel	();
     bool		isPanelActive	(const std::string& panel_name);
+
+	/*
+	 * get the panel of given type T (don't show it or do anything else with it)
+	 */
+	template <typename T>
+	T* getPanel(const std::string& panel_name)
+	{
+		T* panel = dynamic_cast<T*>(getPanel(panel_name));
+		if (!panel)
+		{
+			llwarns << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << llendl;
+			return NULL;
+		}
+		return panel;
+	}
+
 	/*
 	 * get currently active tab
 	 */
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 33c74e7465..26b7e0fb6d 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -6453,7 +6453,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**)
 	LLPanelLandCovenant::updateEstateOwnerName(owner_name);
 	LLFloaterBuyLand::updateEstateOwnerName(owner_name);
 
-	LLPanelPlaceProfile* panel = LLSideTray::getInstance()->findChild<LLPanelPlaceProfile>("panel_place_profile");
+	LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel<LLPanelPlaceProfile>("panel_place_profile");
 	if (panel)
 	{
 		panel->updateEstateName(estate_name);
@@ -6587,7 +6587,7 @@ void onCovenantLoadComplete(LLVFS *vfs,
 	LLPanelLandCovenant::updateCovenantText(covenant_text);
 	LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid);
 
-	LLPanelPlaceProfile* panel = LLSideTray::getInstance()->findChild<LLPanelPlaceProfile>("panel_place_profile");
+	LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel<LLPanelPlaceProfile>("panel_place_profile");
 	if (panel)
 	{
 		panel->updateCovenantText(covenant_text);
-- 
cgit v1.2.3