diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp index 34354e3e8..f41fce8ed 100644 --- a/indra/llinventory/llpermissions.cpp +++ b/indra/llinventory/llpermissions.cpp @@ -1022,6 +1022,16 @@ void mask_to_string(U32 mask, char* str) { *str = ' '; } + str++; + + if (mask & PERM_EXPORT) + { + *str = 'E'; + } + else + { + *str = ' '; + } str++; *str = '\0'; } diff --git a/indra/llinventory/llpermissionsflags.h b/indra/llinventory/llpermissionsflags.h index f810929d6..02224d0c8 100644 --- a/indra/llinventory/llpermissionsflags.h +++ b/indra/llinventory/llpermissionsflags.h @@ -52,6 +52,9 @@ const PermissionBit PERM_MODIFY = (1 << 14); // 0x00004000 // objects, allow copy const PermissionBit PERM_COPY = (1 << 15); // 0x00008000 +// objects, allow exporting +const PermissionBit PERM_EXPORT = (1 << 16); // 0x00010000 + // parcels, allow entry, deprecated //const PermissionBit PERM_ENTER = (1 << 16); // 0x00010000 diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 9e3abed3e..c5dcff371 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -97,6 +97,7 @@ set(viewer_SOURCE_FILES hippopanelgrids.cpp importtracker.cpp jcfloaterareasearch.cpp + lfsimfeaturehandler.cpp lggdicdownload.cpp lgghunspell_wrapper.cpp llaccountingcostmanager.cpp @@ -597,6 +598,7 @@ set(viewer_HEADER_FILES hippopanelgrids.h importtracker.h jcfloaterareasearch.h + lfsimfeaturehandler.h lggdicdownload.h lgghunspell_wrapper.h llaccountingcostmanager.h diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index d30cb4343..b591a82db 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -314,6 +314,17 @@ Value 0 + EveryoneExport + + Comment + Whether content you upload has exportability permission by default + Persist + 1 + Type + Boolean + Value + 0 + RLVaLoginLastLocation Comment diff --git a/indra/newview/lfsimfeaturehandler.cpp b/indra/newview/lfsimfeaturehandler.cpp new file mode 100644 index 000000000..bce7124ae --- /dev/null +++ b/indra/newview/lfsimfeaturehandler.cpp @@ -0,0 +1,66 @@ +/* Copyright (C) 2013 Liru Færs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA */ + +#include "llviewerprecompiledheaders.h" + +#include "lfsimfeaturehandler.h" + +#include "llagent.h" +#include "llenvmanager.h" +#include "llviewerregion.h" +#include "hippogridmanager.h" + +LFSimFeatureHandler::LFSimFeatureHandler() +: mSupportsExport(false) +{ + if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) // Remove this line if we ever handle SecondLife sim features + LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LFSimFeatureHandler::handleRegionChange, this)); +} + +void LFSimFeatureHandler::handleRegionChange() +{ + if (LLViewerRegion* region = gAgent.getRegion()) + { + if (region->getFeaturesReceived()) + { + setSupportedFeatures(); + } + else + { + region->setFeaturesReceivedCallback(boost::bind(&LFSimFeatureHandler::setSupportedFeatures, this)); + } + } +} + +void LFSimFeatureHandler::setSupportedFeatures() +{ + if (LLViewerRegion* region = gAgent.getRegion()) + { + LLSD info; + region->getSimulatorFeatures(info); + //if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) // Non-SL specific sim features + { + mSupportsExport = info.has("ExportSupported"); + } + } +} + +boost::signals2::connection LFSimFeatureHandler::setSupportsExportCallback(const boost::signals2::signal::slot_type& slot) +{ + return mSupportsExport.connect(slot); +} + diff --git a/indra/newview/lfsimfeaturehandler.h b/indra/newview/lfsimfeaturehandler.h new file mode 100644 index 000000000..070d6ba1e --- /dev/null +++ b/indra/newview/lfsimfeaturehandler.h @@ -0,0 +1,70 @@ +/* Copyright (C) 2013 Liru Færs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA */ + +#ifndef LFSIMFEATUREHANDLER_H +#define LFSIMFEATUREHANDLER_H + +#include "llsingleton.h" + +template +class SignaledType +{ +public: + SignaledType(Type b) : mValue(b) {} + + template + boost::signals2::connection connect(Slot slot) { return mSignal.connect(slot); } + + SignaledType& operator =(Type val) + { + if (val != mValue) + { + mValue = val; + mSignal(); + } + return *this; + } + operator Type() const { return mValue; } + +private: + boost::signals2::signal mSignal; + Type mValue; +}; + +class LFSimFeatureHandler : public LLSingleton +{ +protected: + friend class LLSingleton; + LFSimFeatureHandler(); + +public: + void handleRegionChange(); + void setSupportedFeatures(); + + // Connection setters + boost::signals2::connection setSupportsExportCallback(const boost::signals2::signal::slot_type& slot); + + // Accessors + bool simSupportsExport() const { return mSupportsExport; } + +private: + // SignaledTypes + SignaledType mSupportsExport; +}; + +#endif //LFSIMFEATUREHANDLER_H + diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index c841278d3..01ed3f0c1 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -188,9 +188,14 @@ void LLFloaterChat::handleVisibilityChange(BOOL new_visibility) void LLFloaterChat::onFocusReceived() { LLView* chat_editor = getChildView("Chat Editor"); - if (childIsVisible("Chat Editor")) + if (getVisible() && childIsVisible("Chat Editor")) + { gFocusMgr.setKeyboardFocus(chat_editor); + LLUICtrl * ctrl = static_cast(chat_editor); + ctrl->setFocus(TRUE); + } + LLFloater::onFocusReceived(); } @@ -747,9 +752,13 @@ void LLFloaterChat::hide(LLFloater* instance, const LLSD& key) BOOL LLFloaterChat::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash ) { LLView* chat_editor = getChildView("Chat Editor"); - if (childIsVisible("Chat Editor")) + if (getVisible() && childIsVisible("Chat Editor")) { gFocusMgr.setKeyboardFocus(chat_editor); + + LLUICtrl * ctrl = static_cast(chat_editor); + ctrl->setFocus(TRUE); + return TRUE; } diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index ccbeb8c5c..9a094ad58 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -32,6 +32,7 @@ */ #include "llviewerprecompiledheaders.h" +#include "lfsimfeaturehandler.h" #include "llalertdialog.h" #include "llcheckboxctrl.h" #include "llfloaterperms.h" @@ -40,7 +41,35 @@ #include "llviewerwindow.h" #include "lluictrlfactory.h" #include "llpermissions.h" +#include "hippogridmanager.h" +namespace +{ + bool everyone_export; + void handle_checkboxes(LLUICtrl* ctrl, const LLSD& value) + { + LLPanel* view = static_cast(ctrl->getParent()); + if (ctrl->getName() == "everyone_export") + { + view->childSetEnabled("next_owner_copy", !value); + view->childSetEnabled("next_owner_modify", !value); + view->childSetEnabled("next_owner_transfer", !value); + } + else + { + if (ctrl->getName() == "next_owner_copy") + { + if (!value) // Implements fair use + gSavedSettings.setBOOL("NextOwnerTransfer", true); + view->childSetEnabled("next_owner_transfer", value); + } + if (!value) // If any of these are unchecked, export can no longer be checked. + view->childSetEnabled("everyone_export", false); + else + view->childSetEnabled("everyone_export", LFSimFeatureHandler::instance().simSupportsExport() && (LLFloaterPerms::getNextOwnerPerms() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED); + } + } +} LLFloaterPerms::LLFloaterPerms(const LLSD& seed) { @@ -49,11 +78,35 @@ LLFloaterPerms::LLFloaterPerms(const LLSD& seed) BOOL LLFloaterPerms::postBuild() { - childSetEnabled("next_owner_transfer", gSavedSettings.getBOOL("NextOwnerCopy")); + //handle_checkboxes + { + bool export_support = LFSimFeatureHandler::instance().simSupportsExport(); + const U32 next_owner_perms = getNextOwnerPerms(); + childSetEnabled("everyone_export", export_support && (next_owner_perms & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED); + if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) + childSetVisible("everyone_export", false); + + if (!(next_owner_perms & PERM_COPY)) + { + childSetEnabled("next_owner_transfer", false); + } + else if (export_support) + { + bool export_off = !gSavedPerAccountSettings.getBOOL("EveryoneExport"); + childSetEnabled("next_owner_copy", export_off); + childSetEnabled("next_owner_modify", export_off); + childSetEnabled("next_owner_transfer", export_off); + } + else // Set EveryoneExport false, just in case. + gSavedPerAccountSettings.setBOOL("EveryoneExport", false); + } childSetAction("help", onClickHelp, this); childSetAction("ok", onClickOK, this); childSetAction("cancel", onClickCancel, this); - childSetCommitCallback("next_owner_copy", &onCommitCopy, this); + getChild("next_owner_copy")->setCommitCallback(handle_checkboxes); + getChild("next_owner_modify")->setCommitCallback(handle_checkboxes); + getChild("next_owner_transfer")->setCommitCallback(handle_checkboxes); + getChild("everyone_export")->setCommitCallback(handle_checkboxes); refresh(); @@ -76,20 +129,6 @@ void LLFloaterPerms::onClickCancel(void* data) self->close(); } -//static -void LLFloaterPerms::onCommitCopy(LLUICtrl* ctrl, void* data) -{ - LLFloaterPerms* self = static_cast(data); - // Implements fair use - BOOL copyable = gSavedSettings.getBOOL("NextOwnerCopy"); - if(!copyable) - { - gSavedSettings.setBOOL("NextOwnerTransfer", TRUE); - } - LLCheckBoxCtrl* xfer = self->getChild("next_owner_transfer"); - xfer->setEnabled(copyable); -} - void LLFloaterPerms::ok() { refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official. @@ -102,6 +141,7 @@ void LLFloaterPerms::cancel() gSavedSettings.setBOOL("NextOwnerCopy", mNextOwnerCopy); gSavedSettings.setBOOL("NextOwnerModify", mNextOwnerModify); gSavedSettings.setBOOL("NextOwnerTransfer", mNextOwnerTransfer); + gSavedPerAccountSettings.setBOOL("EveryoneExport", everyone_export); } void LLFloaterPerms::refresh() @@ -111,6 +151,7 @@ void LLFloaterPerms::refresh() mNextOwnerCopy = gSavedSettings.getBOOL("NextOwnerCopy"); mNextOwnerModify = gSavedSettings.getBOOL("NextOwnerModify"); mNextOwnerTransfer = gSavedSettings.getBOOL("NextOwnerTransfer"); + everyone_export = gSavedPerAccountSettings.getBOOL("EveryoneExport"); } void LLFloaterPerms::onClose(bool app_quitting) @@ -130,7 +171,12 @@ U32 LLFloaterPerms::getGroupPerms(std::string prefix) //static U32 LLFloaterPerms::getEveryonePerms(std::string prefix) { - return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE; + U32 flags = PERM_NONE; + if (LFSimFeatureHandler::instance().simSupportsExport() && prefix.empty() && gSavedPerAccountSettings.getBOOL("EveryoneExport")) // TODO: Bulk enable export? + flags |= PERM_EXPORT; + if (gSavedSettings.getBOOL(prefix+"EveryoneCopy")) + flags |= PERM_COPY; + return flags; } //static diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index 805039efe..9193b5983 100644 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -47,7 +47,6 @@ public: void cancel(); static void onClickOK(void*); static void onClickCancel(void*); - static void onCommitCopy(LLUICtrl* ctrl, void* data); // Convenience methods to get current permission preference bitfields from saved settings: static U32 getEveryonePerms(std::string prefix=""); // prefix + "EveryoneCopy" static U32 getGroupPerms(std::string prefix=""); // prefix + "ShareWithGroup" diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 34a51e018..cbd42ac0b 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -60,6 +60,7 @@ #include "lluictrlfactory.h" +#include "lfsimfeaturehandler.h" #include "hippogridmanager.h" @@ -67,6 +68,8 @@ #include "rlvhandler.h" // [/RLVa:KB] +bool can_set_export(const U32& base, const U32& own, const U32& next); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLPropertiesObserver // @@ -197,6 +200,9 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& // everyone permissions childSetCommitCallback("CheckEveryoneCopy",&onCommitPermissions, this); childSetCommitCallback("CheckEveryoneMove",&onCommitPermissions, this); + childSetCommitCallback("CheckExport", &onCommitPermissions, this); + if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) + LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLFloaterProperties::refresh, this)); // next owner permissions childSetCommitCallback("CheckNextOwnerModify",&onCommitPermissions, this); childSetCommitCallback("CheckNextOwnerCopy",&onCommitPermissions, this); @@ -251,11 +257,13 @@ void LLFloaterProperties::refresh() "CheckOwnerModify", "CheckOwnerCopy", "CheckOwnerTransfer", + "CheckOwnerExport", "CheckGroupCopy", "CheckGroupMod", "CheckGroupMove", "CheckEveryoneCopy", "CheckEveryoneMove", + "CheckExport", "CheckNextOwnerModify", "CheckNextOwnerCopy", "CheckNextOwnerTransfer", @@ -437,6 +445,12 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) childSetEnabled("CheckOwnerTransfer",FALSE); childSetValue("CheckOwnerTransfer",LLSD((BOOL)(owner_mask & PERM_TRANSFER))); + bool supports_export = LFSimFeatureHandler::instance().simSupportsExport(); + childSetEnabled("CheckOwnerExport",false); + childSetValue("CheckOwnerExport", supports_export && owner_mask & PERM_EXPORT); + if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) + childSetVisible("CheckOwnerExport", false); + /////////////////////// // DEBUG PERMISSIONS // /////////////////////// @@ -459,11 +473,15 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) perm_string = "B: "; perm_string += mask_to_string(base_mask); + if (!supports_export && base_mask & PERM_EXPORT) // Hide Export when not available + perm_string.erase(perm_string.find_last_of("E")); childSetText("BaseMaskDebug",perm_string); childSetVisible("BaseMaskDebug",TRUE); perm_string = "O: "; perm_string += mask_to_string(owner_mask); + if (!supports_export && owner_mask & PERM_EXPORT) // Hide Export when not available + perm_string.erase(perm_string.find_last_of("E")); childSetText("OwnerMaskDebug",perm_string); childSetVisible("OwnerMaskDebug",TRUE); @@ -476,6 +494,8 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) perm_string = "E"; perm_string += overwrite_everyone ? "*: " : ": "; perm_string += mask_to_string(everyone_mask); + if (!supports_export && everyone_mask & PERM_EXPORT) // Hide Export when not available + perm_string.erase(perm_string.find_last_of("E")); childSetText("EveryoneMaskDebug",perm_string); childSetVisible("EveryoneMaskDebug",TRUE); @@ -519,6 +539,8 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) childSetEnabled("CheckEveryoneCopy",false); childSetEnabled("CheckEveryoneMove",false); } + childSetEnabled("CheckExport", supports_export && item->getType() != LLAssetType::AT_OBJECT && gAgentID == item->getCreatorUUID() + && can_set_export(base_mask, owner_mask, next_owner_mask)); // Set values. BOOL is_group_copy = (group_mask & PERM_COPY) ? TRUE : FALSE; @@ -531,6 +553,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) childSetValue("CheckEveryoneCopy",LLSD((BOOL)(everyone_mask & PERM_COPY))); childSetValue("CheckEveryoneMove",LLSD((BOOL)(everyone_mask & PERM_MOVE))); + childSetValue("CheckExport", supports_export && everyone_mask & PERM_EXPORT); /////////////// // SALE INFO // @@ -545,10 +568,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) childSetEnabled("SaleLabel",is_complete); childSetEnabled("CheckPurchase",is_complete); - childSetEnabled("NextOwnerLabel",TRUE); - childSetEnabled("CheckNextOwnerModify",base_mask & PERM_MODIFY); - childSetEnabled("CheckNextOwnerCopy",base_mask & PERM_COPY); - childSetEnabled("CheckNextOwnerTransfer",next_owner_mask & PERM_COPY); + bool no_export = !(everyone_mask & PERM_EXPORT); // Next owner perms can't be changed if set + childSetEnabled("NextOwnerLabel", no_export); + childSetEnabled("CheckNextOwnerModify", no_export && base_mask & PERM_MODIFY); + childSetEnabled("CheckNextOwnerCopy", no_export && base_mask & PERM_COPY); + childSetEnabled("CheckNextOwnerTransfer", no_export && next_owner_mask & PERM_COPY); childSetEnabled("RadioSaleType",is_complete && is_for_sale); childSetEnabled("TextPrice",is_complete && is_for_sale); @@ -750,6 +774,11 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), CheckEveryoneCopy->get(), PERM_COPY); } + LLCheckBoxCtrl* CheckExport = self->getChild("CheckExport"); + if(CheckExport) + { + perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), CheckExport->get(), PERM_EXPORT); + } LLCheckBoxCtrl* CheckNextOwnerModify = self->getChild("CheckNextOwnerModify"); if(CheckNextOwnerModify) diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 1ec2be0df..7c9cd398a 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -2609,9 +2609,13 @@ const bool LLFloaterIMPanel::isModerator(const LLUUID& speaker_id) BOOL LLFloaterIMPanel::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash ) { LLView* chat_editor = getChildView("chat_editor"); - if (childIsVisible("chat_editor")) + if (getVisible() && childIsVisible("chat_editor")) { gFocusMgr.setKeyboardFocus(chat_editor); + + LLUICtrl * ctrl = static_cast(chat_editor); + ctrl->setFocus(TRUE); + return TRUE; } @@ -2621,8 +2625,13 @@ BOOL LLFloaterIMPanel::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash void LLFloaterIMPanel::onFocusReceived() { LLView* chat_editor = getChildView("chat_editor"); - if (childIsVisible("chat_editor")) + if (getVisible() && childIsVisible("chat_editor")) + { gFocusMgr.setKeyboardFocus(chat_editor); + LLUICtrl * ctrl = static_cast(chat_editor); + ctrl->setFocus(TRUE); + } + LLFloater::onFocusReceived(); } diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 99ea6e9c4..019bf507f 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -67,7 +67,9 @@ #include "lluictrlfactory.h" #include "roles_constants.h" #include "lltrans.h" +#include "llinventoryfunctions.h" +#include "lfsimfeaturehandler.h" #include "hippogridmanager.h" @@ -76,6 +78,32 @@ #include "rlvhandler.h" // [/RLVa:KB] +// base and own must have EXPORT, next owner must be UNRESTRICTED +bool can_set_export(const U32& base, const U32& own, const U32& next) +{ + return base & PERM_EXPORT && own & PERM_EXPORT && (next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED; +} + +bool perms_allow_export(const LLPermissions& perms) +{ + return perms.getMaskBase() & PERM_EXPORT && perms.getMaskEveryone() & PERM_EXPORT; +} + +bool is_asset_exportable(const LLUUID& asset_id) +{ + if (asset_id.isNull()) return true; // Don't permission-check null textures + LLViewerInventoryCategory::cat_array_t cats; + LLViewerInventoryItem::item_array_t items; + LLAssetIDMatches asset_id_matches(asset_id); + gInventory.collectDescendentsIf(LLUUID::null, cats, items, true, asset_id_matches, false); + + for (int i = 0; i < items.count(); ++i) + { + if (perms_allow_export(items[i]->getPermissions())) return true; + } + return false; +} + ///---------------------------------------------------------------------------- /// Class llpanelpermissions ///---------------------------------------------------------------------------- @@ -112,6 +140,8 @@ BOOL LLPanelPermissions::postBuild() childSetCommitCallback("checkbox allow everyone copy",LLPanelPermissions::onCommitEveryoneCopy,this); + getChild("checkbox allow export")->setCommitCallback(boost::bind(&LLPanelPermissions::onCommitExport, this, _2)); + childSetCommitCallback("checkbox for sale",LLPanelPermissions::onCommitSaleInfo,this); childSetCommitCallback("Edit Cost",LLPanelPermissions::onCommitSaleInfo,this); @@ -136,6 +166,9 @@ BOOL LLPanelPermissions::postBuild() mLabelGroupName = NULL; } + if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) + LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLPanelPermissions::refresh, this)); + return TRUE; } @@ -145,6 +178,14 @@ LLPanelPermissions::~LLPanelPermissions() // base class will take care of everything } +// virtual +void LLPanelPermissions::handleVisibilityChange(BOOL new_visibility) +{ + llwarns << "Hey, does this warning show whenever you switch to this tab?" << llendl; // Find out if the addition of this function is actually worthwhile. + if (new_visibility) + refresh(); + LLPanel::handleVisibilityChange(new_visibility); +} void LLPanelPermissions::refresh() { @@ -223,10 +264,13 @@ void LLPanelPermissions::refresh() childSetEnabled("checkbox share with group",false); childSetEnabled("button deed",false); + childSetEnabled("text anyone can", 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); + childSetValue("checkbox allow export", false); + childSetEnabled("checkbox allow export", false); //Next owner can: childSetEnabled("Next owner can:",false); @@ -601,6 +645,7 @@ void LLPanelPermissions::refresh() &next_owner_mask_on, &next_owner_mask_off); + bool supports_export = LFSimFeatureHandler::instance().simSupportsExport(); if( gSavedSettings.getBOOL("DebugPermissions") ) { @@ -610,6 +655,8 @@ void LLPanelPermissions::refresh() { perm_string = "B: "; perm_string += mask_to_string(base_mask_on); + if (!supports_export && base_mask_on & PERM_EXPORT) // Hide Export when not available + perm_string.erase(perm_string.find_last_of("E")); if (U32 diff_mask = base_mask_on ^ owner_mask_on) // When different, show the user's potential permissions lowercase. { if (diff_mask & PERM_MOVE) @@ -620,12 +667,16 @@ void LLPanelPermissions::refresh() LLStringUtil::replaceChar(perm_string, 'C', 'c'); if (diff_mask & PERM_TRANSFER) LLStringUtil::replaceChar(perm_string, 'T', 't'); + if (diff_mask & PERM_EXPORT) + LLStringUtil::replaceChar(perm_string, 'E', 'e'); } childSetText("B:",perm_string); childSetVisible("B:",true); perm_string = "O: "; perm_string += mask_to_string(owner_mask_on); + if (!supports_export && owner_mask_on & PERM_EXPORT) // Hide Export when not available + perm_string.erase(perm_string.find_last_of("E")); childSetText("O:",perm_string); childSetVisible("O:",true); @@ -636,6 +687,8 @@ void LLPanelPermissions::refresh() perm_string = "E: "; perm_string += mask_to_string(everyone_mask_on); + if (!supports_export && everyone_mask_on & PERM_EXPORT) // Hide Export when not available + perm_string.erase(perm_string.find_last_of("E")); childSetText("E:",perm_string); childSetVisible("E:",true); @@ -688,16 +741,41 @@ void LLPanelPermissions::refresh() if (has_change_perm_ability) { childSetEnabled("checkbox share with group",true); + childSetEnabled("text anyone can", 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("text anyone can", false); childSetEnabled("checkbox allow everyone move", FALSE); childSetEnabled("checkbox allow everyone copy", FALSE); } + // Is this user allowed to toggle export on this object? + if (supports_export && self_owned && mCreatorID == mOwnerID && can_set_export(base_mask_on, owner_mask_on, next_owner_mask_on)) + { + bool can_export = true; + LLInventoryObject::object_list_t objects; + objectp->getInventoryContents(objects); + for (LLInventoryObject::object_list_t::iterator i = objects.begin(); can_export && i != objects.end() ; ++i) //The object's inventory must have EXPORT. + { + LLViewerInventoryItem* item = static_cast(i->get()); //getInventoryContents() filters out categories, static_cast. + can_export = perms_allow_export(item->getPermissions()); + } + for (U8 i = 0; can_export && i < objectp->getNumTEs(); ++i) // Can the textures be exported? + if (LLTextureEntry* texture = objectp->getTE(i)) + can_export = is_asset_exportable(texture->getID()); + childSetEnabled("checkbox allow export", can_export); + } + else + { + childSetEnabled("checkbox allow export", false); + if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) + childSetVisible("checkbox allow export", false); + } + if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) { childSetEnabled("checkbox for sale", can_transfer || (!can_transfer && num_for_sale)); @@ -706,10 +784,11 @@ void LLPanelPermissions::refresh() 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); + bool no_export = everyone_mask_off & PERM_EXPORT; // Next owner perms can't be changed if set + childSetEnabled("Next owner can:", no_export); + childSetEnabled("checkbox next owner can modify", no_export && base_mask_on & PERM_MODIFY); + childSetEnabled("checkbox next owner can copy", no_export && base_mask_on & PERM_COPY); + childSetEnabled("checkbox next owner can transfer", no_export && next_owner_mask_on & PERM_COPY); } else { @@ -779,6 +858,31 @@ void LLPanelPermissions::refresh() childSetValue("checkbox allow everyone copy",TRUE); childSetTentative("checkbox allow everyone copy",true); } + + // Export + if (supports_export) + { + if(everyone_mask_on & PERM_EXPORT) + { + childSetValue("checkbox allow export", true); + childSetTentative("checkbox allow export", false); + } + else if(everyone_mask_off & PERM_EXPORT) + { + childSetValue("checkbox allow export", false); + childSetTentative("checkbox allow export", false); + } + else + { + childSetValue("checkbox allow export", true); + childSetTentative("checkbox allow export", true); + } + } + else + { + childSetValue("checkbox allow export", false); + childSetTentative("checkbox allow export", false); + } } if(valid_next_perms) @@ -1064,6 +1168,11 @@ void LLPanelPermissions::onCommitEveryoneCopy(LLUICtrl *ctrl, void *data) onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_COPY); } +void LLPanelPermissions::onCommitExport(const LLSD& param) +{ + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_EVERYONE, param, PERM_EXPORT); +} + // static void LLPanelPermissions::onCommitNextOwnerModify(LLUICtrl* ctrl, void* data) { diff --git a/indra/newview/llpanelpermissions.h b/indra/newview/llpanelpermissions.h index 85ac41831..706067a01 100644 --- a/indra/newview/llpanelpermissions.h +++ b/indra/newview/llpanelpermissions.h @@ -57,6 +57,7 @@ public: virtual ~LLPanelPermissions(); virtual BOOL postBuild(); + virtual void handleVisibilityChange(BOOL new_visibility); // MANIPULATORS void refresh(); // refresh all labels as needed @@ -86,6 +87,7 @@ protected: static void onCommitEveryoneMove(LLUICtrl *ctrl, void *data); static void onCommitEveryoneCopy(LLUICtrl *ctrl, void *data); //static void onCommitEveryoneModify(LLUICtrl *ctrl, void *data); + void onCommitExport(const LLSD& param); static void onCommitNextOwnerModify(LLUICtrl* ctrl, void* data); static void onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data); diff --git a/indra/newview/skins/default/xui/en-us/floater_inventory_item_properties.xml b/indra/newview/skins/default/xui/en-us/floater_inventory_item_properties.xml index e29b362a2..f577635bf 100644 --- a/indra/newview/skins/default/xui/en-us/floater_inventory_item_properties.xml +++ b/indra/newview/skins/default/xui/en-us/floater_inventory_item_properties.xml @@ -80,9 +80,10 @@ initial_value="false" label="Copy" left_delta="78" mouse_opaque="true" name="CheckOwnerCopy" radio_style="false" width="88" /> + +