From 31aa30e3d0890041f21482a26d4b6268b20271a4 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Sun, 2 Feb 2014 16:27:20 -0500 Subject: [PATCH] Group Feature Request: Option to Copy SLURL for an avatar's profile Added to avatar list menus and instant message drop down menu. --- indra/newview/llimpanel.cpp | 3 +++ indra/newview/llpanelgroup.cpp | 7 ++---- indra/newview/llviewermenu.cpp | 22 +++++++++++++++++++ .../xui/en-us/floater_instant_message.xml | 1 + ...floater_instant_message_concisebuttons.xml | 1 + .../skins/default/xui/en-us/menu_avs_list.xml | 4 ++++ .../skins/default/xui/en-us/menu_radar.xml | 4 ++++ 7 files changed, 37 insertions(+), 5 deletions(-) diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 085d14a2f..d2366f8c9 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -964,6 +964,8 @@ void LLFloaterIMPanel::addDynamics(LLComboBox* flyout) //flyout->add(LLAvatarActions::isBlocked(mOtherParticipantUUID) ? getString("unmute") : getString("mute"), 9); } +void copy_profile_uri(const LLUUID& id, bool group = false); + void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) { if (value.isUndefined()) @@ -978,6 +980,7 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) else if (option == 3) LLAvatarActions::teleportRequest(mOtherParticipantUUID); else if (option == 4) LLAvatarActions::pay(mOtherParticipantUUID); else if (option == 5) LLAvatarActions::inviteToGroup(mOtherParticipantUUID); + else if (option == -1) copy_profile_uri(mOtherParticipantUUID); else if (option >= 6) // Options that use dynamic items { // First remove them all diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 9e4ef15cc..92ce2545f 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -129,10 +129,7 @@ void LLPanelGroupTab::handleClickHelp() } } -static void copy_group_profile_uri(const LLUUID& id) -{ - gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring("secondlife:///app/group/"+id.asString()+"/about")); -} +void copy_profile_uri(const LLUUID& id, bool group); LLPanelGroup::LLPanelGroup(const LLUUID& group_id) : LLPanel("PanelGroup", LLRect(), FALSE), @@ -163,7 +160,7 @@ LLPanelGroup::LLPanelGroup(const LLUUID& group_id) LLGroupMgr::getInstance()->addObserver(this); - mCommitCallbackRegistrar.add("Group.CopyURI", boost::bind(copy_group_profile_uri, boost::ref(mID))); + mCommitCallbackRegistrar.add("Group.CopyURI", boost::bind(copy_profile_uri, boost::ref(mID), true)); // Pass on construction of this panel to the control factory. LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group.xml", &getFactoryMap()); } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 102738498..ba83afd25 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9325,6 +9325,18 @@ const uuid_vec_t get_focused_list_ids_selected() return uuid_vec_t(); } +const LLWString get_slurl_for(const LLUUID& id, bool group) +{ + std::string str("secondlife:///app/"); + str += group ? "group/" : "agent/"; + return utf8str_to_wstring(str + id.asString() + "/about"); +} + +void copy_profile_uri(const LLUUID& id, bool group) +{ + gViewerWindow->getWindow()->copyTextToClipboard(get_slurl_for(id, group)); +} + class ListEnableAnySelected : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -9412,6 +9424,15 @@ class ListVisibleWebProfile : public view_listener_t } }; +class ListCopySLURL : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + copy_profile_uri(get_focused_list_id_selected(), false); + return true; + } +}; + class ListCopyUUIDs : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -9939,6 +9960,7 @@ void initialize_menus() addMenu(new ListEnableMute(), "List.EnableMute"); addMenu(new ListEnableOfferTeleport(), "List.EnableOfferTeleport"); addMenu(new ListVisibleWebProfile(), "List.VisibleWebProfile"); + addMenu(new ListCopySLURL(), "List.CopySLURL"); addMenu(new ListCopyUUIDs(), "List.CopyUUIDs"); addMenu(new ListInviteToGroup(), "List.InviteToGroup"); addMenu(new ListOfferTeleport(), "List.OfferTeleport"); diff --git a/indra/newview/skins/default/xui/en-us/floater_instant_message.xml b/indra/newview/skins/default/xui/en-us/floater_instant_message.xml index 53a441397..43f5a4e1c 100644 --- a/indra/newview/skins/default/xui/en-us/floater_instant_message.xml +++ b/indra/newview/skins/default/xui/en-us/floater_instant_message.xml @@ -14,6 +14,7 @@ + diff --git a/indra/newview/skins/default/xui/en-us/floater_instant_message_concisebuttons.xml b/indra/newview/skins/default/xui/en-us/floater_instant_message_concisebuttons.xml index 1901df923..80cb4e3b2 100644 --- a/indra/newview/skins/default/xui/en-us/floater_instant_message_concisebuttons.xml +++ b/indra/newview/skins/default/xui/en-us/floater_instant_message_concisebuttons.xml @@ -17,6 +17,7 @@ + diff --git a/indra/newview/skins/default/xui/en-us/menu_avs_list.xml b/indra/newview/skins/default/xui/en-us/menu_avs_list.xml index 7377eebf9..53fff36bd 100644 --- a/indra/newview/skins/default/xui/en-us/menu_avs_list.xml +++ b/indra/newview/skins/default/xui/en-us/menu_avs_list.xml @@ -66,4 +66,8 @@ + + + + diff --git a/indra/newview/skins/default/xui/en-us/menu_radar.xml b/indra/newview/skins/default/xui/en-us/menu_radar.xml index 8d30d76a6..7f450a889 100644 --- a/indra/newview/skins/default/xui/en-us/menu_radar.xml +++ b/indra/newview/skins/default/xui/en-us/menu_radar.xml @@ -65,6 +65,10 @@ + + + +