summaryrefslogtreecommitdiff
path: root/indra/llui/llurlentry.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-03-29 16:55:22 -0700
committerJames Cook <james@lindenlab.com>2010-03-29 16:55:22 -0700
commitecc2c726502448076295254714c0bfa8c0074f25 (patch)
tree6a9434c540f7b5ea7bca326df1a420e4a0a99cc4 /indra/llui/llurlentry.cpp
parentd2f9e34598621f1dabad15025417efd6b81dddf0 (diff)
parentac103403160e87bb6b40ac3e032d077a3381da8e (diff)
Merge latest viewer-hotfix, approximately equal to Viewer 2.0 final
Diffstat (limited to 'indra/llui/llurlentry.cpp')
-rw-r--r--indra/llui/llurlentry.cpp72
1 files changed, 64 insertions, 8 deletions
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index ff6454c141..a79a257c09 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -319,7 +319,6 @@ LLUrlEntryAgent::LLUrlEntryAgent()
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_agent.xml";
mIcon = "Generic_Person";
- mTooltip = LLTrans::getString("TooltipAgentUrl");
mColor = LLUIColorTable::instance().getColor("AgentLinkColor");
}
@@ -341,6 +340,38 @@ void LLUrlEntryAgent::onAvatarNameCache(const LLUUID& id,
callObservers(id.asString(), label, icon);
}
+std::string LLUrlEntryAgent::getTooltip(const std::string &string) const
+{
+ // return a tooltip corresponding to the URL type instead of the generic one
+ std::string url = getUrl(string);
+
+ if (LLStringUtil::endsWith(url, "/mute"))
+ {
+ return LLTrans::getString("TooltipAgentMute");
+ }
+ if (LLStringUtil::endsWith(url, "/unmute"))
+ {
+ return LLTrans::getString("TooltipAgentUnmute");
+ }
+ if (LLStringUtil::endsWith(url, "/im"))
+ {
+ return LLTrans::getString("TooltipAgentIM");
+ }
+ if (LLStringUtil::endsWith(url, "/pay"))
+ {
+ return LLTrans::getString("TooltipAgentPay");
+ }
+ if (LLStringUtil::endsWith(url, "/offerteleport"))
+ {
+ return LLTrans::getString("TooltipAgentOfferTeleport");
+ }
+ if (LLStringUtil::endsWith(url, "/requestfriend"))
+ {
+ return LLTrans::getString("TooltipAgentRequestFriend");
+ }
+ return LLTrans::getString("TooltipAgentUrl");
+}
+
std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
{
if (!gCacheName)
@@ -348,14 +379,14 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
// probably at the login screen, use short string for layout
return LLTrans::getString("LoadingData");
}
-
+
std::string agent_id_string = getIDStringFromUrl(url);
if (agent_id_string.empty())
{
// something went wrong, just give raw url
return unescapeUrl(url);
}
-
+
LLUUID agent_id(agent_id_string);
if (agent_id.isNull())
{
@@ -383,19 +414,44 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
// ...no display names
std::string full_name;
if (gCacheName->getFullName(agent_id, full_name))
+ {
+ // customize label string based on agent SLapp suffix
+ if (LLStringUtil::endsWith(url, "/mute"))
{
- return full_name;
+ return LLTrans::getString("SLappAgentMute") + " " + full_name;
}
- else
+ if (LLStringUtil::endsWith(url, "/unmute"))
+ {
+ return LLTrans::getString("SLappAgentUnmute") + " " + full_name;
+ }
+ if (LLStringUtil::endsWith(url, "/im"))
+ {
+ return LLTrans::getString("SLappAgentIM") + " " + full_name;
+ }
+ if (LLStringUtil::endsWith(url, "/pay"))
+ {
+ return LLTrans::getString("SLappAgentPay") + " " + full_name;
+ }
+ if (LLStringUtil::endsWith(url, "/offerteleport"))
+ {
+ return LLTrans::getString("SLappAgentOfferTeleport") + " " + full_name;
+ }
+ if (LLStringUtil::endsWith(url, "/requestfriend"))
{
+ return LLTrans::getString("SLappAgentRequestFriend") + " " + full_name;
+ }
+ return full_name;
+ }
+ else
+ {
gCacheName->get(agent_id, false,
boost::bind(&LLUrlEntryAgent::onNameCache,
this, _1, _2, _3));
- addObserver(agent_id_string, url, cb);
- return LLTrans::getString("LoadingData");
- }
+ addObserver(agent_id_string, url, cb);
+ return LLTrans::getString("LoadingData");
}
}
+}
std::string LLUrlEntryAgent::getIcon(const std::string &url) const