/indra/newview/llinventorybridge.cpp
C++ | 2423 lines | 1934 code | 297 blank | 192 comment | 447 complexity | 66041d855fcc39989ddec1ec50bf98f8 MD5 | raw file
Possible License(s): LGPL-2.1
- /**
- * @file llinventorybridge.cpp
- * @brief Implementation of the Inventory-Folder-View-Bridge classes.
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
- #include "llviewerprecompiledheaders.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 "llattachmentsmgr.h"
- #include "llavataractions.h"
- #include "llfloateropenobject.h"
- #include "llfloaterreg.h"
- #include "llfloatersidepanelcontainer.h"
- #include "llfloaterworldmap.h"
- #include "llfolderview.h"
- #include "llfriendcard.h"
- #include "llgesturemgr.h"
- #include "llgiveinventory.h"
- #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 "llmarketplacefunctions.h"
- #include "llnotifications.h"
- #include "llnotificationsutil.h"
- #include "llpreviewanim.h"
- #include "llpreviewgesture.h"
- #include "llpreviewtexture.h"
- #include "llselectmgr.h"
- #include "llsidepanelappearance.h"
- #include "lltooldraganddrop.h"
- #include "lltrans.h"
- #include "llviewerassettype.h"
- #include "llviewerfoldertype.h"
- #include "llviewermenu.h"
- #include "llviewermessage.h"
- #include "llviewerobjectlist.h"
- #include "llviewerwindow.h"
- #include "llvoavatarself.h"
- #include "llwearablelist.h"
- // Marketplace outbox current disabled
- #define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 1
- #define ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU 0
- #define BLOCK_WORN_ITEMS_IN_OUTBOX 1
- 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
- // bug in busy count inc/dec right now, logic is complex... do we really need it?
- void inc_busy_count()
- {
- // gViewerWindow->getWindow()->incBusyCount();
- // check balance of these calls if this code is changed to ever actually
- // *do* something!
- }
- void dec_busy_count()
- {
- // gViewerWindow->getWindow()->decBusyCount();
- // check balance of these calls if this code is changed to ever actually
- // *do* something!
- }
- // Function declarations
- 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_attachment_rez(const LLSD& notification, const LLSD& response);
- void teleport_via_landmark(const LLUUID& asset_id);
- static BOOL can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit);
- // Helper functions
- bool isAddAction(const std::string& action)
- {
- return ("wear" == action || "attach" == action || "activate" == action);
- }
- bool isRemoveAction(const std::string& action)
- {
- return ("take_off" == action || "detach" == action || "deactivate" == action);
- }
- bool isMarketplaceCopyAction(const std::string& action)
- {
- return (("copy_to_outbox" == action) || ("move_to_outbox" == action));
- }
- bool isMarketplaceSendAction(const std::string& action)
- {
- return ("send_to_marketplace" == action);
- }
- // +=================================================+
- // | LLInvFVBridge |
- // +=================================================+
- LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- mUUID(uuid),
- mRoot(root),
- mInvType(LLInventoryType::IT_NONE),
- mIsLink(FALSE)
- {
- mInventoryPanel = inventory->getHandle();
- const LLInventoryObject* obj = getInventoryObject();
- mIsLink = obj && obj->getIsLinkType();
- }
- const std::string& LLInvFVBridge::getName() const
- {
- const LLInventoryObject* obj = getInventoryObject();
- if(obj)
- {
- return obj->getName();
- }
- return LLStringUtil::null;
- }
- const std::string& LLInvFVBridge::getDisplayName() const
- {
- return getName();
- }
- // Folders have full perms
- PermissionMask LLInvFVBridge::getPermissionMask() const
- {
- return PERM_ALL;
- }
- // virtual
- LLFolderType::EType LLInvFVBridge::getPreferredType() const
- {
- return LLFolderType::FT_NONE;
- }
- // Folders don't have creation dates.
- time_t LLInvFVBridge::getCreationDate() const
- {
- return 0;
- }
- // Can be destroyed (or moved to trash)
- BOOL LLInvFVBridge::isItemRemovable() const
- {
- return get_is_item_removable(getInventoryModel(), mUUID);
- }
- // Can be moved to another folder
- BOOL LLInvFVBridge::isItemMovable() const
- {
- return TRUE;
- }
- BOOL LLInvFVBridge::isLink() const
- {
- return mIsLink;
- }
- /*virtual*/
- /**
- * @brief Adds this item into clipboard storage
- */
- void LLInvFVBridge::cutToClipboard()
- {
- if(isItemMovable())
- {
- LLInventoryClipboard::instance().cut(mUUID);
- }
- }
- // *TODO: make sure this does the right thing
- void LLInvFVBridge::showProperties()
- {
- show_item_profile(mUUID);
- // Disable old properties floater; this is replaced by the sidepanel.
- /*
- LLFloaterReg::showInstance("properties", mUUID);
- */
- }
- void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch)
- {
- // Deactivate gestures when moving them into Trash
- LLInvFVBridge* bridge;
- LLInventoryModel* model = getInventoryModel();
- LLViewerInventoryItem* item = NULL;
- LLViewerInventoryCategory* cat = NULL;
- LLInventoryModel::cat_array_t descendent_categories;
- LLInventoryModel::item_array_t descendent_items;
- S32 count = batch.count();
- S32 i,j;
- for(i = 0; i < count; ++i)
- {
- bridge = (LLInvFVBridge*)(batch.get(i));
- if(!bridge || !bridge->isItemRemovable()) continue;
- item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
- if (item)
- {
- if(LLAssetType::AT_GESTURE == item->getType())
- {
- LLGestureMgr::instance().deactivateGesture(item->getUUID());
- }
- }
- }
- for(i = 0; i < count; ++i)
- {
- bridge = (LLInvFVBridge*)(batch.get(i));
- if(!bridge || !bridge->isItemRemovable()) continue;
- cat = (LLViewerInventoryCategory*)model->getCategory(bridge->getUUID());
- if (cat)
- {
- gInventory.collectDescendents( cat->getUUID(), descendent_categories, descendent_items, FALSE );
- for (j=0; j<descendent_items.count(); j++)
- {
- if(LLAssetType::AT_GESTURE == descendent_items[j]->getType())
- {
- LLGestureMgr::instance().deactivateGesture(descendent_items[j]->getUUID());
- }
- }
- }
- }
- removeBatchNoCheck(batch);
- }
- void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch)
- {
- // this method moves a bunch of items and folders to the trash. As
- // per design guidelines for the inventory model, the message is
- // built and the accounting is performed first. After all of that,
- // we call LLInventoryModel::moveObject() to move everything
- // around.
- LLInvFVBridge* bridge;
- LLInventoryModel* model = getInventoryModel();
- if(!model) return;
- LLMessageSystem* msg = gMessageSystem;
- const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- LLViewerInventoryItem* item = NULL;
- uuid_vec_t move_ids;
- LLInventoryModel::update_map_t update;
- bool start_new_message = true;
- S32 count = batch.count();
- S32 i;
- // first, hide any 'preview' floaters that correspond to the items
- // being deleted.
- for(i = 0; i < count; ++i)
- {
- bridge = (LLInvFVBridge*)(batch.get(i));
- if(!bridge || !bridge->isItemRemovable()) continue;
- item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
- if(item)
- {
- LLPreview::hide(item->getUUID());
- }
- }
- // do the inventory move to trash
- for(i = 0; i < count; ++i)
- {
- bridge = (LLInvFVBridge*)(batch.get(i));
- if(!bridge || !bridge->isItemRemovable()) continue;
- item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
- if(item)
- {
- if(item->getParentUUID() == trash_id) continue;
- move_ids.push_back(item->getUUID());
- --update[item->getParentUUID()];
- ++update[trash_id];
- if(start_new_message)
- {
- start_new_message = false;
- msg->newMessageFast(_PREHASH_MoveInventoryItem);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addBOOLFast(_PREHASH_Stamp, TRUE);
- }
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
- msg->addUUIDFast(_PREHASH_FolderID, trash_id);
- msg->addString("NewName", NULL);
- if(msg->isSendFullFast(_PREHASH_InventoryData))
- {
- start_new_message = true;
- gAgent.sendReliableMessage();
- gInventory.accountForUpdate(update);
- update.clear();
- }
- }
- }
- if(!start_new_message)
- {
- start_new_message = true;
- gAgent.sendReliableMessage();
- gInventory.accountForUpdate(update);
- update.clear();
- }
- for(i = 0; i < count; ++i)
- {
- bridge = (LLInvFVBridge*)(batch.get(i));
- if(!bridge || !bridge->isItemRemovable()) continue;
- LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)model->getCategory(bridge->getUUID());
- if(cat)
- {
- if(cat->getParentUUID() == trash_id) continue;
- move_ids.push_back(cat->getUUID());
- --update[cat->getParentUUID()];
- ++update[trash_id];
- if(start_new_message)
- {
- start_new_message = false;
- msg->newMessageFast(_PREHASH_MoveInventoryFolder);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addBOOL("Stamp", TRUE);
- }
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addUUIDFast(_PREHASH_FolderID, cat->getUUID());
- msg->addUUIDFast(_PREHASH_ParentID, trash_id);
- if(msg->isSendFullFast(_PREHASH_InventoryData))
- {
- start_new_message = true;
- gAgent.sendReliableMessage();
- gInventory.accountForUpdate(update);
- update.clear();
- }
- }
- }
- if(!start_new_message)
- {
- gAgent.sendReliableMessage();
- gInventory.accountForUpdate(update);
- }
- // move everything.
- 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);
- }
- // notify inventory observers.
- model->notifyObservers();
- }
- BOOL LLInvFVBridge::isClipboardPasteable() const
- {
- if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory())
- {
- return FALSE;
- }
- LLInventoryModel* model = getInventoryModel();
- if (!model)
- {
- return FALSE;
- }
- const LLUUID &agent_id = gAgent.getID();
- LLDynamicArray<LLUUID> objects;
- LLInventoryClipboard::instance().retrieve(objects);
- S32 count = objects.count();
- for(S32 i = 0; i < count; i++)
- {
- const LLUUID &item_id = objects.get(i);
- // Can't paste folders
- const LLInventoryCategory *cat = model->getCategory(item_id);
- if (cat)
- {
- return FALSE;
- }
- const LLInventoryItem *item = model->getItem(item_id);
- if (item)
- {
- if (!item->getPermissions().allowCopyBy(agent_id))
- {
- return FALSE;
- }
- }
- }
- return TRUE;
- }
- BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
- {
- if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory())
- {
- return FALSE;
- }
- const LLInventoryModel* model = getInventoryModel();
- if (!model)
- {
- return FALSE;
- }
- LLDynamicArray<LLUUID> objects;
- LLInventoryClipboard::instance().retrieve(objects);
- S32 count = objects.count();
- for(S32 i = 0; i < count; i++)
- {
- const LLInventoryItem *item = model->getItem(objects.get(i));
- if (item)
- {
- if (!LLAssetType::lookupCanLink(item->getActualType()))
- {
- return FALSE;
- }
- }
- const LLViewerInventoryCategory *cat = model->getCategory(objects.get(i));
- if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
- {
- return FALSE;
- }
- }
- return TRUE;
- }
- void hide_context_entries(LLMenuGL& menu,
- const menuentry_vec_t &entries_to_show,
- const menuentry_vec_t &disabled_entries)
- {
- const LLView::child_list_t *list = menu.getChildList();
- // 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;
- for (LLView::child_list_t::const_iterator itor = list->begin();
- itor != list->end();
- ++itor)
- {
- LLView *menu_item = (*itor);
- std::string name = menu_item->getName();
- // descend into split menus:
- LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(menu_item);
- if ((name == "More") && branchp)
- {
- hide_context_entries(*branchp->getBranch(), entries_to_show, disabled_entries);
- }
- bool found = false;
- menuentry_vec_t::const_iterator itor2;
- for (itor2 = entries_to_show.begin(); itor2 != entries_to_show.end(); ++itor2)
- {
- if (*itor2 == name)
- {
- found = true;
- break;
- }
- }
- // Don't allow multiple separators in a row (e.g. such as if there are no items
- // between two separators).
- if (found)
- {
- const bool is_entry_separator = (dynamic_cast<LLMenuItemSeparatorGL *>(menu_item) != NULL);
- found = !(is_entry_separator && is_previous_entry_separator);
- is_previous_entry_separator = is_entry_separator;
- }
-
- if (!found)
- {
- if (!menu_item->getLastVisible())
- {
- menu_item->setVisible(FALSE);
- }
- menu_item->setEnabled(FALSE);
- }
- else
- {
- menu_item->setVisible(TRUE);
- // A bit of a hack so we can remember that some UI element explicitly set this to be visible
- // so that some other UI element from multi-select doesn't later set this invisible.
- menu_item->pushVisible(TRUE);
- bool enabled = (menu_item->getEnabled() == TRUE);
- for (itor2 = disabled_entries.begin(); enabled && (itor2 != disabled_entries.end()); ++itor2)
- {
- enabled &= (*itor2 != name);
- }
- menu_item->setEnabled(enabled);
- }
- }
- }
- // Helper for commonly-used entries
- void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
- menuentry_vec_t &items,
- menuentry_vec_t &disabled_items, U32 flags)
- {
- const LLInventoryObject *obj = getInventoryObject();
- if (obj)
- {
- if (obj->getIsLinkType())
- {
- items.push_back(std::string("Find Original"));
- if (isLinkedObjectMissing())
- {
- disabled_items.push_back(std::string("Find Original"));
- }
- }
- else
- {
- if (LLAssetType::lookupCanLink(obj->getType()))
- {
- items.push_back(std::string("Find Links"));
- }
- if (!isInboxFolder())
- {
- items.push_back(std::string("Rename"));
- if (!isItemRenameable() || (flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Rename"));
- }
- }
-
- if (show_asset_id)
- {
- items.push_back(std::string("Copy Asset UUID"));
- bool is_asset_knowable = false;
- LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID);
- if (inv_item)
- {
- 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() ) )
- || (flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Copy Asset UUID"));
- }
- }
- items.push_back(std::string("Copy Separator"));
-
- items.push_back(std::string("Copy"));
- if (!isItemCopyable())
- {
- disabled_items.push_back(std::string("Copy"));
- }
- if (canListOnMarketplace())
- {
- items.push_back(std::string("Marketplace Separator"));
- items.push_back(std::string("Merchant Copy"));
- if (!canListOnMarketplaceNow())
- {
- disabled_items.push_back(std::string("Merchant Copy"));
- }
- }
- }
- }
- // Don't allow items to be pasted directly into the COF or the inbox/outbox
- if (!isCOFFolder() && !isInboxFolder() && !isOutboxFolder())
- {
- items.push_back(std::string("Paste"));
- }
- if (!isClipboardPasteable() || ((flags & FIRST_SELECTED_ITEM) == 0))
- {
- disabled_items.push_back(std::string("Paste"));
- }
- if (gSavedSettings.getBOOL("InventoryLinking"))
- {
- items.push_back(std::string("Paste As Link"));
- if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Paste As Link"));
- }
- }
- items.push_back(std::string("Paste Separator"));
- addDeleteContextMenuOptions(items, disabled_items);
- // If multiple items are selected, disable properties (if it exists).
- if ((flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Properties"));
- }
- }
- void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
- {
- lldebugs << "LLInvFVBridge::buildContextMenu()" << llendl;
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
- if(isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
- else if(isOutboxFolder())
- {
- addOutboxContextMenuOptions(flags, items, disabled_items);
- }
- else
- {
- 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);
- }
- hide_context_entries(menu, items, disabled_items);
- }
- void LLInvFVBridge::addTrashContextMenuOptions(menuentry_vec_t &items,
- menuentry_vec_t &disabled_items)
- {
- const LLInventoryObject *obj = getInventoryObject();
- if (obj && obj->getIsLinkType())
- {
- items.push_back(std::string("Find Original"));
- if (isLinkedObjectMissing())
- {
- disabled_items.push_back(std::string("Find Original"));
- }
- }
- items.push_back(std::string("Purge Item"));
- if (!isItemRemovable())
- {
- disabled_items.push_back(std::string("Purge Item"));
- }
- items.push_back(std::string("Restore Item"));
- }
- void LLInvFVBridge::addDeleteContextMenuOptions(menuentry_vec_t &items,
- menuentry_vec_t &disabled_items)
- {
- const LLInventoryObject *obj = getInventoryObject();
- // Don't allow delete as a direct option from COF folder.
- if (obj && obj->getIsLinkType() && isCOFFolder() && get_is_item_worn(mUUID))
- {
- return;
- }
- // "Remove link" and "Delete" are the same operation.
- if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID))
- {
- items.push_back(std::string("Remove Link"));
- }
- else
- {
- items.push_back(std::string("Delete"));
- }
- if (!isItemRemovable())
- {
- disabled_items.push_back(std::string("Delete"));
- }
- }
- 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"));
- }
- void LLInvFVBridge::addOutboxContextMenuOptions(U32 flags,
- menuentry_vec_t &items,
- menuentry_vec_t &disabled_items)
- {
- items.push_back(std::string("Rename"));
- items.push_back(std::string("Delete"));
-
- if ((flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Rename"));
- }
-
- #if ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU
- if (isOutboxFolderDirectParent())
- {
- items.push_back(std::string("Marketplace Separator"));
- items.push_back(std::string("Marketplace Send"));
-
- if ((flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Marketplace Send"));
- }
- }
- #endif // ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU
- }
- // *TODO: remove this
- BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
- {
- BOOL rv = FALSE;
- const LLInventoryObject* obj = getInventoryObject();
- if(obj)
- {
- *type = LLViewerAssetType::lookupDragAndDropType(obj->getActualType());
- if(*type == DAD_NONE)
- {
- return FALSE;
- }
- *id = obj->getUUID();
- //object_ids.put(obj->getUUID());
- if (*type == DAD_CATEGORY)
- {
- LLInventoryModelBackgroundFetch::instance().start(obj->getUUID());
- }
- rv = TRUE;
- }
- return rv;
- }
- LLInventoryObject* LLInvFVBridge::getInventoryObject() const
- {
- LLInventoryObject* obj = NULL;
- LLInventoryModel* model = getInventoryModel();
- if(model)
- {
- obj = (LLInventoryObject*)model->getObject(mUUID);
- }
- return obj;
- }
- LLInventoryModel* LLInvFVBridge::getInventoryModel() const
- {
- LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
- return panel ? panel->getModel() : NULL;
- }
- BOOL LLInvFVBridge::isItemInTrash() const
- {
- LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
- const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- return model->isObjectDescendentOf(mUUID, trash_id);
- }
- BOOL LLInvFVBridge::isLinkedObjectInTrash() const
- {
- if (isItemInTrash()) return TRUE;
- const LLInventoryObject *obj = getInventoryObject();
- if (obj && obj->getIsLinkType())
- {
- LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
- const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- return model->isObjectDescendentOf(obj->getLinkedUUID(), trash_id);
- }
- return FALSE;
- }
- BOOL LLInvFVBridge::isLinkedObjectMissing() const
- {
- const LLInventoryObject *obj = getInventoryObject();
- if (!obj)
- {
- return TRUE;
- }
- if (obj->getIsLinkType() && LLAssetType::lookupIsLinkType(obj->getType()))
- {
- return TRUE;
- }
- return FALSE;
- }
- BOOL LLInvFVBridge::isAgentInventory() const
- {
- const LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
- if(gInventory.getRootFolderID() == mUUID) return TRUE;
- return model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID());
- }
- BOOL LLInvFVBridge::isCOFFolder() const
- {
- return LLAppearanceMgr::instance().getIsInCOF(mUUID);
- }
- BOOL LLInvFVBridge::isInboxFolder() const
- {
- const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false);
-
- if (inbox_id.isNull())
- {
- return FALSE;
- }
-
- return gInventory.isObjectDescendentOf(mUUID, inbox_id);
- }
- BOOL LLInvFVBridge::isOutboxFolder() const
- {
- const LLUUID outbox_id = getOutboxFolder();
- if (outbox_id.isNull())
- {
- return FALSE;
- }
- return gInventory.isObjectDescendentOf(mUUID, outbox_id);
- }
- BOOL LLInvFVBridge::isOutboxFolderDirectParent() const
- {
- BOOL outbox_is_parent = FALSE;
-
- const LLInventoryCategory *cat = gInventory.getCategory(mUUID);
- if (cat)
- {
- const LLUUID outbox_id = getOutboxFolder();
-
- outbox_is_parent = (outbox_id.notNull() && (outbox_id == cat->getParentUUID()));
- }
-
- return outbox_is_parent;
- }
- const LLUUID LLInvFVBridge::getOutboxFolder() const
- {
- const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false);
- return outbox_id;
- }
- BOOL LLInvFVBridge::isItemPermissive() const
- {
- return FALSE;
- }
- // static
- void LLInvFVBridge::changeItemParent(LLInventoryModel* model,
- LLViewerInventoryItem* item,
- const LLUUID& new_parent_id,
- BOOL restamp)
- {
- change_item_parent(model, item, new_parent_id, restamp);
- }
- // static
- void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model,
- LLViewerInventoryCategory* cat,
- const LLUUID& new_parent_id,
- BOOL restamp)
- {
- change_category_parent(model, cat, new_parent_id, restamp);
- }
- 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)
- {
- LLInvFVBridge* new_listener = NULL;
- switch(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 " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- 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 " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- 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 " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- 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 " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- 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 " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- new_listener = new LLItemBridge(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 " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- 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 " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- 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 " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- 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 " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- 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 " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- 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 " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, (LLWearableType::EType)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, root, uuid);
- break;
- }
- 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, root, uuid);
- break;
- case LLAssetType::AT_MESH:
- if(!(inv_type == LLInventoryType::IT_MESH))
- {
- llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
- }
- new_listener = new LLMeshBridge(inventory, root, uuid);
- break;
- case LLAssetType::AT_IMAGE_TGA:
- case LLAssetType::AT_IMAGE_JPEG:
- //llwarns << LLAssetType::lookup(asset_type) << " asset type is unhandled for uuid " << uuid << llendl;
- break;
- default:
- llinfos << "Unhandled asset type (llassetstorage.h): "
- << (S32)asset_type << " (" << LLAssetType::lookup(asset_type) << ")" << llendl;
- break;
- }
- if (new_listener)
- {
- new_listener->mInvType = inv_type;
- }
- return new_listener;
- }
- void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid)
- {
- LLInventoryCategory* cat = model->getCategory(uuid);
- if (cat)
- {
- model->purgeDescendentsOf(uuid);
- model->notifyObservers();
- }
- LLInventoryObject* obj = model->getObject(uuid);
- if (obj)
- {
- model->purgeObject(uuid);
- model->notifyObservers();
- }
- }
- bool LLInvFVBridge::canShare() const
- {
- bool can_share = false;
- if (isAgentInventory())
- {
- const LLInventoryModel* model = getInventoryModel();
- if (model)
- {
- const LLViewerInventoryItem *item = model->getItem(mUUID);
- if (item)
- {
- if (LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item))
- {
- can_share = LLGiveInventory::isInventoryGiveAcceptable(item);
- }
- }
- else
- {
- // Categories can be given.
- can_share = (model->getCategory(mUUID) != NULL);
- }
- }
- }
- return can_share;
- }
- bool LLInvFVBridge::canListOnMarketplace() const
- {
- #if ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU
- LLInventoryModel * model = getInventoryModel();
- const LLViewerInventoryCategory * cat = model->getCategory(mUUID);
- if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
- {
- return false;
- }
- if (!isAgentInventory())
- {
- return false;
- }
-
- if (getOutboxFolder().isNull())
- {
- return false;
- }
- if (isInboxFolder() || isOutboxFolder())
- {
- return false;
- }
-
- LLViewerInventoryItem * item = model->getItem(mUUID);
- if (item)
- {
- if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
- {
- return false;
- }
-
- if (LLAssetType::AT_CALLINGCARD == item->getType())
- {
- return false;
- }
- }
- return true;
- #else
- return false;
- #endif
- }
- bool LLInvFVBridge::canListOnMarketplaceNow() const
- {
- #if ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU
-
- bool can_list = true;
- // Do not allow listing while import is in progress
- if (LLMarketplaceInventoryImporter::instanceExists())
- {
- can_list = !LLMarketplaceInventoryImporter::instance().isImportInProgress();
- }
-
- const LLInventoryObject* obj = getInventoryObject();
- can_list &= (obj != NULL);
- if (can_list)
- {
- const LLUUID& object_id = obj->getLinkedUUID();
- can_list = object_id.notNull();
- if (can_list)
- {
- LLFolderViewFolder * object_folderp = mRoot->getFolderByID(object_id);
- if (object_folderp)
- {
- can_list = !object_folderp->isLoading();
- }
- }
-
- if (can_list)
- {
- // Get outbox id
- const LLUUID & outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
- LLFolderViewItem * outbox_itemp = mRoot->getItemByID(outbox_id);
- if (outbox_itemp)
- {
- MASK mask = 0x0;
- BOOL drop = FALSE;
- EDragAndDropType cargo_type = LLViewerAssetType::lookupDragAndDropType(obj->getActualType());
- void * cargo_data = (void *) obj;
- std::string tooltip_msg;
-
- can_list = outbox_itemp->getListener()->dragOrDrop(mask, drop, cargo_type, cargo_data, tooltip_msg);
- }
- }
- }
-
- return can_list;
- #else
- return false;
- #endif
- }
- // +=================================================+
- // | InventoryFVBridgeBuilder |
- // +=================================================+
- LLInvFVBridge* LLInventoryFVBridgeBuilder::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
- {
- return LLInvFVBridge::createBridge(asset_type,
- actual_asset_type,
- inv_type,
- inventory,
- root,
- uuid,
- flags);
- }
- // +=================================================+
- // | LLItemBridge |
- // +=================================================+
- void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
- {
- if ("goto" == action)
- {
- gotoItem();
- }
- if ("open" == action || "open_original" == action)
- {
- openItem();
- return;
- }
- else if ("properties" == action)
- {
- showProperties();
- return;
- }
- else if ("purge" == action)
- {
- purgeItem(model, mUUID);
- return;
- }
- else if ("restoreToWorld" == action)
- {
- restoreToWorld();
- return;
- }
- else if ("restore" == action)
- {
- restoreItem();
- return;
- }
- else if ("copy_uuid" == action)
- {
- // Single item only
- LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
- if(!item) return;
- LLUUID asset_id = item->getProtectedAssetUUID();
- std::string buffer;
- asset_id.toString(buffer);
- gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(buffer));
- return;
- }
- else if ("copy" == action)
- {
- copyToClipboard();
- return;
- }
- else if ("paste" == action)
- {
- // Single item only
- LLInventoryItem* itemp = model->getItem(mUUID);
- if (!itemp) return;
- LLFolderViewItem* folder_view_itemp = mRoot->getItemByID(itemp->getParentUUID());
- if (!folder_view_itemp) return;
- folder_view_itemp->getListener()->pasteFromClipboard();
- return;
- }
- else if ("paste_link" == action)
- {
- // Single item only
- LLInventoryItem* itemp = model->getItem(mUUID);
- if (!itemp) return;
- LLFolderViewItem* folder_view_itemp = mRoot->getItemByID(itemp->getParentUUID());
- if (!folder_view_itemp) return;
- folder_view_itemp->getListener()->pasteLinkFromClipboard();
- return;
- }
- else if (isMarketplaceCopyAction(action))
- {
- llinfos << "Copy item to marketplace action!" << llendl;
- LLInventoryItem* itemp = model->getItem(mUUID);
- if (!itemp) return;
- const LLUUID outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false);
- copy_item_to_outbox(itemp, outbox_id, LLUUID::null, LLToolDragAndDrop::getOperationId());
- }
- }
- void LLItemBridge::selectItem()
- {
- LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
- if(item && !item->isFinished())
- {
- item->fetchFromServer();
- //LLInventoryModelBackgroundFetch::instance().start(item->getUUID(), false);
- }
- }
- void LLItemBridge::restoreItem()
- {
- LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
- if(item)
- {
- LLInventoryModel* model = getInventoryModel();
- const LLUUID new_parent = model->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(item->getType()));
- // do not restamp on restore.
- LLInvFVBridge::changeItemParent(model, item, new_parent, FALSE);
- }
- }
- void LLItemBridge::restoreToWorld()
- {
- //Similar functionality to the drag and drop rez logic
- bool remove_from_inventory = false;
- LLViewerInventoryItem* itemp = static_cast<LLViewerInventoryItem*>(getItem());
- if (itemp)
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("RezRestoreToWorld");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_InventoryData);
- itemp->packMessage(msg);
- msg->sendReliable(gAgent.getRegion()->getHost());
- //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)
- {
- gInventory.deleteObject(itemp->getUUID());
- gInventory.notifyObservers();
- }
- }
- void LLItemBridge::gotoItem()
- {
- LLInventoryObject *obj = getInventoryObject();
- if (obj && obj->getIsLinkType())
- {
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
- if (active_panel)
- {
- active_panel->setSelection(obj->getLinkedUUID(), TAKE_FOCUS_NO);
- }
- }
- }
- LLUIImagePtr LLItemBridge::getIcon() const
- {
- LLInventoryObject *obj = getInventoryObject();
- if (obj)
- {
- return LLInventoryIcon::getIcon(obj->getType(),
- LLInventoryType::IT_NONE,
- mIsLink);
- }
-
- return LLInventoryIcon::getIcon(LLInventoryIcon::ICONNAME_OBJECT);
- }
- PermissionMask LLItemBridge::getPermissionMask() const
- {
- LLViewerInventoryItem* item = getItem();
- PermissionMask perm_mask = 0;
- if (item) perm_mask = item->getPermissionMask();
- return perm_mask;
- }
- const std::string& LLItemBridge::getDisplayName() const
- {
- if(mDisplayName.empty())
- {
- buildDisplayName(getItem(), mDisplayName);
- }
- return mDisplayName;
- }
- void LLItemBridge::buildDisplayName(LLInventoryItem* item, std::string& name)
- {
- if(item)
- {
- name.assign(item->getName());
- }
- else
- {
- name.assign(LLStringUtil::null);
- }
- }
- LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const
- {
- U8 font = LLFontGL::NORMAL;
- const LLViewerInventoryItem* item = getItem();
- if (get_is_item_worn(mUUID))
- {
- // llinfos << "BOLD" << llendl;
- font |= LLFontGL::BOLD;
- }
- else if(item && item->getIsLinkType())
- {
- font |= LLFontGL::ITALIC;
- }
- return (LLFontGL::StyleFlags)font;
- }
- std::string LLItemBridge::getLabelSuffix() const
- {
- // String table is loaded before login screen and inventory items are
- // loaded after login, so LLTrans should be ready.
- static std::string NO_COPY = LLTrans::getString("no_copy");
- static std::string NO_MOD = LLTrans::getString("no_modify");
- static std::string NO_XFER = LLTrans::getString("no_transfer");
- static std::string LINK = LLTrans::getString("link");
- static std::string BROKEN_LINK = LLTrans::getString("broken_link");
- std::string suffix;
- LLInventoryItem* item = getItem();
- if(item)
- {
- // Any type can have the link suffix...
- BOOL broken_link = LLAssetType::lookupIsLinkType(item->getType());
- if (broken_link) return BROKEN_LINK;
- BOOL link = item->getIsLinkType();
- if (link) return LINK;
- // ...but it's a bit confusing to put nocopy/nomod/etc suffixes on calling cards.
- if(LLAssetType::AT_CALLINGCARD != item->getType()
- && item->getPermissions().getOwner() == gAgent.getID())
- {
- BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
- if (!copy)
- {
- suffix += NO_COPY;
- }
- BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
- if (!mod)
- {
- suffix += NO_MOD;
- }
- BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
- gAgent.getID());
- if (!xfer)
- {
- suffix += NO_XFER;
- }
- }
- }
- return suffix;
- }
- time_t LLItemBridge::getCreationDate() const
- {
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- return item->getCreationDate();
- }
- return 0;
- }
- BOOL LLItemBridge::isItemRenameable() const
- {
- LLViewerInventoryItem* item = getItem();
- if(item)
- {
- // (For now) Don't allow calling card rename since that may confuse users as to
- // what the calling card points to.
- if (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD)
- {
- return FALSE;
- }
- if (!item->isFinished()) // EXT-8662
- {
- return FALSE;
- }
- if (isInboxFolder())
- {
- return FALSE;
- }
- return (item->getPermissions().allowModifyBy(gAgent.getID()));
- }
- return FALSE;
- }
- BOOL LLItemBridge::renameItem(const std::string& new_name)
- {
- if(!isItemRenameable())
- return FALSE;
- LLPreview::dirty(mUUID);
- LLInventoryModel* model = getInventoryModel();
- if(!model)
- return FALSE;
- LLViewerInventoryItem* item = getItem();
- if(item && (item->getName() != new_name))
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->rename(new_name);
- buildDisplayName(new_item, mDisplayName);
- new_item->updateServer(FALSE);
- model->updateItem(new_item);
- model->notifyObservers();
- }
- // return FALSE because we either notified observers (& therefore
- // rebuilt) or we didn't update.
- return FALSE;
- }
- BOOL LLItemBridge::removeItem()
- {
- if(!isItemRemovable())
- {
- 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);
- 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))
- {
- // move to trash, and restamp
- LLInvFVBridge::changeItemParent(model, item, trash_id, TRUE);
- // delete was successful
- return TRUE;
- }
- return FALSE;
- }
- BOOL LLItemBridge::isItemCopyable() const
- {
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- // Can't copy worn objects. DEV-15183
- if(get_is_item_worn(mUUID))
- {
- return FALSE;
- }
- // You can never copy a link.
- if (item->getIsLinkType())
- {
- return FALSE;
- }
- return item->getPermissions().allowCopyBy(gAgent.getID()) || gSavedSettings.getBOOL("InventoryLinking");
- }
- return FALSE;
- }
- BOOL LLItemBridge::copyToClipboard() const
- {
- if(isItemCopyable())
- {
- LLInventoryClipboard::instance().add(mUUID);
- return TRUE;
- }
- return FALSE;
- }
- LLViewerInventoryItem* LLItemBridge::getItem() const
- {
- LLViewerInventoryItem* item = NULL;
- LLInventoryModel* model = getInventoryModel();
- if(model)
- {
- item = (LLViewerInventoryItem*)model->getItem(mUUID);
- }
- return item;
- }
- BOOL LLItemBridge::isItemPermissive() const
- {
- LLViewerInventoryItem* item = getItem();
- if(item)
- {
- return item->getIsFullPerm();
- }
- return FALSE;
- }
- // +=================================================+
- // | LLFolderBridge |
- // +=================================================+
- LLHandle<LLFolderBridge> LLFolderBridge::sSelf;
- // Can be moved to another folder
- BOOL LLFolderBridge::isItemMovable() const
- {
- LLInventoryObject* obj = getInventoryObject();
- if(obj)
- {
- return (!LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType()));
- }
- return FALSE;
- }
- void LLFolderBridge::selectItem()
- {
- }
- // Iterate through a folder's children to determine if
- // all the children are removable.
- class LLIsItemRemovable : public LLFolderViewFunctor
- {
- public:
- LLIsItemRemovable() : mPassed(TRUE) {}
- virtual void doFolder(LLFolderViewFolder* folder)
- {
- mPassed &= folder->getListener()->isItemRemovable();
- }
- virtual void doItem(LLFolderViewItem* item)
- {
- mPassed &= item->getListener()->isItemRemovable();
- }
- BOOL mPassed;
- };
- // Can be destroyed (or moved to trash)
- BOOL LLFolderBridge::isItemRemovable() const
- {
- if (!get_is_category_removable(getInventoryModel(), mUUID))
- {
- return FALSE;
- }
- LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
- LLFolderViewFolder* folderp = dynamic_cast<LLFolderViewFolder*>(panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL);
- if (folderp)
- {
- LLIsItemRemovable folder_test;
- folderp->applyFunctorToChildren(folder_test);
- if (!folder_test.mPassed)
- {
- return FALSE;
- }
- }
- return TRUE;
- }
- BOOL LLFolderBridge::isUpToDate() const
- {
- LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
- LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
- if( !category )
- {
- return FALSE;
- }
- return category->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN;
- }
- BOOL LLFolderBridge::isItemCopyable() const
- {
- // Can copy folders to paste-as-link, but not for straight paste.
- return gSavedSettings.getBOOL("InventoryLinking");
- }
- BOOL LLFolderBridge::copyToClipboard() const
- {
- if(isItemCopyable())
- {
- LLInventoryClipboard::instance().add(mUUID);
- return TRUE;
- }
- return FALSE;
- }
- BOOL LLFolderBridge::isClipboardPasteable() const
- {
- if ( ! LLInvFVBridge::isClipboardPasteable() )
- return FALSE;
- // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599
- if ( LLFriendCardsManager::instance().isCategoryInFriendFolder( getCategory() ) )
- {
- LLInventoryModel* model = getInventoryModel();
- if ( !model )
- {
- return FALSE;
- }
- LLDynamicArray<LLUUID> objects;
- LLInventoryClipboard::instance().retrieve(objects);
- const LLViewerInventoryCategory *current_cat = getCategory();
- // Search for the direct descendent of current Friends subfolder among all pasted items,
- // and return false if is found.
- for(S32 i = objects.count() - 1; i >= 0; --i)
- {
- const LLUUID &obj_id = objects.get(i);
- if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) )
- {
- return FALSE;
- }
- }
- }
- return TRUE;
- }
- BOOL LLFolderBridge::isClipboardPasteableAsLink() const
- {
- // Check normal paste-as-link permissions
- if (!LLInvFVBridge::isClipboardPasteableAsLink())
- {
- return FALSE;
- }
- const LLInventoryModel* model = getInventoryModel();
- if (!model)
- {
- return FALSE;
- }
- const LLViewerInventoryCategory *current_cat = getCategory();
- if (current_cat)
- {
- const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat );
- const LLUUID ¤t_cat_id = current_cat->getUUID();
- LLDynamicArray<LLUUID> objects;
- LLInventoryClipboard::instance().retrieve(objects);
- S32 count = objects.count();
- for(S32 i = 0; i < count; i++)
- {
- const LLUUID &obj_id = objects.get(i);
- const LLInventoryCategory *cat = model->getCategory(obj_id);
- if (cat)
- {
- const LLUUID &cat_id = cat->getUUID();
- // Don't allow recursive pasting
- if ((cat_id == current_cat_id) ||
- model->isObjectDescendentOf(current_cat_id, cat_id))
- {
- return FALSE;
- }
- }
- // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599
- if ( is_in_friend_folder )
- {
- // If object is direct descendent of current Friends subfolder than return false.
- // Note: We can't use 'const LLInventoryCategory *cat', because it may be null
- // in case type of obj_id is LLInventoryItem.
- if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) )
- {
- return FALSE;
- }
- }
- }
- }
- return TRUE;
- }
- static BOOL can_move_to_outbox(LLInventoryItem* inv_item, std::string& tooltip_msg)
- {
- // Collapse links directly to items/folders
- LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item;
- LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem();
- if (linked_item != NULL)
- {
- inv_item = linked_item;
- }
-
- bool allow_transfer = inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID());
- if (!allow_transfer)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxNoTransfer");
- return false;
- }
- #if BLOCK_WORN_ITEMS_IN_OUTBOX
- bool worn = get_is_item_worn(inv_item->getUUID());
- if (worn)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxWorn");
- return false;
- }
- #endif
-
- bool calling_card = (LLAssetType::AT_CALLINGCARD == inv_item->getType());
- if (calling_card)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxCallingCard");
- return false;
- }
-
- return true;
- }
- int get_folder_levels(LLInventoryCategory* inv_cat)
- {
- LLInventoryModel::cat_array_t* cats;
- LLInventoryModel::item_array_t* items;
- gInventory.getDirectDescendentsOf(inv_cat->getUUID(), cats, items);
- int max_child_levels = 0;
- for (S32 i=0; i < cats->count(); ++i)
- {
- LLInventoryCategory* category = cats->get(i);
- max_child_levels = llmax(max_child_levels, get_folder_levels(category));
- }
- return 1 + max_child_levels;
- }
- int get_folder_path_length(const LLUUID& ancestor_id, const LLUUID& descendant_id)
- {
- int depth = 0;
- if (ancestor_id == descendant_id) return depth;
- const LLInventoryCategory* category = gInventory.getCategory(descendant_id);
- while(category)
- {
- LLUUID parent_id = category->getParentUUID();
- if (parent_id.isNull()) break;
- depth++;
- if (parent_id == ancestor_id) return depth;
- category = gInventory.getCategory(parent_id);
- }
- llwarns << "get_folder_path_length() couldn't trace a path from the descendant to the ancestor" << llendl;
- return -1;
- }
- BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
- BOOL drop,
- std::string& tooltip_msg)
- {
- LLInventoryModel* model = getInventoryModel();
- if (!inv_cat) return FALSE; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL
- if (!model) return FALSE;
- if (!isAgentAvatarValid()) return FALSE;
- if (!isAgentInventory()) return FALSE; // cannot drag categories into library
- const LLUUID &cat_id = inv_cat->getUUID();
- const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
- const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
-
- const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
- const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);
- const BOOL move_is_from_outbox = model->isObjectDescendentOf(cat_id, outbox_id);
- // check to make sure source is agent inventory, and is represented there.
- LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
- const BOOL is_agent_inventory = (model->getCategory(cat_id) != NULL)
- && (LLToolDragAndDrop::SOURCE_AGENT == source);
- BOOL accept = FALSE;
- if (is_agent_inventory)
- {
- const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false);
- const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false);
- const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
- const BOOL move_is_into_outfit = getCategory() && (getCategory()->getPreferredType() == LLFolderType::FT_OUTFIT);
- const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
- //--------------------------------------------------------------------------------
- // Determine if folder can be moved.
- //
- BOOL is_movable = TRUE;
- if (is_movable && (mUUID == cat_id))
- {
- is_movable = FALSE;
- tooltip_msg = LLTrans::getString("TooltipDragOntoSelf");
- }
- if (is_movable && (model->isObjectDescendentOf(mUUID, cat_id)))
- {
- is_movable = FALSE;
- tooltip_msg = LLTrans::getString("TooltipDragOntoOwnChild");
- }
- if (is_movable && LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()))
- {
- is_movable = FALSE;
- // tooltip?
- }
- if (is_movable && move_is_into_outfit)
- {
- is_movable = FALSE;
- // tooltip?
- }
- if (is_movable && (mUUID == model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE)))
- {
- is_movable = FALSE;
- // tooltip?
- }
-
- LLInventoryModel::cat_array_t descendent_categories;
- LLInventoryModel::item_array_t descendent_items;
- if (is_movable)
- {
- model->collectDescendents(cat_id, descendent_categories, descendent_items, FALSE);
- for (S32 i=0; i < descendent_categories.count(); ++i)
- {
- LLInventoryCategory* category = descendent_categories[i];
- if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
- {
- // Can't move "special folders" (e.g. Textures Folder).
- is_movable = FALSE;
- break;
- }
- }
- }
- if (is_movable && move_is_into_trash)
- {
- for (S32 i=0; i < descendent_items.count(); ++i)
- {
- LLInventoryItem* item = descendent_items[i];
- if (get_is_item_worn(item->getUUID()))
- {
- is_movable = FALSE;
- break; // It's generally movable, but not into the trash.
- }
- }
- }
- if (is_movable && move_is_into_landmarks)
- {
- for (S32 i=0; i < descendent_items.count(); ++i)
- {
- LLViewerInventoryItem* item = descendent_items[i];
- // Don't move anything except landmarks and categories into Landmarks folder.
- // We use getType() instead of getActua;Type() to allow links to landmarks and folders.
- if (LLAssetType::AT_LANDMARK != item->getType() && LLAssetType::AT_CATEGORY != item->getType())
- {
- is_movable = FALSE;
- break; // It's generally movable, but not into Landmarks.
- }
- }
- }
- if (is_movable && move_is_into_outbox)
- {
- const int nested_folder_levels = get_folder_path_length(outbox_id, mUUID) + get_folder_levels(inv_cat);
-
- if (nested_folder_levels > gSavedSettings.getU32("InventoryOutboxMaxFolderDepth"))
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxFolderLevels");
- is_movable = FALSE;
- }
- else
- {
- int dragged_folder_count = descendent_categories.count();
- int existing_item_count = 0;
- int existing_folder_count = 0;
-
- const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(outbox_id, mUUID);
-
- if (master_folder != NULL)
- {
- if (model->isObjectDescendentOf(cat_id, master_folder->getUUID()))
- {
- // Don't use count because we're already inside the same category anyway
- dragged_folder_count = 0;
- }
- else
- {
- existing_folder_count = 1; // Include the master folder in the count!
- // If we're in the drop operation as opposed to the drag without drop, we are doing a
- // single category at a time so don't block based on the total amount of cargo data items
- if (drop)
- {
- dragged_folder_count += 1;
- }
- else
- {
- // NOTE: The cargo id's count is a total of categories AND items but we err on the side of
- // prevention rather than letting too many folders into the hierarchy of the outbox,
- // when we're dragging the item to a new parent
- dragged_folder_count += LLToolDragAndDrop::instance().getCargoIDsCount();
- }
- }
-
- // Tally the total number of categories and items inside the master folder
- LLInventoryModel::cat_array_t existing_categories;
- LLInventoryModel::item_array_t existing_items;
- model->collectDescendents(master_folder->getUUID(), existing_categories, existing_items, FALSE);
-
- existing_folder_count += existing_categories.count();
- existing_item_count += existing_items.count();
- }
- else
- {
- // Assume a single category is being dragged to the outbox since we evaluate one at a time
- // when not putting them under a parent item.
- dragged_folder_count += 1;
- }
- const int nested_folder_count = existing_folder_count + dragged_folder_count;
- const int nested_item_count = existing_item_count + descendent_items.count();
-
- if (nested_folder_count > gSavedSettings.getU32("InventoryOutboxMaxFolderCount"))
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxTooManyFolders");
- is_movable = FALSE;
- }
- else if (nested_item_count > gSavedSettings.getU32("InventoryOutboxMaxItemCount"))
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxTooManyObjects");
- is_movable = FALSE;
- }
-
- if (is_movable == TRUE)
- {
- for (S32 i=0; i < descendent_items.count(); ++i)
- {
- LLInventoryItem* item = descendent_items[i];
- if (!can_move_to_outbox(item, tooltip_msg))
- {
- is_movable = FALSE;
- break;
- }
- }
- }
- }
- }
- //
- //--------------------------------------------------------------------------------
- accept = is_movable;
- if (accept && drop)
- {
- // Look for any gestures and deactivate them
- if (move_is_into_trash)
- {
- for (S32 i=0; i < descendent_items.count(); i++)
- {
- LLInventoryItem* item = descendent_items[i];
- if (item->getType() == LLAssetType::AT_GESTURE
- && LLGestureMgr::instance().isGestureActive(item->getUUID()))
- {
- LLGestureMgr::instance().deactivateGesture(item->getUUID());
- }
- }
- }
- // if target is an outfit or current outfit folder we use link
- if (move_is_into_current_outfit || move_is_into_outfit)
- {
- if (inv_cat->getPreferredType() == LLFolderType::FT_NONE)
- {
- if (move_is_into_current_outfit)
- {
- // traverse category and add all contents to currently worn.
- BOOL append = true;
- LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append);
- }
- else
- {
- // Recursively create links in target outfit.
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- model->collectDescendents(cat_id, cats, items, LLInventoryModel::EXCLUDE_TRASH);
- LLAppearanceMgr::instance().linkAll(mUUID,items,NULL);
- }
- }
- else
- {
- #if SUPPORT_ENSEMBLES
- // 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(),
- cat_id,
- mUUID,
- inv_cat->getName(),
- empty_description,
- LLAssetType::AT_LINK_FOLDER,
- cb);
- }
- #endif
- }
- }
- else if (move_is_into_outbox && !move_is_from_outbox)
- {
- copy_folder_to_outbox(inv_cat, mUUID, cat_id, LLToolDragAndDrop::getOperationId());
- }
- else
- {
- if (model->isObjectDescendentOf(cat_id, model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false)))
- {
- set_dad_inbox_object(cat_id);
- }
- // Reparent the folder and restamp children if it's moving
- // into trash.
- LLInvFVBridge::changeCategoryParent(
- model,
- (LLViewerInventoryCategory*)inv_cat,
- mUUID,
- move_is_into_trash);
- }
- }
- }
- else if (LLToolDragAndDrop::SOURCE_WORLD == source)
- {
- if (move_is_into_outbox)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
- accept = FALSE;
- }
- else
- {
- accept = move_inv_category_world_to_agent(cat_id, mUUID, drop);
- }
- }
- else if (LLToolDragAndDrop::SOURCE_LIBRARY == source)
- {
- if (move_is_into_outbox)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
- accept = FALSE;
- }
- else
- {
- // Accept folders that contain complete outfits.
- accept = move_is_into_current_outfit && LLAppearanceMgr::instance().getCanMakeFolderIntoOutfit(cat_id);
- }
- if (accept && drop)
- {
- LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, true, false);
- }
- }
- return accept;
- }
- void warn_move_inventory(LLViewerObject* object, LLMoveInv* move_inv)
- {
- const char* dialog = NULL;
- if (object->flagScripted())
- {
- dialog = "MoveInventoryFromScriptedObject";
- }
- else
- {
- dialog = "MoveInventoryFromObject";
- }
- LLNotificationsUtil::add(dialog, LLSD(), LLSD(), boost::bind(move_task_inventory_callback, _1, _2, move_inv));
- }
- // Move/copy all inventory items from the Contents folder of an in-world
- // object to the agent's inventory, inside a given category.
- BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
- const LLUUID& category_id,
- BOOL drop,
- void (*callback)(S32, void*),
- void* user_data)
- {
- // Make sure the object exists. If we allowed dragging from
- // anonymous objects, it would be possible to bypass
- // permissions.
- // content category has same ID as object itself
- LLViewerObject* object = gObjectList.findObject(object_id);
- if(!object)
- {
- llinfos << "Object not found for drop." << llendl;
- return FALSE;
- }
- // 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
- LLInventoryObject::object_list_t inventory_objects;
- object->getInventoryContents(inventory_objects);
- if (inventory_objects.empty())
- {
- llinfos << "Object contents not found for drop." << llendl;
- return FALSE;
- }
- BOOL accept = TRUE;
- BOOL is_move = FALSE;
- // coming from a task. Need to figure out if the person can
- // move/copy this item.
- 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
- // move/copy this item.
- LLPermissions perm(((LLInventoryItem*)((LLInventoryObject*)(*it)))->getPermissions());
- if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
- && perm.allowTransferTo(gAgent.getID())))
- // || gAgent.isGodlike())
- {
- accept = TRUE;
- }
- else if(object->permYouOwner())
- {
- // If the object cannot be copied, but the object the
- // inventory is owned by the agent, then the item can be
- // moved from the task to agent inventory.
- is_move = TRUE;
- accept = TRUE;
- }
- else
- {
- accept = FALSE;
- break;
- }
- }
- if(drop && accept)
- {
- 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;
- move_inv->mCallback = callback;
- move_inv->mUserData = user_data;
- for ( ; it != end; ++it)
- {
- two_uuids_t two(category_id, (*it)->getUUID());
- move_inv->mMoveList.push_back(two);
- }
- if(is_move)
- {
- // Callback called from within here.
- warn_move_inventory(object, move_inv);
- }
- else
- {
- LLNotification::Params params("MoveInventoryFromObject");
- params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv));
- LLNotifications::instance().forceResponse(params, 0);
- }
- }
- return accept;
- }
- //Used by LLFolderBridge as callback for directory recursion.
- class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver
- {
- public:
- LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) :
- LLInventoryFetchItemsObserver(ids),
- mCopyItems(false)
- { };
- 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
- LLFolderBridge::staticFolderOptionsMenu();
- gInventory.removeObserver(this);
- delete this;
- }
- protected:
- LLUUID mCatID;
- bool mCopyItems;
- };
- //Used by LLFolderBridge as callback for directory recursion.
- class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver
- {
- public:
- LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids,
- bool copy_items) :
- LLInventoryFetchDescendentsObserver(ids),
- mCopyItems(copy_items)
- {}
- ~LLRightClickInventoryFetchDescendentsObserver() {}
- virtual void done();
- protected:
- bool mCopyItems;
- };
- void LLRightClickInventoryFetchDescendentsObserver::done()
- {
- // Avoid passing a NULL-r