Commits

Anonymous committed 87a99e9

Fixed minor bug EXT-2955 ("Teleport" button is enabled in profile panel of offline avatar).

- Fixed not only "Teleport" button from profile, but also from IM (according to comment in JIRA).

  • Participants
  • Parent commits 7ef1b11
  • Branches product-engine

Comments (0)

Files changed (3)

File indra/newview/llpanelavatar.cpp

 	//*TODO not implemented.
 }
 
+LLPanelAvatarNotes::~LLPanelAvatarNotes()
+{
+	if(getAvatarId().notNull())
+	{
+		LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
+	}
+}
+
+// virtual, called by LLAvatarTracker
+void LLPanelAvatarNotes::changed(U32 mask)
+{
+	childSetEnabled("teleport", LLAvatarTracker::instance().isBuddyOnline(getAvatarId()));
+}
+
+void LLPanelAvatarNotes::setAvatarId(const LLUUID& id)
+{
+	if(id.notNull())
+	{
+		if(getAvatarId().notNull())
+		{
+			LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
+		}
+		LLPanelProfileTab::setAvatarId(id);
+		LLAvatarTracker::instance().addParticularFriendObserver(getAvatarId(), this);
+	}
+}
+
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 
 void LLPanelProfileTab::updateButtons()
 {
-	bool enable_map_btn = LLAvatarTracker::instance().isBuddyOnline(getAvatarId())
-					&& gAgent.isGodlike() || is_agent_mappable(getAvatarId());
+	bool is_avatar_online = LLAvatarTracker::instance().isBuddyOnline(getAvatarId());
+	
+	if(LLAvatarActions::isFriend(getAvatarId()))
+	{
+		childSetEnabled("teleport", is_avatar_online);
+	}
+	else
+	{
+		childSetEnabled("teleport", true);
+	}
 
+	bool enable_map_btn = is_avatar_online && gAgent.isGodlike() || is_agent_mappable(getAvatarId());
 	childSetEnabled("show_on_map_btn", enable_map_btn);
 	childSetEnabled("call", LLAvatarActions::canCall(getAvatarId()));
 }
 	LLMenuGL::showPopup(this, mProfileMenu, rect.mRight, rect.mTop);
 }
 
+LLPanelAvatarProfile::~LLPanelAvatarProfile()
+{
+	if(getAvatarId().notNull())
+	{
+		LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
+	}
+}
+
+// virtual, called by LLAvatarTracker
+void LLPanelAvatarProfile::changed(U32 mask)
+{
+	childSetEnabled("teleport", LLAvatarTracker::instance().isBuddyOnline(getAvatarId()));
+}
+
+void LLPanelAvatarProfile::setAvatarId(const LLUUID& id)
+{
+	if(id.notNull())
+	{
+		if(getAvatarId().notNull())
+		{
+			LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
+		}
+		LLPanelProfileTab::setAvatarId(id);
+		LLAvatarTracker::instance().addParticularFriendObserver(getAvatarId(), this);
+	}
+}
+
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////

File indra/newview/llpanelavatar.h

 
 #include "llpanel.h"
 #include "llavatarpropertiesprocessor.h"
+#include "llcallingcard.h"
 
 class LLComboBox;
 class LLLineEditor;
 */
 class LLPanelAvatarProfile
 	: public LLPanelProfileTab
+	, public LLFriendObserver
 {
 public:
 	LLPanelAvatarProfile();
+	/*virtual*/ ~LLPanelAvatarProfile();
 
 	/*virtual*/ void onOpen(const LLSD& key);
 
 	/**
+	 * LLFriendObserver trigger
+	 */
+	virtual void changed(U32 mask);
+
+	/*virtual*/ void setAvatarId(const LLUUID& id);
+
+	/**
 	 * Processes data received from server.
 	 */
 	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
 */
 class LLPanelAvatarNotes 
 	: public LLPanelProfileTab
+	, public LLFriendObserver
 {
 public:
 	LLPanelAvatarNotes();
+	/*virtual*/ ~LLPanelAvatarNotes();
+
+	virtual void setAvatarId(const LLUUID& id);
+
+	/** 
+	 * LLFriendObserver trigger
+	 */
+	virtual void changed(U32 mask);
 
 	/*virtual*/ void onOpen(const LLSD& key);
 

File indra/newview/llpanelimcontrolpanel.cpp

 
 	// Disable "Add friend" button for friends.
 	childSetEnabled("add_friend_btn", !LLAvatarActions::isFriend(mAvatarID));
+	
+	// Disable "Teleport" button if friend is offline
+	if(LLAvatarActions::isFriend(mAvatarID))
+	{
+		childSetEnabled("teleport_btn", LLAvatarTracker::instance().isBuddyOnline(mAvatarID));
+	}
 
 	getChild<LLAvatarIconCtrl>("avatar_icon")->setValue(mAvatarID);
 
 void LLPanelIMControlPanel::changed(U32 mask)
 {
 	childSetEnabled("add_friend_btn", !LLAvatarActions::isFriend(mAvatarID));
+	
+	// Disable "Teleport" button if friend is offline
+	if(LLAvatarActions::isFriend(mAvatarID))
+	{
+		childSetEnabled("teleport_btn", LLAvatarTracker::instance().isBuddyOnline(mAvatarID));
+	}
 }
 
 void LLPanelIMControlPanel::nameUpdatedCallback(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group)