diff options
author | Merov Linden <merov@lindenlab.com> | 2012-02-09 23:37:24 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2012-02-09 23:37:24 -0800 |
commit | 2a4aa438f5798c34f1eef3ef75dc3289492138e1 (patch) | |
tree | 06ef82d5d556f0ae4c275588886fa99371154414 /indra/newview/llinventoryfunctions.cpp | |
parent | 10dadc6b0dd646faa251c0935e75d07c97b3052d (diff) |
EXP-1863 : Implemented cut, copy, paste for folders. Issues with folder filtering though.
Diffstat (limited to 'indra/newview/llinventoryfunctions.cpp')
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 8313b23f44..4fb06f82c1 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -238,6 +238,42 @@ void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::s model->notifyObservers(); } +void copy_inventory_category(LLInventoryModel* model, + LLViewerInventoryCategory* cat, + const LLUUID& parent_id) +{ + // Create the initial folder + LLUUID new_cat_uuid = gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName()); + model->notifyObservers(); + + // Get the content of the folder + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array); + + // Copy all the items + LLInventoryModel::item_array_t item_array_copy = *item_array; + for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) + { + LLInventoryItem* item = *iter; + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + new_cat_uuid, + std::string(), + LLPointer<LLInventoryCallback>(NULL)); + } + + // Copy all 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; + copy_inventory_category(model, category, new_cat_uuid); + } +} + class LLInventoryCollectAllItems : public LLInventoryCollectFunctor { public: |