summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelobjectinventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelobjectinventory.cpp')
-rw-r--r--indra/newview/llpanelobjectinventory.cpp49
1 files changed, 38 insertions, 11 deletions
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 417308abe5..9a5b7a5d15 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -307,17 +307,28 @@ bool LLTaskInvFVBridge::isItemRenameable() const
bool LLTaskInvFVBridge::renameItem(const std::string& new_name)
{
- if (LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()))
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if (!object)
{
- if (LLViewerInventoryItem* item = (LLViewerInventoryItem*)object->getInventoryObject(mUUID))
- {
- if (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE, GOD_LIKE))
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->rename(new_name);
- object->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, false);
- }
- }
+ return false;
+ }
+ if (!object->permModify())
+ {
+ LLNotificationsUtil::add("CantModifyContentInNoModTask");
+ return false;
+ }
+
+ LLViewerInventoryItem* item = NULL;
+ item = (LLViewerInventoryItem*)object->getInventoryObject(mUUID);
+ if (item && (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(),
+ GP_OBJECT_MANIPULATE, GOD_LIKE)))
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->rename(new_name);
+ object->updateInventory(
+ new_item,
+ TASK_INVENTORY_ITEM_KEY,
+ false);
}
return true;
@@ -1367,7 +1378,23 @@ bool LLPanelObjectInventory::postBuild()
void LLPanelObjectInventory::doToSelected(const LLSD& userdata)
{
- LLInventoryAction::doToSelected(&gInventory, mFolders, userdata.asString());
+ std::string action = userdata.asString();
+ if ("rename" == action || "delete" == action)
+ {
+ LLViewerObject* objectp = gObjectList.findObject(mTaskUUID);
+ if (objectp && !objectp->permModify())
+ {
+ LLNotificationsUtil::add("CantModifyContentInNoModTask");
+ }
+ else
+ {
+ LLInventoryAction::doToSelected(&gInventory, mFolders, action);
+ }
+ }
+ else
+ {
+ LLInventoryAction::doToSelected(&gInventory, mFolders, action);
+ }
}
void LLPanelObjectInventory::clearContents()