Allow more flexible perm controls, from item properties floater.

TODO: Bring these permission flexibilities into build floater's general tab.
This commit is contained in:
Lirusaito
2012-07-25 09:19:22 -04:00
parent 3190814265
commit e116548b50
2 changed files with 76 additions and 48 deletions

View File

@@ -197,9 +197,12 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect&
// owner permissions
// Permissions debug text
// group permissions
childSetCommitCallback("CheckShareWithGroup",&onCommitPermissions, this);
childSetCommitCallback("CheckGroupCopy",&onCommitPermissions, this);
childSetCommitCallback("CheckGroupMod",&onCommitPermissions, this);
childSetCommitCallback("CheckGroupMove",&onCommitPermissions, this);
// everyone permissions
childSetCommitCallback("CheckEveryoneCopy",&onCommitPermissions, this);
childSetCommitCallback("CheckEveryoneMove",&onCommitPermissions, this);
// next owner permissions
childSetCommitCallback("CheckNextOwnerModify",&onCommitPermissions, this);
childSetCommitCallback("CheckNextOwnerCopy",&onCommitPermissions, this);
@@ -261,8 +264,11 @@ void LLFloaterProperties::refresh()
"CheckOwnerModify",
"CheckOwnerCopy",
"CheckOwnerTransfer",
"CheckShareWithGroup",
"CheckGroupCopy",
"CheckGroupMod",
"CheckGroupMove",
"CheckEveryoneCopy",
"CheckEveryoneMove",
"CheckNextOwnerModify",
"CheckNextOwnerCopy",
"CheckNextOwnerTransfer",
@@ -530,13 +536,23 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
// Check for ability to change values.
if (!is_link && is_obj_modify && can_agent_manipulate)
{
childSetEnabled("CheckShareWithGroup",TRUE);
childSetEnabled("GroupLabel", true);
childSetEnabled("CheckGroupCopy",owner_mask & PERM_TRANSFER);
childSetEnabled("CheckGroupMod", owner_mask & PERM_MODIFY);
childSetEnabled("CheckGroupMove", true);
childSetEnabled("EveryoneLabel", true);
childSetEnabled("CheckEveryoneCopy",(owner_mask & PERM_COPY) && (owner_mask & PERM_TRANSFER));
childSetEnabled("CheckEveryoneMove",true);
}
else
{
childSetEnabled("CheckShareWithGroup",FALSE);
childSetEnabled("GroupLabel", false);
childSetEnabled("CheckGroupCopy", false);
childSetEnabled("CheckGroupMod", false);
childSetEnabled("CheckGroupMove", false);
childSetEnabled("EveryoneLabel", false);
childSetEnabled("CheckEveryoneCopy",FALSE);
childSetEnabled("CheckEveryoneMove",false);
}
// Set values.
@@ -544,36 +560,12 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
BOOL is_group_modify = (group_mask & PERM_MODIFY) ? TRUE : FALSE;
BOOL is_group_move = (group_mask & PERM_MOVE) ? TRUE : FALSE;
if (is_group_copy && is_group_modify && is_group_move)
{
childSetValue("CheckShareWithGroup",LLSD((BOOL)TRUE));
LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
if(ctl)
{
ctl->setTentative(FALSE);
}
}
else if (!is_group_copy && !is_group_modify && !is_group_move)
{
childSetValue("CheckShareWithGroup",LLSD((BOOL)FALSE));
LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
if(ctl)
{
ctl->setTentative(FALSE);
}
}
else
{
LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
if(ctl)
{
ctl->setTentative(TRUE);
ctl->set(TRUE);
}
}
childSetValue("CheckGroupCopy", is_group_copy);
childSetValue("CheckGroupMod", is_group_modify);
childSetValue("CheckGroupMove", is_group_move);
childSetValue("CheckEveryoneCopy",LLSD((BOOL)(everyone_mask & PERM_COPY)));
childSetValue("CheckEveryoneMove",LLSD((BOOL)(everyone_mask & PERM_MOVE)));
///////////////
// SALE INFO //
@@ -762,13 +754,30 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data)
LLPermissions perm(item->getPermissions());
LLCheckBoxCtrl* CheckShareWithGroup = self->getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
if(CheckShareWithGroup)
LLCheckBoxCtrl* CheckGroupCopy = self->getChild<LLCheckBoxCtrl>("CheckGroupCopy");
if(CheckGroupCopy)
{
perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(),
CheckShareWithGroup->get(),
PERM_MODIFY | PERM_MOVE | PERM_COPY);
CheckGroupCopy->get(), PERM_COPY);
}
LLCheckBoxCtrl* CheckGroupMod = self->getChild<LLCheckBoxCtrl>("CheckGroupMod");
if(CheckGroupMod)
{
perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(),
CheckGroupMod->get(), PERM_MODIFY);
}
LLCheckBoxCtrl* CheckGroupMove = self->getChild<LLCheckBoxCtrl>("CheckGroupMove");
if(CheckGroupMove)
{
perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(),
CheckGroupMove->get(), PERM_MOVE);
}
LLCheckBoxCtrl* CheckEveryoneMove = self->getChild<LLCheckBoxCtrl>("CheckEveryoneMove");
if(CheckEveryoneMove)
{
perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(),
CheckEveryoneMove->get(), PERM_MOVE);
}
LLCheckBoxCtrl* CheckEveryoneCopy = self->getChild<LLCheckBoxCtrl>("CheckEveryoneCopy");
if(CheckEveryoneCopy)

View File

@@ -113,16 +113,35 @@
mouse_opaque="true" name="NextMaskDebug" v_pad="0" width="90">
N:
</text>
<check_box bottom="-187" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Share with group" left="10"
mouse_opaque="true" name="CheckShareWithGroup" radio_style="false"
width="106" />
<check_box bottom_delta="-32" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Allow anyone to copy" left="10"
mouse_opaque="true" name="CheckEveryoneCopy" radio_style="false"
width="130" />
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom_delta="-26" drop_shadow_visible="true" follows="left|top"
bottom_delta="-20" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="10" left="10"
mouse_opaque="true" name="GroupLabel" v_pad="0" width="198">
Group members can:
</text>
<check_box bottom_delta="-20" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Modify" left="10" mouse_opaque="true"
name="CheckGroupMod" radio_style="false" width="78" />
<check_box bottom_delta="0" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Copy" left_delta="78" mouse_opaque="true"
name="CheckGroupCopy" radio_style="false" width="88" />
<check_box bottom_delta="0" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Move" left_delta="88" mouse_opaque="true"
name="CheckGroupMove" radio_style="false" width="106" />
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom_delta="-17" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="10" left="10"
mouse_opaque="true" name="EveryoneLabel" v_pad="0" width="88">
Anyone can:
</text>
<check_box bottom_delta="-8" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Copy" left="88" mouse_opaque="true"
name="CheckEveryoneCopy" radio_style="false" width="88" />
<check_box bottom_delta="0" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Move" left_delta="88" mouse_opaque="true"
name="CheckEveryoneMove" radio_style="false" width="88" />
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom_delta="-13" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="10" left="10"
mouse_opaque="true" name="NextOwnerLabel" v_pad="0" width="88">
Next owner can:
@@ -130,10 +149,10 @@
<check_box bottom_delta="-20" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Modify" left="10" mouse_opaque="true"
name="CheckNextOwnerModify" radio_style="false" width="78" />
<check_box bottom="-265" follows="left|top" font="SansSerifSmall" height="16"
<check_box bottom_delta="0" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Copy" left_delta="78" mouse_opaque="true"
name="CheckNextOwnerCopy" radio_style="false" width="88" />
<check_box bottom="-265" follows="left|top" font="SansSerifSmall" height="16"
<check_box bottom_delta="0" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Resell/Give away" left_delta="88"
mouse_opaque="true" name="CheckNextOwnerTransfer" radio_style="false"
width="106" />