Copy folders support!
Sync with v-d/rlva for Copy folder support Also, guard against outboxy stuff, like when we're importing, don't show the Marketplace Send menu entry. Fixed a few comments Please view this commit with space/tab changes off! There were a lot of retabbing cases that don't need to waste anymore of anyone's time.
This commit is contained in:
@@ -95,7 +95,7 @@ LLUUID LLInventoryState::sWearNewClothingTransactionID;
|
||||
void append_path(const LLUUID& id, std::string& path)
|
||||
{
|
||||
std::string temp;
|
||||
LLInventoryObject* obj = gInventory.getObject(id);
|
||||
const LLInventoryObject* obj = gInventory.getObject(id);
|
||||
LLUUID parent_id;
|
||||
if(obj) parent_id = obj->getParentUUID();
|
||||
std::string forward_slash("/");
|
||||
@@ -131,6 +131,49 @@ 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,
|
||||
const LLUUID& root_copy_id)
|
||||
{
|
||||
// Create the initial folder
|
||||
LLUUID new_cat_uuid = gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName());
|
||||
model->notifyObservers();
|
||||
|
||||
// We need to exclude the initial root of the copy to avoid recursively copying the copy, etc...
|
||||
LLUUID root_id = (root_copy_id.isNull() ? new_cat_uuid : root_copy_id);
|
||||
|
||||
// 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;
|
||||
if (category->getUUID() != root_id)
|
||||
{
|
||||
copy_inventory_category(model, category, new_cat_uuid, root_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class LLInventoryCollectAllItems : public LLInventoryCollectFunctor
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user