diff options
author | Oz Linden <oz@lindenlab.com> | 2014-03-06 13:01:12 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2014-03-06 13:01:12 -0500 |
commit | 43eae437980226d62898c5f6fdb2a068f3b3c49b (patch) | |
tree | 64912b2398a34b9474e481d2d26f1afb124e7351 /indra | |
parent | 9185f1e25602bb9bc4c2bf7923f2743effa281fa (diff) | |
parent | a0f668c0a382ad4bd7a9be703bbcf1edd2bcf460 (diff) |
merge changes for storm-68
Diffstat (limited to 'indra')
25 files changed, 1375 insertions, 291 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4c7b192ae5..a4c173897c 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3533,17 +3533,6 @@ <key>Value</key> <string>http://events.secondlife.com/viewer/embed/event/</string> </map> - <key>EveryoneCopy</key> - <map> - <key>Comment</key> - <string>Everyone can copy the newly created objects</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> <key>FastCacheFetchEnabled</key> <map> <key>Comment</key> @@ -6426,39 +6415,6 @@ <key>Value</key> <integer>130</integer> </map> - <key>NextOwnerCopy</key> - <map> - <key>Comment</key> - <string>Newly created objects can be copied by next owner</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> - <key>NextOwnerModify</key> - <map> - <key>Comment</key> - <string>Newly created objects can be modified by next owner</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> - <key>NextOwnerTransfer</key> - <map> - <key>Comment</key> - <string>Newly created objects can be resold or given away by next owner</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>1</integer> - </map> <key>NewCacheLocation</key> <map> <key>Comment</key> @@ -10321,17 +10277,6 @@ <key>Value</key> <integer>0</integer> </map> - <key>ShareWithGroup</key> - <map> - <key>Comment</key> - <string>Newly created objects are shared with the currently active group</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> <key>ShowAdvancedGraphicsSettings</key> <map> <key>Comment</key> @@ -14583,6 +14528,347 @@ <key>Value</key> <integer>0</integer> </map> + <key>ObjectsNextOwnerCopy</key> + <map> + <key>Comment</key> + <string>Newly created objects can be copied by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>ObjectsNextOwnerModify</key> + <map> + <key>Comment</key> + <string>Newly created objects can be modified by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>ObjectsNextOwnerTransfer</key> + <map> + <key>Comment</key> + <string>Newly created objects can be resold or given away by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>ObjectsEveryoneCopy</key> + <map> + <key>Comment</key> + <string>Everyone can copy the newly created object</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>ObjectsShareWithGroup</key> + <map> + <key>Comment</key> + <string>Newly created objects are shared with the currently active group</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>UploadsNextOwnerCopy</key> + <map> + <key>Comment</key> + <string>Newly uploaded items can be copied by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>UploadsNextOwnerModify</key> + <map> + <key>Comment</key> + <string>Newly uploaded items can be modified by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>UploadsNextOwnerTransfer</key> + <map> + <key>Comment</key> + <string>Newly uploaded items can be resold or given away by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>UploadsEveryoneCopy</key> + <map> + <key>Comment</key> + <string>Everyone can copy the newly uploaded item</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>UploadsShareWithGroup</key> + <map> + <key>Comment</key> + <string>Newly uploaded items are shared with the currently active group</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>ScriptsNextOwnerCopy</key> + <map> + <key>Comment</key> + <string>Newly created scripts can be copied by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>ScriptsNextOwnerModify</key> + <map> + <key>Comment</key> + <string>Newly created scripts can be modified by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>ScriptsNextOwnerTransfer</key> + <map> + <key>Comment</key> + <string>Newly created scripts can be resold or given away by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>ScriptsEveryoneCopy</key> + <map> + <key>Comment</key> + <string>Everyone can copy the newly created script</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>ScriptsShareWithGroup</key> + <map> + <key>Comment</key> + <string>Newly created scripts are shared with the currently active group</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>NotecardsNextOwnerCopy</key> + <map> + <key>Comment</key> + <string>Newly created notecards can be copied by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>NotecardsNextOwnerModify</key> + <map> + <key>Comment</key> + <string>Newly created notecards can be modified by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>NotecardsNextOwnerTransfer</key> + <map> + <key>Comment</key> + <string>Newly created notecards can be resold or given away by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>NotecardsEveryoneCopy</key> + <map> + <key>Comment</key> + <string>Everyone can copy the newly created notecard</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>NotecardsShareWithGroup</key> + <map> + <key>Comment</key> + <string>Newly created notecards are shared with the currently active group</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>GesturesNextOwnerCopy</key> + <map> + <key>Comment</key> + <string>Newly created gestures can be copied by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>GesturesNextOwnerModify</key> + <map> + <key>Comment</key> + <string>Newly created gestures can be modified by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>GesturesNextOwnerTransfer</key> + <map> + <key>Comment</key> + <string>Newly created gestures can be resold or given away by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>GesturesEveryoneCopy</key> + <map> + <key>Comment</key> + <string>Everyone can copy the newly created gesture</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>GesturesShareWithGroup</key> + <map> + <key>Comment</key> + <string>Newly created gestures are shared with the currently active group</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>WearablesNextOwnerCopy</key> + <map> + <key>Comment</key> + <string>Newly created clothing or body part can be copied by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>WearablesNextOwnerModify</key> + <map> + <key>Comment</key> + <string>Newly created clothing or body part can be modified by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>WearablesNextOwnerTransfer</key> + <map> + <key>Comment</key> + <string>Newly created clothing or body part can be resold or given away by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>WearablesEveryoneCopy</key> + <map> + <key>Comment</key> + <string>Everyone can copy the newly created clothing or body part</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>WearablesShareWithGroup</key> + <map> + <key>Comment</key> + <string>Newly created clothing or body part is shared with the currently active group</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>DefaultUploadPermissionsConverted</key> + <map> + <key>Comment</key> + <string>Default upload permissions have been converted to default creation permissions</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>PathfindingRetrieveNeighboringRegion</key> <map> <key>Comment</key> @@ -14970,6 +15256,62 @@ <key>Value</key> <string /> </map> + <key>EveryoneCopy</key> + <map> + <key>Comment</key> + <string>(obsolete) Everyone can copy the newly created objects</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>NextOwnerCopy</key> + <map> + <key>Comment</key> + <string>(obsolete) Newly created objects can be copied by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>NextOwnerModify</key> + <map> + <key>Comment</key> + <string>(obsolete) Newly created objects can be modified by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>NextOwnerTransfer</key> + <map> + <key>Comment</key> + <string>(obsolete) Newly created objects can be resold or given away by next owner</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>ShareWithGroup</key> + <map> + <key>Comment</key> + <string>(obsolete) Newly created objects are shared with the currently active group</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + </map> </llsd> diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f150ceda67..54e0375a2b 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -47,6 +47,7 @@ #include "llfirstuse.h" #include "llfloatercamera.h" #include "llfloaterimcontainer.h" +#include "llfloaterperms.h" #include "llfloaterreg.h" #include "llfloatertools.h" #include "llgroupactions.h" diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index fa810aac76..aa97bddec8 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -49,6 +49,7 @@ #include "llvoavatarself.h" #include "llviewerwearable.h" #include "llwearablelist.h" +#include "llfloaterperms.h" #include <boost/scoped_ptr.hpp> @@ -65,6 +66,19 @@ void wear_and_edit_cb(const LLUUID& inv_item) { if (inv_item.isNull()) return; + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); + item->setPermissions(perm); + + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); + // Request editing the item after it gets worn. gAgentWearables.requestEditingWearable(inv_item); @@ -72,6 +86,26 @@ void wear_and_edit_cb(const LLUUID& inv_item) LLAppearanceMgr::instance().wearItemOnAvatar(inv_item); } +void wear_cb(const LLUUID& inv_item) +{ + if (!inv_item.isNull()) + { + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); + item->setPermissions(perm); + + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); + } + } +} + /////////////////////////////////////////////////////////////////////////////// // HACK: For EXT-3923: Pants item shows in inventory with skin icon and messes with "current look" @@ -482,6 +516,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, LLViewerWearable* new_wearable = LLWearableList::instance().createCopy( old_wearable, trunc_name); + LLPointer<LLInventoryCallback> cb = new addWearableToAgentInventoryCallback( LLPointer<LLRefCount>(NULL), @@ -1804,7 +1839,16 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp); LLAssetType::EType asset_type = wearable->getAssetType(); LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; - LLPointer<LLInventoryCallback> cb = wear ? new LLBoostFuncInventoryCallback(wear_and_edit_cb) : NULL; + LLPointer<LLInventoryCallback> cb; + if(wear) + { + cb = new LLBoostFuncInventoryCallback(wear_and_edit_cb); + } + else + { + cb = new LLBoostFuncInventoryCallback(wear_cb); + } + LLUUID folder_id; if (parent_id.notNull()) @@ -1817,10 +1861,15 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con folder_id = gInventory.findCategoryUUIDForType(folder_type); } - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - folder_id, wearable->getTransactionID(), wearable->getName(), - wearable->getDescription(), asset_type, inv_type, wearable->getType(), - wearable->getPermissions().getMaskNextOwner(), + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + folder_id, + wearable->getTransactionID(), + wearable->getName(), + wearable->getDescription(), + asset_type, inv_type, + wearable->getType(), + LLFloaterPerms::getNextOwnerPerms("Wearables"), cb); } diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index f2deb6a805..a992443ce1 100755 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -1002,7 +1002,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) 0, LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION, - LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), name, callback, expected_upload_cost, userdata); diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 56051ff684..59f5b2b346 100755 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -48,6 +48,7 @@ #include "llviewermenu.h" #include "llviewerinventory.h" #include "llviewercontrol.h" +#include "llfloaterperms.h" BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b ) { @@ -74,6 +75,17 @@ public: void fire(const LLUUID &inv_item) { LLPreviewGesture::show(inv_item, LLUUID::null); + + LLInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Gestures")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); + item->setPermissions(perm); + item->updateServer(FALSE); + } } }; @@ -449,9 +461,17 @@ void LLFloaterGesture::onClickPlay() void LLFloaterGesture::onClickNew() { LLPointer<LLInventoryCallback> cb = new GestureShowCallback(); - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - LLUUID::null, LLTransactionID::tnull, "New Gesture", "", LLAssetType::AT_GESTURE, - LLInventoryType::IT_GESTURE, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, cb); + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + LLUUID::null, + LLTransactionID::tnull, + "New Gesture", + "", + LLAssetType::AT_GESTURE, + LLInventoryType::IT_GESTURE, + NOT_WEARABLE, + PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Gestures"), + cb); } void LLFloaterGesture::onActivateBtnClick() diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 27b1c3b9cd..ee7f413a59 100755 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -45,6 +45,7 @@ #include "lluictrlfactory.h" #include "llstring.h" #include "lleconomy.h" +#include "llpermissions.h" // linden includes #include "llassetstorage.h" @@ -167,11 +168,14 @@ void LLFloaterNameDesc::onBtnOK( ) S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). void *nruserdata = NULL; std::string display_name = LLStringUtil::null; + upload_new_resource(mFilenameAndPath, // file getChild<LLUICtrl>("name_form")->getValue().asString(), getChild<LLUICtrl>("description_form")->getValue().asString(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, expected_upload_cost, nruserdata); closeFloater(false); } diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 80b55c3cbb..0880a5f35a 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -1,7 +1,7 @@ /** * @file llfloaterperms.cpp * @brief Asset creation permission preferences. - * @author Coco + * @author Jonathan Yap * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -32,101 +32,230 @@ #include "llviewerwindow.h" #include "lluictrlfactory.h" #include "llpermissions.h" - +#include "llagent.h" +#include "llviewerregion.h" +#include "llnotificationsutil.h" LLFloaterPerms::LLFloaterPerms(const LLSD& seed) : LLFloater(seed) { - mCommitCallbackRegistrar.add("Perms.Copy", boost::bind(&LLFloaterPerms::onCommitCopy, this)); - mCommitCallbackRegistrar.add("Perms.OK", boost::bind(&LLFloaterPerms::onClickOK, this)); - mCommitCallbackRegistrar.add("Perms.Cancel", boost::bind(&LLFloaterPerms::onClickCancel, this)); - } BOOL LLFloaterPerms::postBuild() { - mCloseSignal.connect(boost::bind(&LLFloaterPerms::cancel, this)); - + return TRUE; +} + +//static +U32 LLFloaterPerms::getGroupPerms(std::string prefix) +{ + return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY | PERM_MOVE | PERM_MODIFY : PERM_NONE; +} + +//static +U32 LLFloaterPerms::getEveryonePerms(std::string prefix) +{ + return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE; +} + +//static +U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) +{ + U32 flags = PERM_MOVE; + if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) + { + flags |= PERM_COPY; + } + if ( gSavedSettings.getBOOL(prefix+"NextOwnerModify") ) + { + flags |= PERM_MODIFY; + } + if ( gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") ) + { + flags |= PERM_TRANSFER; + } + return flags; +} + +//static +U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix) +{ + // Sets bits for permissions that are off + U32 flags = PERM_MOVE; + if ( !gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) + { + flags |= PERM_COPY; + } + if ( !gSavedSettings.getBOOL(prefix+"NextOwnerModify") ) + { + flags |= PERM_MODIFY; + } + if ( !gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") ) + { + flags |= PERM_TRANSFER; + } + return flags; +} + +static bool mCapSent = false; + +LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) + : LLFloater(seed) +{ + mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2)); + mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this)); + mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this)); +} + + +// String equivalents of enum Categories - initialization order must match enum order! +const std::string LLFloaterPermsDefault::sCategoryNames[CAT_LAST] = +{ + "Objects", + "Uploads", + "Scripts", + "Notecards", + "Gestures", + "Wearables" +}; + +BOOL LLFloaterPermsDefault::postBuild() +{ + if(!gSavedSettings.getBOOL("DefaultUploadPermissionsConverted")) + { + gSavedSettings.setBOOL("UploadsEveryoneCopy", gSavedSettings.getBOOL("EveryoneCopy")); + gSavedSettings.setBOOL("UploadsNextOwnerCopy", gSavedSettings.getBOOL("NextOwnerCopy")); + gSavedSettings.setBOOL("UploadsNextOwnerModify", gSavedSettings.getBOOL("NextOwnerModify")); + gSavedSettings.setBOOL("UploadsNextOwnerTransfer", gSavedSettings.getBOOL("NextOwnerTransfer")); + gSavedSettings.setBOOL("UploadsShareWithGroup", gSavedSettings.getBOOL("ShareWithGroup")); + gSavedSettings.setBOOL("DefaultUploadPermissionsConverted", true); + } + + mCloseSignal.connect(boost::bind(&LLFloaterPermsDefault::cancel, this)); + refresh(); - return TRUE; + return true; } -void LLFloaterPerms::onClickOK() +void LLFloaterPermsDefault::onClickOK() { ok(); closeFloater(); } -void LLFloaterPerms::onClickCancel() +void LLFloaterPermsDefault::onClickCancel() { cancel(); closeFloater(); } -void LLFloaterPerms::onCommitCopy() +void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data) { // Implements fair use - BOOL copyable = gSavedSettings.getBOOL("NextOwnerCopy"); + std::string prefix = user_data.asString(); + + BOOL copyable = gSavedSettings.getBOOL(prefix+"NextOwnerCopy"); if(!copyable) { - gSavedSettings.setBOOL("NextOwnerTransfer", TRUE); + gSavedSettings.setBOOL(prefix+"NextOwnerTransfer", TRUE); } - LLCheckBoxCtrl* xfer = getChild<LLCheckBoxCtrl>("next_owner_transfer"); + LLCheckBoxCtrl* xfer = getChild<LLCheckBoxCtrl>(prefix+"_transfer"); xfer->setEnabled(copyable); } -void LLFloaterPerms::ok() +class LLFloaterPermsResponder : public LLHTTPClient::Responder { - refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official. -} +public: + LLFloaterPermsResponder(): LLHTTPClient::Responder() {} +private: + static std::string sPreviousReason; + + void error(U32 status, const std::string& reason) + { + // Do not display the same error more than once in a row + if (reason != sPreviousReason) + { + sPreviousReason = reason; + LLSD args; + args["REASON"] = reason; + LLNotificationsUtil::add("DefaultObjectPermissions", args); + } + } + void result(const LLSD& content) + { + // Since we have had a successful POST call be sure to display the next error message + // even if it is the same as a previous one. + sPreviousReason = ""; + LLFloaterPermsDefault::setCapSent(true); + LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL; + } +}; + + std::string LLFloaterPermsResponder::sPreviousReason; -void LLFloaterPerms::cancel() +void LLFloaterPermsDefault::sendInitialPerms() { - gSavedSettings.setBOOL("ShareWithGroup", mShareWithGroup); - gSavedSettings.setBOOL("EveryoneCopy", mEveryoneCopy); - gSavedSettings.setBOOL("NextOwnerCopy", mNextOwnerCopy); - gSavedSettings.setBOOL("NextOwnerModify", mNextOwnerModify); - gSavedSettings.setBOOL("NextOwnerTransfer", mNextOwnerTransfer); + if(!mCapSent) + { + updateCap(); + } } -void LLFloaterPerms::refresh() +void LLFloaterPermsDefault::updateCap() { - mShareWithGroup = gSavedSettings.getBOOL("ShareWithGroup"); - mEveryoneCopy = gSavedSettings.getBOOL("EveryoneCopy"); - mNextOwnerCopy = gSavedSettings.getBOOL("NextOwnerCopy"); - mNextOwnerModify = gSavedSettings.getBOOL("NextOwnerModify"); - mNextOwnerTransfer = gSavedSettings.getBOOL("NextOwnerTransfer"); + std::string object_url = gAgent.getRegion()->getCapability("AgentPreferences"); + + if(!object_url.empty()) + { + LLSD report = LLSD::emptyMap(); + report["default_object_perm_masks"]["Group"] = + (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["Everyone"] = + (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["NextOwner"] = + (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); + + LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); + } } -//static -U32 LLFloaterPerms::getGroupPerms(std::string prefix) -{ - return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY : PERM_NONE; +void LLFloaterPermsDefault::setCapSent(bool cap_sent) +{ + mCapSent = cap_sent; } -//static -U32 LLFloaterPerms::getEveryonePerms(std::string prefix) +void LLFloaterPermsDefault::ok() { - return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE; +// Changes were already applied automatically to saved settings. +// Refreshing internal values makes it official. + refresh(); + +// We know some setting has changed but not which one. Just in case it was a setting for +// object permissions tell the server what the values are. + updateCap(); } -//static -U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) +void LLFloaterPermsDefault::cancel() { - U32 flags = PERM_MOVE; - if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) + for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - flags |= PERM_COPY; - } - if ( gSavedSettings.getBOOL(prefix+"NextOwnerModify") ) - { - flags |= PERM_MODIFY; + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerModify", mNextOwnerModify[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"ShareWithGroup", mShareWithGroup[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"EveryoneCopy", mEveryoneCopy[iter]); } - if ( gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") ) +} + +void LLFloaterPermsDefault::refresh() +{ + for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - flags |= PERM_TRANSFER; + mShareWithGroup[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"ShareWithGroup"); + mEveryoneCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"EveryoneCopy"); + mNextOwnerCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerCopy"); + mNextOwnerModify[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerModify"); + mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerTransfer"); } - return flags; } - diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index 6b65f4b0cd..2bb0a19dc1 100755 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -1,7 +1,7 @@ /** * @file llfloaterperms.h * @brief Asset creation permission preferences. - * @author Coco + * @author Jonathan Yap * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code @@ -36,26 +36,57 @@ class LLFloaterPerms : public LLFloater public: /*virtual*/ BOOL postBuild(); - void ok(); - void cancel(); - void onClickOK(); - void onClickCancel(); - void onCommitCopy(); + // 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" static U32 getNextOwnerPerms(std::string prefix=""); // bitfield for prefix + "NextOwner" + "Copy", "Modify", and "Transfer" + static U32 getNextOwnerPermsInverted(std::string prefix=""); private: LLFloaterPerms(const LLSD& seed); + +}; + +class LLFloaterPermsDefault : public LLFloater +{ + friend class LLFloaterReg; + +public: + /*virtual*/ BOOL postBuild(); + void ok(); + void cancel(); + void onClickOK(); + void onClickCancel(); + void onCommitCopy(const LLSD& user_data); + static void sendInitialPerms(); + static void updateCap(); + static void setCapSent(bool cap_sent); + +// Update instantiation of sCategoryNames in the .cpp file to match if you change this! +enum Categories +{ + CAT_OBJECTS, + CAT_UPLOADS, + CAT_SCRIPTS, + CAT_NOTECARDS, + CAT_GESTURES, + CAT_WEARABLES, + CAT_LAST +}; + +private: + LLFloaterPermsDefault(const LLSD& seed); void refresh(); - BOOL // cached values only for implementing cancel. - mShareWithGroup, - mEveryoneCopy, - mNextOwnerCopy, - mNextOwnerModify, - mNextOwnerTransfer; + static const std::string sCategoryNames[CAT_LAST]; + + // cached values only for implementing cancel. + bool mShareWithGroup[CAT_LAST]; + bool mEveryoneCopy[CAT_LAST]; + bool mNextOwnerCopy[CAT_LAST]; + bool mNextOwnerModify[CAT_LAST]; + bool mNextOwnerTransfer[CAT_LAST]; }; #endif diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 87ae36716d..0f6f4a0192 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -346,6 +346,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this)); mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this)); mCommitCallbackRegistrar.add("Pref.AutoReplace", boost::bind(&LLFloaterPreference::onClickAutoReplace, this)); + mCommitCallbackRegistrar.add("Pref.PermsDefault", boost::bind(&LLFloaterPreference::onClickPermsDefault, this)); mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this)); sSkin = gSavedSettings.getString("SkinCurrent"); @@ -1187,6 +1188,9 @@ void LLFloaterPreference::refreshEnabledState() disableUnavailableSettings(); getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess()); + + // Cannot have floater active until caps have been received + getChild<LLButton>("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true); } void LLFloaterPreference::disableUnavailableSettings() @@ -1682,6 +1686,11 @@ void LLFloaterPreference::onClickActionChange() mClickActionDirty = true; } +void LLFloaterPreference::onClickPermsDefault() +{ + LLFloaterReg::showInstance("perms_default"); +} + void LLFloaterPreference::onDeleteTranscripts() { LLSD args; diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index cb180f6f1e..e287631b1a 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -164,6 +164,7 @@ public: void onClickBlockList(); void onClickProxySettings(); void onClickTranslationSettings(); + void onClickPermsDefault(); void onClickAutoReplace(); void onClickSpellChecker(); void applyUIColor(LLUICtrl* ctrl, const LLSD& param); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 5afd2cb329..b0c8aa2d3a 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2004,9 +2004,9 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) result["asset_type"] = "mesh"; result["inventory_type"] = "object"; result["description"] = "(No Description)"; - result["next_owner_mask"] = LLSD::Integer(LLFloaterPerms::getNextOwnerPerms()); - result["group_mask"] = LLSD::Integer(LLFloaterPerms::getGroupPerms()); - result["everyone_mask"] = LLSD::Integer(LLFloaterPerms::getEveryonePerms()); + result["next_owner_mask"] = LLSD::Integer(LLFloaterPerms::getNextOwnerPerms("Uploads")); + result["group_mask"] = LLSD::Integer(LLFloaterPerms::getGroupPerms("Uploads")); + result["everyone_mask"] = LLSD::Integer(LLFloaterPerms::getEveryonePerms("Uploads")); res["mesh_list"] = LLSD::emptyArray(); res["texture_list"] = LLSD::emptyArray(); diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index 1a427338e5..89a9e0dc16 100755 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -59,6 +59,7 @@ #include "llviewerregion.h" #include "llviewerwindow.h" #include "llworld.h" +#include "llfloaterperms.h" // // Imported globals @@ -156,12 +157,14 @@ void LLPanelContents::onClickNewScript(void *userdata) { LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); + + // Parameters are base, owner, everyone, group, next perm.initMasks( PERM_ALL, PERM_ALL, - PERM_NONE, - PERM_NONE, - PERM_MOVE | PERM_TRANSFER); + LLFloaterPerms::getEveryonePerms("Scripts"), + LLFloaterPerms::getGroupPerms("Scripts"), + PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Scripts")); std::string desc; LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); LLPointer<LLViewerInventoryItem> new_item = @@ -179,6 +182,8 @@ void LLPanelContents::onClickNewScript(void *userdata) time_corrected()); object->saveScript(new_item, TRUE, true); + std::string name = new_item->getName(); + // *NOTE: In order to resolve SL-22177, we needed to create // the script first, and then you have to click it in // inventory to edit it. diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index a8eeddb798..632a7d8bc3 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -262,6 +262,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("pathfinding_linksets", "floater_pathfinding_linksets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingLinksets>); LLFloaterReg::add("pathfinding_console", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingConsole>); LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); + LLFloaterReg::add("perms_default", "floater_perms_default.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPermsDefault>); LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>); LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreferenceProxy>); @@ -270,7 +271,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTranslationSettings>); LLFloaterReg::add("prefs_spellchecker", "floater_spellcheck.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSpellCheckerSettings>); LLFloaterReg::add("prefs_autoreplace", "floater_autoreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAutoReplaceSettings>); - LLFloaterReg::add("perm_prefs", "floater_perm_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPerms>); LLFloaterReg::add("picks", "floater_picks.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterJoystick>); LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewAnim>, "preview"); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index fff9821e86..e8ae621e41 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -65,6 +65,7 @@ #include "llavataractions.h" #include "lllogininstance.h" #include "llfavoritesbar.h" +#include "llfloaterperms.h" // Two do-nothing ops for use in callbacks. void no_op_inventory_func(const LLUUID&) {} @@ -989,24 +990,73 @@ void activate_gesture_cb(const LLUUID& inv_item) LLGestureMgr::instance().activateGesture(inv_item); } -void create_gesture_cb(const LLUUID& inv_item) +void create_script_cb(const LLUUID& inv_item) { - if (inv_item.isNull()) - return; + if (!inv_item.isNull()) + { + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); - LLGestureMgr::instance().activateGesture(inv_item); + item->setPermissions(perm); + + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); + } + } +} + +void create_gesture_cb(const LLUUID& inv_item) +{ + if (!inv_item.isNull()) + { + LLGestureMgr::instance().activateGesture(inv_item); - LLViewerInventoryItem* item = gInventory.getItem(inv_item); - if (!item) return; - gInventory.updateItem(item); - gInventory.notifyObservers(); + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); + + item->setPermissions(perm); + + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); - LLPreviewGesture* preview = LLPreviewGesture::show(inv_item, LLUUID::null); - // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); + LLPreviewGesture* preview = LLPreviewGesture::show(inv_item, LLUUID::null); + // Force to be entirely onscreen. + gFloaterView->adjustToFitScreen(preview, FALSE); + } + } } +void create_notecard_cb(const LLUUID& inv_item) +{ + if (!inv_item.isNull()) + { + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Notecards")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Notecards")); + + item->setPermissions(perm); + + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); + } + } +} + LLInventoryCallbackManager gInventoryCallbacks; void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, @@ -1260,22 +1310,45 @@ void create_new_item(const std::string& name, LLViewerAssetType::generateDescriptionFor(asset_type, desc); next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER; - - if (inv_type == LLInventoryType::IT_GESTURE) - { - LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(create_gesture_cb); - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, - NOT_WEARABLE, next_owner_perm, cb); - } - else + LLPointer<LLInventoryCallback> cb = NULL; + + switch (inv_type) { - LLPointer<LLInventoryCallback> cb = NULL; - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, - NOT_WEARABLE, next_owner_perm, cb); + case LLInventoryType::IT_LSL: + { + cb = new LLBoostFuncInventoryCallback(create_script_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Scripts"); + break; + } + + case LLInventoryType::IT_GESTURE: + { + cb = new LLBoostFuncInventoryCallback(create_gesture_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Gestures"); + break; + } + + case LLInventoryType::IT_NOTECARD: + { + cb = new LLBoostFuncInventoryCallback(create_notecard_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards"); + break; + } + default: + break; } - + + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + parent_id, + LLTransactionID::tnull, + name, + desc, + asset_type, + inv_type, + NOT_WEARABLE, + next_owner_perm, + cb); } const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not) @@ -1316,7 +1389,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, parent_id, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, - PERM_MOVE | PERM_TRANSFER); + PERM_MOVE | PERM_TRANSFER); // overridden in create_new_item } else if ("notecard" == type_name) { @@ -1325,7 +1398,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, parent_id, LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, - PERM_ALL); + PERM_ALL); // overridden in create_new_item } else if ("gesture" == type_name) { @@ -1334,7 +1407,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, parent_id, LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, - PERM_ALL); + PERM_ALL); // overridden in create_new_item } else { diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index ab19a12014..dc2fdb8c8d 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -249,7 +249,9 @@ void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachme void activate_gesture_cb(const LLUUID& inv_item); +void create_script_cb(const LLUUID& inv_item); void create_gesture_cb(const LLUUID& inv_item); +void create_notecard_cb(const LLUUID& inv_item); class AddFavoriteLandmarkCallback : public LLInventoryCallback { diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index be78603e2d..16e75a4ad7 100755 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -442,9 +442,9 @@ class LLFileUploadBulk : public view_listener_t 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - LLFloaterPerms::getNextOwnerPerms(), - LLFloaterPerms::getGroupPerms(), - LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, expected_upload_cost, @@ -1004,9 +1004,9 @@ void upload_done_callback( 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - PERM_NONE, - PERM_NONE, - PERM_NONE, + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, expected_upload_cost, // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 1544e66431..7de72dc2cd 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -100,6 +100,7 @@ #include "lltrans.h" #include "llsdutil.h" #include "llmediaentry.h" +#include "llfloaterperms.h" //#define DEBUG_UPDATE_TYPE @@ -2503,6 +2504,7 @@ void LLViewerObject::saveScript( * interaction with doUpdateInventory() called below. */ lldebugs << "LLViewerObject::saveScript() " << item->getUUID() << " " << item->getAssetUUID() << llendl; + LLPointer<LLViewerInventoryItem> task_item = new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(), item->getAssetUUID(), item->getType(), diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index b4e287c446..b7a4510bac 100755 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -76,6 +76,7 @@ #include "object_flags.h" #include "llappviewer.h" +#include "llfloaterperms.h" extern F32 gMinObjectDistance; extern BOOL gAnimateTextures; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c6ae7d7fa0..03e016796e 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -71,6 +71,7 @@ #include "stringize.h" #include "llviewercontrol.h" #include "llsdserialize.h" +#include "llfloaterperms.h" #ifdef LL_WINDOWS #pragma warning(disable:4355) @@ -1576,6 +1577,7 @@ void LLViewerRegion::unpackRegionHandshake() void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) { + capabilityNames.append("AgentPreferences"); capabilityNames.append("AgentState"); capabilityNames.append("AttachmentResources"); capabilityNames.append("AvatarPickerSearch"); @@ -1844,6 +1846,8 @@ void LLViewerRegion::setCapabilitiesReceived(bool received) { mCapabilitiesReceivedSignal(getRegionID()); + LLFloaterPermsDefault::sendInitialPerms(); + // This is a single-shot signal. Forget callbacks to save resources. mCapabilitiesReceivedSignal.disconnect_all_slots(); } diff --git a/indra/newview/skins/default/xui/en/floater_perm_prefs.xml b/indra/newview/skins/default/xui/en/floater_perm_prefs.xml deleted file mode 100755 index ff454e3ebf..0000000000 --- a/indra/newview/skins/default/xui/en/floater_perm_prefs.xml +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<floater - legacy_header_height="18" - height="180" - layout="topleft" - name="perm prefs" - help_topic="perm_prefs" - save_rect="true" - title="DEFAULT UPLOAD PERMISSIONS" - width="315"> - <panel - follows="left|top|right|bottom" - height="120" - label="Permissions" - layout="topleft" - left="10" - name="permissions" - top="20" - width="315"> - <check_box - control_name="ShareWithGroup" - height="16" - label="Share with group" - layout="topleft" - left="10" - name="share_with_group" - top="5" - width="150" /> - <check_box - control_name="EveryoneCopy" - height="16" - label="Allow anyone to copy" - layout="topleft" - left_delta="0" - name="everyone_copy" - top_pad="5" - width="150" /> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left_delta="0" - name="NextOwnerLabel" - top_pad="5" - width="200"> - Next owner can: - </text> - <check_box - control_name="NextOwnerModify" - height="16" - label="Modify" - layout="topleft" - left_delta="0" - name="next_owner_modify" - top_pad="5" - width="150" /> - <check_box - control_name="NextOwnerCopy" - height="16" - label="Copy" - layout="topleft" - left_delta="0" - name="next_owner_copy" - top_pad="5" - width="150" > - <check_box.commit_callback - function="Perms.Copy" /> - </check_box> - <check_box - enabled_control="NextOwnerCopy" - control_name="NextOwnerTransfer" - enabled="false" - height="16" - initial_value="true" - label="Resell/Give away" - layout="topleft" - left_delta="0" - name="next_owner_transfer" - top_pad="5" - width="150" /> - </panel> - <button - height="20" - label="OK" - label_selected="OK" - layout="topleft" - left="90" - name="ok" - top="150" - width="100"> - <button.commit_callback - function="Perms.OK" /> - </button> - <button - height="20" - label="Cancel" - label_selected="Cancel" - layout="topleft" - left_pad="5" - name="cancel" - top_delta="0" - width="100"> - <button.commit_callback - function="Perms.Cancel" /> - </button> -</floater> diff --git a/indra/newview/skins/default/xui/en/floater_perms_default.xml b/indra/newview/skins/default/xui/en/floater_perms_default.xml new file mode 100644 index 0000000000..ceb260fffb --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_perms_default.xml @@ -0,0 +1,503 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + legacy_header_height="18" + height="250" + layout="topleft" + name="perms default" + help_topic="perms_default" + save_rect="true" + title="DEFAULT CREATION PERMISSIONS" + width="700"> + <panel + follows="left|top|right|bottom" + height="200" + label="Default Permissions" + layout="topleft" + left="10" + name="default permissions" + top="20" + width="690"> + <view_border + bevel_style="none" + height="18" + top="8" + left="0" + width="430" /> + <text + type="string" + length="1" + follows="left|top" + height="16" + halign="right" + layout="topleft" + left="0" + top="10" + width="115"> + Next owner: + </text> + <text + type="string" + length="1" + follows="left|top" + height="16" + halign="center" + layout="topleft" + left_pad="5" + top="10" + width="100"> + Copy + </text> + <text + type="string" + length="1" + follows="left|top" + height="16" + halign="center" + layout="topleft" + left_pad="5" + top="10" + width="100"> + Modify + </text> + <text + type="string" + length="1" + follows="left|top" + height="16" + halign="center" + layout="topleft" + left_pad="5" + top="10" + width="100"> + Transfer + </text> + <text + type="string" + length="1" + follows="left|top" + height="32" + halign="center" + layout="topleft" + left_pad="5" + top="10" + word_wrap="true" + width="100"> + Share with group + </text> + <text + type="string" + length="1" + follows="left|top" + height="32" + halign="center" + layout="topleft" + left_pad="5" + top="10" + word_wrap="true" + width="120"> + Allow anyone to copy + </text> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left="0" + top_pad="10" + tool_tip="Set default permissions for when Objects are created" + width="100"> + Objects + </text> + <icon + follows="left|top" + height="16" + image_name="Inv_Object" + layout="topleft" + left_pad="2" + width="18"/> + <check_box + control_name="ObjectsNextOwnerCopy" + height="16" + layout="topleft" + name="objects_c" + left_pad="45" + top_delta="0" + width="100"> + <check_box.commit_callback + function="PermsDefault.Copy" + parameter="Objects" /> + </check_box> + <check_box + control_name="ObjectsNextOwnerModify" + height="16" + layout="topleft" + name="objects_m" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + enabled_control="ObjectsNextOwnerCopy" + control_name="ObjectsNextOwnerTransfer" + height="16" + layout="topleft" + name="objects_t" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + control_name="ObjectsShareWithGroup" + height="16" + layout="topleft" + name="objects_s" + left_pad="0" + top_delta="0" + width="120" /> + <check_box + control_name="ObjectsEveryoneCopy" + height="16" + layout="topleft" + name="objects_e" + left_pad="0" + top_delta="0" + width="100" /> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left="0" + tool_tip="Set default permissions for uploaded items" + width="100"> + Uploads + </text> + <icon + follows="left|top" + height="16" + image_name="Inv_Texture" + layout="topleft" + left_pad="2" + width="18"/> + <check_box + control_name="UploadsNextOwnerCopy" + height="16" + layout="topleft" + name="uploads_c" + left_pad="45" + top_delta="0" + width="100"> + <check_box.commit_callback + function="PermsDefault.Copy" + parameter="Uploads" /> + </check_box> + <check_box + control_name="UploadsNextOwnerModify" + height="16" + layout="topleft" + name="uploads_m" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + enabled_control="UploadsNextOwnerCopy" + control_name="UploadsNextOwnerTransfer" + height="16" + layout="topleft" + name="uploads_t" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + control_name="UploadsShareWithGroup" + height="16" + layout="topleft" + name="uploads_s" + left_pad="0" + top_delta="0" + width="120" /> + <check_box + control_name="UploadsEveryoneCopy" + height="16" + layout="topleft" + name="uploads_e" + left_pad="0" + top_delta="0" + width="100" /> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left="0" + tool_tip="Set default permissions for when Scripts are created" + width="100"> + Scripts + </text> + <icon + follows="left|top" + height="16" + image_name="Inv_Script" + layout="topleft" + left_pad="2" + width="18"/> + <check_box + control_name="ScriptsNextOwnerCopy" + height="16" + layout="topleft" + name="scripts_c" + left_pad="45" + top_delta="0" + width="100"> + <check_box.commit_callback + function="PermsDefault.Copy" + parameter="Scripts" /> + </check_box> + <check_box + control_name="ScriptsNextOwnerModify" + height="16" + layout="topleft" + name="scripts_m" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + enabled_control="ScriptsNextOwnerCopy" + control_name="ScriptsNextOwnerTransfer" + height="16" + layout="topleft" + name="scripts_t" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + control_name="ScriptsShareWithGroup" + height="16" + layout="topleft" + name="scripts_s" + left_pad="0" + top_delta="0" + width="120" /> + <check_box + control_name="ScriptsEveryoneCopy" + height="16" + layout="topleft" + name="scripts_e" + left_pad="0" + top_delta="0" + width="100" /> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left="0" + tool_tip="Set default permissions for when Notecards are created" + width="100"> + Notecards + </text> + <icon + follows="left|top" + height="16" + image_name="Inv_Notecard" + layout="topleft" + left_pad="2" + width="18"/> + <check_box + control_name="NotecardsNextOwnerCopy" + height="16" + layout="topleft" + name="notecards_c" + left_pad="45" + top_delta="0" + width="100"> + <check_box.commit_callback + function="PermsDefault.Copy" + parameter="Notecards" /> + </check_box> + <check_box + control_name="NotecardsNextOwnerModify" + height="16" + layout="topleft" + name="notecards_m" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + enabled_control="NotecardsNextOwnerCopy" + control_name="NotecardsNextOwnerTransfer" + height="16" + layout="topleft" + name="notecards_t" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + control_name="NotecardsShareWithGroup" + height="16" + layout="topleft" + name="notecards_s" + left_pad="0" + top_delta="0" + width="120" /> + <check_box + control_name="NotecardsEveryoneCopy" + height="16" + layout="topleft" + name="notecards_e" + left_pad="0" + top_delta="0" + width="100" /> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left="0" + tool_tip="Set default permissions for when Gestures are created" + width="100"> + Gestures + </text> + <icon + follows="left|top" + height="16" + image_name="Inv_Gesture" + layout="topleft" + left_pad="2" + width="18"/> + <check_box + control_name="GesturesNextOwnerCopy" + height="16" + layout="topleft" + name="gestures_c" + left_pad="45" + top_delta="0" + width="100"> + <check_box.commit_callback + function="PermsDefault.Copy" + parameter="Gestures" /> + </check_box> + <check_box + control_name="GesturesNextOwnerModify" + height="16" + layout="topleft" + name="gestures_m" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + enabled_control="GesturesNextOwnerCopy" + control_name="GesturesNextOwnerTransfer" + height="16" + layout="topleft" + name="gestures_t" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + control_name="GesturesShareWithGroup" + height="16" + layout="topleft" + name="gestures_s" + left_pad="0" + top_delta="0" + width="120" /> + <check_box + control_name="GesturesEveryoneCopy" + height="16" + layout="topleft" + name="gestures_a" + left_pad="0" + top_delta="0" + width="100" /> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left="0" + tool_tip="Set default permissions for when Clothing or Body Parts are created" + width="100"> + Wearables + </text> + <icon + follows="left|top" + height="16" + image_name="Inv_BodyShape" + layout="topleft" + left_pad="2" + width="18"/> + <check_box + control_name="WearablesNextOwnerCopy" + height="16" + layout="topleft" + name="wearables_c" + left_pad="45" + top_delta="0" + width="100"> + <check_box.commit_callback + function="PermsDefault.Copy" + parameter="Wearables" /> + </check_box> + <check_box + control_name="WearablesNextOwnerModify" + height="16" + layout="topleft" + name="wearables_m" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + enabled_control="WearablesNextOwnerCopy" + control_name="WearablesNextOwnerTransfer" + height="16" + layout="topleft" + name="wearables_t" + left_pad="0" + top_delta="0" + width="100" /> + <check_box + control_name="WearablesShareWithGroup" + height="16" + layout="topleft" + name="wearables_s" + left_pad="0" + top_delta="0" + width="120" /> + <check_box + control_name="WearablesEveryoneCopy" + height="16" + layout="topleft" + name="wearables_e" + left_pad="0" + top_delta="0" + width="100" /> + </panel> + <button + height="20" + label="OK" + label_selected="OK" + layout="topleft" + name="ok" + left="475" + width="100"> + <button.commit_callback + function="PermsDefault.OK" /> + </button> + <button + height="20" + label="Cancel" + label_selected="Cancel" + layout="topleft" + left_pad="5" + name="cancel" + top_delta="0" + width="100"> + <button.commit_callback + function="PermsDefault.Cancel" /> + </button> +</floater> diff --git a/indra/newview/skins/default/xui/en/menu_inventory_add.xml b/indra/newview/skins/default/xui/en/menu_inventory_add.xml index 29720a680b..afeb1bf226 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory_add.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory_add.xml @@ -63,13 +63,6 @@ function="File.UploadBulk" parameter="" /> </menu_item_call> - <menu_item_call - label="Set Default Upload Permissions" - name="perm prefs"> - <menu_item_call.on_click - function="Floater.Toggle" - parameter="perm_prefs" /> - </menu_item_call> </menu> <menu_item_call diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 018f654935..675130b2b2 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1187,8 +1187,9 @@ <menu_item_call.on_enable function="SomethingSelected" /> </menu_item_call> + <menu_item_separator/> <menu_item_call - label="Grid Options" + label="Grid Options..." name="Grid Options" shortcut="control|shift|B"> <menu_item_call.on_click @@ -1197,6 +1198,13 @@ <menu_item_call.on_enable function="Tools.EnableToolNotPie" /> </menu_item_call> + <menu_item_call + label="Set Default Permissions..." + name="Set default permissions"> + <menu_item_call.on_click + function="Floater.ToggleOrBringToFront" + parameter="perms_default" /> + </menu_item_call> </menu> <menu create_jump_keys="true" @@ -1264,13 +1272,6 @@ function="File.UploadBulk" parameter="" /> </menu_item_call> - <menu_item_call - label="Set Default Upload Permissions" - name="perm prefs"> - <menu_item_call.on_click - function="Floater.Toggle" - parameter="perm_prefs" /> - </menu_item_call> </menu> <menu_item_separator/> <menu_item_call diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index a93601f5fd..eb8f28b6a2 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -10209,5 +10209,16 @@ Cannot create large prims that intersect other players. Please re-try when othe name="okignore" yestext="OK"/> </notification> + + <notification + icon="alertmodal.tga" + name="DefaultObjectPermissions" + type="alert"> + There was a problem saving the default permissions due to the following reason: [REASON]. Please try setting the default permissions later. + <tag>fail</tag> + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> </notifications> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index 50fd57494f..2e778014c5 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -222,4 +222,15 @@ name="show_develop_menu_check" top_pad="5" width="237"/> + <button + height="20" + label="Default Creation Permissions" + layout="topleft" + name="default_creation_permissions" + left="30" + top_pad = "20" + width="250"> + <button.commit_callback + function="Pref.PermsDefault" /> + </button> </panel> |