From cea5a5d34f9b22b77563b46388a0dcd65b7ca516 Mon Sep 17 00:00:00 2001 From: Arrehn Date: Fri, 18 Mar 2011 21:41:38 -0400 Subject: [PATCH] Patch by Zi Ree FIRE-663 for group UUID text and copy buttons in Firestorm Grey, & W/sidetabs. This resolves FIRE-659. --HG-- branch : Firestorm_2.4.2 --- indra/newview/llpanelgroupgeneral.cpp | 34 +++++++++++++++++++++++++-- indra/newview/llpanelgroupgeneral.h | 3 +++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 80df420a4e..0d43d2b343 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -32,6 +32,10 @@ #include "llagent.h" #include "roles_constants.h" +// for copy URI button +#include "llclipboard.h" + + // UI elements #include "llbutton.h" #include "llcheckboxctrl.h" @@ -96,7 +100,8 @@ BOOL LLPanelGroupGeneral::postBuild() mEditCharter->setFocusReceivedCallback(boost::bind(onFocusEdit, _1, this)); mEditCharter->setFocusChangedCallback(boost::bind(onFocusEdit, _1, this)); } - + // set up callback for copy URI button + childSetCommitCallback("copy_uri",boost::bind(&LLPanelGroupGeneral::onCopyURI,this),NULL); mListVisibleMembers = getChild("visible_members", recurse); @@ -897,12 +902,28 @@ void LLPanelGroupGeneral::resetDirty() void LLPanelGroupGeneral::setGroupID(const LLUUID& id) { LLPanelGroupTab::setGroupID(id); - + // get group key display and copy URI button pointers + LLTextEditor* groupKeyEditor = getChild("group_key"); + LLButton* copyURIButton = getChild("copy_uri"); + // happens when a new group is created if(id == LLUUID::null) { + if (groupKeyEditor) + groupKeyEditor->setValue(LLSD()); + + if (copyURIButton) + copyURIButton->setEnabled(FALSE); + reset(); return; } + // fill in group key + if (groupKeyEditor) + groupKeyEditor->setValue(id.asString()); + + // activate copy URI button + if (copyURIButton) + copyURIButton->setEnabled(TRUE); BOOL accept_notices = FALSE; BOOL list_in_profile = FALSE; @@ -955,3 +976,12 @@ S32 LLPanelGroupGeneral::sortMembersList(S32 col_idx,const LLScrollListItem* i1, return LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); } + +// protected + +// Copy URI button callback +void LLPanelGroupGeneral::onCopyURI() +{ + std::string name = "secondlife:///app/group/"+getChild("group_key")->getValue().asString()+"/about"; + gClipboard.copyFromString(utf8str_to_wstring(name)); +} \ No newline at end of file diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h index 88c092c461..a91012dfbd 100644 --- a/indra/newview/llpanelgroupgeneral.h +++ b/indra/newview/llpanelgroupgeneral.h @@ -62,6 +62,9 @@ public: virtual void setupCtrls (LLPanel* parent); +protected: + void onCopyURI(); + private: void reset();