Skip to content
Snippets Groups Projects
Commit 7196c8c2 authored by Andrey Kleshchev's avatar Andrey Kleshchev
Browse files

SL-17659 Reset button for user profile

parent 200e185d
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,7 @@ class LLFloaterDisplayName : public LLFloater ...@@ -47,6 +47,7 @@ class LLFloaterDisplayName : public LLFloater
virtual ~LLFloaterDisplayName() { } virtual ~LLFloaterDisplayName() { }
/*virtual*/ BOOL postBuild(); /*virtual*/ BOOL postBuild();
void onSave(); void onSave();
void onReset();
void onCancel(); void onCancel();
/*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onOpen(const LLSD& key);
...@@ -101,6 +102,7 @@ void LLFloaterDisplayName::onOpen(const LLSD& key) ...@@ -101,6 +102,7 @@ void LLFloaterDisplayName::onOpen(const LLSD& key)
BOOL LLFloaterDisplayName::postBuild() BOOL LLFloaterDisplayName::postBuild()
{ {
getChild<LLUICtrl>("reset_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onReset, this));
getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onCancel, this)); getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onCancel, this));
getChild<LLUICtrl>("save_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onSave, this)); getChild<LLUICtrl>("save_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onSave, this));
...@@ -156,6 +158,20 @@ void LLFloaterDisplayName::onCancel() ...@@ -156,6 +158,20 @@ void LLFloaterDisplayName::onCancel()
setVisible(false); setVisible(false);
} }
void LLFloaterDisplayName::onReset()
{
LLAvatarName av_name;
if (!LLAvatarNameCache::get(gAgent.getID(), &av_name))
{
return;
}
getChild<LLUICtrl>("display_name_editor")->setValue(av_name.getCompleteName());
getChild<LLUICtrl>("display_name_confirm")->clear();
getChild<LLUICtrl>("display_name_confirm")->setFocus(TRUE);
}
void LLFloaterDisplayName::onSave() void LLFloaterDisplayName::onSave()
{ {
std::string display_name_utf8 = getChild<LLUICtrl>("display_name_editor")->getValue().asString(); std::string display_name_utf8 = getChild<LLUICtrl>("display_name_editor")->getValue().asString();
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
max_length_chars="31" max_length_chars="31"
height="20" height="20"
top_pad="5" top_pad="5"
left="50" /> left_delta="0" />
<text <text
top_pad="15" top_pad="15"
left="25" left="25"
...@@ -72,23 +72,33 @@ ...@@ -72,23 +72,33 @@
max_length_chars="31" max_length_chars="31"
height="20" height="20"
top_pad="5" top_pad="5"
left="50" /> left_delta="0" />
<button
label="Reset"
layout="topleft"
font="SansSerif"
width="120"
height="23"
top_pad="40"
left_delta="0"
name="reset_btn"
tool_tip="Use Username as a Display Name" />
<button <button
height="23" height="23"
label="Save" label="Save"
layout="topleft" layout="topleft"
font="SansSerif" font="SansSerif"
left="35" left_pad="35"
name="save_btn" name="save_btn"
tool_tip="Save your new Display Name" tool_tip="Save your new Display Name"
top_pad="40" top_delta="0"
width="120" /> width="120" />
<button <button
height="23" height="23"
label="Cancel" label="Cancel"
font="SansSerif" font="SansSerif"
layout="topleft" layout="topleft"
left_pad="125" left_pad="5"
name="cancel_btn" name="cancel_btn"
width="120" /> width="120" />
</floater> </floater>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment