From 3fd5a27d653283fdfd689a6eb428726c25b738cd Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Sun, 17 Dec 2023 18:00:22 -0500 Subject: [PATCH] Add Copy UUID and Copy SLurl to many places it was missing from --- indra/llui/llscrolllistctrl.cpp | 7 ++++ indra/llui/llscrolllistctrl.h | 1 + indra/llui/lltextbase.cpp | 1 + indra/llui/llurlaction.cpp | 9 +++++ indra/llui/llurlaction.h | 3 ++ indra/newview/llgrouplist.cpp | 21 ++++++++++++ indra/newview/llpanelprofile.cpp | 5 +++ .../default/xui/en/menu_attachment_other.xml | 10 ++++-- .../default/xui/en/menu_attachment_self.xml | 6 ++++ .../skins/default/xui/en/menu_avatar_icon.xml | 2 +- .../default/xui/en/menu_avatar_other.xml | 2 +- .../default/xui/en/menu_conversation.xml | 2 +- .../default/xui/en/menu_gesture_gear.xml | 2 +- .../default/xui/en/menu_im_conversation.xml | 2 +- .../skins/default/xui/en/menu_object.xml | 2 +- .../default/xui/en/menu_people_groups.xml | 34 +++++++++++++++++++ .../default/xui/en/menu_people_nearby.xml | 2 +- .../xui/en/menu_people_nearby_multiselect.xml | 2 +- .../default/xui/en/menu_profile_legacy.xml | 2 +- .../default/xui/en/menu_profile_other.xml | 10 +++++- .../default/xui/en/menu_profile_self.xml | 10 +++++- .../default/xui/en/menu_settings_gear.xml | 2 +- .../skins/default/xui/en/menu_url_agent.xml | 7 ++++ .../skins/default/xui/en/menu_url_group.xml | 7 ++++ .../default/xui/en/menu_url_objectim.xml | 7 ++++ 25 files changed, 144 insertions(+), 14 deletions(-) diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index a76a000b767..93a8e5722ba 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -2121,6 +2121,7 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) registrar.add("Url.Execute", boost::bind(&LLScrollListCtrl::showNameDetails, id, is_group)); registrar.add("Url.CopyLabel", boost::bind(&LLScrollListCtrl::copyNameToClipboard, id, is_group)); registrar.add("Url.CopyUrl", boost::bind(&LLScrollListCtrl::copySLURLToClipboard, id, is_group)); + registrar.add("Url.CopyUUID", boost::bind(&LLScrollListCtrl::copyUUIDToClipboard, id)); // create the context menu from the XUI file and display it std::string menu_name = is_group ? "menu_url_group.xml" : "menu_url_agent.xml"; @@ -2229,6 +2230,12 @@ void LLScrollListCtrl::copySLURLToClipboard(std::string id, bool is_group) LLUrlAction::copyURLToClipboard(slurl); } +void LLScrollListCtrl::copyUUIDToClipboard(std::string id) +{ + // copy a UUID for the avatar or group to the clipboard + LLUrlAction::copyURLToClipboard(id); +} + BOOL LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) { //BOOL handled = FALSE; diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 07b7cea4165..7b02318025c 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -499,6 +499,7 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler, static void showNameDetails(std::string id, bool is_group); static void copyNameToClipboard(std::string id, bool is_group); static void copySLURLToClipboard(std::string id, bool is_group); + static void copyUUIDToClipboard(std::string id); S32 mLineHeight; // the max height of a single line S32 mScrollLines; // how many lines we've scrolled down diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index e8cf5ad7c45..a15de1c4612 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2165,6 +2165,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) registrar.add("Url.ShowOnMap", boost::bind(&LLUrlAction::showLocationOnMap, url)); registrar.add("Url.CopyLabel", boost::bind(&LLUrlAction::copyLabelToClipboard, url)); registrar.add("Url.CopyUrl", boost::bind(&LLUrlAction::copyURLToClipboard, url)); + registrar.add("Url.CopyUUID", boost::bind(&LLUrlAction::copyUUIDToClipboard, url)); // create and return the context menu from the XUI file diff --git a/indra/llui/llurlaction.cpp b/indra/llui/llurlaction.cpp index 82160461746..52487c3b6f8 100644 --- a/indra/llui/llurlaction.cpp +++ b/indra/llui/llurlaction.cpp @@ -133,6 +133,15 @@ void LLUrlAction::copyURLToClipboard(std::string url) LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(url)); } +void LLUrlAction::copyUUIDToClipboard(std::string url) +{ + std::string id_str = getUserID(url); + if (LLUUID::validate(id_str)) + { + LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(id_str)); + } +} + void LLUrlAction::copyLabelToClipboard(std::string url) { LLUrlMatch match; diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h index c2c576254dc..5486333e21b 100644 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h @@ -74,6 +74,9 @@ class LLUrlAction /// copy a Url to the clipboard static void copyURLToClipboard(std::string url); + /// copy a UUID to the clipboard + static void copyUUIDToClipboard(std::string url); + /// if the Url specifies an SL command in the form like 'app/{cmd}/{id}/*', show its profile static void showProfile(std::string url); static std::string getUserID(std::string url); diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp index 659607ae801..52beba93112 100644 --- a/indra/newview/llgrouplist.cpp +++ b/indra/newview/llgrouplist.cpp @@ -29,17 +29,20 @@ #include "llgrouplist.h" // libs +#include "llclipboard.h" #include "llbutton.h" #include "llgroupiconctrl.h" #include "llmenugl.h" #include "lltextbox.h" #include "lltextutil.h" #include "lltrans.h" +#include "llwindow.h" // newview #include "llagent.h" #include "llgroupactions.h" #include "llfloaterreg.h" +#include "llslurl.h" #include "llviewercontrol.h" // for gSavedSettings #include "llviewermenu.h" // for gMenuHolder #include "llvoiceclient.h" @@ -377,6 +380,24 @@ bool LLGroupList::onContextMenuItemClick(const LLSD& userdata) { LLGroupActions::leave(selected_group); } + else if (action == "copy_label") + { + std::string group_name; + gCacheName->getGroupName(LLUUID(selected_group), group_name); + LLWString wstr = utf8str_to_wstring(group_name); + LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + } + else if (action == "copy_slurl") + { + std::string slurl = LLSLURL("group", selected_group, "about").getSLURLString(); + LLWString wstr = utf8str_to_wstring(slurl); + LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + } + else if (action == "copy_uuid") + { + LLWString wstr = utf8str_to_wstring(selected_group.asString()); + LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + } return true; } diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 0a5b8142ca4..fc7c3ed2c85 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -1436,6 +1436,11 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) { LLAvatarActions::toggleBlock(agent_id); } + else if (item_name == "copy_user_slurl") + { + LLWString wstr = utf8str_to_wstring(LLSLURL("agent", getAvatarId(), "about").getSLURLString()); + LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + } else if (item_name == "copy_user_id") { LLWString wstr = utf8str_to_wstring(getAvatarId().asString()); diff --git a/indra/newview/skins/default/xui/en/menu_attachment_other.xml b/indra/newview/skins/default/xui/en/menu_attachment_other.xml index 6afa27c3f33..491535e7988 100644 --- a/indra/newview/skins/default/xui/en/menu_attachment_other.xml +++ b/indra/newview/skins/default/xui/en/menu_attachment_other.xml @@ -165,8 +165,8 @@ function="RLV.CanShowName" /> </menu_item_call> <menu_item_call - label="Copy ID" - name="Copy ID"> + label="Copy Agent UUID" + name="Copy Agent ID"> <menu_item_call.on_click function="Avatar.CopyData" parameter="id"/> @@ -284,4 +284,10 @@ function="Floater.ShowOrBringToFront" parameter="inspect" /> </menu_item_call> + <menu_item_call + label="Copy Object UUID" + name="Copy Object ID"> + <menu_item_call.on_click + function="Object.CopyID" /> + </menu_item_call> </context_menu> diff --git a/indra/newview/skins/default/xui/en/menu_attachment_self.xml b/indra/newview/skins/default/xui/en/menu_attachment_self.xml index 0d7aa667792..5815c5300c8 100644 --- a/indra/newview/skins/default/xui/en/menu_attachment_self.xml +++ b/indra/newview/skins/default/xui/en/menu_attachment_self.xml @@ -63,6 +63,12 @@ function="Floater.ShowOrBringToFront" parameter="inspect" /> </menu_item_call> + <menu_item_call + label="Copy Object UUID" + name="Copy Object ID"> + <menu_item_call.on_click + function="Object.CopyID" /> + </menu_item_call> <menu_item_separator layout="topleft" /> <menu_item_call diff --git a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml index 2cef9c1de8b..7ae9ad6562e 100644 --- a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml @@ -195,7 +195,7 @@ parameter="slurl"/> </menu_item_call> <menu_item_call - label="Copy ID" + label="Copy UUID" name="Copy ID"> <menu_item_call.on_click function="AvatarIcon.CopyData" diff --git a/indra/newview/skins/default/xui/en/menu_avatar_other.xml b/indra/newview/skins/default/xui/en/menu_avatar_other.xml index 8145b465c1d..f83d036fd15 100644 --- a/indra/newview/skins/default/xui/en/menu_avatar_other.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_other.xml @@ -167,7 +167,7 @@ function="RLV.CanShowName" /> </menu_item_call> <menu_item_call - label="Copy ID" + label="Copy UUID" name="Copy ID"> <menu_item_call.on_click function="Avatar.CopyData" diff --git a/indra/newview/skins/default/xui/en/menu_conversation.xml b/indra/newview/skins/default/xui/en/menu_conversation.xml index cadc32c24a9..a3ec370e1a2 100644 --- a/indra/newview/skins/default/xui/en/menu_conversation.xml +++ b/indra/newview/skins/default/xui/en/menu_conversation.xml @@ -268,7 +268,7 @@ parameter="copy_slurl"/> </menu_item_call> <menu_item_call - label="Copy ID" + label="Copy UUID" name="copy_uuid"> <menu_item_call.on_click function="Avatar.DoToSelected" diff --git a/indra/newview/skins/default/xui/en/menu_gesture_gear.xml b/indra/newview/skins/default/xui/en/menu_gesture_gear.xml index 359c093eff9..359df63634d 100644 --- a/indra/newview/skins/default/xui/en/menu_gesture_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_gesture_gear.xml @@ -44,7 +44,7 @@ parameter="paste" /> </menu_item_call> <menu_item_call - label="Copy UUID" + label="Copy Asset UUID" layout="topleft" name="copy_uuid"> <on_click diff --git a/indra/newview/skins/default/xui/en/menu_im_conversation.xml b/indra/newview/skins/default/xui/en/menu_im_conversation.xml index 9f8002ab3c2..464c684beef 100644 --- a/indra/newview/skins/default/xui/en/menu_im_conversation.xml +++ b/indra/newview/skins/default/xui/en/menu_im_conversation.xml @@ -141,7 +141,7 @@ parameter="copy_slurl"/> </menu_item_call> <menu_item_call - label="Copy ID" + label="Copy UUID" name="copy_uuid"> <menu_item_call.on_click function="Avatar.GearDoToSelected" diff --git a/indra/newview/skins/default/xui/en/menu_object.xml b/indra/newview/skins/default/xui/en/menu_object.xml index 51d68c22732..fd5543bfb57 100644 --- a/indra/newview/skins/default/xui/en/menu_object.xml +++ b/indra/newview/skins/default/xui/en/menu_object.xml @@ -371,7 +371,7 @@ function="Avatar.EnableResetSkeleton"/> </menu_item_call> <menu_item_call - label="Copy ID" + label="Copy Object UUID" name="Copy ID"> <menu_item_call.on_click function="Object.CopyID" /> diff --git a/indra/newview/skins/default/xui/en/menu_people_groups.xml b/indra/newview/skins/default/xui/en/menu_people_groups.xml index 1e0364b84eb..c82f834fccc 100644 --- a/indra/newview/skins/default/xui/en/menu_people_groups.xml +++ b/indra/newview/skins/default/xui/en/menu_people_groups.xml @@ -42,6 +42,40 @@ function="People.Groups.Enable" parameter="call" /> </menu_item_call> + <menu_item_separator /> + <menu_item_call + label="Copy Name" + layout="topleft" + name="copy_label"> + <menu_item_call.on_click + function="People.Groups.Action" + parameter="copy_label" /> + <menu_item_call.on_enable + function="People.Groups.Enable" + parameter="copy_label" /> + </menu_item_call> + <menu_item_call + label="Copy SLurl" + layout="topleft" + name="copy_slurl"> + <menu_item_call.on_click + function="People.Groups.Action" + parameter="copy_slurl" /> + <menu_item_call.on_enable + function="People.Groups.Enable" + parameter="copy_slurl" /> + </menu_item_call> + <menu_item_call + label="Copy UUID" + layout="topleft" + name="copy_uuid"> + <menu_item_call.on_click + function="People.Groups.Action" + parameter="copy_uuid" /> + <menu_item_call.on_enable + function="People.Groups.Enable" + parameter="copy_uuid" /> + </menu_item_call> <menu_item_separator /> <menu_item_call label="Leave" diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby.xml b/indra/newview/skins/default/xui/en/menu_people_nearby.xml index ef4b0e00e89..dfc51eb4c95 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby.xml @@ -244,7 +244,7 @@ parameter="slurl"/> </menu_item_call> <menu_item_call - label="Copy ID" + label="Copy UUID" name="copy_uuid"> <menu_item_call.on_click function="Avatar.CopyData" diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml index 6c366fea782..044377f2cc3 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml @@ -151,7 +151,7 @@ parameter="slurl"/> </menu_item_call> <menu_item_call - label="Copy ID" + label="Copy UUID" name="copy_uuid"> <menu_item_call.on_click function="Avatar.CopyData" diff --git a/indra/newview/skins/default/xui/en/menu_profile_legacy.xml b/indra/newview/skins/default/xui/en/menu_profile_legacy.xml index eb84af1aee0..93724bbca1a 100644 --- a/indra/newview/skins/default/xui/en/menu_profile_legacy.xml +++ b/indra/newview/skins/default/xui/en/menu_profile_legacy.xml @@ -126,7 +126,7 @@ function="RLV.CanShowName" /> </menu_item_call> <menu_item_call - label="Copy ID" + label="Copy UUID" name="Copy ID"> <menu_item_call.on_click function="Avatar.CopyData" diff --git a/indra/newview/skins/default/xui/en/menu_profile_other.xml b/indra/newview/skins/default/xui/en/menu_profile_other.xml index 4db4d0922bf..b6c7ed94361 100644 --- a/indra/newview/skins/default/xui/en/menu_profile_other.xml +++ b/indra/newview/skins/default/xui/en/menu_profile_other.xml @@ -161,7 +161,15 @@ parameter="copy_username"/> </menu_item_call> <menu_item_call - label="Copy Agent Id" + label="Copy SLurl" + layout="topleft" + name="copy_slurl"> + <menu_item_call.on_click + function="Profile.Commit" + parameter="copy_user_slurl"/> + </menu_item_call> + <menu_item_call + label="Copy UUID" layout="topleft" name="copy_id"> <menu_item_call.on_click diff --git a/indra/newview/skins/default/xui/en/menu_profile_self.xml b/indra/newview/skins/default/xui/en/menu_profile_self.xml index d0bd4000f85..83ef3ae4833 100644 --- a/indra/newview/skins/default/xui/en/menu_profile_self.xml +++ b/indra/newview/skins/default/xui/en/menu_profile_self.xml @@ -75,7 +75,15 @@ parameter="copy_username"/> </menu_item_call> <menu_item_call - label="Copy Agent Id" + label="Copy SLurl" + layout="topleft" + name="copy_slurl"> + <menu_item_call.on_click + function="Profile.Commit" + parameter="copy_user_slurl"/> + </menu_item_call> + <menu_item_call + label="Copy UUID" layout="topleft" name="copy_id"> <menu_item_call.on_click diff --git a/indra/newview/skins/default/xui/en/menu_settings_gear.xml b/indra/newview/skins/default/xui/en/menu_settings_gear.xml index ea8e328407d..93aa47abe6e 100644 --- a/indra/newview/skins/default/xui/en/menu_settings_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_settings_gear.xml @@ -73,7 +73,7 @@ parameter="paste" /> </menu_item_call> <menu_item_call - label="Copy UUID" + label="Copy Asset UUID" layout="topleft" name="copy_uuid"> <on_click diff --git a/indra/newview/skins/default/xui/en/menu_url_agent.xml b/indra/newview/skins/default/xui/en/menu_url_agent.xml index 5ca8be21230..255e6bbf2d6 100644 --- a/indra/newview/skins/default/xui/en/menu_url_agent.xml +++ b/indra/newview/skins/default/xui/en/menu_url_agent.xml @@ -53,4 +53,11 @@ <menu_item_call.on_click function="Url.CopyUrl" /> </menu_item_call> + <menu_item_call + label="Copy UUID to clipboard" + layout="topleft" + name="url_copy_uuid"> + <menu_item_call.on_click + function="Url.CopyUUID" /> + </menu_item_call> </context_menu> diff --git a/indra/newview/skins/default/xui/en/menu_url_group.xml b/indra/newview/skins/default/xui/en/menu_url_group.xml index 2cb125ce094..792c2581a72 100644 --- a/indra/newview/skins/default/xui/en/menu_url_group.xml +++ b/indra/newview/skins/default/xui/en/menu_url_group.xml @@ -25,4 +25,11 @@ <menu_item_call.on_click function="Url.CopyUrl" /> </menu_item_call> + <menu_item_call + label="Copy UUID to clipboard" + layout="topleft" + name="url_copy_uuid"> + <menu_item_call.on_click + function="Url.CopyUUID" /> + </menu_item_call> </context_menu> diff --git a/indra/newview/skins/default/xui/en/menu_url_objectim.xml b/indra/newview/skins/default/xui/en/menu_url_objectim.xml index 41d40b389a6..00ff524ed48 100644 --- a/indra/newview/skins/default/xui/en/menu_url_objectim.xml +++ b/indra/newview/skins/default/xui/en/menu_url_objectim.xml @@ -55,4 +55,11 @@ <menu_item_call.on_click function="Url.CopyUrl" /> </menu_item_call> + <menu_item_call + label="Copy UUID to clipboard" + layout="topleft" + name="url_copy_uuid"> + <menu_item_call.on_click + function="Url.CopyUUID" /> + </menu_item_call> </context_menu> -- GitLab