summaryrefslogtreecommitdiff
path: root/indra/newview/llfloateropenobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloateropenobject.cpp')
-rw-r--r--indra/newview/llfloateropenobject.cpp60
1 files changed, 50 insertions, 10 deletions
diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp
index 8b6619def2..4bfef8b45f 100644
--- a/indra/newview/llfloateropenobject.cpp
+++ b/indra/newview/llfloateropenobject.cpp
@@ -162,26 +162,66 @@ void LLFloaterOpenObject::moveToInventory(bool wear)
{
parent_category_id = gInventory.getRootFolderID();
}
+
+ LLCategoryCreate* cat_data = new LLCategoryCreate(object_id, wear);
+
LLUUID category_id = gInventory.createNewCategory(parent_category_id,
- LLFolderType::FT_NONE,
- name);
+ LLFolderType::FT_NONE,
+ name,
+ callbackCreateInventoryCategory,
+ (void*)cat_data);
+
+ //If we get a null category ID, we are using a capability in createNewCategory and we will
+ //handle the following in the callbackCreateInventoryCategory routine.
+ if ( category_id.notNull() )
+ {
+ delete cat_data;
+
+ LLCatAndWear* data = new LLCatAndWear;
+ data->mCatID = category_id;
+ data->mWear = wear;
+ data->mFolderResponded = false;
+
+ // Copy and/or move the items into the newly created folder.
+ // Ignore any "you're going to break this item" messages.
+ BOOL success = move_inv_category_world_to_agent(object_id, category_id, TRUE,
+ callbackMoveInventory,
+ (void*)data);
+ if (!success)
+ {
+ delete data;
+ data = NULL;
- LLCatAndWear* data = new LLCatAndWear;
- data->mCatID = category_id;
- data->mWear = wear;
+ LLNotificationsUtil::add("OpenObjectCannotCopy");
+ }
+ }
+}
+// static
+void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLSD& result, void* data)
+{
+ LLCategoryCreate* cat_data = (LLCategoryCreate*)data;
+
+ LLUUID category_id = result["folder_id"].asUUID();
+ LLCatAndWear* wear_data = new LLCatAndWear;
+
+ wear_data->mCatID = category_id;
+ wear_data->mWear = cat_data->mWear;
+ wear_data->mFolderResponded = true;
+
// Copy and/or move the items into the newly created folder.
// Ignore any "you're going to break this item" messages.
- BOOL success = move_inv_category_world_to_agent(object_id, category_id, TRUE,
+ BOOL success = move_inv_category_world_to_agent(cat_data->mObjectID, category_id, TRUE,
callbackMoveInventory,
- (void*)data);
+ (void*)wear_data);
if (!success)
{
- delete data;
- data = NULL;
-
+ delete wear_data;
+ wear_data = NULL;
+
LLNotificationsUtil::add("OpenObjectCannotCopy");
}
+ delete cat_data;
}
// static