diff options
author | andreykproductengine <akleshchev@productengine.com> | 2014-12-25 20:36:07 +0200 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2014-12-25 20:36:07 +0200 |
commit | 1918428e66b63d66260717f581e865b472f821ea (patch) | |
tree | 7c4cb481ecc1e39b05d1e433a8881f0296343700 /indra | |
parent | 5683d7a2f21d54604cb56e36fa8f0562a19480c4 (diff) |
MAINT-1863 FIXED 'Delete' button is always disabled for Notecard that was opened from object's content
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llpreviewnotecard.cpp | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 337a63e627..307fd55875 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,13 +500,27 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) void LLPreviewNotecard::deleteNotecard() { - LLViewerInventoryItem* item = gInventory.getItem(mItemUUID); - if (item != NULL) + if (mObjectUUID.isNull()) { - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - gInventory.changeItemParent(item, trash_id, FALSE); + LLViewerInventoryItem* item = gInventory.getItem(mItemUUID); + if (item != NULL) + { + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + gInventory.changeItemParent(item, trash_id, FALSE); + } + } + else + { + LLViewerObject* object = gObjectList.findObject(mObjectUUID); + if(object) + { + LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemUUID)); + if (item != NULL) + { + object->removeInventory(mItemUUID); + } + } } - closeFloater(); } |