From 938f42ded789dd70b31820d29694256cec3a1572 Mon Sep 17 00:00:00 2001
From: Todd Stinson <stinson@lindenlab.com>
Date: Thu, 31 May 2012 12:22:47 -0700
Subject: [PATCH] Reloading the the pathfinding object floaters when the god
 level is changed.

---
 indra/newview/llagent.cpp                     |  7 +++++++
 indra/newview/llagent.h                       | 10 ++++++++++
 indra/newview/llfloaterpathfindingobjects.cpp | 15 +++++++++++++++
 indra/newview/llfloaterpathfindingobjects.h   |  3 +++
 4 files changed, 35 insertions(+)

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 3870a3be2ec..d94e01ee471 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -243,6 +243,7 @@ LLAgent::LLAgent() :
 	mbTeleportKeepsLookAt(false),
 
 	mAgentAccess(new LLAgentAccess(gSavedSettings)),
+	mGodLevelChangeSignal(),
 	mCanEditParcel(false),
 	mTeleportSourceSLURL(new LLSLURL),
 	mTeleportState( TELEPORT_NONE ),
@@ -2434,6 +2435,12 @@ void LLAgent::setAdminOverride(BOOL b)
 void LLAgent::setGodLevel(U8 god_level)	
 { 
 	mAgentAccess->setGodLevel(god_level);
+	mGodLevelChangeSignal(god_level);
+}
+
+LLAgent::god_level_change_slot_t LLAgent::registerGodLevelChanageListener(god_level_change_callback_t pGodLevelChangeCallback)
+{
+	return mGodLevelChangeSignal.connect(pGodLevelChangeCallback);
 }
 
 void LLAgent::setAOTransition()
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 740770bbdf2..72f695d9171 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -631,6 +631,16 @@ class LLAgent : public LLOldEvents::LLObservable
 	void			requestEnterGodMode();
 	void			requestLeaveGodMode();
 
+	typedef boost::function<void (U8)>         god_level_change_callback_t;
+	typedef boost::signals2::signal<void (U8)> god_level_change_signal_t;
+	typedef boost::signals2::connection        god_level_change_slot_t;
+
+	god_level_change_slot_t registerGodLevelChanageListener(god_level_change_callback_t pGodLevelChangeCallback);
+
+private:
+	god_level_change_signal_t mGodLevelChangeSignal;
+	
+
 	//--------------------------------------------------------------------
 	// Maturity
 	//--------------------------------------------------------------------
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp
index e8d80c09d8d..3f6c4983d5a 100644
--- a/indra/newview/llfloaterpathfindingobjects.cpp
+++ b/indra/newview/llfloaterpathfindingobjects.cpp
@@ -78,11 +78,21 @@ void LLFloaterPathfindingObjects::onOpen(const LLSD &pKey)
 		mRegionBoundaryCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLFloaterPathfindingObjects::onRegionBoundaryCrossed, this));
 	}
 
+	if (!mGodLevelChangeSlot.connected())
+	{
+		mGodLevelChangeSlot = gAgent.registerGodLevelChanageListener(boost::bind(&LLFloaterPathfindingObjects::onGodLevelChange, this, _1));
+	}
+
 	requestGetObjects();
 }
 
 void LLFloaterPathfindingObjects::onClose(bool pIsAppQuitting)
 {
+	if (mGodLevelChangeSlot.connected())
+	{
+		mGodLevelChangeSlot.disconnect();
+	}
+
 	if (mRegionBoundaryCrossingSlot.connected())
 	{
 		mRegionBoundaryCrossingSlot.disconnect();
@@ -554,6 +564,11 @@ void LLFloaterPathfindingObjects::onRegionBoundaryCrossed()
 	requestGetObjects();
 }
 
+void LLFloaterPathfindingObjects::onGodLevelChange(U8 pGodLevel)
+{
+	requestGetObjects();
+}
+
 void LLFloaterPathfindingObjects::updateMessagingStatus()
 {
 	std::string statusText("");
diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h
index 34eb129864c..79d241757c5 100644
--- a/indra/newview/llfloaterpathfindingobjects.h
+++ b/indra/newview/llfloaterpathfindingobjects.h
@@ -29,6 +29,7 @@
 
 #include <boost/signals2.hpp>
 
+#include "llagent.h"
 #include "llfloater.h"
 #include "llpathfindingmanager.h"
 #include "llpathfindingobject.h"
@@ -115,6 +116,7 @@ class LLFloaterPathfindingObjects : public LLFloater
 	void onScrollListSelectionChanged();
 	void onSelectionListChanged();
 	void onRegionBoundaryCrossed();
+	void onGodLevelChange(U8 pGodLevel);
 
 	void updateMessagingStatus();
 	void updateStateOnListActionControls();
@@ -148,6 +150,7 @@ class LLFloaterPathfindingObjects : public LLFloater
 
 	boost::signals2::connection        mSelectionUpdateSlot;
 	boost::signals2::connection        mRegionBoundaryCrossingSlot;
+	LLAgent::god_level_change_slot_t   mGodLevelChangeSlot;
 };
 
 #endif // LL_LLFLOATERPATHFINDINGOBJECTS_H
-- 
GitLab