summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
authorCallum Prentice <callum@mbp.localdomain>2022-12-12 11:05:24 -0800
committerCallum Prentice <callum@mbp.localdomain>2022-12-12 11:05:24 -0800
commit6daa0a9ecba98fc805a3e76573c894f1d956da8a (patch)
tree8dd833707caf512e580cbe8f2a265d4367103894 /indra/newview/llinventorybridge.cpp
parenta849c51837c9fad2a6929564f4b3a3446a2f4e9a (diff)
parenta0c3d69c620a92d73a1008f218680fb4d0ef9255 (diff)
Merge branch 'main' into DRTVWR-489-emoji
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r--indra/newview/llinventorybridge.cpp108
1 files changed, 68 insertions, 40 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index a0bc1035bf..7793b71f56 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -614,7 +614,7 @@ BOOL LLInvFVBridge::isClipboardPasteable() const
if (cat)
{
LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, item_id);
- if (!cat_br.isItemCopyable())
+ if (!cat_br.isItemCopyable(false))
return FALSE;
// Skip to the next item in the clipboard
continue;
@@ -622,7 +622,7 @@ BOOL LLInvFVBridge::isClipboardPasteable() const
// Each item must be copyable to be pastable
LLItemBridge item_br(mInventoryPanel.get(), mRoot, item_id);
- if (!item_br.isItemCopyable())
+ if (!item_br.isItemCopyable(false))
{
return FALSE;
}
@@ -654,6 +654,11 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
{
return FALSE;
}
+
+ if (gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()))
+ {
+ return FALSE;
+ }
}
const LLViewerInventoryCategory *cat = model->getCategory(objects.at(i));
if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
@@ -729,15 +734,15 @@ void hide_context_entries(LLMenuGL& menu,
}
bool found = false;
- menuentry_vec_t::const_iterator itor2;
- for (itor2 = entries_to_show.begin(); itor2 != entries_to_show.end(); ++itor2)
- {
- if (*itor2 == name)
- {
- found = true;
- break;
- }
- }
+
+ std::string myinput;
+ std::vector<std::string> mylist{ "a", "b", "c" };
+
+ menuentry_vec_t::const_iterator itor2 = std::find(entries_to_show.begin(), entries_to_show.end(), name);
+ if (itor2 != entries_to_show.end())
+ {
+ found = true;
+ }
// Don't allow multiple separators in a row (e.g. such as if there are no items
// between two separators).
@@ -755,7 +760,21 @@ void hide_context_entries(LLMenuGL& menu,
menu_item->setVisible(FALSE);
}
- menu_item->setEnabled(FALSE);
+ if (menu_item->getEnabled())
+ {
+ // These should stay enabled unless specifically disabled
+ const menuentry_vec_t exceptions = {
+ "Detach From Yourself",
+ "Wearable And Object Wear",
+ "Wearable Add",
+ };
+
+ menuentry_vec_t::const_iterator itor2 = std::find(exceptions.begin(), exceptions.end(), name);
+ if (itor2 == exceptions.end())
+ {
+ menu_item->setEnabled(FALSE);
+ }
+ }
}
else
{
@@ -882,7 +901,8 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
disabled_items.push_back(std::string("Paste"));
}
- if (gSavedSettings.getBOOL("InventoryLinking"))
+ static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryLinking", true);
+ if (inventory_linking)
{
items.push_back(std::string("Paste As Link"));
if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0)
@@ -2059,7 +2079,8 @@ BOOL LLItemBridge::removeItem()
// we can't do this check because we may have items in a folder somewhere that is
// not yet in memory, so we don't want false negatives. (If disabled, then we
// know we only have links in the Outfits folder which we explicitly fetch.)
- if (!gSavedSettings.getBOOL("InventoryLinking"))
+ static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryLinking", true);
+ if (!inventory_linking)
{
if (!item->getIsLinkType())
{
@@ -2102,22 +2123,24 @@ BOOL LLItemBridge::confirmRemoveItem(const LLSD& notification, const LLSD& respo
return FALSE;
}
-BOOL LLItemBridge::isItemCopyable() const
+bool LLItemBridge::isItemCopyable(bool can_copy_as_link) const
{
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- // Can't copy worn objects.
- // Worn objects are tied to their inworld conterparts
- // Copy of modified worn object will return object with obsolete asset and inventory
- if(get_is_item_worn(mUUID))
- {
- return FALSE;
- }
+ LLViewerInventoryItem* item = getItem();
+ if (!item)
+ {
+ return false;
+ }
+ // Can't copy worn objects.
+ // Worn objects are tied to their inworld conterparts
+ // Copy of modified worn object will return object with obsolete asset and inventory
+ if (get_is_item_worn(mUUID))
+ {
+ return false;
+ }
- return item->getPermissions().allowCopyBy(gAgent.getID()) || gSavedSettings.getBOOL("InventoryLinking");
- }
- return FALSE;
+ static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryLinking", true);
+ return (can_copy_as_link && inventory_linking)
+ || item->getPermissions().allowCopyBy(gAgent.getID());
}
LLViewerInventoryItem* LLItemBridge::getItem() const
@@ -2321,7 +2344,7 @@ BOOL LLFolderBridge::isUpToDate() const
return category->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN;
}
-BOOL LLFolderBridge::isItemCopyable() const
+bool LLFolderBridge::isItemCopyable(bool can_copy_as_link) const
{
// Folders are copyable if items in them are, recursively, copyable.
@@ -2336,22 +2359,26 @@ BOOL LLFolderBridge::isItemCopyable() const
{
LLInventoryItem* item = *iter;
LLItemBridge item_br(mInventoryPanel.get(), mRoot, item->getUUID());
- if (!item_br.isItemCopyable())
- return FALSE;
-}
+ if (!item_br.isItemCopyable(false))
+ {
+ return false;
+ }
+ }
// Check the folders
LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
-{
+ {
LLViewerInventoryCategory* category = *iter;
LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, category->getUUID());
- if (!cat_br.isItemCopyable())
- return FALSE;
- }
-
- return TRUE;
- }
+ if (!cat_br.isItemCopyable(false))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
BOOL LLFolderBridge::isClipboardPasteable() const
{
@@ -3768,6 +3795,7 @@ void LLFolderBridge::perform_pasteFromClipboard()
LLInventoryObject *obj = model->getObject(item_id);
if (obj)
{
+
if (move_is_into_lost_and_found)
{
if (LLAssetType::AT_CATEGORY == obj->getType())
@@ -4296,7 +4324,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
items.push_back(std::string("IM All Contacts In Folder"));
}
- if (((flags & ITEM_IN_MULTI_SELECTION) == 0) && hasChildren())
+ if (((flags & ITEM_IN_MULTI_SELECTION) == 0) && hasChildren() && (type != LLFolderType::FT_OUTFIT))
{
items.push_back(std::string("Ungroup folder items"));
}