diff options
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 89 |
1 files changed, 88 insertions, 1 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 87b3c2e835..3071ef3b71 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -672,6 +672,11 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } items.push_back(std::string("Open")); items.push_back(std::string("Properties")); @@ -1031,6 +1036,38 @@ bool LLInvFVBridge::isInOutfitsSidePanel() const return outfit_panel->isTabPanel(my_panel); } +bool LLInvFVBridge::canShare() +{ + const LLInventoryModel* model = getInventoryModel(); + if(!model) + { + return false; + } + + LLViewerInventoryItem *item = model->getItem(mUUID); + if (item) + { + bool allowed = false; + allowed = LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item); + if (allowed && + !item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + { + allowed = false; + } + if (allowed && + !item->getPermissions().allowCopyBy(gAgent.getID())) + { + allowed = false; + } + return allowed; + } + + LLViewerInventoryCategory* cat = model->getCategory(mUUID); + + // All categories can be given. + return cat != NULL; +} + // +=================================================+ // | InventoryFVBridgeBuilder | // +=================================================+ @@ -2757,7 +2794,13 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { mDisabledItems.push_back(std::string("Delete System Folder")); } - + + mItems.push_back(std::string("Share")); + if (!canShare()) + { + mDisabledItems.push_back(std::string("Share")); + } + hide_context_entries(menu, mItems, mDisabledItems); } @@ -3176,6 +3219,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else { + // store dad inventory item to select added one later. See EXT-4347 + set_dad_inventory_item(inv_item, mUUID); + LLNotification::Params params("MoveInventoryFromObject"); params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv)); LLNotifications::instance().forceResponse(params, 0); @@ -3272,6 +3318,12 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } + items.push_back(std::string("Open")); items.push_back(std::string("Properties")); @@ -3360,6 +3412,11 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } items.push_back(std::string("Sound Open")); items.push_back(std::string("Properties")); @@ -3406,6 +3463,11 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } items.push_back(std::string("Landmark Open")); items.push_back(std::string("Properties")); @@ -3623,6 +3685,11 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } items.push_back(std::string("Open")); items.push_back(std::string("Properties")); @@ -3893,6 +3960,11 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } bool is_sidepanel = isInOutfitsSidePanel(); if (!is_sidepanel) @@ -3951,6 +4023,11 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } items.push_back(std::string("Animation Open")); items.push_back(std::string("Properties")); @@ -4227,6 +4304,11 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } bool is_sidepanel = isInOutfitsSidePanel(); if (!is_sidepanel) @@ -4616,6 +4698,11 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) can_open = FALSE; } + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } bool is_sidepanel = isInOutfitsSidePanel(); if (can_open && !is_sidepanel) |