summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterdisplayname.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2023-07-12 10:08:56 -0400
committerNat Goodspeed <nat@lindenlab.com>2023-07-12 10:08:56 -0400
commit73d90aa9dd87986dc2ef8f39db346b71c58b181b (patch)
treea2ec930f732aaed7d7addbb22bb34b15c78d408b /indra/newview/llfloaterdisplayname.cpp
parent8e70575be833cf2056b1ceef7ef842cbc7700ce0 (diff)
parente80f0f331dbfca686e0a80c557e9b1e455c8d167 (diff)
SL-18837: Merge branch 'DRTVWR-587-maint-V' into rm-cxxstd.
Diffstat (limited to 'indra/newview/llfloaterdisplayname.cpp')
-rw-r--r--indra/newview/llfloaterdisplayname.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp
index 19bc865d8b..ad2533debc 100644
--- a/indra/newview/llfloaterdisplayname.cpp
+++ b/indra/newview/llfloaterdisplayname.cpp
@@ -165,10 +165,21 @@ void LLFloaterDisplayName::onReset()
{
return;
}
- getChild<LLUICtrl>("display_name_editor")->setValue(av_name.getCompleteName());
+ getChild<LLUICtrl>("display_name_editor")->setValue(av_name.getUserName());
- getChild<LLUICtrl>("display_name_confirm")->clear();
- getChild<LLUICtrl>("display_name_confirm")->setFocus(TRUE);
+ if (getChild<LLUICtrl>("display_name_editor")->getEnabled())
+ {
+ // UI is enabled, fill the first field
+ getChild<LLUICtrl>("display_name_confirm")->clear();
+ getChild<LLUICtrl>("display_name_confirm")->setFocus(TRUE);
+ }
+ else
+ {
+ // UI is disabled, looks like we should allow resetting
+ // even if user already set a display name, enable save button
+ getChild<LLUICtrl>("display_name_confirm")->setValue(av_name.getUserName());
+ getChild<LLUICtrl>("save_btn")->setEnabled(true);
+ }
}
@@ -183,6 +194,21 @@ void LLFloaterDisplayName::onSave()
return;
}
+ LLAvatarName av_name;
+ if (!LLAvatarNameCache::get(gAgent.getID(), &av_name))
+ {
+ return;
+ }
+
+ std::string user_name = av_name.getUserName();
+ if (display_name_utf8.compare(user_name) == 0
+ && LLAvatarNameCache::getInstance()->hasNameLookupURL())
+ {
+ // A reset
+ LLViewerDisplayName::set("", boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3));
+ return;
+ }
+
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)