Commit ac76ae6a authored by Rye Mutt's avatar Rye Mutt 🍞
Browse files

Improvements to inventory link handling by Kitty Barnett

parent 92972880
......@@ -385,7 +385,7 @@ BOOL LLInvFVBridge::perform_cutToClipboard()
BOOL LLInvFVBridge::copyToClipboard() const
{
const LLInventoryObject* obj = gInventory.getObject(mUUID);
if (obj && isItemCopyable())
if (obj && (isItemCopyable() || isItemLinkable()))
{
return LLClipboard::instance().addToClipboard(mUUID);
}
......@@ -783,8 +783,14 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
{
items.push_back(std::string("Copy Separator"));
items.push_back(std::string("Cut"));
if (!isItemMovable() || !isItemRemovable() || isLibraryItem())
{
disabled_items.push_back(std::string("Cut"));
}
items.push_back(std::string("Copy"));
if (!isItemCopyable())
if (!isItemCopyable() && !isItemLinkable())
{
disabled_items.push_back(std::string("Copy"));
}
......@@ -832,12 +838,6 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
}
}
items.push_back(std::string("Cut"));
if (!isItemMovable() || !isItemRemovable())
{
disabled_items.push_back(std::string("Cut"));
}
if (canListOnMarketplace() && !isMarketplaceListingsFolder() && !isInboxFolder())
{
items.push_back(std::string("Marketplace Separator"));
......@@ -2117,11 +2117,22 @@ BOOL LLItemBridge::isItemCopyable() const
LLViewerInventoryItem* item = getItem();
if (item)
{
return item->getPermissions().allowCopyBy(gAgent.getID()) || gSavedSettings.getBOOL("InventoryLinking");
if (item->getIsLinkType())
{
return item->getLinkedItem() != nullptr;
}
return item->getPermissions().allowCopyBy(gAgent.getID());
}
return FALSE;
}
bool LLItemBridge::isItemLinkable() const
{
LLViewerInventoryItem* item = getItem();
return (item && LLAssetType::lookupCanLink(item->getType()));
}
LLViewerInventoryItem* LLItemBridge::getItem() const
{
LLViewerInventoryItem* item = NULL;
......@@ -2349,6 +2360,12 @@ BOOL LLFolderBridge::isItemCopyable() const
return TRUE;
}
bool LLFolderBridge::isItemLinkable() const
{
LLFolderType::EType ftType = getPreferredType();
return (LLFolderType::FT_NONE == ftType || LLFolderType::FT_OUTFIT == ftType);
}
BOOL LLFolderBridge::isClipboardPasteable() const
{
if ( ! LLInvFVBridge::isClipboardPasteable() )
......@@ -3899,13 +3916,10 @@ void LLFolderBridge::perform_pasteFromClipboard()
break;
}
}
else if (item->getIsLinkType())
{
link_inventory_object(parent_id, item_id,
LLPointer<LLInventoryCallback>(NULL));
}
else
{
if (item->getPermissions().allowCopyBy(gAgent.getID()))
{
copy_inventory_item(
gAgent.getID(),
item->getPermissions().getOwner(),
......@@ -3913,6 +3927,15 @@ void LLFolderBridge::perform_pasteFromClipboard()
parent_id,
std::string(),
LLPointer<LLInventoryCallback>(NULL));
}
else if (LLAssetType::lookupIsLinkType(item->getActualType()))
{
LLInventoryObject::const_object_list_t obj_array;
obj_array.push_back(LLConstPointer<LLInventoryObject>(item));
link_inventory_array(parent_id,
obj_array,
LLPointer<LLInventoryCallback>(NULL));
}
}
}
}
......
......@@ -118,6 +118,7 @@ public:
void removeBatch(std::vector<LLFolderViewModelItem*>& batch) override;
void move(LLFolderViewModelItem* new_parent_bridge) override {}
BOOL isItemCopyable() const override { return FALSE; }
virtual bool isItemLinkable() const { return FALSE; }
BOOL copyToClipboard() const override;
BOOL cutToClipboard() override;
bool isCutToClipboard() override;
......@@ -245,6 +246,7 @@ public:
BOOL renameItem(const std::string& new_name) override;
BOOL removeItem() override;
BOOL isItemCopyable() const override;
bool isItemLinkable() const override;
bool hasChildren() const override { return FALSE; }
BOOL isUpToDate() const override { return TRUE; }
LLUIImagePtr getIconOverlay() const override;
......@@ -318,6 +320,7 @@ public:
BOOL isItemMovable() const override;
BOOL isUpToDate() const override;
BOOL isItemCopyable() const override;
bool isItemLinkable() const override;
BOOL isClipboardPasteable() const override;
BOOL isClipboardPasteableAsLink() const override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment