summaryrefslogtreecommitdiff
path: root/indra/newview/llinspectavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinspectavatar.cpp')
-rw-r--r--indra/newview/llinspectavatar.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 8dc7833f6a..866669f326 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -39,6 +39,7 @@
#include "llavataractions.h"
#include "llavatarpropertiesprocessor.h"
#include "llcallingcard.h"
+#include "lldateutil.h"
#include "llfloaterreporter.h"
#include "llfloaterworldmap.h"
#include "llinspect.h"
@@ -117,6 +118,9 @@ private:
bool onVisibleZoomIn();
void onClickMuteVolume();
void onVolumeChange(const LLSD& data);
+
+ // Is used to determine if "Add friend" option should be enabled in gear menu
+ bool isNotFriend();
// Callback for gCacheName to look up avatar name
void nameUpdatedCallback(
@@ -208,6 +212,7 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd)
boost::bind(&LLInspectAvatar::onVisibleFreezeEject, this));
mVisibleCallbackRegistrar.add("InspectAvatar.VisibleZoomIn",
boost::bind(&LLInspectAvatar::onVisibleZoomIn, this));
+ mEnableCallbackRegistrar.add("InspectAvatar.Gear.Enable", boost::bind(&LLInspectAvatar::isNotFriend, this));
// can't make the properties request until the widgets are constructed
// as it might return immediately, so do it in postBuild.
@@ -347,7 +352,7 @@ void LLInspectAvatar::processAvatarData(LLAvatarData* data)
{
LLStringUtil::format_map_t args;
args["[BORN_ON]"] = data->born_on;
- args["[AGE]"] = data->born_on;
+ args["[AGE]"] = LLDateUtil::ageFromDate(data->born_on, LLDate::now());
args["[SL_PROFILE]"] = data->about_text;
args["[RW_PROFILE"] = data->fl_about_text;
args["[ACCTTYPE]"] = LLAvatarPropertiesProcessor::accountType(data);
@@ -473,6 +478,11 @@ void LLInspectAvatar::onClickViewProfile()
closeFloater();
}
+bool LLInspectAvatar::isNotFriend()
+{
+ return !LLAvatarActions::isFriend(mAvatarID);
+}
+
bool LLInspectAvatar::onVisibleFindOnMap()
{
return gAgent.isGodlike() || is_agent_mappable(mAvatarID);