From 8e9305f67843672a758cbc15c9dcd2123c87613c Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 23 Aug 2010 11:28:14 -0700 Subject: Added 'Copy Key' button to the build general tab --- linden/indra/newview/llpanelpermissions.cpp | 52 ++++++++++++++++++++++ linden/indra/newview/llpanelpermissions.h | 1 + .../skins/default/xui/en-us/floater_tools.xml | 4 ++ .../newview/skins/default/xui/en-us/strings.xml | 3 ++ 4 files changed, 60 insertions(+) (limited to 'linden') diff --git a/linden/indra/newview/llpanelpermissions.cpp b/linden/indra/newview/llpanelpermissions.cpp index d541bce..afe2de4 100644 --- a/linden/indra/newview/llpanelpermissions.cpp +++ b/linden/indra/newview/llpanelpermissions.cpp @@ -54,13 +54,16 @@ #include "llstatusbar.h" // for getBalance() #include "lllineeditor.h" #include "llradiogroup.h" +#include "llchat.h" #include "llcombobox.h" #include "llfloateravatarinfo.h" +#include "llfloaterchat.h" #include "lluiconstants.h" #include "lldbstrings.h" #include "llfloatergroupinfo.h" #include "llfloatergroups.h" #include "llnamebox.h" +#include "lltrans.h" #include "llviewercontrol.h" #include "lluictrlfactory.h" #include "roles_constants.h" @@ -96,6 +99,8 @@ BOOL LLPanelPermissions::postBuild() this->childSetAction("button deed",LLPanelPermissions::onClickDeedToGroup,this); + this->childSetAction("button copy key",LLPanelPermissions::onClickCopyObjKey,this); + this->childSetCommitCallback("checkbox allow everyone move",LLPanelPermissions::onCommitEveryoneMove,this); this->childSetCommitCallback("checkbox allow everyone copy",LLPanelPermissions::onCommitEveryoneCopy,this); @@ -259,6 +264,8 @@ void LLPanelPermissions::refresh() childSetVisible("N:",false); childSetVisible("F:",false); + childSetEnabled("button copy key",false); + return; } @@ -844,6 +851,8 @@ void LLPanelPermissions::refresh() } childSetEnabled("label click action",is_perm_modify && all_volume); childSetEnabled("clickaction",is_perm_modify && all_volume); + + childSetEnabled("button copy key",true); } @@ -977,6 +986,49 @@ void LLPanelPermissions::onClickDeedToGroup(void* data) LLNotifications::instance().add( "DeedObjectToGroup", args, LLSD(), callback_deed_to_group); } +void LLPanelPermissions::onClickCopyObjKey(void* data) +{ + std::string output; + std::string keys; + const std::string separator = ", "; + LLChat chat; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) + { + LLSelectNode* selectNode = *iter; + LLViewerObject* object = selectNode->getObject(); + if (object) + { + if (!output.empty()) + { + output.append(separator); + } + output.append(selectNode->mName); + output.append(": "); + output.append(object->getID().asString()); + + if (!keys.empty()) + { + keys.append(separator); + } + keys.append(object->getID().asString()); + } + } + + if (!output.empty()) + { + chat.mText = LLTrans::getString("copy_obj_key_info") + "\n" + output; + LLFloaterChat::addChat(chat); + } + + if (!keys.empty()) + { + gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(keys)); + } +} + ///---------------------------------------------------------------------------- /// Permissions checkboxes ///---------------------------------------------------------------------------- diff --git a/linden/indra/newview/llpanelpermissions.h b/linden/indra/newview/llpanelpermissions.h index 9fa4cce..d8451e4 100644 --- a/linden/indra/newview/llpanelpermissions.h +++ b/linden/indra/newview/llpanelpermissions.h @@ -74,6 +74,7 @@ protected: static void onClickGroup(void*); static void cbGroupID(LLUUID group_id, void* userdata); static void onClickDeedToGroup(void*); + static void onClickCopyObjKey(void*); static void onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm); diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml index 58c6443..6210cdd 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml @@ -466,6 +466,10 @@ Contents +