diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloaterdisplayname.cpp | 32 |
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) |