From 74d3f9d017a424d69bfc256ecc1062fdaa3b18c3 Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Fri, 5 Feb 2021 20:31:22 +0200
Subject: [PATCH] SL-14797 Normalize right-click menus on Landmarks & Picks
 Part#2

---
 indra/newview/llpanellandmarkinfo.cpp         | 14 +++++++++-
 indra/newview/llpanellandmarkinfo.h           | 16 +++++++++---
 indra/newview/llpanellandmarks.cpp            |  9 ++++++-
 indra/newview/llpanelplaces.cpp               |  3 ++-
 .../skins/default/xui/en/menu_picks.xml       | 26 +++++++++----------
 .../xui/en/menu_places_gear_folder.xml        |  4 +--
 6 files changed, 50 insertions(+), 22 deletions(-)

diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index 6751c25fb99..069fb32a56f 100644
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -106,6 +106,18 @@ void LLPanelLandmarkInfo::resetLocation()
 
 // virtual
 void LLPanelLandmarkInfo::setInfoType(EInfoType type)
+{
+    LLUUID dest_folder;
+    setInfoType(type, dest_folder);
+}
+
+// Sets CREATE_LANDMARK infotype and creates landmark at desired folder
+void LLPanelLandmarkInfo::setInfoAndCreateLandmark(const LLUUID& fodler_id)
+{
+    setInfoType(CREATE_LANDMARK, fodler_id);
+}
+
+void LLPanelLandmarkInfo::setInfoType(EInfoType type, const LLUUID &folder_id)
 {
 	LLPanel* landmark_info_panel = getChild<LLPanel>("landmark_info_panel");
 
@@ -183,7 +195,7 @@ void LLPanelLandmarkInfo::setInfoType(EInfoType type)
 			// remote parcel request to complete.
 			if (!LLLandmarkActions::landmarkAlreadyExists())
 			{
-				createLandmark(LLUUID());
+				createLandmark(folder_id);
 			}
 		}
 		break;
diff --git a/indra/newview/llpanellandmarkinfo.h b/indra/newview/llpanellandmarkinfo.h
index 9712736182b..9a2e0c8f59e 100644
--- a/indra/newview/llpanellandmarkinfo.h
+++ b/indra/newview/llpanellandmarkinfo.h
@@ -43,8 +43,12 @@ class LLPanelLandmarkInfo : public LLPanelPlaceInfo
 
 	/*virtual*/ void resetLocation();
 
+    // If landmark doesn't exists, will create it at default folder
 	/*virtual*/ void setInfoType(EInfoType type);
 
+    // Sets CREATE_LANDMARK infotype and creates landmark at desired folder
+    void setInfoAndCreateLandmark(const LLUUID& fodler_id);
+
 	/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
 
 	// Displays landmark owner, creator and creation date info.
@@ -59,13 +63,17 @@ class LLPanelLandmarkInfo : public LLPanelPlaceInfo
 	// Select current landmark folder in combobox.
 	BOOL setLandmarkFolder(const LLUUID& id);
 
-	// Create a landmark for the current location
-	// in a folder specified by folder_id.
-	void createLandmark(const LLUUID& folder_id);
-
 	static std::string getFullFolderName(const LLViewerInventoryCategory* cat);
 
 private:
+    // Create a landmark for the current location
+    // in a folder specified by folder_id.
+    // Expects title and description to be initialized
+    void createLandmark(const LLUUID& folder_id);
+
+    // If landmark doesn't exists, will create it at specified folder
+    void setInfoType(EInfoType type, const LLUUID &folder_id);
+
 	void populateFoldersList();
 
 	LLTextBox*			mOwner;
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 578485c9676..46c23961f4b 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -785,7 +785,14 @@ void LLLandmarksPanel::onAddAction(const LLSD& userdata) const
 		}
 		else
 		{
-			LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "create_landmark"));
+            LLSD args;
+            args["type"] = "create_landmark";
+            if (view_model->getInventoryType()
+                == LLInventoryType::IT_CATEGORY)
+            {
+                args["dest_folder"] = view_model->getUUID();
+            }
+			LLFloaterSidePanelContainer::showPanel("places", args);
 		}
 	} 
 	else if ("category" == command_name)
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index abec3ba733f..c0382076280 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -409,7 +409,8 @@ void LLPanelPlaces::onOpen(const LLSD& key)
 			}
 			else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE)
 			{
-				mLandmarkInfo->setInfoType(LLPanelPlaceInfo::CREATE_LANDMARK);
+				LLUUID dest_folder = key["dest_folder"];
+				mLandmarkInfo->setInfoAndCreateLandmark(dest_folder);
 
 				if (key.has("x") && key.has("y") && key.has("z"))
 				{
diff --git a/indra/newview/skins/default/xui/en/menu_picks.xml b/indra/newview/skins/default/xui/en/menu_picks.xml
index ebb49c90042..a408e6136c1 100644
--- a/indra/newview/skins/default/xui/en/menu_picks.xml
+++ b/indra/newview/skins/default/xui/en/menu_picks.xml
@@ -3,7 +3,17 @@
  layout="topleft"
  name="Picks">
     <menu_item_call
-     label="Info"
+     label="Teleport"
+     layout="topleft"
+     name="pick_teleport">
+        <menu_item_call.on_click
+         function="Pick.Teleport" />
+        <menu_item_call.on_enable
+         function="Pick.Enable" 
+         parameter="teleport" />
+    </menu_item_call>
+    <menu_item_call
+     label="View Pick"
      layout="topleft"
      name="pick_info">
         <menu_item_call.on_click
@@ -13,7 +23,7 @@
          parameter="info" />
     </menu_item_call>
     <menu_item_call
-     label="Edit"
+     label="Edit Pick"
      layout="topleft"
      name="pick_edit"
      visible="false">
@@ -24,17 +34,7 @@
          parameter="edit" />
     </menu_item_call>
     <menu_item_call
-     label="Teleport"
-     layout="topleft"
-     name="pick_teleport">
-        <menu_item_call.on_click
-         function="Pick.Teleport" />
-        <menu_item_call.on_enable
-         function="Pick.Enable" 
-         parameter="teleport" />
-    </menu_item_call>
-    <menu_item_call
-     label="Map"
+     label="Show on map"
      layout="topleft"
      name="pick_map">
         <menu_item_call.on_click
diff --git a/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml b/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
index 4d59ab06317..eb76f58722d 100644
--- a/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
+++ b/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
@@ -7,7 +7,7 @@
  name="menu_folder_gear"
  visible="false">
     <menu_item_call
-     label="Add Landmark"
+     label="Landmark current location"
      layout="topleft"
      name="add_landmark">
         <on_click
@@ -18,7 +18,7 @@
          parameter="add_landmark" />
     </menu_item_call>
     <menu_item_call
-     label="Add Folder"
+     label="Create subfolder"
      layout="topleft"
      name="add_folder">
         <on_click
-- 
GitLab