summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-05-22 21:48:46 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-05-22 21:48:46 +0300
commitfd51230df64a268aeb18e9a3ec4faf6765ac9d67 (patch)
tree70a5f2670e851405ba45ea17959919af74cc7087
parente54c9987e772690cb649e945c891439a98b9fc0c (diff)
SL-11190 Ability to duplicate a group role
-rw-r--r--indra/newview/llpanelgrouproles.cpp62
-rw-r--r--indra/newview/llpanelgrouproles.h4
-rw-r--r--indra/newview/skins/default/xui/en/panel_group_roles.xml12
3 files changed, 76 insertions, 2 deletions
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index 52a13304df..0efb234015 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -1962,6 +1962,7 @@ LLPanelGroupRolesSubTab::LLPanelGroupRolesSubTab()
mRoleDescription(NULL),
mMemberVisibleCheck(NULL),
mDeleteRoleButton(NULL),
+ mCopyRoleButton(NULL),
mCreateRoleButton(NULL),
mFirstOpen(TRUE),
mHasRoleChange(FALSE)
@@ -2012,6 +2013,14 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root)
mCreateRoleButton->setClickedCallback(onCreateRole, this);
mCreateRoleButton->setEnabled(FALSE);
}
+
+ mCopyRoleButton =
+ parent->getChild<LLButton>("role_copy", recurse);
+ if ( mCopyRoleButton )
+ {
+ mCopyRoleButton->setClickedCallback(onCopyRole, this);
+ mCopyRoleButton->setEnabled(FALSE);
+ }
mDeleteRoleButton =
parent->getChild<LLButton>("role_delete", recurse);
@@ -2226,6 +2235,7 @@ void LLPanelGroupRolesSubTab::update(LLGroupChange gc)
mRoleTitle->clear();
setFooterEnabled(FALSE);
mDeleteRoleButton->setEnabled(FALSE);
+ mCopyRoleButton->setEnabled(FALSE);
}
}
@@ -2336,6 +2346,7 @@ void LLPanelGroupRolesSubTab::handleRoleSelect()
mSelectedRole = item->getUUID();
buildMembersList();
+ mCopyRoleButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_ROLE_CREATE));
can_delete = can_delete && gAgent.hasPowerInGroup(mGroupID,
GP_ROLE_DELETE);
mDeleteRoleButton->setEnabled(can_delete);
@@ -2662,6 +2673,57 @@ void LLPanelGroupRolesSubTab::handleCreateRole()
}
// static
+void LLPanelGroupRolesSubTab::onCopyRole(void* user_data)
+{
+ LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
+ if (!self) return;
+
+ self->handleCopyRole();
+}
+
+void LLPanelGroupRolesSubTab::handleCopyRole()
+{
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+
+ if (!gdatap) return;
+
+ LLScrollListItem* role_item = mRolesList->getFirstSelected();
+ if (!role_item || role_item->getUUID().isNull())
+ {
+ return;
+ }
+
+ LLRoleData rd;
+ if (!gdatap->getRoleData(role_item->getUUID(), rd))
+ {
+ return;
+ }
+
+ LLUUID new_role_id;
+ new_role_id.generate();
+ rd.mRoleName += "(Copy)";
+ gdatap->createRole(new_role_id,rd);
+
+ mRolesList->deselectAllItems(TRUE);
+ LLSD row;
+ row["id"] = new_role_id;
+ row["columns"][0]["column"] = "name";
+ row["columns"][0]["value"] = rd.mRoleName;
+ mRolesList->addElement(row, ADD_BOTTOM, this);
+ mRolesList->selectByID(new_role_id);
+
+ // put focus on name field and select its contents
+ if(mRoleName)
+ {
+ mRoleName->setFocus(TRUE);
+ mRoleName->onTabInto();
+ gFocusMgr.triggerFocusFlash();
+ }
+
+ notifyObservers();
+}
+
+// static
void LLPanelGroupRolesSubTab::onDeleteRole(void* user_data)
{
LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h
index aafbd242cb..459b77703f 100644
--- a/indra/newview/llpanelgrouproles.h
+++ b/indra/newview/llpanelgrouproles.h
@@ -269,6 +269,9 @@ public:
static void onCreateRole(void*);
void handleCreateRole();
+ static void onCopyRole(void*);
+ void handleCopyRole();
+
static void onDeleteRole(void*);
void handleDeleteRole();
@@ -296,6 +299,7 @@ protected:
LLCheckBoxCtrl* mMemberVisibleCheck;
LLButton* mDeleteRoleButton;
LLButton* mCreateRoleButton;
+ LLButton* mCopyRoleButton;
LLUUID mSelectedRole;
BOOL mHasRoleChange;
diff --git a/indra/newview/skins/default/xui/en/panel_group_roles.xml b/indra/newview/skins/default/xui/en/panel_group_roles.xml
index 714d4166c0..f15f79e9aa 100644
--- a/indra/newview/skins/default/xui/en/panel_group_roles.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_roles.xml
@@ -212,7 +212,15 @@ clicking on their names.
layout="topleft"
left="0"
name="role_create"
- width="120" />
+ width="100" />
+ <button
+ follows="top|left"
+ height="23"
+ label="Copy Role"
+ layout="topleft"
+ left_pad="10"
+ name="role_copy"
+ width="100" />
<button
height="23"
follows="top|left"
@@ -220,7 +228,7 @@ clicking on their names.
layout="topleft"
left_pad="10"
name="role_delete"
- width="120" />
+ width="100" />
</panel>
<panel
border="false"