summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelprofileview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelprofileview.cpp')
-rw-r--r--indra/newview/llpanelprofileview.cpp62
1 files changed, 54 insertions, 8 deletions
diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp
index dba047660d..7635aedf58 100644
--- a/indra/newview/llpanelprofileview.cpp
+++ b/indra/newview/llpanelprofileview.cpp
@@ -26,11 +26,13 @@
#include "llviewerprecompiledheaders.h"
+#include "llpanelprofileview.h"
+
#include "llavatarconstants.h"
+#include "llavatarnamecache.h" // IDEVO
+#include "llclipboard.h"
#include "lluserrelations.h"
-#include "llpanelprofileview.h"
-
#include "llavatarpropertiesprocessor.h"
#include "llcallingcard.h"
#include "llpanelavatar.h"
@@ -98,11 +100,15 @@ void LLPanelProfileView::onOpen(const LLSD& key)
if(id.notNull() && getAvatarId() != id)
{
setAvatarId(id);
+
+ // clear name fields, which might have old data
+ getChild<LLUICtrl>("user_name")->setValue( LLSD() );
+ getChild<LLUICtrl>("user_slid")->setValue( LLSD() );
}
// Update the avatar name.
- gCacheName->get(getAvatarId(), FALSE,
- boost::bind(&LLPanelProfileView::onAvatarNameCached, this, _1, _2, _3, _4));
+ LLAvatarNameCache::get(getAvatarId(),
+ boost::bind(&LLPanelProfileView::onAvatarNameCache, this, _1, _2));
updateOnlineStatus();
@@ -124,7 +130,8 @@ BOOL LLPanelProfileView::postBuild()
mStatusText->setVisible(false);
childSetCommitCallback("back",boost::bind(&LLPanelProfileView::onBackBtnClick,this),NULL);
-
+ childSetCommitCallback("copy_to_clipboard",boost::bind(&LLPanelProfileView::onCopyToClipboard,this),NULL);
+
return TRUE;
}
@@ -144,6 +151,12 @@ void LLPanelProfileView::onBackBtnClick()
}
}
+void LLPanelProfileView::onCopyToClipboard()
+{
+ std::string name = getChild<LLUICtrl>("user_name")->getValue().asString() + " (" + getChild<LLUICtrl>("user_slid")->getValue().asString() + ")";
+ gClipboard.copyFromString(utf8str_to_wstring(name));
+}
+
bool LLPanelProfileView::isGrantedToSeeOnlineStatus()
{
const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
@@ -192,10 +205,43 @@ void LLPanelProfileView::processOnlineStatus(bool online)
mStatusText->setValue(status);
}
-void LLPanelProfileView::onAvatarNameCached(const LLUUID& id, const std::string& first_name, const std::string& last_name, BOOL is_group)
+void LLPanelProfileView::onAvatarNameCache(const LLUUID& agent_id,
+ const LLAvatarName& av_name)
{
- llassert(getAvatarId() == id);
- getChild<LLUICtrl>("user_name", FALSE)->setValue(first_name + " " + last_name);
+ getChild<LLUICtrl>("user_name")->setValue( av_name.mDisplayName );
+ getChild<LLUICtrl>("user_name_small")->setValue( av_name.mDisplayName );
+ getChild<LLUICtrl>("user_slid")->setValue( av_name.mUsername );
+
+ // show smaller display name if too long to display in regular size
+ if (getChild<LLTextBox>("user_name")->getTextPixelWidth() > getChild<LLTextBox>("user_name")->getRect().getWidth())
+ {
+ getChild<LLUICtrl>("user_name_small")->setVisible( true );
+ getChild<LLUICtrl>("user_name")->setVisible( false );
+ }
+ else
+ {
+ getChild<LLUICtrl>("user_name_small")->setVisible( false );
+ getChild<LLUICtrl>("user_name")->setVisible( true );
+ }
+
+ if (LLAvatarNameCache::useDisplayNames())
+ {
+ getChild<LLUICtrl>("user_label")->setVisible( true );
+ getChild<LLUICtrl>("user_slid")->setVisible( true );
+ getChild<LLUICtrl>("display_name_label")->setVisible( true );
+ getChild<LLUICtrl>("copy_to_clipboard")->setVisible( true );
+ getChild<LLUICtrl>("copy_to_clipboard")->setEnabled( true );
+ getChild<LLUICtrl>("solo_username_label")->setVisible( false );
+ }
+ else
+ {
+ getChild<LLUICtrl>("user_label")->setVisible( false );
+ getChild<LLUICtrl>("user_slid")->setVisible( false );
+ getChild<LLUICtrl>("display_name_label")->setVisible( false );
+ getChild<LLUICtrl>("copy_to_clipboard")->setVisible( false );
+ getChild<LLUICtrl>("copy_to_clipboard")->setEnabled( false );
+ getChild<LLUICtrl>("solo_username_label")->setVisible( true );
+ }
}
// EOF