summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewnotecard.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2015-06-15 15:53:45 -0400
committerOz Linden <oz@lindenlab.com>2015-06-15 15:53:45 -0400
commit95fc2d48eced78b2aaa29b9e8b3f9410eed1ad8c (patch)
tree7748f0142e0ecbc91daa33c42a679799c4375d5e /indra/newview/llpreviewnotecard.cpp
parent96d16928600dbf3666221a19575af9330840cfd5 (diff)
parente0f5ed29daa3b2803aaec60a77bde8df7df292ee (diff)
merge changes for 3.7.30-release
Diffstat (limited to 'indra/newview/llpreviewnotecard.cpp')
-rwxr-xr-xindra/newview/llpreviewnotecard.cpp66
1 files changed, 53 insertions, 13 deletions
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index 337a63e627..1308d1e9a7 100755
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -215,9 +215,12 @@ void LLPreviewNotecard::loadAsset()
if(item)
{
- if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),
- GP_OBJECT_MANIPULATE)
- || gAgent.isGodlike())
+ LLPermissions perm(item->getPermissions());
+ BOOL is_owner = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_MANIPULATE);
+ BOOL allow_copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE);
+ BOOL allow_modify = gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE);
+
+ if (allow_copy || gAgent.isGodlike())
{
mAssetID = item->getAssetUUID();
if(mAssetID.isNull())
@@ -271,12 +274,17 @@ void LLPreviewNotecard::loadAsset()
editor->setEnabled(FALSE);
mAssetStatus = PREVIEW_ASSET_LOADED;
}
- if(!gAgent.allowOperation(PERM_MODIFY, item->getPermissions(),
- GP_OBJECT_MANIPULATE))
+
+ if(!allow_modify)
{
editor->setEnabled(FALSE);
getChildView("lock")->setVisible( TRUE);
}
+
+ if(allow_modify || is_owner)
+ {
+ getChildView("Delete")->setEnabled(TRUE);
+ }
}
else
{
@@ -492,14 +500,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem)
void LLPreviewNotecard::deleteNotecard()
{
- LLViewerInventoryItem* item = gInventory.getItem(mItemUUID);
- if (item != NULL)
- {
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- gInventory.changeItemParent(item, trash_id, FALSE);
- }
-
- closeFloater();
+ LLNotificationsUtil::add("DeleteNotecard", LLSD(), LLSD(), boost::bind(&LLPreviewNotecard::handleConfirmDeleteDialog,this, _1, _2));
}
// static
@@ -605,4 +606,43 @@ bool LLPreviewNotecard::handleSaveChangesDialog(const LLSD& notification, const
return false;
}
+bool LLPreviewNotecard::handleConfirmDeleteDialog(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0)
+ {
+ // canceled
+ return false;
+ }
+
+ if (mObjectUUID.isNull())
+ {
+ // move item from agent's inventory into trash
+ LLViewerInventoryItem* item = gInventory.getItem(mItemUUID);
+ if (item != NULL)
+ {
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ gInventory.changeItemParent(item, trash_id, FALSE);
+ }
+ }
+ else
+ {
+ // delete item from inventory of in-world object
+ LLViewerObject* object = gObjectList.findObject(mObjectUUID);
+ if(object)
+ {
+ LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemUUID));
+ if (item != NULL)
+ {
+ object->removeInventory(mItemUUID);
+ }
+ }
+ }
+
+ // close floater, ignore unsaved changes
+ mForceClose = TRUE;
+ closeFloater();
+ return false;
+}
+
// EOF