From 46cc8496f0c2405342b0892a673bcf69cc13847b Mon Sep 17 00:00:00 2001 From: maxim_productengine <mnikolenko@productengine.com> Date: Wed, 2 May 2018 12:24:14 +0300 Subject: [PATCH] MAINT-8553 Allow copy a link or copy a folder containing a link in inventory. --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llinventorybridge.cpp | 26 ++++++++++++------------- indra/newview/llinventoryfunctions.cpp | 6 +++++- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 45e2fc9bf05..379c05a66ca 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4798,7 +4798,7 @@ <key>Type</key> <string>Boolean</string> <key>Value</key> - <integer>0</integer> + <integer>1</integer> </map> <key>InventoryOutboxDisplayBoth</key> <map> diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 67b51f11b39..29e63e4bca2 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -779,6 +779,14 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, if (obj) { + + items.push_back(std::string("Copy Separator")); + items.push_back(std::string("Copy")); + if (!isItemCopyable()) + { + disabled_items.push_back(std::string("Copy")); + } + if (obj->getIsLinkType()) { items.push_back(std::string("Find Original")); @@ -821,13 +829,6 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, disabled_items.push_back(std::string("Copy Asset UUID")); } } - items.push_back(std::string("Copy Separator")); - - items.push_back(std::string("Copy")); - if (!isItemCopyable()) - { - disabled_items.push_back(std::string("Copy")); - } items.push_back(std::string("Cut")); if (!isItemMovable() || !isItemRemovable()) @@ -2104,12 +2105,6 @@ BOOL LLItemBridge::isItemCopyable() const return FALSE; } - // You can never copy a link. - if (item->getIsLinkType()) - { - return FALSE; - } - return item->getPermissions().allowCopyBy(gAgent.getID()) || gSavedSettings.getBOOL("InventoryLinking"); } return FALSE; @@ -3812,6 +3807,11 @@ void LLFolderBridge::perform_pasteFromClipboard() break; } } + else if (item->getIsLinkType()) + { + link_inventory_object(parent_id, item_id, + LLPointer<LLInventoryCallback>(NULL)); + } else { copy_inventory_item( diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index e056ccebee5..49144903197 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -425,7 +425,11 @@ void copy_inventory_category(LLInventoryModel* model, LLInventoryItem* item = *iter; LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid)); - if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + if (item->getIsLinkType()) + { + link_inventory_object(new_cat_uuid, item->getLinkedUUID(), cb); + } + else if(!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) { // If the item is nocopy, we do nothing or, optionally, move it if (move_no_copy_items) -- GitLab