SL-11190 Ability to duplicate a group role
parent
e54c9987e7
commit
fd51230df6
|
|
@ -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);
|
||||
|
|
@ -2661,6 +2672,57 @@ void LLPanelGroupRolesSubTab::handleCreateRole()
|
|||
notifyObservers();
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue