diff options
Diffstat (limited to 'linden/indra/newview/llfloateropenobject.cpp')
-rw-r--r-- | linden/indra/newview/llfloateropenobject.cpp | 76 |
1 files changed, 59 insertions, 17 deletions
diff --git a/linden/indra/newview/llfloateropenobject.cpp b/linden/indra/newview/llfloateropenobject.cpp index fc483dd..4190c3e 100644 --- a/linden/indra/newview/llfloateropenobject.cpp +++ b/linden/indra/newview/llfloateropenobject.cpp | |||
@@ -155,29 +155,71 @@ void LLFloaterOpenObject::moveToInventory(bool wear) | |||
155 | { | 155 | { |
156 | parent_category_id = gAgent.getInventoryRootID(); | 156 | parent_category_id = gAgent.getInventoryRootID(); |
157 | } | 157 | } |
158 | |||
159 | LLCategoryCreate* cat_data = new LLCategoryCreate(object_id, wear); | ||
158 | LLUUID category_id = gInventory.createNewCategory(parent_category_id, | 160 | LLUUID category_id = gInventory.createNewCategory(parent_category_id, |
159 | LLAssetType::AT_NONE, | 161 | LLAssetType::AT_NONE, |
160 | name); | 162 | name, |
161 | 163 | callbackCreateInventoryCategory, | |
162 | LLCatAndWear* data = new LLCatAndWear; | 164 | (void*)cat_data); |
163 | data->mCatID = category_id; | 165 | |
164 | data->mWear = wear; | ||
165 | |||
166 | // Copy and/or move the items into the newly created folder. | ||
167 | // Ignore any "you're going to break this item" messages. | ||
168 | BOOL success = move_inv_category_world_to_agent(object_id, category_id, TRUE, | ||
169 | callbackMoveInventory, | ||
170 | (void*)data); | ||
171 | if (!success) | ||
172 | { | ||
173 | delete data; | ||
174 | data = NULL; | ||
175 | 166 | ||
176 | LLNotifications::instance().add("OpenObjectCannotCopy"); | 167 | // If we get a null category ID, we are using a capability in |
168 | // createNewCategory and we will handle the following in the | ||
169 | // callbackCreateInventoryCategory routine. | ||
170 | if (category_id.notNull()) | ||
171 | { | ||
172 | delete cat_data; | ||
173 | |||
174 | LLCatAndWear* data = new LLCatAndWear; | ||
175 | data->mCatID = category_id; | ||
176 | data->mWear = wear; | ||
177 | data->mFolderResponded = false; | ||
178 | |||
179 | // Copy and/or move the items into the newly created folder. | ||
180 | // Ignore any "you're going to break this item" messages. | ||
181 | BOOL success = move_inv_category_world_to_agent(object_id, category_id, TRUE, | ||
182 | callbackMoveInventory, | ||
183 | (void*)data); | ||
184 | if (!success) | ||
185 | { | ||
186 | delete data; | ||
187 | data = NULL; | ||
188 | |||
189 | LLNotifications::instance().add("OpenObjectCannotCopy"); | ||
190 | } | ||
177 | } | 191 | } |
178 | } | 192 | } |
179 | 193 | ||
180 | // static | 194 | // static |
195 | void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLSD& result, void* data) | ||
196 | { | ||
197 | LLCategoryCreate* cat_data = (LLCategoryCreate*)data; | ||
198 | |||
199 | LLUUID category_id = result["folder_id"].asUUID(); | ||
200 | LLCatAndWear* wear_data = new LLCatAndWear; | ||
201 | |||
202 | wear_data->mCatID = category_id; | ||
203 | wear_data->mWear = cat_data->mWear; | ||
204 | wear_data->mFolderResponded = true; | ||
205 | |||
206 | // Copy and/or move the items into the newly created folder. | ||
207 | // Ignore any "you're going to break this item" messages. | ||
208 | |||
209 | BOOL success = move_inv_category_world_to_agent(cat_data->mObjectID, category_id, TRUE, | ||
210 | callbackMoveInventory, | ||
211 | (void*)wear_data); | ||
212 | if (!success) | ||
213 | { | ||
214 | delete wear_data; | ||
215 | wear_data = NULL; | ||
216 | |||
217 | LLNotifications::instance().add("OpenObjectCannotCopy"); | ||
218 | } | ||
219 | delete cat_data; | ||
220 | } | ||
221 | |||
222 | // static | ||
181 | void LLFloaterOpenObject::callbackMoveInventory(S32 result, void* data) | 223 | void LLFloaterOpenObject::callbackMoveInventory(S32 result, void* data) |
182 | { | 224 | { |
183 | LLCatAndWear* cat = (LLCatAndWear*)data; | 225 | LLCatAndWear* cat = (LLCatAndWear*)data; |