summaryrefslogtreecommitdiff
path: root/indra/newview/llnamebox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnamebox.cpp')
-rw-r--r--indra/newview/llnamebox.cpp35
1 files changed, 31 insertions, 4 deletions
diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp
index 2f4a266198..cd810b9793 100644
--- a/indra/newview/llnamebox.cpp
+++ b/indra/newview/llnamebox.cpp
@@ -52,6 +52,8 @@ LLNameBox::LLNameBox(const Params& p)
: LLTextBox(p)
{
mNameID = LLUUID::null;
+ mLink = p.link;
+ mInitialValue = p.initial_value().asString();
LLNameBox::sInstances.insert(this);
setText(LLStringUtil::null);
}
@@ -66,17 +68,23 @@ void LLNameBox::setNameID(const LLUUID& name_id, BOOL is_group)
mNameID = name_id;
std::string name;
+ BOOL got_name = FALSE;
if (!is_group)
{
- gCacheName->getFullName(name_id, name);
+ got_name = gCacheName->getFullName(name_id, name);
}
else
{
- gCacheName->getGroupName(name_id, name);
+ got_name = gCacheName->getGroupName(name_id, name);
}
- setText(name);
+ // Got the name already? Set it.
+ // Otherwise it will be set later in refresh().
+ if (got_name)
+ setName(name, is_group);
+ else
+ setText(mInitialValue);
}
void LLNameBox::refresh(const LLUUID& id, const std::string& firstname,
@@ -93,7 +101,7 @@ void LLNameBox::refresh(const LLUUID& id, const std::string& firstname,
{
name = firstname;
}
- setText(name);
+ setName(name, is_group);
}
}
@@ -109,3 +117,22 @@ void LLNameBox::refreshAll(const LLUUID& id, const std::string& firstname,
box->refresh(id, firstname, lastname, is_group);
}
}
+
+void LLNameBox::setName(const std::string& name, BOOL is_group)
+{
+ if (mLink)
+ {
+ std::string url;
+
+ if (is_group)
+ url = "[secondlife:///app/group/" + LLURI::escape(name) + "/about " + name + "]";
+ else
+ url = "[secondlife:///app/agent/" + mNameID.asString() + "/about " + name + "]";
+
+ setText(url);
+ }
+ else
+ {
+ setText(name);
+ }
+}