diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelplaces.cpp | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index a9a0c30e26..5d43c38612 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -711,6 +711,34 @@ void LLPanelPlaces::onEditButtonClicked() updateVerbs(); } +class LLUpdateLandmarkParent : public LLInventoryCallback +{ +public: + LLUpdateLandmarkParent(LLPointer<LLViewerInventoryItem> item, LLUUID new_parent) : + mItem(item), + mNewParentId(new_parent) + {}; + /* virtual */ void fire(const LLUUID& inv_item_id) + { + LLInventoryModel::update_list_t update; + LLInventoryModel::LLCategoryUpdate old_folder(mItem->getParentUUID(), -1); + update.push_back(old_folder); + LLInventoryModel::LLCategoryUpdate new_folder(mNewParentId, 1); + update.push_back(new_folder); + gInventory.accountForUpdate(update); + + mItem->setParent(mNewParentId); + mItem->updateParentOnServer(FALSE); + + gInventory.updateItem(mItem); + gInventory.notifyObservers(); + } + +private: + LLPointer<LLViewerInventoryItem> mItem; + LLUUID mNewParentId; +}; + void LLPanelPlaces::onSaveButtonClicked() { if (!mLandmarkInfo || mItem.isNull()) @@ -726,6 +754,7 @@ void LLPanelPlaces::onSaveButtonClicked() LLUUID item_id = mItem->getUUID(); LLUUID folder_id = mLandmarkInfo->getLandmarkFolder(); + bool change_parent = folder_id != mItem->getParentUUID(); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(mItem); @@ -734,10 +763,16 @@ void LLPanelPlaces::onSaveButtonClicked() { new_item->rename(current_title_value); new_item->setDescription(current_notes_value); - new_item->updateServer(FALSE); + LLPointer<LLInventoryCallback> cb; + if (change_parent) + { + cb = new LLUpdateLandmarkParent(new_item, folder_id); + } + LLInventoryModel::LLCategoryUpdate up(mItem->getParentUUID(), 0); + gInventory.accountForUpdate(up); + update_inventory_item(new_item, cb); } - - if(folder_id != mItem->getParentUUID()) + else if (change_parent) { LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate old_folder(mItem->getParentUUID(),-1); |