diff options
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 1628 |
1 files changed, 901 insertions, 727 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index bcf40ea5f9..f6e839e2f8 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -31,14 +31,14 @@ */ #include "llviewerprecompiledheaders.h" -// external projects -#include "lltransfersourceasset.h" - #include "llinventorybridge.h" +// external projects +#include "lltransfersourceasset.h" #include "llavatarnamecache.h" // IDEVO #include "llagent.h" +#include "llagentcamera.h" #include "llagentwearables.h" #include "llappearancemgr.h" #include "llavataractions.h" @@ -51,8 +51,10 @@ #include "llimfloater.h" #include "llimview.h" #include "llinventoryclipboard.h" +#include "llinventorydefines.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" +#include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" #include "llnotifications.h" #include "llnotificationsutil.h" @@ -70,6 +72,18 @@ #include "llwearablelist.h" #include "llpaneloutfitsinventory.h" +typedef std::pair<LLUUID, LLUUID> two_uuids_t; +typedef std::list<two_uuids_t> two_uuids_list_t; + +struct LLMoveInv +{ + LLUUID mObjectID; + LLUUID mCategoryID; + two_uuids_list_t mMoveList; + void (*mCallback)(S32, void*); + void* mUserData; +}; + using namespace LLOldEvents; // Helpers @@ -93,6 +107,7 @@ void remove_inventory_category_from_avatar(LLInventoryCategory* category); void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id); bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv*); bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response); +void teleport_via_landmark(const LLUUID& asset_id); std::string ICON_NAME[ICON_NAME_COUNT] = { @@ -137,8 +152,12 @@ std::string ICON_NAME[ICON_NAME_COUNT] = // | LLInvFVBridge | // +=================================================+ -LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : -mUUID(uuid), mInvType(LLInventoryType::IT_NONE) +LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid) : + mUUID(uuid), + mRoot(root), + mInvType(LLInventoryType::IT_NONE) { mInventoryPanel = inventory->getHandle(); } @@ -193,10 +212,14 @@ BOOL LLInvFVBridge::isItemRemovable() const return FALSE; } - // Disable delete from COF folder; have users explicitly choose "detach/take off". - if (LLAppearanceManager::instance().getIsProtectedCOFItem(mUUID)) + // Disable delete from COF folder; have users explicitly choose "detach/take off", + // unless the item is not worn but in the COF (i.e. is bugged). + if (LLAppearanceMgr::instance().getIsProtectedCOFItem(mUUID)) { - return FALSE; + if (get_is_item_worn(mUUID)) + { + return FALSE; + } } const LLInventoryObject *obj = model->getItem(mUUID); @@ -237,7 +260,7 @@ void LLInvFVBridge::showProperties() // Disable old properties floater; this is replaced by the sidepanel. /* - LLFloaterReg::showInstance("properties", mUUID); + LLFloaterReg::showInstance("properties", mUUID); */ } @@ -261,7 +284,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc { if(LLAssetType::AT_GESTURE == item->getType()) { - LLGestureManager::instance().deactivateGesture(item->getUUID()); + LLGestureMgr::instance().deactivateGesture(item->getUUID()); } } } @@ -277,7 +300,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc { if(LLAssetType::AT_GESTURE == descendent_items[j]->getType()) { - LLGestureManager::instance().deactivateGesture(descendent_items[j]->getUUID()); + LLGestureMgr::instance().deactivateGesture(descendent_items[j]->getUUID()); } } } @@ -298,7 +321,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener* LLMessageSystem* msg = gMessageSystem; const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); LLViewerInventoryItem* item = NULL; - std::vector<LLUUID> move_ids; + uuid_vec_t move_ids; LLInventoryModel::update_map_t update; bool start_new_message = true; S32 count = batch.count(); @@ -399,8 +422,8 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener* } // move everything. - std::vector<LLUUID>::iterator it = move_ids.begin(); - std::vector<LLUUID>::iterator end = move_ids.end(); + uuid_vec_t::iterator it = move_ids.begin(); + uuid_vec_t::iterator end = move_ids.end(); for(; it != end; ++it) { gInventory.moveObject((*it), trash_id); @@ -476,7 +499,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const } } const LLViewerInventoryCategory *cat = model->getCategory(objects.get(i)); - if (cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType())) + if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { return FALSE; } @@ -485,8 +508,8 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const } void hide_context_entries(LLMenuGL& menu, - const menuentry_vec_t &entries_to_show, - const menuentry_vec_t &disabled_entries) + const menuentry_vec_t &entries_to_show, + const menuentry_vec_t &disabled_entries) { const LLView::child_list_t *list = menu.getChildList(); @@ -594,7 +617,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID); if (inv_item) { - is_asset_knowable = is_asset_id_knowable(inv_item->getType()); + is_asset_knowable = LLAssetType::lookupIsAssetIDKnowable(inv_item->getType()); } if ( !is_asset_knowable // disable menu item for Inventory items with unknown asset. EXT-5308 || (! ( isItemPermissive() || gAgent.isGodlike() ) ) @@ -623,7 +646,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, disabled_items.push_back(std::string("Paste")); } - if (gAgent.isGodlike()) + if (gSavedSettings.getBOOL("InventoryLinking")) { items.push_back(std::string("Paste As Link")); if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0) @@ -654,7 +677,13 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { - items.push_back(std::string("Open")); + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } + + addOpenRightClickMenuOption(items); items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); @@ -689,7 +718,7 @@ void LLInvFVBridge::addDeleteContextMenuOptions(menuentry_vec_t &items, const LLInventoryObject *obj = getInventoryObject(); // Don't allow delete as a direct option from COF folder. - if (obj && obj->getIsLinkType() && isCOFFolder()) + if (obj && obj->getIsLinkType() && isCOFFolder() && get_is_item_worn(mUUID)) { return; } @@ -710,6 +739,17 @@ void LLInvFVBridge::addDeleteContextMenuOptions(menuentry_vec_t &items, } } +void LLInvFVBridge::addOpenRightClickMenuOption(menuentry_vec_t &items) +{ + const LLInventoryObject *obj = getInventoryObject(); + const BOOL is_link = (obj && obj->getIsLinkType()); + + if (is_link) + items.push_back(std::string("Open Original")); + else + items.push_back(std::string("Open")); +} + // *TODO: remove this BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const { @@ -730,7 +770,7 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const if (*type == DAD_CATEGORY) { - gInventory.startBackgroundFetch(obj->getUUID()); + LLInventoryModelBackgroundFetch::instance().start(obj->getUUID()); } rv = TRUE; @@ -803,7 +843,7 @@ BOOL LLInvFVBridge::isAgentInventory() const BOOL LLInvFVBridge::isCOFFolder() const { - return LLAppearanceManager::instance().getIsInCOF(mUUID); + return LLAppearanceMgr::instance().getIsInCOF(mUUID); } BOOL LLInvFVBridge::isItemPermissive() const @@ -817,21 +857,7 @@ void LLInvFVBridge::changeItemParent(LLInventoryModel* model, const LLUUID& new_parent_id, BOOL restamp) { - if (item->getParentUUID() != new_parent_id) - { - LLInventoryModel::update_list_t update; - LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1); - update.push_back(old_folder); - LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1); - update.push_back(new_folder); - gInventory.accountForUpdate(update); - - LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); - new_item->setParent(new_parent_id); - new_item->updateParentOnServer(restamp); - model->updateItem(new_item); - model->notifyObservers(); - } + change_item_parent(model, item, new_parent_id, restamp); } // static @@ -860,21 +886,11 @@ void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model, model->notifyObservers(); } - -const std::string safe_inv_type_lookup(LLInventoryType::EType inv_type) -{ - const std::string rv= LLInventoryType::lookup(inv_type); - if(rv.empty()) - { - return std::string("<invalid>"); - } - return rv; -} - LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, LLAssetType::EType actual_asset_type, LLInventoryType::EType inv_type, LLInventoryPanel* inventory, + LLFolderView* root, const LLUUID& uuid, U32 flags) { @@ -884,104 +900,104 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_TEXTURE: if(!(inv_type == LLInventoryType::IT_TEXTURE || inv_type == LLInventoryType::IT_SNAPSHOT)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLTextureBridge(inventory, uuid, inv_type); + new_listener = new LLTextureBridge(inventory, root, uuid, inv_type); break; case LLAssetType::AT_SOUND: if(!(inv_type == LLInventoryType::IT_SOUND)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLSoundBridge(inventory, uuid); + new_listener = new LLSoundBridge(inventory, root, uuid); break; case LLAssetType::AT_LANDMARK: if(!(inv_type == LLInventoryType::IT_LANDMARK)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLLandmarkBridge(inventory, uuid, flags); + new_listener = new LLLandmarkBridge(inventory, root, uuid, flags); break; case LLAssetType::AT_CALLINGCARD: if(!(inv_type == LLInventoryType::IT_CALLINGCARD)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLCallingCardBridge(inventory, uuid); + new_listener = new LLCallingCardBridge(inventory, root, uuid); break; case LLAssetType::AT_SCRIPT: if(!(inv_type == LLInventoryType::IT_LSL)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLScriptBridge(inventory, uuid); + new_listener = new LLScriptBridge(inventory, root, uuid); break; case LLAssetType::AT_OBJECT: if(!(inv_type == LLInventoryType::IT_OBJECT || inv_type == LLInventoryType::IT_ATTACHMENT)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLObjectBridge(inventory, uuid, inv_type, flags); + new_listener = new LLObjectBridge(inventory, root, uuid, inv_type, flags); break; case LLAssetType::AT_NOTECARD: if(!(inv_type == LLInventoryType::IT_NOTECARD)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLNotecardBridge(inventory, uuid); + new_listener = new LLNotecardBridge(inventory, root, uuid); break; case LLAssetType::AT_ANIMATION: if(!(inv_type == LLInventoryType::IT_ANIMATION)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLAnimationBridge(inventory, uuid); + new_listener = new LLAnimationBridge(inventory, root, uuid); break; case LLAssetType::AT_GESTURE: if(!(inv_type == LLInventoryType::IT_GESTURE)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLGestureBridge(inventory, uuid); + new_listener = new LLGestureBridge(inventory, root, uuid); break; case LLAssetType::AT_LSL_TEXT: if(!(inv_type == LLInventoryType::IT_LSL)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLLSLTextBridge(inventory, uuid); + new_listener = new LLLSLTextBridge(inventory, root, uuid); break; case LLAssetType::AT_CLOTHING: case LLAssetType::AT_BODYPART: if(!(inv_type == LLInventoryType::IT_WEARABLE)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } - new_listener = new LLWearableBridge(inventory, uuid, asset_type, inv_type, (EWearableType)flags); + new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, (EWearableType)flags); break; case LLAssetType::AT_CATEGORY: if (actual_asset_type == LLAssetType::AT_LINK_FOLDER) { // Create a link folder handler instead. - new_listener = new LLLinkFolderBridge(inventory, uuid); + new_listener = new LLLinkFolderBridge(inventory, root, uuid); break; } - new_listener = new LLFolderBridge(inventory, uuid); + new_listener = new LLFolderBridge(inventory, root, uuid); break; case LLAssetType::AT_LINK: case LLAssetType::AT_LINK_FOLDER: // Only should happen for broken links. - new_listener = new LLLinkItemBridge(inventory, uuid); + new_listener = new LLLinkItemBridge(inventory, root, uuid); break; default: llinfos << "Unhandled asset type (llassetstorage.h): " @@ -1023,6 +1039,38 @@ bool LLInvFVBridge::isInOutfitsSidePanel() const return outfit_panel->isTabPanel(my_panel); } +bool LLInvFVBridge::canShare() +{ + const LLInventoryModel* model = getInventoryModel(); + if(!model) + { + return false; + } + + LLViewerInventoryItem *item = model->getItem(mUUID); + if (item) + { + bool allowed = false; + allowed = LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item); + if (allowed && + !item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + { + allowed = false; + } + if (allowed && + !item->getPermissions().allowCopyBy(gAgent.getID())) + { + allowed = false; + } + return allowed; + } + + LLViewerInventoryCategory* cat = model->getCategory(mUUID); + + // All categories can be given. + return cat != NULL; +} + // +=================================================+ // | InventoryFVBridgeBuilder | // +=================================================+ @@ -1030,29 +1078,31 @@ LLInvFVBridge* LLInventoryFVBridgeBuilder::createBridge(LLAssetType::EType asset LLAssetType::EType actual_asset_type, LLInventoryType::EType inv_type, LLInventoryPanel* inventory, + LLFolderView* root, const LLUUID& uuid, U32 flags /* = 0x00 */) const { return LLInvFVBridge::createBridge(asset_type, - actual_asset_type, - inv_type, - inventory, - uuid, - flags); + actual_asset_type, + inv_type, + inventory, + root, + uuid, + flags); } // +=================================================+ // | LLItemBridge | // +=================================================+ -void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) +void LLItemBridge::performAction(LLInventoryModel* model, std::string action) { if ("goto" == action) { - gotoItem(folder); + gotoItem(); } - if ("open" == action) + if ("open" == action || "open_original" == action) { openItem(); return; @@ -1100,7 +1150,7 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, LLInventoryItem* itemp = model->getItem(mUUID); if (!itemp) return; - LLFolderViewItem* folder_view_itemp = folder->getItemByID(itemp->getParentUUID()); + LLFolderViewItem* folder_view_itemp = mRoot->getItemByID(itemp->getParentUUID()); if (!folder_view_itemp) return; folder_view_itemp->getListener()->pasteFromClipboard(); @@ -1112,7 +1162,7 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, LLInventoryItem* itemp = model->getItem(mUUID); if (!itemp) return; - LLFolderViewItem* folder_view_itemp = folder->getItemByID(itemp->getParentUUID()); + LLFolderViewItem* folder_view_itemp = mRoot->getItemByID(itemp->getParentUUID()); if (!folder_view_itemp) return; folder_view_itemp->getListener()->pasteLinkFromClipboard(); @@ -1123,7 +1173,7 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, void LLItemBridge::selectItem() { LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem()); - if(item && !item->isComplete()) + if(item && !item->isFinished()) { item->fetchFromServer(); } @@ -1181,7 +1231,7 @@ void LLItemBridge::restoreToWorld() } } -void LLItemBridge::gotoItem(LLFolderView *folder) +void LLItemBridge::gotoItem() { LLInventoryObject *obj = getInventoryObject(); if (obj && obj->getIsLinkType()) @@ -1359,13 +1409,65 @@ BOOL LLItemBridge::removeItem() { return FALSE; } + + // move it to the trash LLPreview::hide(mUUID, TRUE); LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); + const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); + LLViewerInventoryItem* item = getItem(); + if (!item) return FALSE; + + // Already in trash + if (model->isObjectDescendentOf(mUUID, trash_id)) return FALSE; + + LLNotification::Params params("ConfirmItemDeleteHasLinks"); + params.functor.function(boost::bind(&LLItemBridge::confirmRemoveItem, this, _1, _2)); + + // Check if this item has any links. If generic inventory linking is enabled, + // we can't do this check because we may have items in a folder somewhere that is + // not yet in memory, so we don't want false negatives. (If disabled, then we + // know we only have links in the Outfits folder which we explicitly fetch.) + if (!gSavedSettings.getBOOL("InventoryLinking")) + { + if (!item->getIsLinkType()) + { + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + LLLinkedItemIDMatches is_linked_item_match(mUUID); + gInventory.collectDescendentsIf(gInventory.getRootFolderID(), + cat_array, + item_array, + LLInventoryModel::INCLUDE_TRASH, + is_linked_item_match); + + const U32 num_links = cat_array.size() + item_array.size(); + if (num_links > 0) + { + // Warn if the user is will break any links when deleting this item. + LLNotifications::instance().add(params); + return FALSE; + } + } + } + + LLNotifications::instance().forceResponse(params, 0); + return TRUE; +} + +BOOL LLItemBridge::confirmRemoveItem(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option != 0) return FALSE; + + LLInventoryModel* model = getInventoryModel(); + if (!model) return FALSE; + LLViewerInventoryItem* item = getItem(); + if (!item) return FALSE; + const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); // if item is not already in trash if(item && !model->isObjectDescendentOf(mUUID, trash_id)) { @@ -1374,11 +1476,7 @@ BOOL LLItemBridge::removeItem() // delete was successful return TRUE; } - else - { - // tried to delete already item in trash (should purge?) - return FALSE; - } + return FALSE; } BOOL LLItemBridge::isItemCopyable() const @@ -1398,17 +1496,11 @@ BOOL LLItemBridge::isItemCopyable() const return FALSE; } - if (gAgent.isGodlike()) - { - // All items can be copied in god mode since you can - // at least paste-as-link the item, though you - // still may not be able paste the item. - return TRUE; - } - else - { - return (item->getPermissions().allowCopyBy(gAgent.getID())); - } + // All items can be copied in god mode since you can + // at least paste-as-link the item, though you + // still may not be able paste the item. + return TRUE; + // return (item->getPermissions().allowCopyBy(gAgent.getID())); } return FALSE; } @@ -1507,14 +1599,10 @@ BOOL LLFolderBridge::isItemRemovable() const return FALSE; } - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( !avatar ) - { - return FALSE; - } + if (!isAgentAvatarValid()) return FALSE; LLInventoryCategory* category = model->getCategory(mUUID); - if( !category ) + if(!category) { return FALSE; } @@ -1553,6 +1641,11 @@ BOOL LLFolderBridge::isUpToDate() const BOOL LLFolderBridge::isItemCopyable() const { + if (gSavedSettings.getBOOL("InventoryLinking")) + { + // Can copy folders to paste-as-link, but not for straight paste. + return TRUE; + } return FALSE; } @@ -1662,8 +1755,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if(!avatar) return FALSE; + if (!isAgentAvatarValid()) return FALSE; // cannot drag categories into library if(!isAgentInventory()) @@ -1687,7 +1779,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, // Is the destination the trash? const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); BOOL move_is_into_trash = (mUUID == trash_id) - || model->isObjectDescendentOf(mUUID, trash_id); + || model->isObjectDescendentOf(mUUID, trash_id); BOOL is_movable = (!LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType())); const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); @@ -1735,12 +1827,11 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } } - - accept = is_movable - && (mUUID != cat_id) // Can't move a folder into itself - && (mUUID != inv_cat->getParentUUID()) // Avoid moves that would change nothing - && !(model->isObjectDescendentOf(mUUID, cat_id)); // Avoid circularity - if(accept && drop) + accept = is_movable + && (mUUID != cat_id) // Can't move a folder into itself + && (mUUID != inv_cat->getParentUUID()) // Avoid moves that would change nothing + && !(model->isObjectDescendentOf(mUUID, cat_id)); // Avoid circularity + if (accept && drop) { // Look for any gestures and deactivate them if (move_is_into_trash) @@ -1749,9 +1840,9 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, { LLInventoryItem* item = descendent_items[i]; if (item->getType() == LLAssetType::AT_GESTURE - && LLGestureManager::instance().isGestureActive(item->getUUID())) + && LLGestureMgr::instance().isGestureActive(item->getUUID())) { - LLGestureManager::instance().deactivateGesture(item->getUUID()); + LLGestureMgr::instance().deactivateGesture(item->getUUID()); } } } @@ -1764,7 +1855,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, { // traverse category and add all contents to currently worn. BOOL append = true; - LLAppearanceManager::instance().wearInventoryCategory(inv_cat, false, append); + LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append); } else { @@ -1772,28 +1863,30 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; gInventory.collectDescendents(inv_cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH); - LLAppearanceManager::instance().linkAll(mUUID,items,NULL); + LLAppearanceMgr::instance().linkAll(mUUID,items,NULL); } } else { #if SUPPORT_ENSEMBLES - // BAP - should skip if dup. - if (move_is_into_current_outfit) - { - LLAppearanceManager::instance().addEnsembleLink(inv_cat); - } - else - { - LLPointer<LLInventoryCallback> cb = NULL; - link_inventory_item( - gAgent.getID(), - inv_cat->getUUID(), - mUUID, - inv_cat->getName(), - LLAssetType::AT_LINK_FOLDER, - cb); - } + // BAP - should skip if dup. + if (move_is_into_current_outfit) + { + LLAppearanceMgr::instance().addEnsembleLink(inv_cat); + } + else + { + LLPointer<LLInventoryCallback> cb = NULL; + const std::string empty_description = ""; + link_inventory_item( + gAgent.getID(), + inv_cat->getUUID(), + mUUID, + inv_cat->getName(), + empty_description, + LLAssetType::AT_LINK_FOLDER, + cb); + } #endif } } @@ -1810,7 +1903,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } } } - else if(LLToolDragAndDrop::SOURCE_WORLD == source) + else if (LLToolDragAndDrop::SOURCE_WORLD == source) { // content category has same ID as object itself LLUUID object_id = inv_cat->getUUID(); @@ -1855,7 +1948,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, // this folder is coming from an object, as there is only one folder in an object, the root, // we need to collect the entire contents and handle them as a group - InventoryObjectList inventory_objects; + LLInventoryObject::object_list_t inventory_objects; object->getInventoryContents(inventory_objects); if (inventory_objects.empty()) @@ -1869,8 +1962,8 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, // coming from a task. Need to figure out if the person can // move/copy this item. - InventoryObjectList::iterator it = inventory_objects.begin(); - InventoryObjectList::iterator end = inventory_objects.end(); + LLInventoryObject::object_list_t::iterator it = inventory_objects.begin(); + LLInventoryObject::object_list_t::iterator end = inventory_objects.end(); for ( ; it != end; ++it) { // coming from a task. Need to figure out if the person can @@ -1900,7 +1993,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, if(drop && accept) { it = inventory_objects.begin(); - InventoryObjectList::iterator first_it = inventory_objects.begin(); + LLInventoryObject::object_list_t::iterator first_it = inventory_objects.begin(); LLMoveInv* move_inv = new LLMoveInv; move_inv->mObjectID = object_id; move_inv->mCategoryID = category_id; @@ -1928,61 +2021,21 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, return accept; } -bool LLFindCOFValidItems::operator()(LLInventoryCategory* cat, - LLInventoryItem* item) -{ - // Valid COF items are: - // - links to wearables (body parts or clothing) - // - links to attachments - // - links to gestures - // - links to ensemble folders - LLViewerInventoryItem *linked_item = ((LLViewerInventoryItem*)item)->getLinkedItem(); - if (linked_item) - { - LLAssetType::EType type = linked_item->getType(); - return (type == LLAssetType::AT_CLOTHING || - type == LLAssetType::AT_BODYPART || - type == LLAssetType::AT_GESTURE || - type == LLAssetType::AT_OBJECT); - } - else - { - LLViewerInventoryCategory *linked_category = ((LLViewerInventoryItem*)item)->getLinkedCategory(); - // BAP remove AT_NONE support after ensembles are fully working? - return (linked_category && - ((linked_category->getPreferredType() == LLFolderType::FT_NONE) || - (LLFolderType::lookupIsEnsembleType(linked_category->getPreferredType())))); - } -} - - -bool LLFindWearables::operator()(LLInventoryCategory* cat, - LLInventoryItem* item) -{ - if(item) - { - if((item->getType() == LLAssetType::AT_CLOTHING) - || (item->getType() == LLAssetType::AT_BODYPART)) - { - return TRUE; - } - } - return FALSE; -} - - - //Used by LLFolderBridge as callback for directory recursion. -class LLRightClickInventoryFetchObserver : public LLInventoryFetchObserver +class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver { public: - LLRightClickInventoryFetchObserver() : + LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) : + LLInventoryFetchItemsObserver(ids), mCopyItems(false) { }; - LLRightClickInventoryFetchObserver(const LLUUID& cat_id, bool copy_items) : + LLRightClickInventoryFetchObserver(const uuid_vec_t& ids, + const LLUUID& cat_id, + bool copy_items) : + LLInventoryFetchItemsObserver(ids), mCatID(cat_id), mCopyItems(copy_items) - { }; + { }; virtual void done() { // we've downloaded all the items, so repaint the dialog @@ -2003,7 +2056,11 @@ protected: class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver { public: - LLRightClickInventoryFetchDescendentsObserver(bool copy_items) : mCopyItems(copy_items) {} + LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids, + bool copy_items) : + LLInventoryFetchDescendentsObserver(ids), + mCopyItems(copy_items) + {} ~LLRightClickInventoryFetchDescendentsObserver() {} virtual void done(); protected: @@ -2014,7 +2071,7 @@ void LLRightClickInventoryFetchDescendentsObserver::done() { // Avoid passing a NULL-ref as mCompleteFolders.front() down to // gInventory.collectDescendents() - if( mCompleteFolders.empty() ) + if( mComplete.empty() ) { llwarns << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << llendl; dec_busy_count(); @@ -2028,7 +2085,7 @@ void LLRightClickInventoryFetchDescendentsObserver::done() // happen. LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; - gInventory.collectDescendents(mCompleteFolders.front(), + gInventory.collectDescendents(mComplete.front(), cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH); @@ -2046,14 +2103,14 @@ void LLRightClickInventoryFetchDescendentsObserver::done() } #endif - LLRightClickInventoryFetchObserver* outfit; - outfit = new LLRightClickInventoryFetchObserver(mCompleteFolders.front(), mCopyItems); - LLInventoryFetchObserver::item_ref_t ids; + uuid_vec_t ids; for(S32 i = 0; i < count; ++i) { ids.push_back(item_array.get(i)->getUUID()); } + LLRightClickInventoryFetchObserver* outfit = new LLRightClickInventoryFetchObserver(ids, mComplete.front(), mCopyItems); + // clean up, and remove this as an observer since the call to the // outfit could notify observers and throw us into an infinite // loop. @@ -2066,19 +2123,19 @@ void LLRightClickInventoryFetchDescendentsObserver::done() inc_busy_count(); // do the fetch - outfit->fetchItems(ids); + outfit->startFetch(); outfit->done(); //Not interested in waiting and this will be right 99% of the time. //Uncomment the following code for laggy Inventory UI. -/* if(outfit->isEverythingComplete()) +/* if(outfit->isFinished()) { - // everything is already here - call done. - outfit->done(); + // everything is already here - call done. + outfit->done(); } else { - // it's all on it's way - add an observer, and the inventory - // will call done for us when everything is here. - gInventory.addObserver(outfit); + // it's all on it's way - add an observer, and the inventory + // will call done for us when everything is here. + gInventory.addObserver(outfit); }*/ } @@ -2092,7 +2149,8 @@ void LLRightClickInventoryFetchDescendentsObserver::done() class LLInventoryCopyAndWearObserver : public LLInventoryObserver { public: - LLInventoryCopyAndWearObserver(const LLUUID& cat_id, int count) :mCatID(cat_id), mContentsCount(count), mFolderAdded(FALSE) {} + LLInventoryCopyAndWearObserver(const LLUUID& cat_id, int count) : + mCatID(cat_id), mContentsCount(count), mFolderAdded(FALSE) {} virtual ~LLInventoryCopyAndWearObserver() {} virtual void changed(U32 mask); @@ -2131,7 +2189,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) if (NULL == category) { llwarns << "gInventory.getCategory(" << mCatID - << ") was NULL" << llendl; + << ") was NULL" << llendl; } else { @@ -2139,7 +2197,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) mContentsCount) { gInventory.removeObserver(this); - LLAppearanceManager::instance().wearInventoryCategory(category, FALSE, TRUE); + LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, TRUE); delete this; } } @@ -2150,11 +2208,11 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) -void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) +void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) { if ("open" == action) { - LLFolderViewFolder *f = dynamic_cast<LLFolderViewFolder *>(folder->getItemByID(mUUID)); + LLFolderViewFolder *f = dynamic_cast<LLFolderViewFolder *>(mRoot->getItemByID(mUUID)); if (f) { f->setOpen(TRUE); @@ -2189,7 +2247,7 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model if(!model) return; LLViewerInventoryCategory* cat = getCategory(); if(!cat) return; - LLAppearanceManager::instance().addEnsembleLink(cat,true); + LLAppearanceMgr::instance().addEnsembleLink(cat,true); return; } #endif @@ -2419,9 +2477,9 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re const LLViewerInventoryItem* item = (*iter); const LLUUID& item_id = item->getUUID(); if (item->getType() == LLAssetType::AT_GESTURE - && LLGestureManager::instance().isGestureActive(item_id)) + && LLGestureMgr::instance().isGestureActive(item_id)) { - LLGestureManager::instance().deactivateGesture(item_id); + LLGestureMgr::instance().deactivateGesture(item_id); } } @@ -2494,26 +2552,26 @@ void LLFolderBridge::pasteLinkFromClipboard() ++iter) { const LLUUID &object_id = (*iter); -#if SUPPORT_ENSEMBLES if (LLInventoryCategory *cat = model->getCategory(object_id)) { + const std::string empty_description = ""; link_inventory_item( gAgent.getID(), cat->getUUID(), parent_id, cat->getName(), + empty_description, LLAssetType::AT_LINK_FOLDER, LLPointer<LLInventoryCallback>(NULL)); } - else -#endif - if (LLInventoryItem *item = model->getItem(object_id)) + else if (LLInventoryItem *item = model->getItem(object_id)) { link_inventory_item( gAgent.getID(), item->getLinkedUUID(), parent_id, item->getName(), + item->getDescription(), LLAssetType::AT_LINK, LLPointer<LLInventoryCallback>(NULL)); } @@ -2541,7 +2599,7 @@ void LLFolderBridge::folderOptionsMenu() const bool is_system_folder = LLFolderType::lookupIsProtectedType(type); // BAP change once we're no longer treating regular categories as ensembles. const bool is_ensemble = (type == LLFolderType::FT_NONE || - LLFolderType::lookupIsEnsembleType(type)); + LLFolderType::lookupIsEnsembleType(type)); // calling card related functionality for folders. @@ -2671,10 +2729,17 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) const LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); if (lost_and_found_id == mUUID) - { + { // This is the lost+found folder. - mItems.push_back(std::string("Empty Lost And Found")); - } + mItems.push_back(std::string("Empty Lost And Found")); + + mDisabledItems.push_back(std::string("New Folder")); + mDisabledItems.push_back(std::string("New Script")); + mDisabledItems.push_back(std::string("New Note")); + mDisabledItems.push_back(std::string("New Gesture")); + mDisabledItems.push_back(std::string("New Clothes")); + mDisabledItems.push_back(std::string("New Body Parts")); + } if(trash_id == mUUID) { @@ -2724,7 +2789,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) addDeleteContextMenuOptions(mItems, mDisabledItems); // EXT-4030: disallow deletion of currently worn outfit - const LLViewerInventoryItem *base_outfit_link = LLAppearanceManager::instance().getBaseOutfitLink(); + const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink(); if (base_outfit_link && (cat == base_outfit_link->getLinkedCategory())) { mDisabledItems.push_back(std::string("Delete")); @@ -2754,17 +2819,18 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) mMenu = &menu; sSelf = this; - LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(FALSE); - LLInventoryFetchDescendentsObserver::folder_ref_t folders; + + uuid_vec_t folders; LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID); if (category) { folders.push_back(category->getUUID()); } - fetch->fetchDescendents(folders); + LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE); + fetch->startFetch(); inc_busy_count(); - if(fetch->isEverythingComplete()) + if(fetch->isFinished()) { // everything is already here - call done. fetch->done(); @@ -2787,7 +2853,13 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { mDisabledItems.push_back(std::string("Delete System Folder")); } - + + mItems.push_back(std::string("Share")); + if (!canShare()) + { + mDisabledItems.push_back(std::string("Share")); + } + hide_context_entries(menu, mItems, mDisabledItems); } @@ -2959,10 +3031,10 @@ void LLFolderBridge::createWearable(const LLUUID &parent_id, EWearableType type) LLAssetType::EType asset_type = wearable->getAssetType(); LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, wearable->getTransactionID(), wearable->getName(), - wearable->getDescription(), asset_type, inv_type, wearable->getType(), - wearable->getPermissions().getMaskNextOwner(), - LLPointer<LLInventoryCallback>(NULL)); + parent_id, wearable->getTransactionID(), wearable->getName(), + wearable->getDescription(), asset_type, inv_type, wearable->getType(), + wearable->getPermissions().getMaskNextOwner(), + LLPointer<LLInventoryCallback>(NULL)); } void LLFolderBridge::modifyOutfit(BOOL append) @@ -2972,7 +3044,7 @@ void LLFolderBridge::modifyOutfit(BOOL append) LLViewerInventoryCategory* cat = getCategory(); if(!cat) return; - LLAppearanceManager::instance().wearInventoryCategory( cat, FALSE, append ); + LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, append ); } // helper stuff @@ -2986,7 +3058,7 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response { if (cat_and_wear && cat_and_wear->mWear) { - InventoryObjectList inventory_objects; + LLInventoryObject::object_list_t inventory_objects; object->getInventoryContents(inventory_objects); int contents_count = inventory_objects.size()-1; //subtract one for containing folder @@ -2996,8 +3068,8 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response two_uuids_list_t::iterator move_it; for (move_it = move_inv->mMoveList.begin(); - move_it != move_inv->mMoveList.end(); - ++move_it) + move_it != move_inv->mMoveList.end(); + ++move_it) { object->moveInventory(move_it->first, move_it->second); } @@ -3027,8 +3099,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, return FALSE; } - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if(!avatar) return FALSE; + if (!isAgentAvatarValid()) return FALSE; LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); BOOL accept = FALSE; @@ -3038,11 +3109,11 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, BOOL is_movable = TRUE; switch( inv_item->getActualType() ) { - case LLAssetType::AT_CATEGORY: - is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType()); - break; - default: - break; + case LLAssetType::AT_CATEGORY: + is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType()); + break; + default: + break; } const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); @@ -3050,7 +3121,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_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()); + const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID()); // Can't explicitly drag things out of the COF. if (move_is_outof_current_outfit) @@ -3082,9 +3153,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if(accept && drop) { if (inv_item->getType() == LLAssetType::AT_GESTURE - && LLGestureManager::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash) + && LLGestureMgr::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash) { - LLGestureManager::instance().deactivateGesture(inv_item->getUUID()); + LLGestureMgr::instance().deactivateGesture(inv_item->getUUID()); } // If an item is being dragged between windows, unselect // everything in the active window so that we don't follow @@ -3137,7 +3208,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // BAP - should skip if dup. if (move_is_into_current_outfit) { - LLAppearanceManager::instance().addCOFItemLink(inv_item); + LLAppearanceMgr::instance().addCOFItemLink(inv_item); } else { @@ -3147,6 +3218,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, inv_item->getLinkedUUID(), mUUID, inv_item->getName(), + inv_item->getDescription(), LLAssetType::AT_LINK, cb); } @@ -3207,6 +3279,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else { + // store dad inventory item to select added one later. See EXT-4347 + set_dad_inventory_item(inv_item, mUUID); + LLNotification::Params params("MoveInventoryFromObject"); params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv)); LLNotifications::instance().forceResponse(params, 0); @@ -3220,13 +3295,13 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if(drop) { copy_inventory_from_notecard(LLToolDragAndDrop::getInstance()->getObjectID(), - LLToolDragAndDrop::getInstance()->getSourceID(), inv_item); + LLToolDragAndDrop::getInstance()->getSourceID(), inv_item); } } else if(LLToolDragAndDrop::SOURCE_LIBRARY == source) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item; - if(item && item->isComplete()) + if(item && item->isFinished()) { accept = TRUE; if(drop) @@ -3303,7 +3378,13 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { - items.push_back(std::string("Open")); + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } + + addOpenRightClickMenuOption(items); items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); @@ -3319,7 +3400,7 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } // virtual -void LLTextureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) +void LLTextureBridge::performAction(LLInventoryModel* model, std::string action) { if ("save_as" == action) { @@ -3330,7 +3411,7 @@ void LLTextureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode preview_texture->openToSave(); } } - else LLItemBridge::performAction(folder, model, action); + else LLItemBridge::performAction(model, action); } // +=================================================+ @@ -3355,14 +3436,14 @@ void LLSoundBridge::openItem() // only open the preview dialog through the contextual right-click menu // double-click just plays the sound - LLViewerInventoryItem* item = getItem(); - if(item) - { - openSoundPreview((void*)this); - //send_uuid_sound_trigger(item->getAssetUUID(), 1.0); - } -*/ +LLViewerInventoryItem* item = getItem(); +if(item) +{ +openSoundPreview((void*)this); +//send_uuid_sound_trigger(item->getAssetUUID(), 1.0); } +*/ + } void LLSoundBridge::previewItem() { @@ -3391,6 +3472,11 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } items.push_back(std::string("Sound Open")); items.push_back(std::string("Properties")); @@ -3407,11 +3493,14 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // | LLLandmarkBridge | // +=================================================+ -LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory, const LLUUID& uuid, U32 flags/* = 0x00*/) : -LLItemBridge(inventory, uuid) +LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid, + U32 flags/* = 0x00*/) : + LLItemBridge(inventory, root, uuid) { mVisited = FALSE; - if (flags & LLInventoryItem::II_FLAGS_LANDMARK_VISITED) + if (flags & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED) { mVisited = TRUE; } @@ -3434,6 +3523,11 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } items.push_back(std::string("Landmark Open")); items.push_back(std::string("Properties")); @@ -3469,7 +3563,7 @@ void teleport_via_landmark(const LLUUID& asset_id) } // virtual -void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) +void LLLandmarkBridge::performAction(LLInventoryModel* model, std::string action) { if ("teleport" == action) { @@ -3493,7 +3587,7 @@ void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* mod } else { - LLItemBridge::performAction(folder, model, action); + LLItemBridge::performAction(model, action); } } @@ -3520,35 +3614,33 @@ void LLLandmarkBridge::openItem() { LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } -/* - LLViewerInventoryItem* item = getItem(); - if( item ) - { - // Opening (double-clicking) a landmark immediately teleports, - // but warns you the first time. - // open_landmark(item); - LLSD payload; - payload["asset_id"] = item->getAssetUUID(); - LLNotificationsUtil::add("TeleportFromLandmark", LLSD(), payload); - } -*/ } // +=================================================+ // | LLCallingCardObserver | // +=================================================+ -void LLCallingCardObserver::changed(U32 mask) +class LLCallingCardObserver : public LLFriendObserver { - mBridgep->refreshFolderViewItem(); -} +public: + LLCallingCardObserver(LLCallingCardBridge* bridge) : mBridgep(bridge) {} + virtual ~LLCallingCardObserver() { mBridgep = NULL; } + virtual void changed(U32 mask) + { + mBridgep->refreshFolderViewItem(); + } +protected: + LLCallingCardBridge* mBridgep; +}; // +=================================================+ // | LLCallingCardBridge | // +=================================================+ -LLCallingCardBridge::LLCallingCardBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) : - LLItemBridge(inventory, uuid) +LLCallingCardBridge::LLCallingCardBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid ) : + LLItemBridge(inventory, root, uuid) { mObserver = new LLCallingCardObserver(this); LLAvatarTracker::instance().addObserver(mObserver); @@ -3571,7 +3663,7 @@ void LLCallingCardBridge::refreshFolderViewItem() } // virtual -void LLCallingCardBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) +void LLCallingCardBridge::performAction(LLInventoryModel* model, std::string action) { if ("begin_im" == action) { @@ -3604,7 +3696,7 @@ void LLCallingCardBridge::performAction(LLFolderView* folder, LLInventoryModel* LLAvatarActions::offerTeleport(item->getCreatorUUID()); } } - else LLItemBridge::performAction(folder, model, action); + else LLItemBridge::performAction(model, action); } LLUIImagePtr LLCallingCardBridge::getIcon() const @@ -3640,11 +3732,11 @@ void LLCallingCardBridge::openItem() LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } /* - LLViewerInventoryItem* item = getItem(); - if(item && !item->getCreatorUUID().isNull()) - { - LLAvatarActions::showProfile(item->getCreatorUUID()); - } + LLViewerInventoryItem* item = getItem(); + if(item && !item->getCreatorUUID().isNull()) + { + LLAvatarActions::showProfile(item->getCreatorUUID()); + } */ } @@ -3660,15 +3752,20 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { - items.push_back(std::string("Open")); + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } + addOpenRightClickMenuOption(items); items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); LLInventoryItem* item = getItem(); BOOL good_card = (item - && (LLUUID::null != item->getCreatorUUID()) - && (item->getCreatorUUID() != gAgent.getID())); + && (LLUUID::null != item->getCreatorUUID()) + && (item->getCreatorUUID() != gAgent.getID())); BOOL user_online = FALSE; if (item) { @@ -3703,16 +3800,16 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, // check the type switch(cargo_type) { - case DAD_TEXTURE: - case DAD_SOUND: - case DAD_LANDMARK: - case DAD_SCRIPT: - case DAD_CLOTHING: - case DAD_OBJECT: - case DAD_NOTECARD: - case DAD_BODYPART: - case DAD_ANIMATION: - case DAD_GESTURE: + case DAD_TEXTURE: + case DAD_SOUND: + case DAD_LANDMARK: + case DAD_SCRIPT: + case DAD_CLOTHING: + case DAD_OBJECT: + case DAD_NOTECARD: + case DAD_BODYPART: + case DAD_ANIMATION: + case DAD_GESTURE: { LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data; const LLPermissions& perm = inv_item->getPermissions(); @@ -3735,7 +3832,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, } break; } - case DAD_CATEGORY: + case DAD_CATEGORY: { LLInventoryCategory* inv_cat = (LLInventoryCategory*)cargo_data; if( gInventory.getCategory( inv_cat->getUUID() ) ) @@ -3757,8 +3854,8 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, } break; } - default: - break; + default: + break; } } return rv; @@ -3783,11 +3880,11 @@ void LLNotecardBridge::openItem() } /* - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES); - } + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES); + } */ } @@ -3803,7 +3900,7 @@ LLUIImagePtr LLGestureBridge::getIcon() const LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const { - if( LLGestureManager::instance().isGestureActive(mUUID) ) + if( LLGestureMgr::instance().isGestureActive(mUUID) ) { return LLFontGL::BOLD; } @@ -3815,7 +3912,7 @@ LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const std::string LLGestureBridge::getLabelSuffix() const { - if( LLGestureManager::instance().isGestureActive(mUUID) ) + if( LLGestureMgr::instance().isGestureActive(mUUID) ) { LLStringUtil::format_map_t args; args["[GESLABEL]"] = LLItemBridge::getLabelSuffix(); @@ -3828,11 +3925,11 @@ std::string LLGestureBridge::getLabelSuffix() const } // virtual -void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) +void LLGestureBridge::performAction(LLInventoryModel* model, std::string action) { if (isAddAction(action)) { - LLGestureManager::instance().activateGesture(mUUID); + LLGestureMgr::instance().activateGesture(mUUID); LLViewerInventoryItem* item = gInventory.getItem(mUUID); if (!item) return; @@ -3844,7 +3941,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode } else if (isRemoveAction(action)) { - LLGestureManager::instance().deactivateGesture(mUUID); + LLGestureMgr::instance().deactivateGesture(mUUID); LLViewerInventoryItem* item = gInventory.getItem(mUUID); if (!item) return; @@ -3856,17 +3953,17 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode } else if("play" == action) { - if(!LLGestureManager::instance().isGestureActive(mUUID)) + if(!LLGestureMgr::instance().isGestureActive(mUUID)) { // we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList. BOOL inform_server = TRUE; BOOL deactivate_similar = FALSE; - LLGestureManager::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID)); + LLGestureMgr::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID)); LLViewerInventoryItem* item = gInventory.getItem(mUUID); llassert(item); if (item) { - LLGestureManager::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar); + LLGestureMgr::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar); } } else @@ -3874,7 +3971,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode playGesture(mUUID); } } - else LLItemBridge::performAction(folder, model, action); + else LLItemBridge::performAction(model, action); } void LLGestureBridge::openItem() @@ -3886,12 +3983,12 @@ void LLGestureBridge::openItem() LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } /* - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null); - preview->setFocus(TRUE); - } + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null); + preview->setFocus(TRUE); + } */ } @@ -3908,7 +4005,7 @@ BOOL LLGestureBridge::removeItem() // This will also force close the preview window, if it exists. // This may actually delete *this, if mUUID is in the COF. - LLGestureManager::instance().deactivateGesture(item_id); + LLGestureMgr::instance().deactivateGesture(item_id); // If deactivateGesture deleted *this, then return out immediately. if (!model->getObject(item_id)) @@ -3930,18 +4027,23 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } bool is_sidepanel = isInOutfitsSidePanel(); if (!is_sidepanel) { - items.push_back(std::string("Open")); + addOpenRightClickMenuOption(items); items.push_back(std::string("Properties")); } getClipboardEntries(true, items, disabled_items, flags); items.push_back(std::string("Gesture Separator")); - if (LLGestureManager::instance().isGestureActive(getUUID())) + if (LLGestureMgr::instance().isGestureActive(getUUID())) { items.push_back(std::string("Deactivate")); } @@ -3956,13 +4058,13 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // static void LLGestureBridge::playGesture(const LLUUID& item_id) { - if (LLGestureManager::instance().isGesturePlaying(item_id)) + if (LLGestureMgr::instance().isGesturePlaying(item_id)) { - LLGestureManager::instance().stopGesture(item_id); + LLGestureMgr::instance().stopGesture(item_id); } else { - LLGestureManager::instance().playGesture(item_id); + LLGestureMgr::instance().playGesture(item_id); } } @@ -3988,6 +4090,11 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } items.push_back(std::string("Animation Open")); items.push_back(std::string("Properties")); @@ -4003,7 +4110,7 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } // virtual -void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) +void LLAnimationBridge::performAction(LLInventoryModel* model, std::string action) { if ((action == "playworld") || (action == "playlocal")) { @@ -4022,7 +4129,7 @@ void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* mo } else { - LLItemBridge::performAction(folder, model, action); + LLItemBridge::performAction(model, action); } } @@ -4035,11 +4142,11 @@ void LLAnimationBridge::openItem() LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } /* - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES); - } + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES); + } */ } @@ -4050,12 +4157,17 @@ void LLAnimationBridge::openItem() // static LLUUID LLObjectBridge::sContextMenuItemID; -LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type, U32 flags) : -LLItemBridge(inventory, uuid), mInvType(type) +LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid, + LLInventoryType::EType type, + U32 flags) : + LLItemBridge(inventory, root, uuid), + mInvType(type) { mAttachPt = (flags & 0xff); // low bye of inventory flags - mIsMultiObject = ( flags & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? TRUE: FALSE; + mIsMultiObject = ( flags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? TRUE: FALSE; } LLUIImagePtr LLObjectBridge::getIcon() const @@ -4075,7 +4187,7 @@ LLInventoryObject* LLObjectBridge::getObject() const } // virtual -void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) +void LLObjectBridge::performAction(LLInventoryModel* model, std::string action) { if (isAddAction(action)) { @@ -4086,7 +4198,7 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model { rez_attachment(item, NULL); } - else if(item && item->isComplete()) + else if(item && item->isFinished()) { // must be in library. copy it to our inventory and put it on. LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0); @@ -4119,7 +4231,7 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model } } } - else LLItemBridge::performAction(folder, model, action); + else LLItemBridge::performAction(model, action); } void LLObjectBridge::openItem() @@ -4137,7 +4249,7 @@ void LLObjectBridge::openItem() // Disable old properties floater; this is replaced by the sidepanel. /* - LLFloaterReg::showInstance("properties", mUUID); + LLFloaterReg::showInstance("properties", mUUID); */ } @@ -4163,8 +4275,7 @@ std::string LLObjectBridge::getLabelSuffix() const { if (get_is_item_worn(mUUID)) { - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - std::string attachment_point_name = avatar->getAttachedPointName(mUUID); + std::string attachment_point_name = gAgentAvatarp->getAttachedPointName(mUUID); // e.g. "(worn on ...)" / "(attached to ...)" LLStringUtil::format_map_t args; @@ -4183,10 +4294,10 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach payload["item_id"] = item->getLinkedUUID(); // Wear the base object in case this is a link. S32 attach_pt = 0; - if (gAgent.getAvatarObject() && attachment) + if (isAgentAvatarValid() && attachment) { - for (LLVOAvatar::attachment_map_t::iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin(); - iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter) + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) { if (iter->second == attachment) { @@ -4212,9 +4323,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response) { - LLVOAvatar *avatarp = gAgent.getAvatarObject(); - - if (!avatarp->canAttachMoreObjects()) + if (!gAgentAvatarp->canAttachMoreObjects()) { LLSD args; args["MAX_ATTACHMENTS"] = llformat("%d", MAX_AGENT_ATTACHMENTS); @@ -4262,6 +4371,11 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } bool is_sidepanel = isInOutfitsSidePanel(); if (!is_sidepanel) @@ -4276,11 +4390,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLInventoryItem *item = getItem(); if(item) { - LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); - if( !avatarp ) - { - return; - } + if (!isAgentAvatarValid()) return; if( get_is_item_worn( mUUID ) ) { @@ -4296,7 +4406,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // commented out for DEV-32347 //items.push_back(std::string("Restore to Last Position")); - if (!avatarp->canAttachMoreObjects()) + if (!gAgentAvatarp->canAttachMoreObjects()) { disabled_items.push_back(std::string("Object Wear")); disabled_items.push_back(std::string("Attach To")); @@ -4304,15 +4414,14 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", TRUE); LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", TRUE); - LLVOAvatar *avatarp = gAgent.getAvatarObject(); if (attach_menu && (attach_menu->getChildCount() == 0) && attach_hud_menu && (attach_hud_menu->getChildCount() == 0) - && avatarp) + && isAgentAvatarValid()) { - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end(); ) + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; @@ -4362,11 +4471,10 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name) model->notifyObservers(); - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( avatar ) + if (isAgentAvatarValid()) { - LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); - if( obj ) + LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() ); + if(obj) { LLSelectMgr::getInstance()->deselectAll(); LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE ); @@ -4397,19 +4505,25 @@ void LLLSLTextBridge::openItem() { LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } - /* - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES); - } - */ } // +=================================================+ // | LLWearableBridge | // +=================================================+ +LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid, + LLAssetType::EType asset_type, + LLInventoryType::EType inv_type, + EWearableType wearable_type) : + LLItemBridge(inventory, root, uuid), + mAssetType( asset_type ), + mInvType(inv_type), + mWearableType(wearable_type) +{ +} + // *NOTE: hack to get from avatar inventory to avatar void wear_inventory_item_on_avatar( LLInventoryItem* item ) { @@ -4418,7 +4532,7 @@ void wear_inventory_item_on_avatar( LLInventoryItem* item ) lldebugs << "wear_inventory_item_on_avatar( " << item->getName() << " )" << llendl; - LLAppearanceManager::instance().addCOFItemLink(item); + LLAppearanceMgr::instance().addCOFItemLink(item); } } @@ -4430,10 +4544,10 @@ void wear_add_inventory_item_on_avatar( LLInventoryItem* item ) << " )" << llendl; LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - LLWearableBridge::onWearAddOnAvatarArrived, - new LLUUID(item->getUUID())); + item->getName(), + item->getType(), + LLWearableBridge::onWearAddOnAvatarArrived, + new LLUUID(item->getUUID())); } } @@ -4555,7 +4669,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ LLViewerInventoryItem *gest_item = gest_item_array.get(i); if (get_is_item_worn(gest_item->getUUID())) { - LLGestureManager::instance().deactivateGesture( gest_item->getLinkedUUID() ); + LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() ); gInventory.updateItem( gest_item ); gInventory.notifyObservers(); } @@ -4593,7 +4707,7 @@ LLUIImagePtr LLWearableBridge::getIcon() const } // virtual -void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) +void LLWearableBridge::performAction(LLInventoryModel* model, std::string action) { if (isAddAction(action)) { @@ -4613,7 +4727,7 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod removeFromAvatar(); return; } - else LLItemBridge::performAction(folder, model, action); + else LLItemBridge::performAction(model, action); } void LLWearableBridge::openItem() @@ -4624,42 +4738,6 @@ void LLWearableBridge::openItem() { LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } - /* - if( isItemInTrash() ) - { - LLNotificationsUtil::add("CannotWearTrash"); - } - else if(isAgentInventory()) - { - if( !get_is_item_worn( mUUID ) ) - { - wearOnAvatar(); - } - } - else - { - // must be in the inventory library. copy it to our inventory - // and put it on right away. - LLViewerInventoryItem* item = getItem(); - if(item && item->isComplete()) - { - LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback(); - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - LLUUID::null, - std::string(), - cb); - } - else if(item) - { - // *TODO: We should fetch the item details, and then do - // the operation above. - LLNotificationsUtil::add("CannotWearInfoNotComplete"); - } - } - */ } void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) @@ -4687,11 +4765,16 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) can_open = FALSE; } + items.push_back(std::string("Share")); + if (!canShare()) + { + disabled_items.push_back(std::string("Share")); + } bool is_sidepanel = isInOutfitsSidePanel(); if (can_open && !is_sidepanel) { - items.push_back(std::string("Open")); + addOpenRightClickMenuOption(items); } if (!is_sidepanel) @@ -4758,7 +4841,7 @@ BOOL LLWearableBridge::canWearOnAvatar(void* user_data) if(!self->isAgentInventory()) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem(); - if(!item || !item->isComplete()) return FALSE; + if(!item || !item->isFinished()) return FALSE; } return (!get_is_item_worn(self->mUUID)); } @@ -4915,10 +4998,10 @@ void LLWearableBridge::editOnAvatar() if (gFloaterCustomize) gFloaterCustomize->setCurrentWearableType( wearable->getType() ); - if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() ) + if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgentCamera.getCameraMode() ) { // Start Avatar Customization - gAgent.changeCameraToCustomizeAvatar(); + gAgentCamera.changeCameraToCustomizeAvatar(); } } } @@ -4969,34 +5052,21 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES ) ) //&& //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) ) { - // MULTI_WEARABLE: FIXME HACK - always remove all bool do_remove_all = false; - gAgentWearables.removeWearable( type, do_remove_all, 0 ); + U32 index = gAgentWearables.getWearableIndex(wearable); + gAgentWearables.removeWearable( type, do_remove_all, index ); } } } // Find and remove this item from the COF. - // FIXME 2.1 - call removeCOFItemLinks in llappearancemgr instead. - LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(item_id, LLAppearanceManager::instance().getCOF()); - if (items.size() != 1) - { - llwarns << "Found " << items.size() << " COF links to " << item_id.asString() << ", expected 1" << llendl; - } - for (LLInventoryModel::item_array_t::const_iterator iter = items.begin(); - iter != items.end(); - ++iter) - { - const LLViewerInventoryItem *linked_item = (*iter); - const LLUUID &item_id = linked_item->getUUID(); - gInventory.purgeObject(item_id); - } + LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false); gInventory.notifyObservers(); delete on_remove_struct; } -/* static */ +// static void LLWearableBridge::removeAllClothesFromAvatar() { // Remove COF links. @@ -5016,20 +5086,7 @@ void LLWearableBridge::removeAllClothesFromAvatar() continue; // Find and remove this item from the COF. - LLInventoryModel::item_array_t items = gInventory.collectLinkedItems( - item_id, LLAppearanceManager::instance().getCOF()); - if (items.size() != 1) - { - llwarns << "Found " << items.size() << " COF links to " << item_id.asString() << ", expected 1" << llendl; - } - for (LLInventoryModel::item_array_t::const_iterator iter = items.begin(); - iter != items.end(); - ++iter) - { - const LLViewerInventoryItem *linked_item = (*iter); - const LLUUID &item_id = linked_item->getUUID(); - gInventory.purgeObject(item_id); - } + LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false); } gInventory.notifyObservers(); @@ -5037,7 +5094,7 @@ void LLWearableBridge::removeAllClothesFromAvatar() LLAgentWearables::userRemoveAllClothes(); } -/* static */ +// static void LLWearableBridge::removeItemFromAvatar(LLViewerInventoryItem *item) { if (item) @@ -5059,65 +5116,132 @@ void LLWearableBridge::removeFromAvatar() } } -LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type, - const LLUUID& uuid,LLInventoryModel* model) +// +=================================================+ +// | LLLinkItemBridge | +// +=================================================+ +// For broken item links +std::string LLLinkItemBridge::sPrefix("Link: "); +LLUIImagePtr LLLinkItemBridge::getIcon() const { - LLInvFVBridgeAction* action = NULL; - switch(asset_type) + if (LLViewerInventoryItem *item = getItem()) { - case LLAssetType::AT_TEXTURE: - action = new LLTextureBridgeAction(uuid,model); - break; - - case LLAssetType::AT_SOUND: - action = new LLSoundBridgeAction(uuid,model); - break; - - case LLAssetType::AT_LANDMARK: - action = new LLLandmarkBridgeAction(uuid,model); - break; - - case LLAssetType::AT_CALLINGCARD: - action = new LLCallingCardBridgeAction(uuid,model); - break; - - case LLAssetType::AT_OBJECT: - action = new LLObjectBridgeAction(uuid,model); - break; - - case LLAssetType::AT_NOTECARD: - action = new LLNotecardBridgeAction(uuid,model); - break; - - case LLAssetType::AT_ANIMATION: - action = new LLAnimationBridgeAction(uuid,model); - break; - - case LLAssetType::AT_GESTURE: - action = new LLGestureBridgeAction(uuid,model); - break; + U32 attachment_point = (item->getFlags() & 0xff); // low byte of inventory flags + bool is_multi = LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags(); - case LLAssetType::AT_LSL_TEXT: - action = new LLLSLTextBridgeAction(uuid,model); - break; + return get_item_icon(item->getActualType(), item->getInventoryType(), attachment_point, is_multi); + } + return get_item_icon(LLAssetType::AT_LINK, LLInventoryType::IT_NONE, 0, FALSE); +} +void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + // *TODO: Translate + lldebugs << "LLLink::buildContextMenu()" << llendl; + menuentry_vec_t items; + menuentry_vec_t disabled_items; - case LLAssetType::AT_CLOTHING: - case LLAssetType::AT_BODYPART: - action = new LLWearableBridgeAction(uuid,model); + items.push_back(std::string("Find Original")); + disabled_items.push_back(std::string("Find Original")); + + if(isItemInTrash()) + { + addTrashContextMenuOptions(items, disabled_items); + } + else + { + items.push_back(std::string("Properties")); + addDeleteContextMenuOptions(items, disabled_items); + } + hide_context_entries(menu, items, disabled_items); +} - break; +// +=================================================+ +// | LLLinkBridge | +// +=================================================+ +// For broken folder links. +std::string LLLinkFolderBridge::sPrefix("Link: "); +LLUIImagePtr LLLinkFolderBridge::getIcon() const +{ + LLFolderType::EType preferred_type = LLFolderType::FT_NONE; + if (LLViewerInventoryItem *item = getItem()) + { + if (const LLViewerInventoryCategory* cat = item->getLinkedCategory()) + { + preferred_type = cat->getPreferredType(); + } + } + return LLFolderBridge::getIcon(preferred_type); +} +void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + // *TODO: Translate + lldebugs << "LLLink::buildContextMenu()" << llendl; + menuentry_vec_t items; + menuentry_vec_t disabled_items; - default: - break; + if (isItemInTrash()) + { + addTrashContextMenuOptions(items, disabled_items); + } + else + { + items.push_back(std::string("Find Original")); + addDeleteContextMenuOptions(items, disabled_items); + } + hide_context_entries(menu, items, disabled_items); +} +void LLLinkFolderBridge::performAction(LLInventoryModel* model, std::string action) +{ + if ("goto" == action) + { + gotoItem(); + return; + } + LLItemBridge::performAction(model,action); +} +void LLLinkFolderBridge::gotoItem() +{ + const LLUUID &cat_uuid = getFolderID(); + if (!cat_uuid.isNull()) + { + if (LLFolderViewItem *base_folder = mRoot->getItemByID(cat_uuid)) + { + if (LLInventoryModel* model = getInventoryModel()) + { + model->fetchDescendentsOf(cat_uuid); + } + base_folder->setOpen(TRUE); + mRoot->setSelectionFromRoot(base_folder,TRUE); + mRoot->scrollToShowSelection(); + } } - return action; +} +const LLUUID &LLLinkFolderBridge::getFolderID() const +{ + if (LLViewerInventoryItem *link_item = getItem()) + { + if (const LLViewerInventoryCategory *cat = link_item->getLinkedCategory()) + { + const LLUUID& cat_uuid = cat->getUUID(); + return cat_uuid; + } + } + return LLUUID::null; } -//static +/******************************************************************************** + ** + ** BRIDGE ACTIONS + **/ + +// static void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type, - const LLUUID& uuid,LLInventoryModel* model) + const LLUUID& uuid, + LLInventoryModel* model) { - LLInvFVBridgeAction* action = createAction(asset_type,uuid,model); + // Perform indirection in case of link. + const LLUUID& linked_uuid = gInventory.getLinkedItemID(uuid); + + LLInvFVBridgeAction* action = createAction(asset_type,linked_uuid,model); if(action) { action->doIt(); @@ -5125,7 +5249,7 @@ void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type, } } -//static +// static void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model) { llassert(model); @@ -5145,129 +5269,232 @@ void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model) LLViewerInventoryItem* LLInvFVBridgeAction::getItem() const { - if(mModel) + if (mModel) return (LLViewerInventoryItem*)mModel->getItem(mUUID); return NULL; } -//virtual -void LLTextureBridgeAction::doIt() +class LLTextureBridgeAction: public LLInvFVBridgeAction { - if (getItem()) + friend class LLInvFVBridgeAction; +public: + virtual void doIt() { - LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); + if (getItem()) + { + LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); + } + LLInvFVBridgeAction::doIt(); } + virtual ~LLTextureBridgeAction(){} +protected: + LLTextureBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} +}; - LLInvFVBridgeAction::doIt(); -} - -//virtual -void LLSoundBridgeAction::doIt() +class LLSoundBridgeAction: public LLInvFVBridgeAction { - LLViewerInventoryItem* item = getItem(); - if(item) + friend class LLInvFVBridgeAction; +public: + virtual void doIt() { - LLFloaterReg::showInstance("preview_sound", LLSD(mUUID), TAKE_FOCUS_YES); + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_sound", LLSD(mUUID), TAKE_FOCUS_YES); + } + LLInvFVBridgeAction::doIt(); } + virtual ~LLSoundBridgeAction(){} +protected: + LLSoundBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} +}; - LLInvFVBridgeAction::doIt(); -} - - -//virtual -void LLLandmarkBridgeAction::doIt() +class LLLandmarkBridgeAction: public LLInvFVBridgeAction { - LLViewerInventoryItem* item = getItem(); - if( item ) + friend class LLInvFVBridgeAction; +public: + virtual void doIt() { - // Opening (double-clicking) a landmark immediately teleports, - // but warns you the first time. - LLSD payload; - payload["asset_id"] = item->getAssetUUID(); - - LLSD args; - args["LOCATION"] = item->getName(); - - LLNotificationsUtil::add("TeleportFromLandmark", args, payload); + LLViewerInventoryItem* item = getItem(); + if (item) + { + // Opening (double-clicking) a landmark immediately teleports, + // but warns you the first time. + LLSD payload; + payload["asset_id"] = item->getAssetUUID(); + + LLSD args; + args["LOCATION"] = item->getName(); + + LLNotificationsUtil::add("TeleportFromLandmark", args, payload); + } + LLInvFVBridgeAction::doIt(); } + virtual ~LLLandmarkBridgeAction(){} +protected: + LLLandmarkBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} +}; - LLInvFVBridgeAction::doIt(); -} - - -//virtual -void LLCallingCardBridgeAction::doIt() +class LLCallingCardBridgeAction: public LLInvFVBridgeAction { - LLViewerInventoryItem* item = getItem(); - if(item && item->getCreatorUUID().notNull()) + friend class LLInvFVBridgeAction; +public: + virtual void doIt() { - LLAvatarActions::showProfile(item->getCreatorUUID()); + LLViewerInventoryItem* item = getItem(); + if (item && item->getCreatorUUID().notNull()) + { + LLAvatarActions::showProfile(item->getCreatorUUID()); + } + LLInvFVBridgeAction::doIt(); } + virtual ~LLCallingCardBridgeAction(){} +protected: + LLCallingCardBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} - LLInvFVBridgeAction::doIt(); -} +}; -//virtual -void -LLNotecardBridgeAction::doIt() +class LLNotecardBridgeAction +: public LLInvFVBridgeAction { - LLViewerInventoryItem* item = getItem(); - if (item) + friend class LLInvFVBridgeAction; +public: + virtual void doIt() { - LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES); + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES); + } + LLInvFVBridgeAction::doIt(); } + virtual ~LLNotecardBridgeAction(){} +protected: + LLNotecardBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} +}; - LLInvFVBridgeAction::doIt(); -} - -//virtual -void LLGestureBridgeAction::doIt() +class LLGestureBridgeAction: public LLInvFVBridgeAction { - LLViewerInventoryItem* item = getItem(); - if (item) + friend class LLInvFVBridgeAction; +public: + virtual void doIt() { - LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null); - preview->setFocus(TRUE); + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null); + preview->setFocus(TRUE); + } + LLInvFVBridgeAction::doIt(); } + virtual ~LLGestureBridgeAction(){} +protected: + LLGestureBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} +}; - LLInvFVBridgeAction::doIt(); -} - -//virtual -void LLAnimationBridgeAction::doIt() +class LLAnimationBridgeAction: public LLInvFVBridgeAction { - LLViewerInventoryItem* item = getItem(); - if (item) + friend class LLInvFVBridgeAction; +public: + virtual void doIt() { - LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES); + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES); + } + LLInvFVBridgeAction::doIt(); } + virtual ~LLAnimationBridgeAction(){} +protected: + LLAnimationBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} +}; - LLInvFVBridgeAction::doIt(); -} - - -//virtual -void LLObjectBridgeAction::doIt() +class LLObjectBridgeAction: public LLInvFVBridgeAction { - /* - LLFloaterReg::showInstance("properties", mUUID); - */ - LLInvFVBridgeAction::doIt(); -} - + friend class LLInvFVBridgeAction; +public: + virtual void doIt() + { + /* + LLFloaterReg::showInstance("properties", mUUID); + */ + LLInvFVBridgeAction::doIt(); + } + virtual ~LLObjectBridgeAction(){} +protected: + LLObjectBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} +}; -//virtual -void LLLSLTextBridgeAction::doIt() +class LLLSLTextBridgeAction: public LLInvFVBridgeAction { - LLViewerInventoryItem* item = getItem(); - if (item) + friend class LLInvFVBridgeAction; +public: + virtual void doIt() { - LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES); + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES); + } + LLInvFVBridgeAction::doIt(); } + virtual ~LLLSLTextBridgeAction(){} +protected: + LLLSLTextBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} +}; - LLInvFVBridgeAction::doIt(); -} - +class LLWearableBridgeAction: public LLInvFVBridgeAction +{ + friend class LLInvFVBridgeAction; +public: + virtual void doIt() + { + if(isItemInTrash()) + { + LLNotificationsUtil::add("CannotWearTrash"); + } + else if(isAgentInventory()) + { + if(!get_is_item_worn(mUUID)) + { + wearOnAvatar(); + } + } + else + { + // must be in the inventory library. copy it to our inventory + // and put it on right away. + LLViewerInventoryItem* item = getItem(); + if(item && item->isFinished()) + { + LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback(); + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + LLUUID::null, + std::string(), + cb); + } + else if(item) + { + // *TODO: We should fetch the item details, and then do + // the operation above. + LLNotificationsUtil::add("CannotWearInfoNotComplete"); + } + } + LLInvFVBridgeAction::doIt(); + } + virtual ~LLWearableBridgeAction(){} +protected: + LLWearableBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} + BOOL isItemInTrash() const; + // return true if the item is in agent inventory. if false, it + // must be lost or in the inventory library. + BOOL isAgentInventory() const; + void wearOnAvatar(); +}; BOOL LLWearableBridgeAction::isItemInTrash() const { @@ -5314,167 +5541,114 @@ void LLWearableBridgeAction::wearOnAvatar() } } -//virtual -void LLWearableBridgeAction::doIt() +LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type, + const LLUUID& uuid, + LLInventoryModel* model) { - if(isItemInTrash()) - { - LLNotificationsUtil::add("CannotWearTrash"); - } - else if(isAgentInventory()) - { - if(!get_is_item_worn(mUUID)) - { - wearOnAvatar(); - } - } - else + LLInvFVBridgeAction* action = NULL; + switch(asset_type) { - // must be in the inventory library. copy it to our inventory - // and put it on right away. - LLViewerInventoryItem* item = getItem(); - if(item && item->isComplete()) - { - LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback(); - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - LLUUID::null, - std::string(), - cb); - } - else if(item) - { - // *TODO: We should fetch the item details, and then do - // the operation above. - LLNotificationsUtil::add("CannotWearInfoNotComplete"); - } + case LLAssetType::AT_TEXTURE: + action = new LLTextureBridgeAction(uuid,model); + break; + case LLAssetType::AT_SOUND: + action = new LLSoundBridgeAction(uuid,model); + break; + case LLAssetType::AT_LANDMARK: + action = new LLLandmarkBridgeAction(uuid,model); + break; + case LLAssetType::AT_CALLINGCARD: + action = new LLCallingCardBridgeAction(uuid,model); + break; + case LLAssetType::AT_OBJECT: + action = new LLObjectBridgeAction(uuid,model); + break; + case LLAssetType::AT_NOTECARD: + action = new LLNotecardBridgeAction(uuid,model); + break; + case LLAssetType::AT_ANIMATION: + action = new LLAnimationBridgeAction(uuid,model); + break; + case LLAssetType::AT_GESTURE: + action = new LLGestureBridgeAction(uuid,model); + break; + case LLAssetType::AT_LSL_TEXT: + action = new LLLSLTextBridgeAction(uuid,model); + break; + case LLAssetType::AT_CLOTHING: + case LLAssetType::AT_BODYPART: + action = new LLWearableBridgeAction(uuid,model); + break; + default: + break; } - - LLInvFVBridgeAction::doIt(); + return action; } -// +=================================================+ -// | LLLinkItemBridge | -// +=================================================+ -// For broken links - -std::string LLLinkItemBridge::sPrefix("Link: "); +/** Bridge Actions + ** + ********************************************************************************/ - -LLUIImagePtr LLLinkItemBridge::getIcon() const +/************************************************************************/ +/* Recent Inventory Panel related classes */ +/************************************************************************/ +void LLRecentItemsFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - if (LLViewerInventoryItem *item = getItem()) - { - U32 attachment_point = (item->getFlags() & 0xff); // low byte of inventory flags - bool is_multi = LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags(); + LLFolderBridge::buildContextMenu(menu, flags); - return get_item_icon(item->getActualType(), item->getInventoryType(), attachment_point, is_multi); - } - return get_item_icon(LLAssetType::AT_LINK, LLInventoryType::IT_NONE, 0, FALSE); -} + menuentry_vec_t disabled_items, items = getMenuItems(); -void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - // *TODO: Translate - lldebugs << "LLLink::buildContextMenu()" << llendl; - menuentry_vec_t items; - menuentry_vec_t disabled_items; + items.erase(std::find(items.begin(), items.end(), std::string("New Folder"))); + items.erase(std::find(items.begin(), items.end(), std::string("New Script"))); + items.erase(std::find(items.begin(), items.end(), std::string("New Note"))); + items.erase(std::find(items.begin(), items.end(), std::string("New Gesture"))); + items.erase(std::find(items.begin(), items.end(), std::string("New Clothes"))); + items.erase(std::find(items.begin(), items.end(), std::string("New Body Parts"))); - items.push_back(std::string("Find Original")); - disabled_items.push_back(std::string("Find Original")); - - if(isItemInTrash()) - { - addTrashContextMenuOptions(items, disabled_items); - } - else - { - items.push_back(std::string("Properties")); - addDeleteContextMenuOptions(items, disabled_items); - } hide_context_entries(menu, items, disabled_items); } - -// +=================================================+ -// | LLLinkBridge | -// +=================================================+ -// For broken links. - -std::string LLLinkFolderBridge::sPrefix("Link: "); - - -LLUIImagePtr LLLinkFolderBridge::getIcon() const +LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge( + LLAssetType::EType asset_type, + LLAssetType::EType actual_asset_type, + LLInventoryType::EType inv_type, + LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid, + U32 flags /*= 0x00*/ ) const { - LLFolderType::EType preferred_type = LLFolderType::FT_NONE; - if (LLViewerInventoryItem *item = getItem()) + LLInvFVBridge* new_listener = NULL; + switch(asset_type) { - if (const LLViewerInventoryCategory* cat = item->getLinkedCategory()) - { - preferred_type = cat->getPreferredType(); + case LLAssetType::AT_CATEGORY: + if (actual_asset_type == LLAssetType::AT_LINK_FOLDER) + { + // *TODO: Create a link folder handler instead if it is necessary + new_listener = LLInventoryFVBridgeBuilder::createBridge( + asset_type, + actual_asset_type, + inv_type, + inventory, + root, + uuid, + flags); + break; } + new_listener = new LLRecentItemsFolderBridge(inv_type, inventory, root, uuid); + break; + default: + new_listener = LLInventoryFVBridgeBuilder::createBridge( + asset_type, + actual_asset_type, + inv_type, + inventory, + root, + uuid, + flags); } - return LLFolderBridge::getIcon(preferred_type); -} - -void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - // *TODO: Translate - lldebugs << "LLLink::buildContextMenu()" << llendl; - menuentry_vec_t items; - menuentry_vec_t disabled_items; - - if (isItemInTrash()) - { - addTrashContextMenuOptions(items, disabled_items); - } - else - { - items.push_back(std::string("Find Original")); - addDeleteContextMenuOptions(items, disabled_items); - } - hide_context_entries(menu, items, disabled_items); -} + return new_listener; -void LLLinkFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) -{ - if ("goto" == action) - { - gotoItem(folder); - return; - } - LLItemBridge::performAction(folder,model,action); } -void LLLinkFolderBridge::gotoItem(LLFolderView *folder) -{ - const LLUUID &cat_uuid = getFolderID(); - if (!cat_uuid.isNull()) - { - if (LLFolderViewItem *base_folder = folder->getItemByID(cat_uuid)) - { - if (LLInventoryModel* model = getInventoryModel()) - { - model->fetchDescendentsOf(cat_uuid); - } - base_folder->setOpen(TRUE); - folder->setSelectionFromRoot(base_folder,TRUE); - folder->scrollToShowSelection(); - } - } -} -const LLUUID &LLLinkFolderBridge::getFolderID() const -{ - if (LLViewerInventoryItem *link_item = getItem()) - { - if (const LLViewerInventoryCategory *cat = link_item->getLinkedCategory()) - { - const LLUUID& cat_uuid = cat->getUUID(); - return cat_uuid; - } - } - return LLUUID::null; -} +// EOF |