summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerinventory.cpp
diff options
context:
space:
mode:
authorJonathan Yap <none@none>2012-06-08 13:49:02 -0400
committerJonathan Yap <none@none>2012-06-08 13:49:02 -0400
commitfbb4e5fb0f7bba935ec9d0d466be12a346a6b149 (patch)
tree40b938b298efb8635a47297844d4c64719c13c52 /indra/newview/llviewerinventory.cpp
parenta519e34f02b4b2663fe082ba9ad12f1b423669cb (diff)
STORM-68 As a Builder, I want that ability to set default permissions on creation of objects, clothing, scripts, notecards, etc.
First pass at implementation, debuggins lines still need to be removed and there is one known bug to be resolved.
Diffstat (limited to 'indra/newview/llviewerinventory.cpp')
-rw-r--r--indra/newview/llviewerinventory.cpp98
1 files changed, 81 insertions, 17 deletions
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 45ca23cdfe..0d56233db1 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -64,6 +64,7 @@
#include "llavatarnamecache.h"
#include "llavataractions.h"
#include "lllogininstance.h"
+#include "llfloaterperms.h"
///----------------------------------------------------------------------------
/// Helper class to store special inventory item names and their localized values.
@@ -1013,6 +1014,24 @@ void ActivateGestureCallback::fire(const LLUUID& inv_item)
LLGestureMgr::instance().activateGesture(inv_item);
}
+void CreateScriptCallback::fire(const LLUUID& inv_item)
+{
+ if (inv_item.isNull())
+ return;
+
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item);
+ if (!item) return;
+
+ LLPermissions perm = item->getPermissions();
+ perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts"));
+ perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts"));
+
+ item->setPermissions(perm);
+
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+}
+
void CreateGestureCallback::fire(const LLUUID& inv_item)
{
if (inv_item.isNull())
@@ -1022,6 +1041,12 @@ void CreateGestureCallback::fire(const LLUUID& inv_item)
LLViewerInventoryItem* item = gInventory.getItem(inv_item);
if (!item) return;
+
+ LLPermissions perm = item->getPermissions();
+ perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures"));
+ perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures"));
+ item->setPermissions(perm);
+
gInventory.updateItem(item);
gInventory.notifyObservers();
@@ -1030,6 +1055,23 @@ void CreateGestureCallback::fire(const LLUUID& inv_item)
gFloaterView->adjustToFitScreen(preview, FALSE);
}
+void CreateNotecardCallback::fire(const LLUUID& inv_item)
+{
+ if (inv_item.isNull())
+ return;
+
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item);
+ if (!item) return;
+
+ LLPermissions perm = item->getPermissions();
+ perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Notecards"));
+ perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Notecards"));
+ item->setPermissions(perm);
+
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+}
+
void AddFavoriteLandmarkCallback::fire(const LLUUID& inv_item_id)
{
if (mTargetLandmarkId.isNull()) return;
@@ -1285,22 +1327,44 @@ 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 CreateGestureCallback();
- 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 CreateScriptCallback();
+ next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Scripts");
+ break;
+ }
+
+ case LLInventoryType::IT_GESTURE:
+ {
+ cb = new CreateGestureCallback();
+ next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Gestures");
+ break;
+ }
+
+ case LLInventoryType::IT_NOTECARD:
+ {
+ cb = new CreateNotecardCallback();
+ next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards");
+ 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)
@@ -1341,7 +1405,7 @@ void menu_create_inventory_item(LLFolderView* root, LLFolderBridge *bridge, cons
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)
{
@@ -1350,7 +1414,7 @@ void menu_create_inventory_item(LLFolderView* root, LLFolderBridge *bridge, cons
parent_id,
LLAssetType::AT_NOTECARD,
LLInventoryType::IT_NOTECARD,
- PERM_ALL);
+ PERM_ALL); // overridden in create_new_item
}
else if ("gesture" == type_name)
{
@@ -1359,7 +1423,7 @@ void menu_create_inventory_item(LLFolderView* root, LLFolderBridge *bridge, cons
parent_id,
LLAssetType::AT_GESTURE,
LLInventoryType::IT_GESTURE,
- PERM_ALL);
+ PERM_ALL); // overridden in create_new_item
}
else
{