diff options
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 112 |
1 files changed, 72 insertions, 40 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 19fbd7ade1..019a4b22c3 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -470,7 +470,9 @@ void hide_context_entries(LLMenuGL& menu, { const LLView::child_list_t *list = menu.getChildList(); - BOOL is_previous_entry_separator = FALSE; + // For removing double separators or leading separator. Start at true so that + // if the first element is a separator, it will not be shown. + BOOL is_previous_entry_separator = TRUE; LLView::child_list_t::const_iterator itor; for (itor = list->begin(); itor != list->end(); ++itor) @@ -582,8 +584,12 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, } } - items.push_back(std::string("Paste")); - if (!isClipboardPasteable() || (flags & FIRST_SELECTED_ITEM) == 0) + // Don't allow items to be pasted directly into the COF. + if (!isCOFFolder()) + { + items.push_back(std::string("Paste")); + } + if (!isClipboardPasteable() || ((flags & FIRST_SELECTED_ITEM) == 0)) { disabled_items.push_back(std::string("Paste")); } @@ -781,7 +787,7 @@ void LLInvFVBridge::changeItemParent(LLInventoryModel* model, const LLUUID& new_parent_id, BOOL restamp) { - if(item->getParentUUID() != new_parent_id) + if (item->getParentUUID() != new_parent_id) { LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1); @@ -1107,6 +1113,9 @@ void LLItemBridge::restoreItem() void LLItemBridge::restoreToWorld() { + //Similar functionality to the drag and drop rez logic + bool remove_from_inventory = false; + LLViewerInventoryItem* itemp = (LLViewerInventoryItem*)getItem(); if (itemp) { @@ -1119,23 +1128,20 @@ void LLItemBridge::restoreToWorld() msg->nextBlockFast(_PREHASH_InventoryData); itemp->packMessage(msg); msg->sendReliable(gAgent.getRegion()->getHost()); - } - //Similar functionality to the drag and drop rez logic - BOOL remove_from_inventory = FALSE; - - //remove local inventory copy, sim will deal with permissions and removing the item - //from the actual inventory if its a no-copy etc - if(!itemp->getPermissions().allowCopyBy(gAgent.getID())) - { - remove_from_inventory = TRUE; - } - - // Check if it's in the trash. (again similar to the normal rez logic) - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) - { - remove_from_inventory = TRUE; + //remove local inventory copy, sim will deal with permissions and removing the item + //from the actual inventory if its a no-copy etc + if(!itemp->getPermissions().allowCopyBy(gAgent.getID())) + { + remove_from_inventory = true; + } + + // Check if it's in the trash. (again similar to the normal rez logic) + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) + { + remove_from_inventory = true; + } } if(remove_from_inventory) @@ -1521,7 +1527,7 @@ BOOL LLFolderBridge::isUpToDate() const BOOL LLFolderBridge::isItemCopyable() const { - return TRUE; + return FALSE; } BOOL LLFolderBridge::copyToClipboard() const @@ -2226,7 +2232,10 @@ void LLFolderBridge::determineFolderType() { LLInventoryModel* model = getInventoryModel(); LLViewerInventoryCategory* category = model->getCategory(mUUID); - category->determineFolderType(); + if (category) + { + category->determineFolderType(); + } } } @@ -2423,7 +2432,12 @@ void LLFolderBridge::pasteFromClipboard() { // move_inventory_item() is not enough, //we have to update inventory locally too - changeItemParent(model, dynamic_cast<LLViewerInventoryItem*>(item), parent_id, FALSE); + LLViewerInventoryItem* viitem = dynamic_cast<LLViewerInventoryItem*>(item); + llassert(viitem); + if (viitem) + { + changeItemParent(model, viitem, parent_id, FALSE); + } } else { @@ -2495,11 +2509,13 @@ void LLFolderBridge::folderOptionsMenu() if(!model) return; const LLInventoryCategory* category = model->getCategory(mUUID); + if(!category) return; + LLFolderType::EType type = category->getPreferredType(); - const bool is_system_folder = category && LLFolderType::lookupIsProtectedType(type); + const bool is_system_folder = LLFolderType::lookupIsProtectedType(type); // BAP change once we're no longer treating regular categories as ensembles. - const bool is_ensemble = category && (type == LLFolderType::FT_NONE || - LLFolderType::lookupIsEnsembleType(type)); + const bool is_ensemble = (type == LLFolderType::FT_NONE || + LLFolderType::lookupIsEnsembleType(type)); // calling card related functionality for folders. @@ -2996,7 +3012,6 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, LLViewerObject* object = NULL; if(LLToolDragAndDrop::SOURCE_AGENT == source) { - BOOL is_movable = TRUE; switch( inv_item->getActualType() ) { @@ -3008,11 +3023,18 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id); + const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id); const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); - BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); - BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); + const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); + const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); + const BOOL move_is_outof_current_outfit = LLAppearanceManager::instance().getIsInCOF(inv_item->getUUID()); + // Can't explicitly drag things out of the COF. + if (move_is_outof_current_outfit) + { + is_movable = FALSE; + } + if(is_movable && move_is_into_trash) { is_movable = inv_item->getIsLinkType() || !get_is_item_worn(inv_item->getUUID()); @@ -3615,9 +3637,13 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLInventoryItem* item = getItem(); BOOL good_card = (item - && (LLUUID::null != item->getCreatorUUID()) - && (item->getCreatorUUID() != gAgent.getID())); - BOOL user_online = (LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID())); + && (LLUUID::null != item->getCreatorUUID()) + && (item->getCreatorUUID() != gAgent.getID())); + BOOL user_online = FALSE; + if (item) + { + user_online = (LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID())); + } items.push_back(std::string("Send Instant Message Separator")); items.push_back(std::string("Send Instant Message")); items.push_back(std::string("Offer Teleport...")); @@ -3804,7 +3830,12 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode BOOL inform_server = TRUE; BOOL deactivate_similar = FALSE; LLGestureManager::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID)); - LLGestureManager::instance().activateGestureWithAsset(mUUID, gInventory.getItem(mUUID)->getAssetUUID(), inform_server, deactivate_similar); + LLViewerInventoryItem* item = gInventory.getItem(mUUID); + llassert(item); + if (item) + { + LLGestureManager::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar); + } } else { @@ -4047,12 +4078,13 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); gMessageSystem->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID()); gMessageSystem->sendReliable( gAgent.getRegion()->getHost()); - } - // this object might have been selected, so let the selection manager know it's gone now - LLViewerObject *found_obj = gObjectList.findObject(item->getLinkedUUID()); - if (found_obj) - { - LLSelectMgr::getInstance()->remove(found_obj); + + // this object might have been selected, so let the selection manager know it's gone now + LLViewerObject *found_obj = gObjectList.findObject(item->getLinkedUUID()); + if (found_obj) + { + LLSelectMgr::getInstance()->remove(found_obj); + } } } else LLItemBridge::performAction(folder, model, action); |