summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelplaces.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-10-09 00:42:36 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-10-09 00:42:36 +0000
commit81e0fb43caa27491fa18b17d6a05cafb0e20dfa6 (patch)
treeaea6b59f47a56255ab01c0b814650b943170847e /indra/newview/llpanelplaces.cpp
parent4c89e7389383e2943334ad8ec185b8935cbe7db8 (diff)
merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1943 https://svn.aws.productengine.com/secondlife/pe/stable-2@1958 -> viewer-2.0.0-3
* Bugs: EXT-1148 EXT-1330 EXT-990 EXT-1259 EXT-1184 EXT-1327 EXT-1389 EXT-1276 EXT-1390 EXT-1396 EXT-1050 EXT-1094 EXT-1166 EXT-1137 EXT-1327 EXT-782 EXT-1137 EXT-1394 EXT-1326 EXT-917 EXT-1262 * New Dev: EXT-1292 EXT-1139
Diffstat (limited to 'indra/newview/llpanelplaces.cpp')
-rw-r--r--indra/newview/llpanelplaces.cpp133
1 files changed, 45 insertions, 88 deletions
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index 35206f54c7..d16847de0f 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -317,21 +317,38 @@ void LLPanelPlaces::onOpen(const LLSD& key)
void LLPanelPlaces::setItem(LLInventoryItem* item)
{
- if (!item)
+ if (!mPlaceInfo || !item)
return;
mItem = item;
-
- // If the item is a link get a linked item
- if (mItem->getType() == LLAssetType::AT_LINK)
+
+ LLAssetType::EType item_type = mItem->getActualType();
+ if (item_type == LLAssetType::AT_LANDMARK || item_type == LLAssetType::AT_LINK)
{
- mItem = gInventory.getItem(mItem->getAssetUUID());
- if (mItem.isNull())
- return;
+ // If the item is a link get a linked item
+ if (item_type == LLAssetType::AT_LINK)
+ {
+ mItem = gInventory.getItem(mItem->getLinkedUUID());
+ if (mItem.isNull())
+ return;
+ }
}
-
- if (!mPlaceInfo)
+ else
+ {
return;
+ }
+
+ // Check if item is in agent's inventory and he has the permission to modify it.
+ BOOL is_landmark_editable = gInventory.isObjectDescendentOf(mItem->getUUID(), gInventory.getRootFolderID()) &&
+ mItem->getPermissions().allowModifyBy(gAgent.getID());
+
+ mEditBtn->setEnabled(is_landmark_editable);
+ mSaveBtn->setEnabled(is_landmark_editable);
+
+ if (is_landmark_editable)
+ {
+ mPlaceInfo->setLandmarkFolder(mItem->getParentUUID());
+ }
mPlaceInfo->displayItemInfo(mItem);
@@ -352,12 +369,6 @@ void LLPanelPlaces::onLandmarkLoaded(LLLandmark* landmark)
landmark->getRegionID(region_id);
landmark->getGlobalPos(mPosGlobal);
mPlaceInfo->displayParcelInfo(region_id, mPosGlobal);
-
- // Check if item is in agent's inventory and he has the permission to modify it.
- BOOL is_landmark_editable = mItem.notNull() &&
- gInventory.isObjectDescendentOf(mItem->getUUID(), gInventory.getRootFolderID()) &&
- mItem->getPermissions().allowModifyBy(gAgent.getID());
- mEditBtn->setEnabled(is_landmark_editable);
}
void LLPanelPlaces::onFilterEdit(const std::string& search_string)
@@ -487,22 +498,6 @@ void LLPanelPlaces::onSaveButtonClicked()
if (!mPlaceInfo || mItem.isNull())
return;
- LLAssetType::EType item_type = mItem->getType();
- if (item_type == LLAssetType::AT_LANDMARK || item_type != LLAssetType::AT_LINK)
- {
- // If the item is a link get a linked item
- if (item_type == LLAssetType::AT_LINK)
- {
- mItem = gInventory.getItem(mItem->getAssetUUID());
- if (mItem.isNull())
- return;
- }
- }
- else
- {
- return;
- }
-
std::string current_title_value = mPlaceInfo->getLandmarkTitle();
std::string item_title_value = mItem->getName();
std::string current_notes_value = mPlaceInfo->getLandmarkNotes();
@@ -511,73 +506,35 @@ void LLPanelPlaces::onSaveButtonClicked()
LLStringUtil::trim(current_title_value);
LLStringUtil::trim(current_notes_value);
- bool is_item_update_needed = false;
+ LLUUID item_id = mItem->getUUID();
+ LLUUID folder_id = mPlaceInfo->getLandmarkFolder();
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(mItem);
if (!current_title_value.empty() &&
(item_title_value != current_title_value || item_notes_value != current_notes_value))
{
- is_item_update_needed = true;
+ new_item->rename(current_title_value);
+ new_item->setDescription(current_notes_value);
+ new_item->updateServer(FALSE);
}
- LLUUID item_id = mItem->getUUID();
- LLUUID folder_id = mPlaceInfo->getLandmarkFolder();
-
- // Check if item is in agent's inventory and he has the permission to modify it.
- if (!gInventory.isObjectDescendentOf(item_id, gInventory.getRootFolderID()) ||
- !mItem->getPermissions().allowModifyBy(gAgent.getID()))
- return;
-
- if(folder_id != mItem->getParentUUID() || is_item_update_needed)
+ if(folder_id != mItem->getParentUUID())
{
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)mItem.get();
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(mItem->getParentUUID(),-1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(folder_id, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
- LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE);
-
- // If target is the favorites folder we create link to it.
- if (favorites_id == folder_id)
- {
- if (is_item_update_needed)
- {
- new_item->rename(current_title_value);
- new_item->setDescription(current_notes_value);
- new_item->updateServer(FALSE);
-
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
- }
-
- link_inventory_item(gAgent.getID(),
- item->getUUID(),
- folder_id,
- item->getName(),
- LLAssetType::AT_LINK,
- LLPointer<LLInventoryCallback>(NULL));
- }
- else
- {
- if (is_item_update_needed)
- {
- new_item->rename(current_title_value);
- new_item->setDescription(current_notes_value);
- new_item->updateServer(FALSE);
- }
-
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(folder_id, 1);
- update.push_back(new_folder);
- gInventory.accountForUpdate(update);
-
- new_item->setParent(folder_id);
- new_item->updateParentOnServer(FALSE);
-
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
- }
+ new_item->setParent(folder_id);
+ new_item->updateParentOnServer(FALSE);
}
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+
onCancelButtonClicked();
}