summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelavatar.cpp67
-rw-r--r--indra/newview/llpanelavatar.h19
-rw-r--r--indra/newview/llpanelimcontrolpanel.cpp12
3 files changed, 96 insertions, 2 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 913152e259..f3d6dbbb46 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -331,6 +331,33 @@ void LLPanelAvatarNotes::onShareButtonClick()
//*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);
+ }
+}
+
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -396,9 +423,18 @@ void LLPanelProfileTab::onMapButtonClick()
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()));
}
@@ -716,6 +752,33 @@ void LLPanelAvatarProfile::onOverflowButtonClicked()
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);
+ }
+}
+
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h
index 8f07c67fb1..22efa5dc35 100644
--- a/indra/newview/llpanelavatar.h
+++ b/indra/newview/llpanelavatar.h
@@ -35,6 +35,7 @@
#include "llpanel.h"
#include "llavatarpropertiesprocessor.h"
+#include "llcallingcard.h"
class LLComboBox;
class LLLineEditor;
@@ -120,13 +121,22 @@ private:
*/
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);
@@ -246,9 +256,18 @@ private:
*/
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);
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index a8a75a1feb..279818d52f 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -184,6 +184,12 @@ void LLPanelIMControlPanel::setSessionId(const LLUUID& session_id)
// 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);
@@ -214,6 +220,12 @@ void LLPanelIMControlPanel::setSessionId(const LLUUID& session_id)
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)