diff options
| author | andreykproductengine <akleshchev@productengine.com> | 2016-10-20 17:04:22 +0300 | 
|---|---|---|
| committer | andreykproductengine <akleshchev@productengine.com> | 2016-10-20 17:04:22 +0300 | 
| commit | 10f7847c8b3e2b27776064e5743e13b90e214b21 (patch) | |
| tree | fbde2de934b9509586dc00998b459a9558b39fe8 | |
| parent | 5d1f6223eb39e2bf6eb2c57428d2957c3bc7ffc7 (diff) | |
MAINT-6830 Newly created & renamed favorite landmarks were displaying old name
| -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); | 
