diff options
author | James Cook <james@lindenlab.com> | 2010-05-12 16:32:54 -0700 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2010-05-12 16:32:54 -0700 |
commit | 6871747f11f300fcf90edba2224c91a3645617cc (patch) | |
tree | 932f43f6547d1221c889dc2992fc742787883461 /indra/newview | |
parent | bee1a091469f8d1f2277e8d5b4cc9981e8060bde (diff) |
DEV-50013 Display names limited to 31 chars (not bytes) in viewer UI
Reviewed with Leyla
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpanelme.cpp | 15 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 11 |
2 files changed, 23 insertions, 3 deletions
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 483741e643..f38c8859ef 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -352,8 +352,19 @@ void LLPanelMyProfileEdit::onDialogSetName(const LLSD& notification, const LLSD& LLUUID agent_id = notification["payload"]["agent_id"]; if (agent_id.isNull()) return; - std::string display_name = response["display_name"].asString(); - LLViewerDisplayName::set(display_name, + std::string display_name_utf8 = response["display_name"].asString(); + + const U32 DISPLAY_NAME_MAX_LENGTH = 31; // characters, not bytes + LLWString display_name_wstr = utf8string_to_wstring(display_name_utf8); + if (display_name_wstr.size() > DISPLAY_NAME_MAX_LENGTH) + { + LLSD args; + args["LENGTH"] = llformat("%d", DISPLAY_NAME_MAX_LENGTH); + LLNotificationsUtil::add("SetDisplayNameFailedLength", args); + return; + } + + LLViewerDisplayName::set(display_name_utf8, boost::bind(&LLPanelMyProfileEdit::onCacheSetName, this, _1, _2, _3)); } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index ffc58746e3..c4ddae1a12 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3098,7 +3098,16 @@ Just like in real life, it takes a while for everyone to learn about a new name. See http://wiki.secondlife.com/wiki/Display_Names for details. </notification> - + + <notification + icon="alertmodal.tga" + name="SetDisplayNameFailedLength" + type="alertmodal"> +Sorry, that name is too long. Display names can have a maximum of [LENGTH] characters. + +Please try a shorter name. + </notification> + <notification icon="alertmodal.tga" name="SetDisplayNameFailedGeneric" |