summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerinventory.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-04-14 22:58:14 -0700
committerMerov Linden <merov@lindenlab.com>2014-04-14 22:58:14 -0700
commit545b408618388c0484b16d7dff22b9aeb6421530 (patch)
treef9c60c78842c1f584dfe19d93334a60a7d24ecd3 /indra/newview/llviewerinventory.cpp
parent65e53b70f276ff765fdd38b511563508459d0768 (diff)
DD-20 : Prevent pasting incompatible items in stock folders
Diffstat (limited to 'indra/newview/llviewerinventory.cpp')
-rwxr-xr-xindra/newview/llviewerinventory.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index fff9821e86..4ca569e78c 100755
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -816,6 +816,29 @@ bool LLViewerInventoryCategory::exportFileLocal(LLFILE* fp) const
return true;
}
+bool LLViewerInventoryCategory::acceptItem(LLInventoryItem* inv_item)
+{
+ bool accept = true;
+ // Only stock folders have limitation on which item they will accept
+ if (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK)
+ {
+ // If the item is copyable (i.e. non stock) do not accept the drop in a stock folder
+ if (inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()))
+ {
+ accept = false;
+ }
+ else
+ {
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(getUUID(),cat_array,item_array);
+ // Destination stock folder must be empty OR types of incoming and existing items must be identical
+ accept = (!item_array->count() || (item_array->get(0)->getInventoryType() == inv_item->getInventoryType()));
+ }
+ }
+ return accept;
+}
+
void LLViewerInventoryCategory::determineFolderType()
{
/* Do NOT uncomment this code. This is for future 2.1 support of ensembles.