summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r--indra/newview/llinventorybridge.cpp86
1 files changed, 85 insertions, 1 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 943a851c13..76c0d69dda 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 |
// +=================================================+
@@ -2748,7 +2785,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);
}
@@ -3266,6 +3309,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"));
@@ -3354,6 +3403,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"));
@@ -3400,6 +3454,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"));
@@ -3617,6 +3676,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"));
@@ -3887,6 +3951,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)
@@ -3945,6 +4014,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"));
@@ -4221,6 +4295,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)
@@ -4610,6 +4689,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)