diff options
author | Cinder Biscuits <cinder@alchemyviewer.org> | 2015-11-29 20:14:22 -0700 |
---|---|---|
committer | Cinder Biscuits <cinder@alchemyviewer.org> | 2015-11-29 20:14:22 -0700 |
commit | cc235cdcc41fb1846b878769f5d4097ff9ad3b4d (patch) | |
tree | d34f501bcfd68cad9dd2a3a3bbbb03129e24462f /indra/newview/llpreviewnotecard.cpp | |
parent | 0ba5502506d84fb2a41ce62cb8025ec93b652d38 (diff) | |
parent | e611e35e033e99f619b0e4938f6879c8e387efd5 (diff) |
Merged lindenlab/viewer-tools-update into default
Diffstat (limited to 'indra/newview/llpreviewnotecard.cpp')
-rwxr-xr-x | indra/newview/llpreviewnotecard.cpp | 66 |
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 |