diff options
Diffstat (limited to 'indra/newview/llpanelpermissions.cpp')
-rw-r--r-- | indra/newview/llpanelpermissions.cpp | 654 |
1 files changed, 316 insertions, 338 deletions
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 6a29d76aad..8b8b1bed37 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -181,6 +181,85 @@ LLPanelPermissions::~LLPanelPermissions() } +void LLPanelPermissions::disableAll() +{ + childSetEnabled("perm_modify", FALSE); + childSetText("perm_modify", LLStringUtil::null); + + childSetEnabled("Creator:", FALSE); + childSetText("Creator Name", LLStringUtil::null); + childSetEnabled("Creator Name", FALSE); + + childSetEnabled("Owner:", FALSE); + childSetText("Owner Name", LLStringUtil::null); + childSetEnabled("Owner Name", FALSE); + + childSetEnabled("Group:", FALSE); + childSetText("Group Name", LLStringUtil::null); + childSetEnabled("Group Name", FALSE); + childSetEnabled("button set group", FALSE); + + childSetText("Object Name", LLStringUtil::null); + childSetEnabled("Object Name", FALSE); + childSetEnabled("Name:", FALSE); + childSetText("Group Name", LLStringUtil::null); + childSetEnabled("Group Name", FALSE); + childSetEnabled("Description:", FALSE); + childSetText("Object Description", LLStringUtil::null); + childSetEnabled("Object Description", FALSE); + + childSetEnabled("Permissions:", FALSE); + + childSetValue("checkbox share with group", FALSE); + childSetEnabled("checkbox share with group", FALSE); + childSetEnabled("button deed", FALSE); + + childSetValue("checkbox allow everyone move", FALSE); + childSetEnabled("checkbox allow everyone move", FALSE); + childSetValue("checkbox allow everyone copy", FALSE); + childSetEnabled("checkbox allow everyone copy", FALSE); + + //Next owner can: + childSetEnabled("Next owner can:", FALSE); + childSetValue("checkbox next owner can modify", FALSE); + childSetEnabled("checkbox next owner can modify", FALSE); + childSetValue("checkbox next owner can copy", FALSE); + childSetEnabled("checkbox next owner can copy", FALSE); + childSetValue("checkbox next owner can transfer", FALSE); + childSetEnabled("checkbox next owner can transfer", FALSE); + + //checkbox for sale + childSetValue("checkbox for sale", FALSE); + childSetEnabled("checkbox for sale", FALSE); + + //checkbox include in search + childSetValue("search_check", FALSE); + childSetEnabled("search_check", FALSE); + + LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type"); + combo_sale_type->setValue(LLSaleInfo::FS_COPY); + combo_sale_type->setEnabled(FALSE); + + childSetEnabled("Cost", FALSE); + childSetText("Cost", getString("Cost Default")); + childSetText("Edit Cost", LLStringUtil::null); + childSetEnabled("Edit Cost", FALSE); + + childSetEnabled("label click action", FALSE); + LLComboBox* combo_click_action = getChild<LLComboBox>("clickaction"); + if (combo_click_action) + { + combo_click_action->setEnabled(FALSE); + combo_click_action->clear(); + } + childSetVisible("B:", FALSE); + childSetVisible("O:", FALSE); + childSetVisible("G:", FALSE); + childSetVisible("E:", FALSE); + childSetVisible("N:", FALSE); + childSetVisible("F:", FALSE); +} + void LLPanelPermissions::refresh() { LLButton* BtnDeedToGroup = getChild<LLButton>("button deed"); @@ -215,136 +294,58 @@ void LLPanelPermissions::refresh() if(!nodep || !objectp)// || attachment_selected) { // ...nothing selected - childSetEnabled("perm_modify",false); - childSetText("perm_modify",LLStringUtil::null); - - childSetEnabled("Creator:",false); - childSetText("Creator Name",LLStringUtil::null); - childSetEnabled("Creator Name",false); - - childSetEnabled("Owner:",false); - childSetText("Owner Name",LLStringUtil::null); - childSetEnabled("Owner Name",false); - - childSetEnabled("Group:",false); - childSetText("Group Name",LLStringUtil::null); - childSetEnabled("Group Name",false); - childSetEnabled("button set group",false); - - childSetText("Object Name",LLStringUtil::null); - childSetEnabled("Object Name",false); - childSetEnabled("Name:",false); - childSetText("Group Name",LLStringUtil::null); - childSetEnabled("Group Name",false); - childSetEnabled("Description:",false); - childSetText("Object Description",LLStringUtil::null); - childSetEnabled("Object Description",false); - - childSetEnabled("Permissions:",false); - - childSetValue("checkbox share with group",FALSE); - childSetEnabled("checkbox share with group",false); - childSetEnabled("button deed",false); - - childSetValue("checkbox allow everyone move",FALSE); - childSetEnabled("checkbox allow everyone move",false); - childSetValue("checkbox allow everyone copy",FALSE); - childSetEnabled("checkbox allow everyone copy",false); - - //Next owner can: - childSetEnabled("Next owner can:",false); - childSetValue("checkbox next owner can modify",FALSE); - childSetEnabled("checkbox next owner can modify",false); - childSetValue("checkbox next owner can copy",FALSE); - childSetEnabled("checkbox next owner can copy",false); - childSetValue("checkbox next owner can transfer",FALSE); - childSetEnabled("checkbox next owner can transfer",false); - - //checkbox for sale - childSetValue("checkbox for sale",FALSE); - childSetEnabled("checkbox for sale",false); - - //checkbox include in search - childSetValue("search_check", FALSE); - childSetEnabled("search_check", false); - - LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type"); - combo_sale_type->setValue(LLSaleInfo::FS_COPY); - combo_sale_type->setEnabled(FALSE); - - childSetEnabled("Cost",false); - childSetText("Cost",getString("Cost Default")); - childSetText("Edit Cost",LLStringUtil::null); - childSetEnabled("Edit Cost",false); - - childSetEnabled("label click action",false); - LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction"); - if(ComboClickAction) - { - ComboClickAction->setEnabled(FALSE); - ComboClickAction->clear(); - } - childSetVisible("B:",false); - childSetVisible("O:",false); - childSetVisible("G:",false); - childSetVisible("E:",false); - childSetVisible("N:",false); - childSetVisible("F:",false); - + disableAll(); return; } // figure out a few variables - BOOL is_one_object = (object_count == 1); - + const BOOL is_one_object = (object_count == 1); + // BUG: fails if a root and non-root are both single-selected. BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() - && LLSelectMgr::getInstance()->selectGetRootsModify()) - || LLSelectMgr::getInstance()->selectGetModify(); + && LLSelectMgr::getInstance()->selectGetRootsModify()) + || LLSelectMgr::getInstance()->selectGetModify(); const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); + S32 string_index = 0; std::string MODIFY_INFO_STRINGS[] = - { - getString("text modify info 1"), - getString("text modify info 2"), - getString("text modify info 3"), - getString("text modify info 4") - }; - if(!is_perm_modify) + { + getString("text modify info 1"), + getString("text modify info 2"), + getString("text modify info 3"), + getString("text modify info 4") + }; + if (!is_perm_modify) { string_index += 2; } - if(!is_one_object) + if (!is_one_object) { ++string_index; } - childSetEnabled("perm_modify",true); - childSetText("perm_modify",MODIFY_INFO_STRINGS[string_index]); + childSetEnabled("perm_modify", TRUE); + childSetText("perm_modify", MODIFY_INFO_STRINGS[string_index]); - childSetEnabled("Permissions:",true); + childSetEnabled("Permissions:", TRUE); // Update creator text field - childSetEnabled("Creator:",true); + childSetEnabled("Creator:", TRUE); BOOL creators_identical; std::string creator_name; creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, - creator_name); + creator_name); - childSetText("Creator Name",creator_name); - childSetEnabled("Creator Name",TRUE); + childSetText("Creator Name", creator_name); + childSetEnabled("Creator Name", TRUE); // Update owner text field - childSetEnabled("Owner:",true); + childSetEnabled("Owner:", TRUE); - BOOL owners_identical; std::string owner_name; - owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); - -// llinfos << "owners_identical " << (owners_identical ? "TRUE": "FALSE") << llendl; - + const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); if (mOwnerID.isNull()) { - if(LLSelectMgr::getInstance()->selectIsGroupOwned()) + if (LLSelectMgr::getInstance()->selectIsGroupOwned()) { // Group owned already displayed by selectGetOwner } @@ -359,61 +360,53 @@ void LLPanelPermissions::refresh() if (!mLastOwnerID.isNull() && !last_owner_name.empty()) { owner_name.append(", last "); - owner_name.append( last_owner_name ); + owner_name.append(last_owner_name); } } } - - childSetText("Owner Name",owner_name); - childSetEnabled("Owner Name",TRUE); + childSetText("Owner Name", owner_name); + childSetEnabled("Owner Name", TRUE); // update group text field - childSetEnabled("Group:",true); - childSetText("Group Name",LLStringUtil::null); + childSetEnabled("Group:", TRUE); + childSetText("Group Name", LLStringUtil::null); LLUUID group_id; BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) { - if(mLabelGroupName) + if (mLabelGroupName) { - mLabelGroupName->setNameID(group_id, TRUE); + mLabelGroupName->setNameID(group_id,TRUE); mLabelGroupName->setEnabled(TRUE); } } else { - if(mLabelGroupName) + if (mLabelGroupName) { mLabelGroupName->setNameID(LLUUID::null, TRUE); - mLabelGroupName->refresh(LLUUID::null, LLStringUtil::null, LLStringUtil::null, TRUE); + mLabelGroupName->refresh(LLUUID::null,LLStringUtil::null, LLStringUtil::null, TRUE); mLabelGroupName->setEnabled(FALSE); } } - childSetEnabled("button set group",owners_identical && (mOwnerID == gAgent.getID())); - - // figure out the contents of the name, description, & category - BOOL edit_name_desc = FALSE; - if(is_one_object && objectp->permModify()) - { - edit_name_desc = TRUE; - } + childSetEnabled("button set group", owners_identical && (mOwnerID == gAgent.getID())); - childSetEnabled("Name:",true); + childSetEnabled("Name:", TRUE); LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name"); - childSetEnabled("Description:",true); - LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description"); + childSetEnabled("Description:", TRUE); + LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description"); - if(is_one_object) + if (is_one_object) { - if(keyboard_focus_view != LineEditorObjectName) + if (keyboard_focus_view != LineEditorObjectName) { childSetText("Object Name",nodep->mName); } - if(LineEditorObjectDesc) + if (LineEditorObjectDesc) { - if(keyboard_focus_view != LineEditorObjectDesc) + if (keyboard_focus_view != LineEditorObjectDesc) { LineEditorObjectDesc->setText(nodep->mDescription); } @@ -421,19 +414,25 @@ void LLPanelPermissions::refresh() } else { - childSetText("Object Name",LLStringUtil::null); + childSetText("Object Name", LLStringUtil::null); LineEditorObjectDesc->setText(LLStringUtil::null); } - if(edit_name_desc) + // figure out the contents of the name, description, & category + BOOL edit_name_desc = FALSE; + if (is_one_object && objectp->permModify()) { - childSetEnabled("Object Name",true); - childSetEnabled("Object Description",true); + edit_name_desc = TRUE; + } + if (edit_name_desc) + { + childSetEnabled("Object Name", TRUE); + childSetEnabled("Object Description", TRUE); } else { - childSetEnabled("Object Name",false); - childSetEnabled("Object Description",false); + childSetEnabled("Object Name", FALSE); + childSetEnabled("Object Description", FALSE); } S32 total_sale_price = 0; @@ -442,10 +441,10 @@ void LLPanelPermissions::refresh() BOOL is_sale_price_mixed = FALSE; U32 num_for_sale = FALSE; LLSelectMgr::getInstance()->selectGetAggregateSaleInfo(num_for_sale, - is_for_sale_mixed, - is_sale_price_mixed, - total_sale_price, - individual_sale_price); + is_for_sale_mixed, + is_sale_price_mixed, + total_sale_price, + individual_sale_price); const BOOL self_owned = (gAgent.getID() == mOwnerID); const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; @@ -453,35 +452,35 @@ void LLPanelPermissions::refresh() const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); - if(!owners_identical) + if (!owners_identical) { - childSetEnabled("Cost",false); - childSetText("Edit Cost",LLStringUtil::null); - childSetEnabled("Edit Cost",false); + childSetEnabled("Cost", FALSE); + childSetText("Edit Cost", LLStringUtil::null); + childSetEnabled("Edit Cost", FALSE); } // You own these objects. - else if(self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) + else if (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) { // If there are multiple items for sale then set text to PRICE PER UNIT. if (num_for_sale > 1) { - childSetText("Cost",getString("Cost Per Unit")); + childSetText("Cost", getString("Cost Per Unit")); } else { - childSetText("Cost",getString("Cost Default")); + childSetText("Cost", getString("Cost Default")); } LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost"); - if(!edit_price->hasFocus()) + if (!edit_price->hasFocus()) { // If the sale price is mixed then set the cost to MIXED, otherwise // set to the actual cost. - if (num_for_sale > 0 && is_for_sale_mixed) + if ((num_for_sale > 0) && is_for_sale_mixed) { edit_price->setTentative(TRUE); } - else if (num_for_sale > 0 && is_sale_price_mixed) + else if ((num_for_sale > 0) && is_sale_price_mixed) { edit_price->setTentative(TRUE); } @@ -492,303 +491,279 @@ void LLPanelPermissions::refresh() } // The edit fields are only enabled if you can sell this object // and the sale price is not mixed. - bool enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : false; - childSetEnabled("Cost",enable_edit); - childSetEnabled("Edit Cost",enable_edit); + BOOL enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : FALSE; + childSetEnabled("Cost", enable_edit); + childSetEnabled("Edit Cost", enable_edit); } // Someone, not you, owns these objects. - else if(!public_owned) + else if (!public_owned) { - childSetEnabled("Cost",false); - childSetEnabled("Edit Cost",false); + childSetEnabled("Cost", FALSE); + childSetEnabled("Edit Cost", FALSE); // Don't show a price if none of the items are for sale. if (num_for_sale) - childSetText("Edit Cost",llformat("%d",total_sale_price)); + childSetText("Edit Cost", llformat("%d",total_sale_price)); else - childSetText("Edit Cost",LLStringUtil::null); + childSetText("Edit Cost", LLStringUtil::null); // If multiple items are for sale, set text to TOTAL PRICE. if (num_for_sale > 1) - childSetText("Cost",getString("Cost Total")); + childSetText("Cost", getString("Cost Total")); else - childSetText("Cost",getString("Cost Default")); + childSetText("Cost", getString("Cost Default")); } // This is a public object. else { - childSetEnabled("Cost",false); - childSetText("Cost",getString("Cost Default")); + childSetEnabled("Cost", FALSE); + childSetText("Cost", getString("Cost Default")); - childSetText("Edit Cost",LLStringUtil::null); - childSetEnabled("Edit Cost",false); + childSetText("Edit Cost", LLStringUtil::null); + childSetEnabled("Edit Cost", FALSE); } // Enable and disable the permissions checkboxes // based on who owns the object. // TODO: Creator permissions - BOOL valid_base_perms = FALSE; - BOOL valid_owner_perms = FALSE; - BOOL valid_group_perms = FALSE; - BOOL valid_everyone_perms = FALSE; - BOOL valid_next_perms = FALSE; - - U32 base_mask_on; - U32 base_mask_off; - U32 owner_mask_on; - U32 owner_mask_off; - U32 group_mask_on; - U32 group_mask_off; - U32 everyone_mask_on; - U32 everyone_mask_off; - U32 next_owner_mask_on = 0; - U32 next_owner_mask_off = 0; - - valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE, - &base_mask_on, - &base_mask_off); - - valid_owner_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, - &owner_mask_on, - &owner_mask_off); - - valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP, - &group_mask_on, - &group_mask_off); + U32 base_mask_on = 0; + U32 base_mask_off = 0; + U32 owner_mask_off = 0; + U32 owner_mask_on = 0; + U32 group_mask_on = 0; + U32 group_mask_off = 0; + U32 everyone_mask_on = 0; + U32 everyone_mask_off = 0; + U32 next_owner_mask_on = 0; + U32 next_owner_mask_off = 0; + + BOOL valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE, + &base_mask_on, + &base_mask_off); + //BOOL valid_owner_perms =// + LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, + &owner_mask_on, + &owner_mask_off); + BOOL valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP, + &group_mask_on, + &group_mask_off); - valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE, - &everyone_mask_on, - &everyone_mask_off); + BOOL valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE, + &everyone_mask_on, + &everyone_mask_off); - valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER, - &next_owner_mask_on, - &next_owner_mask_off); + BOOL valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER, + &next_owner_mask_on, + &next_owner_mask_off); - if( gSavedSettings.getBOOL("DebugPermissions") ) + if (gSavedSettings.getBOOL("DebugPermissions") ) { - std::string perm_string; if (valid_base_perms) { - perm_string = "B: "; - perm_string += mask_to_string(base_mask_on); - childSetText("B:",perm_string); - childSetVisible("B:",true); + childSetText("B:", "B: " + mask_to_string(base_mask_on)); + childSetVisible("B:", TRUE); - perm_string = "O: "; - perm_string += mask_to_string(owner_mask_on); - childSetText("O:",perm_string); - childSetVisible("O:",true); + childSetText("O:", "O: " + mask_to_string(owner_mask_on)); + childSetVisible("O:", TRUE); - perm_string = "G: "; - perm_string += mask_to_string(group_mask_on); - childSetText("G:",perm_string); - childSetVisible("G:",true); + childSetText("G:", "G: " + mask_to_string(group_mask_on)); + childSetVisible("G:", TRUE); - perm_string = "E: "; - perm_string += mask_to_string(everyone_mask_on); - childSetText("E:",perm_string); - childSetVisible("E:",true); + childSetText("E:", "E: " + mask_to_string(everyone_mask_on)); + childSetVisible("E:", TRUE); - perm_string = "N: "; - perm_string += mask_to_string(next_owner_mask_on); - childSetText("N:",perm_string); - childSetVisible("N:",true); + childSetText("N:", "N: " + mask_to_string(next_owner_mask_on)); + childSetVisible("N:", TRUE); } - perm_string = "F: "; + U32 flag_mask = 0x0; - if (objectp->permMove()) - flag_mask |= PERM_MOVE; - if (objectp->permModify()) - flag_mask |= PERM_MODIFY; - if (objectp->permCopy()) - flag_mask |= PERM_COPY; - if (objectp->permTransfer()) - flag_mask |= PERM_TRANSFER; - perm_string += mask_to_string(flag_mask); - childSetText("F:",perm_string); - childSetVisible("F:",true); + if (objectp->permMove()) flag_mask |= PERM_MOVE; + if (objectp->permModify()) flag_mask |= PERM_MODIFY; + if (objectp->permCopy()) flag_mask |= PERM_COPY; + if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER; + + childSetText("F:", "F:" + mask_to_string(flag_mask)); + childSetVisible("F:", TRUE); } else { - childSetVisible("B:",false); - childSetVisible("O:",false); - childSetVisible("G:",false); - childSetVisible("E:",false); - childSetVisible("N:",false); - childSetVisible("F:",false); + childSetVisible("B:", FALSE); + childSetVisible("O:", FALSE); + childSetVisible("G:", FALSE); + childSetVisible("E:", FALSE); + childSetVisible("N:", FALSE); + childSetVisible("F:", FALSE); } - bool has_change_perm_ability = false; - bool has_change_sale_ability = false; + BOOL has_change_perm_ability = FALSE; + BOOL has_change_sale_ability = FALSE; - if(valid_base_perms - && (self_owned - || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) + if (valid_base_perms && + (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) { - has_change_perm_ability = true; + has_change_perm_ability = TRUE; } - if(valid_base_perms - && (self_owned - || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) + if (valid_base_perms && + (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) { - has_change_sale_ability = true; + has_change_sale_ability = TRUE; } if (!has_change_perm_ability && !has_change_sale_ability && !root_selected) { // ...must select root to choose permissions - childSetValue("perm_modify", getString("text modify warning")); + childSetValue("perm_modify", getString("text modify warning")); } if (has_change_perm_ability) { - childSetEnabled("checkbox share with group",true); - childSetEnabled("checkbox allow everyone move",owner_mask_on & PERM_MOVE); - childSetEnabled("checkbox allow everyone copy",owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER); + childSetEnabled("checkbox share with group", TRUE); + childSetEnabled("checkbox allow everyone move", owner_mask_on & PERM_MOVE); + childSetEnabled("checkbox allow everyone copy", owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER); } else { - childSetEnabled("checkbox share with group", FALSE); - childSetEnabled("checkbox allow everyone move", FALSE); - childSetEnabled("checkbox allow everyone copy", FALSE); + childSetEnabled("checkbox share with group", FALSE); + childSetEnabled("checkbox allow everyone move", FALSE); + childSetEnabled("checkbox allow everyone copy", FALSE); } if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) { - childSetEnabled("checkbox for sale", can_transfer || (!can_transfer && num_for_sale)); + childSetEnabled("checkbox for sale", can_transfer || (!can_transfer && num_for_sale)); // Set the checkbox to tentative if the prices of each object selected // are not the same. - childSetTentative("checkbox for sale", is_for_sale_mixed); - childSetEnabled("sale type",num_for_sale && can_transfer && !is_sale_price_mixed); + childSetTentative("checkbox for sale", is_for_sale_mixed); + childSetEnabled("sale type", num_for_sale && can_transfer && !is_sale_price_mixed); - childSetEnabled("Next owner can:", TRUE); - childSetEnabled("checkbox next owner can modify",base_mask_on & PERM_MODIFY); - childSetEnabled("checkbox next owner can copy",base_mask_on & PERM_COPY); - childSetEnabled("checkbox next owner can transfer",next_owner_mask_on & PERM_COPY); + childSetEnabled("Next owner can:", TRUE); + childSetEnabled("checkbox next owner can modify", base_mask_on & PERM_MODIFY); + childSetEnabled("checkbox next owner can copy", base_mask_on & PERM_COPY); + childSetEnabled("checkbox next owner can transfer", next_owner_mask_on & PERM_COPY); } else { - childSetEnabled("checkbox for sale",FALSE); - childSetEnabled("sale type",FALSE); + childSetEnabled("checkbox for sale", FALSE); + childSetEnabled("sale type", FALSE); - childSetEnabled("Next owner can:",FALSE); - childSetEnabled("checkbox next owner can modify",FALSE); - childSetEnabled("checkbox next owner can copy",FALSE); - childSetEnabled("checkbox next owner can transfer",FALSE); + childSetEnabled("Next owner can:", FALSE); + childSetEnabled("checkbox next owner can modify", FALSE); + childSetEnabled("checkbox next owner can copy", FALSE); + childSetEnabled("checkbox next owner can transfer", FALSE); } - if(valid_group_perms) + if (valid_group_perms) { - if((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE)) + if ((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE)) { - childSetValue("checkbox share with group",TRUE); - childSetTentative("checkbox share with group",FALSE); - childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); + childSetValue("checkbox share with group", TRUE); + childSetTentative("checkbox share with group", FALSE); + childSetEnabled("button deed", gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } - else if((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) + else if ((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) { - childSetValue("checkbox share with group",FALSE); - childSetTentative("checkbox share with group",false); - childSetEnabled("button deed",false); + childSetValue("checkbox share with group", FALSE); + childSetTentative("checkbox share with group", FALSE); + childSetEnabled("button deed", FALSE); } else { - childSetValue("checkbox share with group",TRUE); - childSetTentative("checkbox share with group",true); - childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); + childSetValue("checkbox share with group", TRUE); + childSetTentative("checkbox share with group", TRUE); + childSetEnabled("button deed", gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } } - if(valid_everyone_perms) + if (valid_everyone_perms) { // Move - if(everyone_mask_on & PERM_MOVE) + if (everyone_mask_on & PERM_MOVE) { - childSetValue("checkbox allow everyone move",TRUE); - childSetTentative("checkbox allow everyone move",false); + childSetValue("checkbox allow everyone move", TRUE); + childSetTentative("checkbox allow everyone move", FALSE); } - else if(everyone_mask_off & PERM_MOVE) + else if (everyone_mask_off & PERM_MOVE) { - childSetValue("checkbox allow everyone move",FALSE); - childSetTentative("checkbox allow everyone move",false); + childSetValue("checkbox allow everyone move", FALSE); + childSetTentative("checkbox allow everyone move", FALSE); } else { - childSetValue("checkbox allow everyone move",TRUE); - childSetTentative("checkbox allow everyone move",true); + childSetValue("checkbox allow everyone move", TRUE); + childSetTentative("checkbox allow everyone move", TRUE); } // Copy == everyone can't copy - if(everyone_mask_on & PERM_COPY) + if (everyone_mask_on & PERM_COPY) { - childSetValue("checkbox allow everyone copy",TRUE); - childSetTentative("checkbox allow everyone copy",!can_copy || !can_transfer); + childSetValue("checkbox allow everyone copy", TRUE); + childSetTentative("checkbox allow everyone copy", !can_copy || !can_transfer); } - else if(everyone_mask_off & PERM_COPY) + else if (everyone_mask_off & PERM_COPY) { - childSetValue("checkbox allow everyone copy",FALSE); - childSetTentative("checkbox allow everyone copy",false); + childSetValue("checkbox allow everyone copy", FALSE); + childSetTentative("checkbox allow everyone copy", FALSE); } else { - childSetValue("checkbox allow everyone copy",TRUE); - childSetTentative("checkbox allow everyone copy",true); + childSetValue("checkbox allow everyone copy", TRUE); + childSetTentative("checkbox allow everyone copy", TRUE); } } - if(valid_next_perms) + if (valid_next_perms) { // Modify == next owner canot modify - if(next_owner_mask_on & PERM_MODIFY) + if (next_owner_mask_on & PERM_MODIFY) { - childSetValue("checkbox next owner can modify",TRUE); - childSetTentative("checkbox next owner can modify",false); + childSetValue("checkbox next owner can modify", TRUE); + childSetTentative("checkbox next owner can modify", FALSE); } - else if(next_owner_mask_off & PERM_MODIFY) + else if (next_owner_mask_off & PERM_MODIFY) { - childSetValue("checkbox next owner can modify",FALSE); - childSetTentative("checkbox next owner can modify",false); + childSetValue("checkbox next owner can modify", FALSE); + childSetTentative("checkbox next owner can modify", FALSE); } else { - childSetValue("checkbox next owner can modify",TRUE); - childSetTentative("checkbox next owner can modify",true); + childSetValue("checkbox next owner can modify", TRUE); + childSetTentative("checkbox next owner can modify", TRUE); } // Copy == next owner cannot copy - if(next_owner_mask_on & PERM_COPY) + if (next_owner_mask_on & PERM_COPY) { - childSetValue("checkbox next owner can copy",TRUE); - childSetTentative("checkbox next owner can copy",!can_copy); + childSetValue("checkbox next owner can copy", TRUE); + childSetTentative("checkbox next owner can copy", !can_copy); } - else if(next_owner_mask_off & PERM_COPY) + else if (next_owner_mask_off & PERM_COPY) { - childSetValue("checkbox next owner can copy",FALSE); - childSetTentative("checkbox next owner can copy",FALSE); + childSetValue("checkbox next owner can copy", FALSE); + childSetTentative("checkbox next owner can copy", FALSE); } else { - childSetValue("checkbox next owner can copy",TRUE); - childSetTentative("checkbox next owner can copy",TRUE); + childSetValue("checkbox next owner can copy", TRUE); + childSetTentative("checkbox next owner can copy", TRUE); } // Transfer == next owner cannot transfer - if(next_owner_mask_on & PERM_TRANSFER) + if (next_owner_mask_on & PERM_TRANSFER) { - childSetValue("checkbox next owner can transfer",TRUE); - childSetTentative("checkbox next owner can transfer",!can_transfer); + childSetValue("checkbox next owner can transfer", TRUE); + childSetTentative("checkbox next owner can transfer", !can_transfer); } - else if(next_owner_mask_off & PERM_TRANSFER) + else if (next_owner_mask_off & PERM_TRANSFER) { - childSetValue("checkbox next owner can transfer",FALSE); - childSetTentative("checkbox next owner can transfer",FALSE); + childSetValue("checkbox next owner can transfer", FALSE); + childSetTentative("checkbox next owner can transfer", FALSE); } else { - childSetValue("checkbox next owner can transfer",TRUE); - childSetTentative("checkbox next owner can transfer",TRUE); + childSetValue("checkbox next owner can transfer", TRUE); + childSetTentative("checkbox next owner can transfer", TRUE); } } @@ -800,48 +775,51 @@ void LLPanelPermissions::refresh() LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type"); if (valid_sale_info) { - combo_sale_type->setValue(sale_type == LLSaleInfo::FS_NOT ? LLSaleInfo::FS_COPY : sale_type); - combo_sale_type->setTentative(FALSE); // unfortunately this doesn't do anything at the moment. + combo_sale_type->setValue( sale_type == LLSaleInfo::FS_NOT ? LLSaleInfo::FS_COPY : sale_type); + combo_sale_type->setTentative( FALSE); // unfortunately this doesn't do anything at the moment. } else { // default option is sell copy, determined to be safest - combo_sale_type->setValue(LLSaleInfo::FS_COPY); - combo_sale_type->setTentative(TRUE); // unfortunately this doesn't do anything at the moment. + combo_sale_type->setValue( LLSaleInfo::FS_COPY); + combo_sale_type->setTentative( TRUE); // unfortunately this doesn't do anything at the moment. } - childSetValue("checkbox for sale", num_for_sale != 0); + childSetValue("checkbox for sale", (num_for_sale != 0)); // HACK: There are some old objects in world that are set for sale, // but are no-transfer. We need to let users turn for-sale off, but only // if for-sale is set. bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY); - if (num_for_sale && has_change_sale_ability && cannot_actually_sell) + if (cannot_actually_sell) { - childSetEnabled("checkbox for sale", true); + if (num_for_sale && has_change_sale_ability) + { + childSetEnabled("checkbox for sale", true); + } } - + // Check search status of objects - BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); + const BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); bool include_in_search; - bool all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); - childSetEnabled("search_check", has_change_sale_ability && all_volume); - childSetValue("search_check", include_in_search); - childSetTentative("search_check", ! all_include_in_search); + const BOOL all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); + childSetEnabled("search_check", has_change_sale_ability && all_volume); + childSetValue("search_check", include_in_search); + childSetTentative("search_check", !all_include_in_search); // Click action (touch, sit, buy) U8 click_action = 0; if (LLSelectMgr::getInstance()->selectionGetClickAction(&click_action)) { - LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction"); - if(ComboClickAction) + LLComboBox* combo_click_action = getChild<LLComboBox>("clickaction"); + if(combo_click_action) { - std::string combo_value = click_action_to_string_value(click_action); - ComboClickAction->setValue(LLSD(combo_value)); + const std::string combo_value = click_action_to_string_value(click_action); + combo_click_action->setValue(LLSD(combo_value)); } } - childSetEnabled("label click action",is_perm_modify && all_volume); - childSetEnabled("clickaction",is_perm_modify && all_volume); + childSetEnabled("label click action", is_perm_modify && all_volume); + childSetEnabled("clickaction", is_perm_modify && all_volume); } |