From 7196c8c2edeeb01ef4ffb839f7731a99df888bd1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 22 Dec 2022 02:16:10 +0200 Subject: SL-17659 Reset button for user profile --- indra/newview/llfloaterdisplayname.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'indra/newview/llfloaterdisplayname.cpp') diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp index 3b0c67415a..19bc865d8b 100644 --- a/indra/newview/llfloaterdisplayname.cpp +++ b/indra/newview/llfloaterdisplayname.cpp @@ -47,6 +47,7 @@ public: virtual ~LLFloaterDisplayName() { } /*virtual*/ BOOL postBuild(); void onSave(); + void onReset(); void onCancel(); /*virtual*/ void onOpen(const LLSD& key); @@ -101,6 +102,7 @@ void LLFloaterDisplayName::onOpen(const LLSD& key) BOOL LLFloaterDisplayName::postBuild() { + getChild("reset_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onReset, this)); getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onCancel, this)); getChild("save_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onSave, this)); @@ -156,6 +158,20 @@ void LLFloaterDisplayName::onCancel() setVisible(false); } +void LLFloaterDisplayName::onReset() +{ + LLAvatarName av_name; + if (!LLAvatarNameCache::get(gAgent.getID(), &av_name)) + { + return; + } + getChild("display_name_editor")->setValue(av_name.getCompleteName()); + + getChild("display_name_confirm")->clear(); + getChild("display_name_confirm")->setFocus(TRUE); +} + + void LLFloaterDisplayName::onSave() { std::string display_name_utf8 = getChild("display_name_editor")->getValue().asString(); -- cgit v1.2.3