summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterdisplayname.cpp
diff options
context:
space:
mode:
authorCallum Prentice <callum@lindenlab.com>2023-05-17 11:31:45 -0700
committerCallum Prentice <callum@lindenlab.com>2023-05-17 11:31:45 -0700
commitf45e888c903bc7a4953b2812e6c30721a4322d1b (patch)
treedc76eefe00474e27ad2981f0d922fec617d1b9ad /indra/newview/llfloaterdisplayname.cpp
parent671978e3927bc3ba9fc34008bbb7efd6f07b6c81 (diff)
parent5a70639b7992842a9f74ec81b11bac56608b8f2e (diff)
Some small tweaks after merge with Viewer release
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)