From 2ed5f04b99c4805b8adda9745811e82616d61c9b Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Thu, 7 Oct 2010 10:42:31 -0700
Subject: [PATCH] Adding viewer hint for setting display name the when edit
 profile is opened with no display name set

---
 .../app_settings/ignorable_dialogs.xml        | 11 ++++++++++
 indra/newview/llfirstuse.cpp                  |  6 +++++
 indra/newview/llfirstuse.h                    |  1 +
 indra/newview/llpanelme.cpp                   | 22 +++++++++++++++++--
 .../skins/default/xui/en/notifications.xml    |  8 +++++++
 5 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/indra/newview/app_settings/ignorable_dialogs.xml b/indra/newview/app_settings/ignorable_dialogs.xml
index 0720ccee491..9ddf007ce76 100644
--- a/indra/newview/app_settings/ignorable_dialogs.xml
+++ b/indra/newview/app_settings/ignorable_dialogs.xml
@@ -45,6 +45,17 @@
     <key>Value</key>
     <integer>1</integer>
   </map>
+  <key>FirstDisplayName</key>
+  <map>
+    <key>Comment</key>
+    <string>Shows hint when edits profile for the first time</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>Boolean</string>
+    <key>Value</key>
+    <integer>1</integer>
+  </map>
   <key>FirstReceiveLindens</key>
   <map>
     <key>Comment</key>
diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp
index dd08706f4ff..b08c1139234 100644
--- a/indra/newview/llfirstuse.cpp
+++ b/indra/newview/llfirstuse.cpp
@@ -116,6 +116,12 @@ void LLFirstUse::notMoving(bool enable)
 	firstUseNotification("FirstNotMoving", enable, "HintMove", LLSD(), LLSD().with("target", "move_btn").with("direction", "top"));
 }
 
+// static
+void LLFirstUse::setDisplayName(bool enable)
+{
+	firstUseNotification("FirstDisplayName", enable, "HintDisplayName", LLSD(), LLSD().with("target", "set_display_name").with("direction", "left"));
+}
+
 // static
 void LLFirstUse::receiveLindens(bool enable)
 {
diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h
index 275f134400f..3b7ff6383b4 100644
--- a/indra/newview/llfirstuse.h
+++ b/indra/newview/llfirstuse.h
@@ -91,6 +91,7 @@ class LLFirstUse
 	static void notMoving(bool enable = true);
 	static void newInventory(bool enable = true);
 	static void receiveLindens(bool enable = true);
+	static void setDisplayName(bool enable = true);
 	static void useSandbox();
 	
 protected:
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index 79d5195ccf4..3cc6b32678c 100644
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -34,6 +34,8 @@
 #include "llagent.h"
 #include "llagentcamera.h"
 #include "llagentwearables.h"
+#include "llfirstuse.h"
+#include "llhints.h"
 #include "llsidetray.h"
 #include "llviewercontrol.h"
 #include "llviewerdisplayname.h"
@@ -190,8 +192,20 @@ void LLPanelMyProfileEdit::onOpen(const LLSD& key)
 	set_name->setEnabled(use_display_names);
 	// force new avatar name fetch so we have latest update time
 	LLAvatarNameCache::fetch(gAgent.getID()); 
-
 	LLPanelMyProfile::onOpen(getAvatarId());
+	
+	LLAvatarName av_name;	
+	if (LLAvatarNameCache::useDisplayNames())
+	{
+		if (LLAvatarNameCache::get(gAgent.getID(), &av_name) && av_name.mIsDisplayNameDefault)  	
+		{
+			LLFirstUse::setDisplayName();
+		}
+		else
+		{
+			LLFirstUse::setDisplayName(false);
+		}
+	}
 }
 
 void LLPanelMyProfileEdit::processProperties(void* data, EAvatarProcessorType type)
@@ -258,6 +272,8 @@ BOOL LLPanelMyProfileEdit::postBuild()
 	getChild<LLUICtrl>("set_name")->setCommitCallback(
 		boost::bind(&LLPanelMyProfileEdit::onClickSetName, this));
 
+	LLHints::registerHintTarget("set_display_name", getChild<LLUICtrl>("set_name")->getHandle());
+
 	return LLPanelAvatarProfile::postBuild();
 }
 /**
@@ -386,7 +402,9 @@ void LLPanelMyProfileEdit::onClickSetName()
 {	
 	LLAvatarNameCache::get(getAvatarId(), 
 			boost::bind(&LLPanelMyProfileEdit::onAvatarNameCache,
-				this, _1, _2));
+				this, _1, _2));	
+
+	LLFirstUse::setDisplayName(false);
 }
 
 void LLPanelMyProfileEdit::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index efd6ed0ac87..88b56138800 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -6537,6 +6537,14 @@ Mute everyone?
     To walk or run, open the Move Panel and use the directional arrows to navigate. You can also use the directional keys on your keyboard.
   </notification>
 
+  <notification
+  name="HintDisplayName"
+  label="Display Name"
+  type="hint"
+  unique="true">
+    Set your customizable display name here. This is in addition to your unique username, which can't be changed.
+  </notification>
+
   <notification
   name="HintInventory"
   label="Inventory"
-- 
GitLab