diff options
author | McCabe Maxsted | 2011-06-08 08:08:14 -0700 |
---|---|---|
committer | Jacek Antonelli | 2011-06-09 23:11:49 -0500 |
commit | f97f281c4f7d1407d2518067ff73c77fa975132c (patch) | |
tree | d402e895352d0e9a0967762dba8fd26294b0663b /linden/indra/newview/llpanelgroupgeneral.cpp | |
parent | Merge remote-tracking branch 'mccabe/1.4-fbeta-iwsupport' into next (diff) | |
download | meta-impy-f97f281c4f7d1407d2518067ff73c77fa975132c.zip meta-impy-f97f281c4f7d1407d2518067ff73c77fa975132c.tar.gz meta-impy-f97f281c4f7d1407d2518067ff73c77fa975132c.tar.bz2 meta-impy-f97f281c4f7d1407d2518067ff73c77fa975132c.tar.xz |
Added copy group link button to create clickable links to groups in the viewer
(cherry picked from commit 18464593de52a31fa098f5ee5e543d9a44f1889e)
Diffstat (limited to 'linden/indra/newview/llpanelgroupgeneral.cpp')
-rw-r--r-- | linden/indra/newview/llpanelgroupgeneral.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/linden/indra/newview/llpanelgroupgeneral.cpp b/linden/indra/newview/llpanelgroupgeneral.cpp index 8c522cc..e466f05 100644 --- a/linden/indra/newview/llpanelgroupgeneral.cpp +++ b/linden/indra/newview/llpanelgroupgeneral.cpp | |||
@@ -38,6 +38,8 @@ | |||
38 | 38 | ||
39 | #include "lluictrlfactory.h" | 39 | #include "lluictrlfactory.h" |
40 | #include "llagent.h" | 40 | #include "llagent.h" |
41 | #include "llchat.h" | ||
42 | #include "llfloaterchat.h" | ||
41 | #include "roles_constants.h" | 43 | #include "roles_constants.h" |
42 | #include "llfloateravatarinfo.h" | 44 | #include "llfloateravatarinfo.h" |
43 | #include "llfloatergroupinfo.h" | 45 | #include "llfloatergroupinfo.h" |
@@ -56,6 +58,7 @@ | |||
56 | #include "lltextbox.h" | 58 | #include "lltextbox.h" |
57 | #include "lltexteditor.h" | 59 | #include "lltexteditor.h" |
58 | #include "lltexturectrl.h" | 60 | #include "lltexturectrl.h" |
61 | #include "llurldispatcher.h" | ||
59 | #include "llviewercontrol.h" | 62 | #include "llviewercontrol.h" |
60 | #include "llviewerwindow.h" | 63 | #include "llviewerwindow.h" |
61 | 64 | ||
@@ -144,6 +147,13 @@ BOOL LLPanelGroupGeneral::postBuild() | |||
144 | mBtnInfo->setCallbackUserData(this); | 147 | mBtnInfo->setCallbackUserData(this); |
145 | } | 148 | } |
146 | 149 | ||
150 | mBtnCopyLink = getChild<LLButton>("copy_link_button", recurse); | ||
151 | if ( mBtnCopyLink ) | ||
152 | { | ||
153 | mBtnCopyLink->setClickedCallback(onClickCopyLink); | ||
154 | mBtnCopyLink->setCallbackUserData(this); | ||
155 | } | ||
156 | |||
147 | LLTextBox* founder = getChild<LLTextBox>("founder_name"); | 157 | LLTextBox* founder = getChild<LLTextBox>("founder_name"); |
148 | if (founder) | 158 | if (founder) |
149 | { | 159 | { |
@@ -269,6 +279,7 @@ BOOL LLPanelGroupGeneral::postBuild() | |||
269 | 279 | ||
270 | mBtnJoinGroup->setVisible(FALSE); | 280 | mBtnJoinGroup->setVisible(FALSE); |
271 | mBtnInfo->setVisible(FALSE); | 281 | mBtnInfo->setVisible(FALSE); |
282 | mBtnCopyLink->setVisible(FALSE); | ||
272 | mGroupName->setVisible(FALSE); | 283 | mGroupName->setVisible(FALSE); |
273 | } | 284 | } |
274 | 285 | ||
@@ -404,6 +415,39 @@ bool LLPanelGroupGeneral::joinDlgCB(const LLSD& notification, const LLSD& respon | |||
404 | } | 415 | } |
405 | 416 | ||
406 | // static | 417 | // static |
418 | void LLPanelGroupGeneral::onClickCopyLink(void* userdata) | ||
419 | { | ||
420 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)userdata; | ||
421 | |||
422 | if (!self || (self->mGroupID).isNull()) return; | ||
423 | |||
424 | LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(self->mGroupID); | ||
425 | |||
426 | // make sure we don't have junk | ||
427 | if (gdatap) | ||
428 | { | ||
429 | std::string buffer = LLURLDispatcher::createGroupJoinLink(gdatap->getID()); | ||
430 | |||
431 | // Say same info in chat -- MC | ||
432 | LLStringUtil::format_map_t targs; | ||
433 | targs["[SLURL]"] = buffer; | ||
434 | std::string msg = self->getString("copy_group_link_info"); | ||
435 | LLStringUtil::format(msg, targs); | ||
436 | |||
437 | LLChat chat; | ||
438 | chat.mSourceType = CHAT_SOURCE_SYSTEM; | ||
439 | chat.mText = msg; | ||
440 | LLFloaterChat::addChat(chat); | ||
441 | |||
442 | gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer)); | ||
443 | } | ||
444 | else | ||
445 | { | ||
446 | llwarns << "Trying to copy group slurl link with no group data!" << llendl; | ||
447 | } | ||
448 | } | ||
449 | |||
450 | // static | ||
407 | void LLPanelGroupGeneral::openProfile(void* data) | 451 | void LLPanelGroupGeneral::openProfile(void* data) |
408 | { | 452 | { |
409 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; | 453 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; |