summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r--indra/newview/llinventorybridge.cpp2431
1 files changed, 1128 insertions, 1303 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index e394b4dfc1..b03947f54d 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -36,22 +36,21 @@
// external projects
#include "lltransfersourceasset.h"
-
-
#include "llagent.h"
#include "llagentcamera.h"
#include "llagentwearables.h"
#include "llappearancemgr.h"
#include "llavataractions.h"
-#include "llfloatercustomize.h"
#include "llfloateropenobject.h"
#include "llfloaterreg.h"
#include "llfloaterworldmap.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"
@@ -62,15 +61,29 @@
#include "llpreviewgesture.h"
#include "llpreviewtexture.h"
#include "llselectmgr.h"
+#include "llsidepanelappearance.h"
#include "llsidetray.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"
-#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;
@@ -90,66 +103,32 @@ void dec_busy_count()
}
// Function declarations
-void wear_add_inventory_item_on_avatar(LLInventoryItem* item);
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);
-
-std::string ICON_NAME[ICON_NAME_COUNT] =
-{
- "Inv_Texture",
- "Inv_Sound",
- "Inv_CallingCard",
- "Inv_CallingCard",
- "Inv_Landmark",
- "Inv_Landmark",
- "Inv_Script",
- "Inv_Clothing",
- "Inv_Object",
- "Inv_Object_Multi",
- "Inv_Notecard",
- "Inv_Skin",
- "Inv_Snapshot",
-
- "Inv_BodyShape",
- "Inv_Skin",
- "Inv_Hair",
- "Inv_Eye",
- "Inv_Shirt",
- "Inv_Pants",
- "Inv_Shoe",
- "Inv_Socks",
- "Inv_Jacket",
- "Inv_Gloves",
- "Inv_Undershirt",
- "Inv_Underpants",
- "Inv_Skirt",
- "Inv_Alpha",
- "Inv_Tattoo",
-
- "Inv_Animation",
- "Inv_Gesture",
-
- "Inv_LinkItem",
- "Inv_LinkFolder",
-
- "Inv_Mesh"
-};
+void teleport_via_landmark(const LLUUID& asset_id);
// +=================================================+
// | 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),
+ mIsLink(FALSE)
{
mInventoryPanel = inventory->getHandle();
+ const LLInventoryObject* obj = getInventoryObject();
+ mIsLink = obj && obj->getIsLinkType();
}
const std::string& LLInvFVBridge::getName() const
{
- LLInventoryObject* obj = getInventoryObject();
+ const LLInventoryObject* obj = getInventoryObject();
if(obj)
{
return obj->getName();
@@ -165,7 +144,6 @@ const std::string& LLInvFVBridge::getDisplayName() const
// Folders have full perms
PermissionMask LLInvFVBridge::getPermissionMask() const
{
-
return PERM_ALL;
}
@@ -185,34 +163,7 @@ time_t LLInvFVBridge::getCreationDate() const
// Can be destroyed (or moved to trash)
BOOL LLInvFVBridge::isItemRemovable() const
{
- const LLInventoryModel* model = getInventoryModel();
- if(!model)
- {
- return FALSE;
- }
-
- // Can't delete an item that's in the library.
- if(!model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()))
- {
- return FALSE;
- }
-
- // Disable delete from COF folder; have users explicitly choose "detach/take off".
- if (LLAppearanceMgr::instance().getIsProtectedCOFItem(mUUID))
- {
- return FALSE;
- }
-
- const LLInventoryObject *obj = model->getItem(mUUID);
- if (obj && obj->getIsLinkType())
- {
- return TRUE;
- }
- if (get_is_item_worn(mUUID))
- {
- return FALSE;
- }
- return TRUE;
+ return get_is_item_removable(getInventoryModel(), mUUID);
}
// Can be moved to another folder
@@ -221,6 +172,11 @@ BOOL LLInvFVBridge::isItemMovable() const
return TRUE;
}
+BOOL LLInvFVBridge::isLink() const
+{
+ return mIsLink;
+}
+
/*virtual*/
/**
* @brief Adds this item into clipboard storage
@@ -235,13 +191,11 @@ void LLInvFVBridge::cutToClipboard()
// *TODO: make sure this does the right thing
void LLInvFVBridge::showProperties()
{
- LLSD key;
- key["id"] = mUUID;
- LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
+ show_item_profile(mUUID);
// Disable old properties floater; this is replaced by the sidepanel.
/*
- LLFloaterReg::showInstance("properties", mUUID);
+ LLFloaterReg::showInstance("properties", mUUID);
*/
}
@@ -480,7 +434,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;
}
@@ -489,8 +443,9 @@ 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,
+ BOOL append) // If append is TRUE, then new enabled entries
{
const LLView::child_list_t *list = menu.getChildList();
@@ -498,13 +453,15 @@ void hide_context_entries(LLMenuGL& menu,
// if the first element is a separator, it will not be shown.
BOOL is_previous_entry_separator = TRUE;
- LLView::child_list_t::const_iterator itor;
- for (itor = list->begin(); itor != list->end(); ++itor)
+ for (LLView::child_list_t::const_iterator itor = list->begin();
+ itor != list->end();
+ ++itor)
{
- std::string name = (*itor)->getName();
+ LLView *menu_item = (*itor);
+ std::string name = menu_item->getName();
// descend into split menus:
- LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(*itor);
+ LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(menu_item);
if ((name == "More") && branchp)
{
hide_context_entries(*branchp->getBranch(), entries_to_show, disabled_entries);
@@ -525,7 +482,7 @@ void hide_context_entries(LLMenuGL& menu,
// between two separators).
if (found)
{
- const BOOL is_entry_separator = (dynamic_cast<LLMenuItemSeparatorGL *>(*itor) != NULL);
+ const BOOL is_entry_separator = (dynamic_cast<LLMenuItemSeparatorGL *>(menu_item) != NULL);
if (is_entry_separator && is_previous_entry_separator)
found = false;
is_previous_entry_separator = is_entry_separator;
@@ -533,16 +490,27 @@ void hide_context_entries(LLMenuGL& menu,
if (!found)
{
- (*itor)->setVisible(FALSE);
+ if (!menu_item->getLastVisible())
+ {
+ menu_item->setVisible(FALSE);
+ }
+ menu_item->setEnabled(FALSE);
}
else
{
- (*itor)->setVisible(TRUE);
+ 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);
+ if (append)
+ {
+ menu_item->setEnabled(TRUE);
+ }
for (itor2 = disabled_entries.begin(); itor2 != disabled_entries.end(); ++itor2)
{
if (*itor2 == name)
{
- (*itor)->setEnabled(FALSE);
+ menu_item->setEnabled(FALSE);
}
}
}
@@ -556,17 +524,6 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
{
const LLInventoryObject *obj = getInventoryObject();
- bool is_sidepanel = isInOutfitsSidePanel();
- if (is_sidepanel)
- {
- // Sidepanel includes restricted menu.
- if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID))
- {
- items.push_back(std::string("Remove Link"));
- }
- return;
- }
-
if (obj)
{
if (obj->getIsLinkType())
@@ -627,7 +584,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)
@@ -658,7 +615,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);
@@ -693,7 +656,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;
}
@@ -714,6 +677,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
{
@@ -821,21 +795,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
@@ -844,41 +804,14 @@ void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model,
const LLUUID& new_parent_id,
BOOL restamp)
{
- // Can't move a folder into a child of itself.
- if (model->isObjectDescendentOf(new_parent_id, cat->getUUID()))
- {
- return;
- }
-
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
- update.push_back(new_folder);
- model->accountForUpdate(update);
-
- LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
- new_cat->setParent(new_parent_id);
- new_cat->updateParentOnServer(restamp);
- model->updateCategory(new_cat);
- 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;
+ 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)
{
@@ -888,112 +821,114 @@ 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 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 " << 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, (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, 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;
- case LLAssetType::AT_MESH:
+#if LL_MESH_ENABLED
+ case LLAssetType::AT_MESH:
if(!(inv_type == LLInventoryType::IT_MESH))
{
- 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 LLMeshBridge(inventory, uuid);
+ new_listener = new LLMeshBridge(inventory, root, uuid);
break;
+#endif
default:
llinfos << "Unhandled asset type (llassetstorage.h): "
@@ -1025,14 +960,25 @@ void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid)
}
}
-bool LLInvFVBridge::isInOutfitsSidePanel() const
+BOOL LLInvFVBridge::canShare() const
{
- LLInventoryPanel *my_panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
- LLPanelOutfitsInventory *outfit_panel =
- dynamic_cast<LLPanelOutfitsInventory*>(LLSideTray::getInstance()->getPanel("panel_outfits_inventory"));
- if (!outfit_panel)
- return false;
- return outfit_panel->isTabPanel(my_panel);
+ if (!isAgentInventory()) return FALSE;
+
+ const LLInventoryModel* model = getInventoryModel();
+ if (!model) return FALSE;
+
+ const LLViewerInventoryItem *item = model->getItem(mUUID);
+ if (item)
+ {
+ if (!LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item))
+ return FALSE;
+ return (BOOL)LLGiveInventory::isInventoryGiveAcceptable(item);
+ }
+
+ // Categories can be given.
+ if (model->getCategory(mUUID)) return TRUE;
+
+ return FALSE;
}
// +=================================================+
@@ -1042,29 +988,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;
@@ -1112,7 +1060,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();
@@ -1124,7 +1072,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();
@@ -1135,7 +1083,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();
}
@@ -1193,7 +1141,7 @@ void LLItemBridge::restoreToWorld()
}
}
-void LLItemBridge::gotoItem(LLFolderView *folder)
+void LLItemBridge::gotoItem()
{
LLInventoryObject *obj = getInventoryObject();
if (obj && obj->getIsLinkType())
@@ -1208,25 +1156,22 @@ void LLItemBridge::gotoItem(LLFolderView *folder)
LLUIImagePtr LLItemBridge::getIcon() const
{
- return LLUI::getUIImage(ICON_NAME[OBJECT_ICON_NAME]);
+ 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)
- {
- BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
- BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
- BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
- gAgent.getID());
-
- if (copy) perm_mask |= PERM_COPY;
- if (mod) perm_mask |= PERM_MODIFY;
- if (xfer) perm_mask |= PERM_TRANSFER;
-
- }
+ if (item) perm_mask = item->getPermissionMask();
return perm_mask;
}
@@ -1254,18 +1199,18 @@ void LLItemBridge::buildDisplayName(LLInventoryItem* item, std::string& name)
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;
}
-
- const LLViewerInventoryItem* item = getItem();
- if (item && item->getIsLinkType())
+ else if(item && item->getIsLinkType())
{
font |= LLFontGL::ITALIC;
}
+
return (LLFontGL::StyleFlags)font;
}
@@ -1335,6 +1280,12 @@ BOOL LLItemBridge::isItemRenameable() const
{
return FALSE;
}
+
+ if (!item->isFinished()) // EXT-8662
+ {
+ return FALSE;
+ }
+
return (item->getPermissions().allowModifyBy(gAgent.getID()));
}
return FALSE;
@@ -1371,13 +1322,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))
{
@@ -1386,11 +1389,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
@@ -1410,17 +1409,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;
}
@@ -1470,7 +1463,7 @@ bool LLItemBridge::isRemoveAction(std::string action) const
// | LLFolderBridge |
// +=================================================+
-LLFolderBridge* LLFolderBridge::sSelf=NULL;
+LLHandle<LLFolderBridge> LLFolderBridge::sSelf;
// Can be moved to another folder
BOOL LLFolderBridge::isItemMovable() const
@@ -1508,26 +1501,7 @@ public:
// Can be destroyed (or moved to trash)
BOOL LLFolderBridge::isItemRemovable() const
{
- LLInventoryModel* model = getInventoryModel();
- if(!model)
- {
- return FALSE;
- }
-
- if(!model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()))
- {
- return FALSE;
- }
-
- if (!isAgentAvatarValid()) return FALSE;
-
- LLInventoryCategory* category = model->getCategory(mUUID);
- if(!category)
- {
- return FALSE;
- }
-
- if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
+ if (!get_is_category_removable(getInventoryModel(), mUUID))
{
return FALSE;
}
@@ -1543,6 +1517,7 @@ BOOL LLFolderBridge::isItemRemovable() const
return FALSE;
}
}
+
return TRUE;
}
@@ -1561,6 +1536,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;
}
@@ -1663,96 +1643,81 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const
BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
BOOL drop)
{
- // This should never happen, but if an inventory item is incorrectly parented,
- // the UI will get confused and pass in a NULL.
- if(!inv_cat) return FALSE;
LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
+ 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
- // cannot drag categories into library
- if(!isAgentInventory())
- {
- return FALSE;
- }
// check to make sure source is agent inventory, and is represented there.
LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
- BOOL is_agent_inventory = (model->getCategory(inv_cat->getUUID()) != NULL)
+ const BOOL is_agent_inventory = (model->getCategory(inv_cat->getUUID()) != NULL)
&& (LLToolDragAndDrop::SOURCE_AGENT == source);
BOOL accept = FALSE;
- S32 i;
- LLInventoryModel::cat_array_t descendent_categories;
- LLInventoryModel::item_array_t descendent_items;
- if(is_agent_inventory)
+ if (is_agent_inventory)
{
- const LLUUID& cat_id = inv_cat->getUUID();
+ const LLUUID &cat_id = inv_cat->getUUID();
+ const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false);
+ const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, 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_current_outfit = (mUUID == current_outfit_id);
- // 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);
- 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);
- BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
- if (move_is_into_current_outfit || move_is_into_outfit)
- {
- // BAP - restrictions?
- is_movable = true;
- }
+ //--------------------------------------------------------------------------------
+ // Determine if folder can be moved.
+ //
+ BOOL is_movable = TRUE;
+ if (LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()))
+ is_movable = FALSE;
+ if (move_is_into_outfit)
+ is_movable = FALSE;
if (mUUID == gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE))
+ is_movable = FALSE;
+ LLInventoryModel::cat_array_t descendent_categories;
+ LLInventoryModel::item_array_t descendent_items;
+ gInventory.collectDescendents(cat_id, descendent_categories, descendent_items, FALSE);
+ for (S32 i=0; i < descendent_categories.count(); ++i)
{
- is_movable = FALSE; // It's generally movable but not into Favorites folder. EXT-1604
+ 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 )
+ if (move_is_into_trash)
{
- gInventory.collectDescendents( cat_id, descendent_categories, descendent_items, FALSE );
-
- for( i = 0; i < descendent_categories.count(); i++ )
+ for (S32 i=0; i < descendent_items.count(); ++i)
{
- LLInventoryCategory* category = descendent_categories[i];
- if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
+ LLInventoryItem* item = descendent_items[i];
+ if (get_is_item_worn(item->getUUID()))
{
- // ...can't move "special folders" like Textures
is_movable = FALSE;
- break;
- }
- }
-
- if( is_movable )
- {
- if( move_is_into_trash )
- {
- for( 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!
- }
- }
+ break; // It's generally movable, but not into the trash.
}
}
}
+ //
+ //--------------------------------------------------------------------------------
- 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)
{
- for (i = 0; i < descendent_items.count(); i++)
+ for (S32 i=0; i < descendent_items.count(); i++)
{
LLInventoryItem* item = descendent_items[i];
if (item->getType() == LLAssetType::AT_GESTURE
@@ -1785,22 +1750,24 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
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;
- 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
}
}
@@ -1817,7 +1784,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();
@@ -1862,7 +1829,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())
@@ -1876,8 +1843,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
@@ -1907,7 +1874,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;
@@ -1936,16 +1903,20 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
}
//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
@@ -1966,7 +1937,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:
@@ -1977,7 +1952,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();
@@ -1991,7 +1966,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);
@@ -2009,14 +1984,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.
@@ -2029,19 +2004,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);
}*/
}
@@ -2055,7 +2030,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);
@@ -2094,7 +2070,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
if (NULL == category)
{
llwarns << "gInventory.getCategory(" << mCatID
- << ") was NULL" << llendl;
+ << ") was NULL" << llendl;
}
else
{
@@ -2102,7 +2078,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
mContentsCount)
{
gInventory.removeObserver(this);
- LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, TRUE);
+ LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, FALSE);
delete this;
}
}
@@ -2113,11 +2089,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);
@@ -2230,13 +2206,7 @@ void LLFolderBridge::determineFolderType()
BOOL LLFolderBridge::isItemRenameable() const
{
- LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)getCategory();
- if(cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType())
- && (cat->getOwnerID() == gAgent.getID()))
- {
- return TRUE;
- }
- return FALSE;
+ return get_is_category_renameable(getInventoryModel(), mUUID);
}
void LLFolderBridge::restoreItem()
@@ -2276,14 +2246,10 @@ LLUIImagePtr LLFolderBridge::getIcon() const
return getIcon(preferred_type);
}
+// static
LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type)
{
- // we only have one folder image now
- if (preferred_type == LLFolderType::FT_OUTFIT)
- {
- return LLUI::getUIImage("Inv_LookFolderClosed");
- }
- return LLUI::getUIImage("Inv_FolderClosed");
+ return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, FALSE));
/*case LLAssetType::AT_MESH:
control = "inv_folder_mesh.tga";
break;*/
@@ -2291,30 +2257,14 @@ LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type)
LLUIImagePtr LLFolderBridge::getOpenIcon() const
{
- if (getPreferredType() == LLFolderType::FT_OUTFIT)
- {
- return LLUI::getUIImage("Inv_LookFolderOpen");
- }
- return LLUI::getUIImage("Inv_FolderOpen");
+ return LLUI::getUIImage(LLViewerFolderType::lookupIconName(getPreferredType(), TRUE));
+
}
BOOL LLFolderBridge::renameItem(const std::string& new_name)
{
- if(!isItemRenameable())
- return FALSE;
- LLInventoryModel* model = getInventoryModel();
- if(!model)
- return FALSE;
- LLViewerInventoryCategory* cat = getCategory();
- if(cat && (cat->getName() != new_name))
- {
- LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
- new_cat->rename(new_name);
- new_cat->updateServer(FALSE);
- model->updateCategory(new_cat);
+ rename_category(getInventoryModel(), mUUID, new_name);
- model->notifyObservers();
- }
// return FALSE because we either notified observers (& therefore
// rebuilt) or we didn't update.
return FALSE;
@@ -2368,36 +2318,7 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re
{
// move it to the trash
LLPreview::hide(mUUID);
- LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
-
- const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
-
- // Look for any gestures and deactivate them
- LLInventoryModel::cat_array_t descendent_categories;
- LLInventoryModel::item_array_t descendent_items;
- gInventory.collectDescendents( mUUID, descendent_categories, descendent_items, FALSE );
-
- for (LLInventoryModel::item_array_t::const_iterator iter = descendent_items.begin();
- iter != descendent_items.end();
- ++iter)
- {
- const LLViewerInventoryItem* item = (*iter);
- const LLUUID& item_id = item->getUUID();
- if (item->getType() == LLAssetType::AT_GESTURE
- && LLGestureMgr::instance().isGestureActive(item_id))
- {
- LLGestureMgr::instance().deactivateGesture(item_id);
- }
- }
-
- // go ahead and do the normal remove if no 'last calling
- // cards' are being removed.
- LLViewerInventoryCategory* cat = getCategory();
- if(cat)
- {
- LLInvFVBridge::changeCategoryParent(model, cat, trash_id, TRUE);
- }
+ remove_category(getInventoryModel(), mUUID);
return TRUE;
}
return FALSE;
@@ -2460,26 +2381,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));
}
@@ -2489,8 +2410,11 @@ void LLFolderBridge::pasteLinkFromClipboard()
void LLFolderBridge::staticFolderOptionsMenu()
{
- if (!sSelf) return;
- sSelf->folderOptionsMenu();
+ LLFolderBridge* selfp = sSelf.get();
+ if (selfp)
+ {
+ selfp->folderOptionsMenu();
+ }
}
void LLFolderBridge::folderOptionsMenu()
@@ -2503,23 +2427,19 @@ void LLFolderBridge::folderOptionsMenu()
const LLInventoryCategory* category = model->getCategory(mUUID);
if(!category) return;
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if (trash_id == mUUID) return;
+ if (isItemInTrash()) return;
+ if (!isAgentInventory()) return;
+
LLFolderType::EType type = category->getPreferredType();
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));
-
- // calling card related functionality for folders.
-
- const bool is_sidepanel = isInOutfitsSidePanel();
- if (is_sidepanel)
- {
- mItems.push_back("Rename");
- addDeleteContextMenuOptions(mItems, disabled_items);
- }
+ LLFolderType::lookupIsEnsembleType(type));
// Only enable calling-card related options for non-system folders.
- if (!is_sidepanel && !is_system_folder)
+ if (!is_system_folder)
{
LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
@@ -2548,10 +2468,7 @@ void LLFolderBridge::folderOptionsMenu()
checkFolderForContentsOfType(model, is_object) ||
checkFolderForContentsOfType(model, is_gesture) )
{
- if (!is_sidepanel)
- {
- mItems.push_back(std::string("Folder Wearables Separator"));
- }
+ mItems.push_back(std::string("Folder Wearables Separator"));
// Only enable add/replace outfit for non-system folders.
if (!is_system_folder)
@@ -2568,17 +2485,21 @@ void LLFolderBridge::folderOptionsMenu()
mItems.push_back(std::string("Wear As Ensemble"));
}
mItems.push_back(std::string("Remove From Outfit"));
- if (!areAnyContentsWorn(model))
+ if (!LLAppearanceMgr::getCanRemoveFromCOF(mUUID))
{
disabled_items.push_back(std::string("Remove From Outfit"));
}
mItems.push_back(std::string("Outfit Separator"));
}
- hide_context_entries(*mMenu, mItems, disabled_items);
+ LLMenuGL* menup = dynamic_cast<LLMenuGL*>(mMenu.get());
+ if (menup)
+ {
+ hide_context_entries(*menup, mItems, disabled_items, TRUE);
- // Reposition the menu, in case we're adding items to an existing menu.
- mMenu->needsArrange();
- mMenu->arrangeAndClear();
+ // Reposition the menu, in case we're adding items to an existing menu.
+ menup->needsArrange();
+ menup->arrangeAndClear();
+ }
}
BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type)
@@ -2593,35 +2514,6 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv
return ((item_array.count() > 0) ? TRUE : FALSE );
}
-class LLFindWorn : public LLInventoryCollectFunctor
-{
-public:
- LLFindWorn() {}
- virtual ~LLFindWorn() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
- {
- if (item && get_is_item_worn(item->getUUID()))
- {
- return TRUE;
- }
- return FALSE;
- }
-};
-
-BOOL LLFolderBridge::areAnyContentsWorn(LLInventoryModel* model) const
-{
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- LLFindWorn is_worn;
- model->collectDescendentsIf(mUUID,
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- is_worn);
- return (item_array.size() > 0);
-}
-
// Flags unused
void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
@@ -2637,10 +2529,21 @@ 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"));
+ }
+
+ // clear out old menu and folder pointers
+ mMenu.markDead();
+ sSelf.markDead();
if(trash_id == mUUID)
{
@@ -2669,9 +2572,9 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
mItems.push_back(std::string("New Clothes"));
mItems.push_back(std::string("New Body Parts"));
- // Changing folder types is just a debug feature; this is fairly unsupported
+#if SUPPORT_ENSEMBLES
+ // Changing folder types is an unfinished unsupported feature
// and can lead to unexpected behavior if enabled.
-#if !LL_RELEASE_FOR_DOWNLOAD
mItems.push_back(std::string("Change Type"));
const LLViewerInventoryCategory *cat = getCategory();
if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
@@ -2717,35 +2620,6 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
mWearables=TRUE;
}
-
- mMenu = &menu;
- sSelf = this;
- LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(FALSE);
-
- uuid_vec_t folders;
- LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
- if (category)
- {
- folders.push_back(category->getUUID());
- }
- fetch->fetchDescendents(folders);
- inc_busy_count();
- if(fetch->isEverythingComplete())
- {
- // everything is already here - call done.
- fetch->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(fetch);
- }
- }
- else
- {
- mItems.push_back(std::string("--no options--"));
- mDisabledItems.push_back(std::string("--no options--"));
}
// Preemptively disable system folder removal if more than one item selected.
@@ -2753,8 +2627,38 @@ 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);
+
+ // Add menu items that are dependent on the contents of the folder.
+ uuid_vec_t folders;
+ LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
+ if (category)
+ {
+ folders.push_back(category->getUUID());
+ }
+
+ mMenu = menu.getHandle();
+ sSelf = getHandle();
+ LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE);
+ fetch->startFetch();
+ inc_busy_count();
+ if(fetch->isFinished())
+ {
+ // everything is already here - call done.
+ fetch->done();
+ }
+ else
+ {
+ // it's all on its way - add an observer, and the inventory will call done for us when everything is here.
+ gInventory.addObserver(fetch);
+ }
}
BOOL LLFolderBridge::hasChildren() const
@@ -2786,7 +2690,9 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,
case DAD_ANIMATION:
case DAD_GESTURE:
case DAD_LINK:
+#if LL_MESH_ENABLED
case DAD_MESH:
+#endif
accept = dragItemIntoFolder((LLInventoryItem*)cargo_data,
drop);
break;
@@ -2846,90 +2752,75 @@ void LLFolderBridge::createNewCategory(void* user_data)
void LLFolderBridge::createNewShirt(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHIRT);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHIRT);
}
void LLFolderBridge::createNewPants(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_PANTS);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_PANTS);
}
void LLFolderBridge::createNewShoes(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHOES);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHOES);
}
void LLFolderBridge::createNewSocks(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SOCKS);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SOCKS);
}
void LLFolderBridge::createNewJacket(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_JACKET);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_JACKET);
}
void LLFolderBridge::createNewSkirt(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIRT);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIRT);
}
void LLFolderBridge::createNewGloves(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_GLOVES);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_GLOVES);
}
void LLFolderBridge::createNewUndershirt(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERSHIRT);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERSHIRT);
}
void LLFolderBridge::createNewUnderpants(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERPANTS);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERPANTS);
}
void LLFolderBridge::createNewShape(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHAPE);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHAPE);
}
void LLFolderBridge::createNewSkin(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIN);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIN);
}
void LLFolderBridge::createNewHair(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_HAIR);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_HAIR);
}
void LLFolderBridge::createNewEyes(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_EYES);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_EYES);
}
// static
-void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type)
+void LLFolderBridge::createWearable(LLFolderBridge* bridge, LLWearableType::EType type)
{
if(!bridge) return;
LLUUID parent_id = bridge->getUUID();
- createWearable(parent_id, type);
-}
-
-// Separate function so can be called by global menu as well as right-click
-// menu.
-// static
-void LLFolderBridge::createWearable(const LLUUID &parent_id, EWearableType type)
-{
- LLWearable* wearable = LLWearableList::instance().createNewWearable(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));
+ LLAgentWearables::createWearable(type, false, parent_id);
}
void LLFolderBridge::modifyOutfit(BOOL append)
@@ -2953,7 +2844,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
@@ -2963,8 +2854,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);
}
@@ -2982,18 +2873,16 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
return false;
}
+// This is used both for testing whether an item can be dropped
+// into the folder, as well as performing the actual drop, depending
+// if drop == TRUE.
BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
BOOL drop)
{
LLInventoryModel* model = getInventoryModel();
- if(!model || !inv_item) return FALSE;
-
- // cannot drag into library
- if(!isAgentInventory())
- {
- return FALSE;
- }
+ if(!model || !inv_item) return FALSE;
+ if(!isAgentInventory()) return FALSE; // cannot drag into library
if (!isAgentAvatarValid()) return FALSE;
LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
@@ -3001,50 +2890,74 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
LLViewerObject* object = NULL;
if(LLToolDragAndDrop::SOURCE_AGENT == source)
{
- BOOL is_movable = TRUE;
- switch( inv_item->getActualType() )
- {
- case LLAssetType::AT_CATEGORY:
- is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType());
- break;
- default:
- break;
- }
+ const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false);
+ const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
+ const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE, false);
- const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
- const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
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 = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID());
+ const BOOL folder_allows_reorder = (mUUID == favorites_id);
+
+ //--------------------------------------------------------------------------------
+ // Determine if item can be moved.
+ //
+ BOOL is_movable = TRUE;
+
+ switch (inv_item->getActualType())
+ {
+ case LLAssetType::AT_CATEGORY:
+ is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType());
+ break;
+ default:
+ break;
+ }
// Can't explicitly drag things out of the COF.
if (move_is_outof_current_outfit)
{
is_movable = FALSE;
}
-
- if(is_movable && move_is_into_trash)
+ if (move_is_into_trash)
{
- is_movable = inv_item->getIsLinkType() || !get_is_item_worn(inv_item->getUUID());
+ is_movable &= inv_item->getIsLinkType() || !get_is_item_worn(inv_item->getUUID());
}
-
- if ( is_movable )
+ if (is_movable)
{
// Don't allow creating duplicates in the Calling Card/Friends
// subfolders, see bug EXT-1599. Check is item direct descendent
// of target folder and forbid item's movement if it so.
// Note: isItemDirectDescendentOfCategory checks if
// passed category is in the Calling Card/Friends folder
- is_movable = ! LLFriendCardsManager::instance()
- .isObjDirectDescendentOfCategory (inv_item, getCategory());
+ is_movable &= !LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(inv_item, getCategory());
+ }
+
+ //
+ //--------------------------------------------------------------------------------
+
+ //--------------------------------------------------------------------------------
+ // Determine if item can be moved & dropped
+ //
+
+ accept = TRUE;
+
+ if (!is_movable)
+ accept = FALSE;
+ if ((mUUID == inv_item->getParentUUID()) && !folder_allows_reorder)
+ accept = FALSE;
+ if (move_is_into_current_outfit || move_is_into_outfit)
+ {
+ if ((inv_item->getInventoryType() != LLInventoryType::IT_WEARABLE) &&
+ (inv_item->getInventoryType() != LLInventoryType::IT_GESTURE) &&
+ (inv_item->getInventoryType() != LLInventoryType::IT_OBJECT))
+ accept = FALSE;
+ }
+ if (move_is_into_current_outfit && get_is_item_worn(inv_item->getUUID()))
+ {
+ accept = FALSE;
}
- const LLUUID& favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- const BOOL folder_allows_reorder = (mUUID == favorites_id);
-
- // we can move item inside a folder only if this folder is Favorites. See EXT-719
- accept = is_movable && ((mUUID != inv_item->getParentUUID()) || folder_allows_reorder);
if(accept && drop)
{
if (inv_item->getType() == LLAssetType::AT_GESTURE
@@ -3052,10 +2965,8 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
{
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
- // the selection to its new location (which is very
- // annoying).
+ // If an item is being dragged between windows, unselect everything in the active window
+ // so that we don't follow the selection to its new location (which is very annoying).
LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
if (active_panel)
{
@@ -3066,7 +2977,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
}
}
- // if dragging from/into favorites folder only reorder items
+ //--------------------------------------------------------------------------------
+ // Destination folder logic
+ //
+
+ // REORDER
+ // (only reorder the item)
if ((mUUID == inv_item->getParentUUID()) && folder_allows_reorder)
{
LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
@@ -3078,7 +2994,10 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
gInventory.rearrangeFavoriteLandmarks(srcItemId, destItemId);
}
}
- else if (favorites_id == mUUID) // if target is the favorites folder we use copy
+
+ // FAVORITES folder
+ // (copy the item)
+ else if (favorites_id == mUUID)
{
// use callback to rearrange favorite landmarks after adding
// to have new one placed before target (on which it was dropped). See EXT-4312.
@@ -3098,37 +3017,50 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
std::string(),
cb);
}
+ // CURRENT OUTFIT or OUTFIT folder
+ // (link the item)
else if (move_is_into_current_outfit || move_is_into_outfit)
{
- // BAP - should skip if dup.
- if (move_is_into_current_outfit)
- {
- LLAppearanceMgr::instance().addCOFItemLink(inv_item);
- }
- else
+ if ((inv_item->getInventoryType() == LLInventoryType::IT_WEARABLE) ||
+ (inv_item->getInventoryType() == LLInventoryType::IT_GESTURE) ||
+ (inv_item->getInventoryType() == LLInventoryType::IT_OBJECT))
{
- LLPointer<LLInventoryCallback> cb = NULL;
- link_inventory_item(
- gAgent.getID(),
- inv_item->getLinkedUUID(),
- mUUID,
- inv_item->getName(),
- LLAssetType::AT_LINK,
- cb);
+ // BAP - should skip if dup.
+ if (move_is_into_current_outfit)
+ {
+ LLAppearanceMgr::instance().wearItemOnAvatar(inv_item->getUUID(), true, true);
+ }
+ else
+ {
+ LLPointer<LLInventoryCallback> cb = NULL;
+ link_inventory_item(
+ gAgent.getID(),
+ inv_item->getLinkedUUID(),
+ mUUID,
+ inv_item->getName(),
+ inv_item->getDescription(),
+ LLAssetType::AT_LINK,
+ cb);
+ }
}
}
+ // NORMAL or TRASH folder
+ // (move the item, restamp if into trash)
else
{
- // restamp if the move is into the trash.
LLInvFVBridge::changeItemParent(
model,
(LLViewerInventoryItem*)inv_item,
mUUID,
move_is_into_trash);
}
+
+ //
+ //--------------------------------------------------------------------------------
+
}
}
- else if(LLToolDragAndDrop::SOURCE_WORLD == source)
+ else if (LLToolDragAndDrop::SOURCE_WORLD == source)
{
// Make sure the object exists. If we allowed dragging from
// anonymous objects, it would be possible to bypass
@@ -3146,7 +3078,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
BOOL is_move = FALSE;
if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
&& perm.allowTransferTo(gAgent.getID())))
-// || gAgent.isGodlike())
+ // || gAgent.isGodlike())
{
accept = TRUE;
@@ -3173,6 +3105,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);
@@ -3186,13 +3121,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)
@@ -3215,21 +3150,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
}
// +=================================================+
-// | LLScriptBridge (DEPRECTED) |
-// +=================================================+
-
-LLUIImagePtr LLScriptBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE);
-}
-
-// +=================================================+
// | LLTextureBridge |
// +=================================================+
LLUIImagePtr LLTextureBridge::getIcon() const
{
- return get_item_icon(LLAssetType::AT_TEXTURE, mInvType, 0, FALSE);
+ return LLInventoryIcon::getIcon(LLAssetType::AT_TEXTURE, mInvType);
}
void LLTextureBridge::openItem()
@@ -3269,7 +3195,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);
@@ -3285,7 +3217,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)
{
@@ -3296,38 +3228,20 @@ void LLTextureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
preview_texture->openToSave();
}
}
- else LLItemBridge::performAction(folder, model, action);
+ else LLItemBridge::performAction(model, action);
}
// +=================================================+
// | LLSoundBridge |
// +=================================================+
-LLUIImagePtr LLSoundBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_SOUND, LLInventoryType::IT_SOUND, 0, FALSE);
-}
-
void LLSoundBridge::openItem()
{
- LLViewerInventoryItem* item = getItem();
-
+ const LLViewerInventoryItem* item = getItem();
if (item)
{
LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
}
-/*
-// Changed this back to the way it USED to work:
-// 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);
- }
-*/
}
void LLSoundBridge::previewItem()
@@ -3357,6 +3271,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"));
@@ -3373,11 +3292,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;
}
@@ -3385,7 +3307,7 @@ LLItemBridge(inventory, uuid)
LLUIImagePtr LLLandmarkBridge::getIcon() const
{
- return get_item_icon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE);
+ return LLInventoryIcon::getIcon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE);
}
void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
@@ -3400,6 +3322,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"));
@@ -3435,7 +3362,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)
{
@@ -3459,7 +3386,7 @@ void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* mod
}
else
{
- LLItemBridge::performAction(folder, model, action);
+ LLItemBridge::performAction(model, action);
}
}
@@ -3486,35 +3413,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);
@@ -3537,7 +3462,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)
{
@@ -3563,7 +3488,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
@@ -3574,7 +3499,7 @@ LLUIImagePtr LLCallingCardBridge::getIcon() const
{
online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID());
}
- return get_item_icon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, FALSE);
+ return LLInventoryIcon::getIcon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, FALSE);
}
std::string LLCallingCardBridge::getLabelSuffix() const
@@ -3599,11 +3524,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());
+ }
*/
}
@@ -3619,15 +3544,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)
{
@@ -3662,17 +3592,19 @@ 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_MESH:
+ 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:
+#if LL_MESH_ENABLED
+ case DAD_MESH:
+#endif
{
LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
const LLPermissions& perm = inv_item->getPermissions();
@@ -3682,7 +3614,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
rv = TRUE;
if(drop)
{
- LLToolDragAndDrop::giveInventory(item->getCreatorUUID(),
+ LLGiveInventory::doGiveInventoryItem(item->getCreatorUUID(),
(LLInventoryItem*)cargo_data);
}
}
@@ -3695,7 +3627,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() ) )
@@ -3703,7 +3635,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
rv = TRUE;
if(drop)
{
- LLToolDragAndDrop::giveInventoryCategory(
+ LLGiveInventory::doGiveInventoryCategory(
item->getCreatorUUID(),
inv_cat);
}
@@ -3717,8 +3649,8 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
}
break;
}
- default:
- break;
+ default:
+ break;
}
}
return rv;
@@ -3728,39 +3660,19 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
// | LLNotecardBridge |
// +=================================================+
-LLUIImagePtr LLNotecardBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, 0, FALSE);
-}
-
void LLNotecardBridge::openItem()
{
LLViewerInventoryItem* item = getItem();
-
if (item)
{
LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
}
-
-/*
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
- }
-*/
}
-
// +=================================================+
// | LLGestureBridge |
// +=================================================+
-LLUIImagePtr LLGestureBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, 0, FALSE);
-}
-
LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
{
if( LLGestureMgr::instance().isGestureActive(mUUID) )
@@ -3788,7 +3700,7 @@ 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))
{
@@ -3834,7 +3746,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
playGesture(mUUID);
}
}
- else LLItemBridge::performAction(folder, model, action);
+ else LLItemBridge::performAction(model, action);
}
void LLGestureBridge::openItem()
@@ -3846,12 +3758,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);
+ }
*/
}
@@ -3890,14 +3802,15 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
else
{
- bool is_sidepanel = isInOutfitsSidePanel();
-
- if (!is_sidepanel)
+ items.push_back(std::string("Share"));
+ if (!canShare())
{
- items.push_back(std::string("Open"));
- items.push_back(std::string("Properties"));
+ disabled_items.push_back(std::string("Share"));
}
+ addOpenRightClickMenuOption(items);
+ items.push_back(std::string("Properties"));
+
getClipboardEntries(true, items, disabled_items, flags);
items.push_back(std::string("Gesture Separator"));
@@ -3931,11 +3844,6 @@ void LLGestureBridge::playGesture(const LLUUID& item_id)
// | LLAnimationBridge |
// +=================================================+
-LLUIImagePtr LLAnimationBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_ANIMATION, LLInventoryType::IT_ANIMATION, 0, FALSE);
-}
-
void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
menuentry_vec_t items;
@@ -3948,6 +3856,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"));
@@ -3963,7 +3876,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"))
{
@@ -3982,7 +3895,7 @@ void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* mo
}
else
{
- LLItemBridge::performAction(folder, model, action);
+ LLItemBridge::performAction(model, action);
}
}
@@ -3995,11 +3908,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);
+ }
*/
}
@@ -4010,17 +3923,21 @@ 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)
{
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;
+ mInvType = type;
}
LLUIImagePtr LLObjectBridge::getIcon() const
{
- return get_item_icon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject );
+ return LLInventoryIcon::getIcon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject);
}
LLInventoryObject* LLObjectBridge::getObject() const
@@ -4035,7 +3952,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))
{
@@ -4044,9 +3961,9 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
item = (LLViewerInventoryItem*)gInventory.getItem(object_id);
if(item && gInventory.isObjectDescendentOf(object_id, gInventory.getRootFolderID()))
{
- rez_attachment(item, NULL);
+ rez_attachment(item, NULL, true); // Replace if "Wear"ing.
}
- 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);
@@ -4060,69 +3977,37 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
}
gFocusMgr.setKeyboardFocus(NULL);
}
+ else if ("wear_add" == action)
+ {
+ LLAppearanceMgr::instance().wearItemOnAvatar(mUUID, true, false); // Don't replace if adding.
+ }
else if (isRemoveAction(action))
{
LLInventoryItem* item = gInventory.getItem(mUUID);
if(item)
{
- gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv);
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID());
- gMessageSystem->sendReliable( gAgent.getRegion()->getHost());
-
- // this object might have been selected, so let the selection manager know it's gone now
- LLViewerObject *found_obj = gObjectList.findObject(item->getLinkedUUID());
- if (found_obj)
- {
- LLSelectMgr::getInstance()->remove(found_obj);
- }
+ LLVOAvatarSelf::detachAttachmentIntoInventory(item->getLinkedUUID());
}
}
- else LLItemBridge::performAction(folder, model, action);
+ else LLItemBridge::performAction(model, action);
}
void LLObjectBridge::openItem()
{
- LLViewerInventoryItem* item = getItem();
-
- if (item)
- {
- LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
- }
-
- LLSD key;
- key["id"] = mUUID;
- LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
-
- // Disable old properties floater; this is replaced by the sidepanel.
- /*
- LLFloaterReg::showInstance("properties", mUUID);
- */
-}
-
-LLFontGL::StyleFlags LLObjectBridge::getLabelStyle() const
-{
- U8 font = LLFontGL::NORMAL;
-
- if(get_is_item_worn( mUUID ) )
- {
- font |= LLFontGL::BOLD;
- }
-
- LLInventoryItem* item = getItem();
- if (item && item->getIsLinkType())
- {
- font |= LLFontGL::ITALIC;
- }
-
- return (LLFontGL::StyleFlags)font;
+ // object double-click action is to wear/unwear object
+ performAction(getInventoryModel(),
+ get_is_item_worn(mUUID) ? "detach" : "attach");
}
std::string LLObjectBridge::getLabelSuffix() const
{
if (get_is_item_worn(mUUID))
{
+ if (!isAgentAvatarValid())
+ {
+ return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn");
+ }
+
std::string attachment_point_name = gAgentAvatarp->getAttachedPointName(mUUID);
// e.g. "(worn on ...)" / "(attached to ...)"
@@ -4136,10 +4021,19 @@ std::string LLObjectBridge::getLabelSuffix() const
}
}
-void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment)
+void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment, bool replace)
{
- LLSD payload;
- payload["item_id"] = item->getLinkedUUID(); // Wear the base object in case this is a link.
+ const LLUUID& item_id = item->getLinkedUUID();
+
+ // Check for duplicate request.
+ if (isAgentAvatarValid() &&
+ (gAgentAvatarp->attachmentWasRequested(item_id) ||
+ gAgentAvatarp->isWearingAttachment(item_id)))
+ {
+ llwarns << "duplicate attachment request, ignoring" << llendl;
+ return;
+ }
+ gAgentAvatarp->addAttachmentRequest(item_id);
S32 attach_pt = 0;
if (isAgentAvatarValid() && attachment)
@@ -4155,15 +4049,21 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
}
}
+ if (!replace)
+ {
+ attach_pt |= ATTACHMENT_ADD;
+ }
+
+ LLSD payload;
+ payload["item_id"] = item_id; // Wear the base object in case this is a link.
payload["attachment_point"] = attach_pt;
-#if !ENABLE_MULTIATTACHMENTS
- if (attachment && attachment->getNumObjects() > 0)
+ if (replace &&
+ (attachment && attachment->getNumObjects() > 0))
{
LLNotificationsUtil::add("ReplaceAttachment", LLSD(), payload, confirm_replace_attachment_rez);
}
else
-#endif
{
LLNotifications::instance().forceResponse(LLNotification::Params("ReplaceAttachment").payload(payload), 0/*YES*/);
}
@@ -4182,10 +4082,14 @@ bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& respon
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0/*YES*/)
{
- LLViewerInventoryItem* itemp = gInventory.getItem(notification["payload"]["item_id"].asUUID());
+ LLUUID item_id = notification["payload"]["item_id"].asUUID();
+ LLViewerInventoryItem* itemp = gInventory.getItem(item_id);
if (itemp)
{
+ U8 attachment_pt = notification["payload"]["attachment_point"].asInteger();
+
+
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RezSingleAttachmentFromInv);
msg->nextBlockFast(_PREHASH_AgentData);
@@ -4194,10 +4098,6 @@ bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& respon
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addUUIDFast(_PREHASH_ItemID, itemp->getUUID());
msg->addUUIDFast(_PREHASH_OwnerID, itemp->getPermissions().getOwner());
- U8 attachment_pt = notification["payload"]["attachment_point"].asInteger();
-#if ENABLE_MULTIATTACHMENTS
- attachment_pt |= ATTACHMENT_ADD;
-#endif
msg->addU8Fast(_PREHASH_AttachmentPt, attachment_pt);
pack_permissions_slam(msg, itemp->getFlags(), itemp->getPermissions());
msg->addStringFast(_PREHASH_Name, itemp->getName());
@@ -4219,13 +4119,14 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
else
{
- bool is_sidepanel = isInOutfitsSidePanel();
-
- if (!is_sidepanel)
+ items.push_back(std::string("Share"));
+ if (!canShare())
{
- items.push_back(std::string("Properties"));
+ disabled_items.push_back(std::string("Share"));
}
+ items.push_back(std::string("Properties"));
+
getClipboardEntries(true, items, disabled_items, flags);
LLObjectBridge::sContextMenuItemID = mUUID;
@@ -4237,13 +4138,14 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
if( get_is_item_worn( mUUID ) )
{
- items.push_back(std::string("Attach Separator"));
+ items.push_back(std::string("Wearable And Object Separator"));
items.push_back(std::string("Detach From Yourself"));
}
else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder())
{
- items.push_back(std::string("Attach Separator"));
- items.push_back(std::string("Object Wear"));
+ items.push_back(std::string("Wearable And Object Separator"));
+ items.push_back(std::string("Wearable And Object Wear"));
+ items.push_back(std::string("Wearable Add"));
items.push_back(std::string("Attach To"));
items.push_back(std::string("Attach To HUD"));
// commented out for DEV-32347
@@ -4251,7 +4153,8 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
if (!gAgentAvatarp->canAttachMoreObjects())
{
- disabled_items.push_back(std::string("Object Wear"));
+ disabled_items.push_back(std::string("Wearable And Object Wear"));
+ disabled_items.push_back(std::string("Wearable Add"));
disabled_items.push_back(std::string("Attach To"));
disabled_items.push_back(std::string("Attach To HUD"));
}
@@ -4280,7 +4183,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
LLSD cbparams;
cbparams["index"] = curiter->first;
- cbparams["label"] = attachment->getName();
+ cbparams["label"] = p.name;
p.on_click.function_name = "Inventory.AttachObject";
p.on_click.parameter = LLSD(attachment->getName());
p.on_enable.function_name = "Attachment.Label";
@@ -4335,11 +4238,6 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
// | LLLSLTextBridge |
// +=================================================+
-LLUIImagePtr LLLSLTextBridge::getIcon() const
-{
- return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE);
-}
-
void LLLSLTextBridge::openItem()
{
LLViewerInventoryItem* item = getItem();
@@ -4348,44 +4246,23 @@ void LLLSLTextBridge::openItem()
{
LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
}
- /*
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES);
- }
- */
}
// +=================================================+
// | LLWearableBridge |
// +=================================================+
-// *NOTE: hack to get from avatar inventory to avatar
-void wear_inventory_item_on_avatar( LLInventoryItem* item )
-{
- if(item)
- {
- lldebugs << "wear_inventory_item_on_avatar( " << item->getName()
- << " )" << llendl;
-
- LLAppearanceMgr::instance().addCOFItemLink(item);
- }
-}
-
-void wear_add_inventory_item_on_avatar( LLInventoryItem* item )
+LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ LLAssetType::EType asset_type,
+ LLInventoryType::EType inv_type,
+ LLWearableType::EType wearable_type) :
+ LLItemBridge(inventory, root, uuid),
+ mAssetType( asset_type ),
+ mWearableType(wearable_type)
{
- if(item)
- {
- lldebugs << "wear_add_inventory_item_on_avatar( " << item->getName()
- << " )" << llendl;
-
- LLWearableList::instance().getAsset(item->getAssetUUID(),
- item->getName(),
- item->getType(),
- LLWearableBridge::onWearAddOnAvatarArrived,
- new LLUUID(item->getUUID()));
- }
+ mInvType = inv_type;
}
void remove_inventory_category_from_avatar( LLInventoryCategory* category )
@@ -4395,15 +4272,13 @@ void remove_inventory_category_from_avatar( LLInventoryCategory* category )
<< " )" << llendl;
- if( gFloaterCustomize )
- {
- gFloaterCustomize->askToSaveIfDirty(
- boost::bind(remove_inventory_category_from_avatar_step2, _1, category->getUUID()));
- }
- else
+ if (gAgentCamera.cameraCustomizeAvatar())
{
- remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() );
+ // switching to outfit editor should automagically save any currently edited wearable
+ LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit"));
}
+
+ remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() );
}
struct OnRemoveStruct
@@ -4462,7 +4337,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_
if (item->getType() == LLAssetType::AT_BODYPART)
continue;
if (gAgent.isTeen() && item->isWearableType() &&
- (item->getWearableType() == WT_UNDERPANTS || item->getWearableType() == WT_UNDERSHIRT))
+ (item->getWearableType() == LLWearableType::WT_UNDERPANTS || item->getWearableType() == LLWearableType::WT_UNDERSHIRT))
continue;
if (get_is_item_worn(item->getUUID()))
{
@@ -4482,19 +4357,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_
LLViewerInventoryItem *obj_item = obj_item_array.get(i);
if (get_is_item_worn(obj_item->getUUID()))
{
- gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv);
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData );
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_ItemID, obj_item->getLinkedUUID() );
-
- gMessageSystem->sendReliable( gAgent.getRegion()->getHost() );
-
- // this object might have been selected, so let the selection manager know it's gone now
- LLViewerObject *found_obj = gObjectList.findObject( obj_item->getLinkedUUID());
- if (found_obj)
- {
- LLSelectMgr::getInstance()->remove(found_obj);
- }
+ LLVOAvatarSelf::detachAttachmentIntoInventory(obj_item->getLinkedUUID());
}
}
}
@@ -4540,11 +4403,11 @@ std::string LLWearableBridge::getLabelSuffix() const
LLUIImagePtr LLWearableBridge::getIcon() const
{
- return get_item_icon(mAssetType, mInvType, mWearableType, FALSE);
+ return LLInventoryIcon::getIcon(mAssetType, mInvType, mWearableType, FALSE);
}
// virtual
-void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLWearableBridge::performAction(LLInventoryModel* model, std::string action)
{
if (isAddAction(action))
{
@@ -4564,7 +4427,7 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod
removeFromAvatar();
return;
}
- else LLItemBridge::performAction(folder, model, action);
+ else LLItemBridge::performAction(model, action);
}
void LLWearableBridge::openItem()
@@ -4575,42 +4438,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)
@@ -4637,25 +4464,27 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
can_open = FALSE;
}
-
- bool is_sidepanel = isInOutfitsSidePanel();
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
- if (can_open && !is_sidepanel)
+ if (can_open)
{
- items.push_back(std::string("Open"));
+ addOpenRightClickMenuOption(items);
}
-
- if (!is_sidepanel)
+ else
{
- items.push_back(std::string("Properties"));
+ disabled_items.push_back(std::string("Open"));
+ disabled_items.push_back(std::string("Open Original"));
}
+ items.push_back(std::string("Properties"));
+
getClipboardEntries(true, items, disabled_items, flags);
- if (!is_sidepanel)
- {
- items.push_back(std::string("Wearable Separator"));
- }
+ items.push_back(std::string("Wearable And Object Separator"));
items.push_back(std::string("Wearable Edit"));
@@ -4666,7 +4495,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
// Don't allow items to be worn if their baseobj is in the trash.
if (isLinkedObjectInTrash() || isLinkedObjectMissing() || isCOFFolder())
{
- disabled_items.push_back(std::string("Wearable Wear"));
+ disabled_items.push_back(std::string("Wearable And Object Wear"));
disabled_items.push_back(std::string("Wearable Add"));
disabled_items.push_back(std::string("Wearable Edit"));
}
@@ -4682,14 +4511,15 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
case LLAssetType::AT_BODYPART:
if (get_is_item_worn(item->getUUID()))
{
- disabled_items.push_back(std::string("Wearable Wear"));
+ disabled_items.push_back(std::string("Wearable And Object Wear"));
disabled_items.push_back(std::string("Wearable Add"));
}
else
{
- items.push_back(std::string("Wearable Wear"));
+ items.push_back(std::string("Wearable And Object Wear"));
items.push_back(std::string("Wearable Add"));
disabled_items.push_back(std::string("Take Off"));
+ disabled_items.push_back(std::string("Wearable Edit"));
}
break;
default:
@@ -4709,7 +4539,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));
}
@@ -4725,63 +4555,23 @@ void LLWearableBridge::onWearOnAvatar(void* user_data)
void LLWearableBridge::wearOnAvatar()
{
- // Don't wear anything until initial wearables are loaded, can
- // destroy clothing items.
- if (!gAgentWearables.areWearablesLoaded())
- {
- LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded");
- return;
- }
+ // TODO: investigate wearables may not be loaded at this point EXT-8231
LLViewerInventoryItem* item = getItem();
if(item)
{
- if(!isAgentInventory())
- {
- LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- LLUUID::null,
- std::string(),
- cb);
- }
- else
- {
- wear_inventory_item_on_avatar(item);
- }
+ LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, true);
}
}
void LLWearableBridge::wearAddOnAvatar()
{
- // Don't wear anything until initial wearables are loaded, can
- // destroy clothing items.
- if (!gAgentWearables.areWearablesLoaded())
- {
- LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded");
- return;
- }
+ // TODO: investigate wearables may not be loaded at this point EXT-8231
LLViewerInventoryItem* item = getItem();
if(item)
{
- if(!isAgentInventory())
- {
- LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- LLUUID::null,
- std::string(),
- cb);
- }
- else
- {
- wear_add_inventory_item_on_avatar(item);
- }
+ LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, false);
}
}
@@ -4858,20 +4648,7 @@ void LLWearableBridge::onEditOnAvatar(void* user_data)
void LLWearableBridge::editOnAvatar()
{
- LLUUID linked_id = gInventory.getLinkedItemID(mUUID);
- const LLWearable* wearable = gAgentWearables.getWearableFromItemID(linked_id);
- if( wearable )
- {
- // Set the tab to the right wearable.
- if (gFloaterCustomize)
- gFloaterCustomize->setCurrentWearableType( wearable->getType() );
-
- if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgentCamera.getCameraMode() )
- {
- // Start Avatar Customization
- gAgentCamera.changeCameraToCustomizeAvatar();
- }
- }
+ LLAgentWearables::editWearable(mUUID);
}
// static
@@ -4915,10 +4692,10 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
{
if( get_is_item_worn( item_id ) )
{
- EWearableType type = wearable->getType();
+ LLWearableType::EType type = wearable->getType();
- if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES ) ) //&&
- //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) )
+ if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES ) ) //&&
+ //!((!gAgent.isTeen()) && ( type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT )) )
{
bool do_remove_all = false;
U32 index = gAgentWearables.getWearableIndex(wearable);
@@ -4934,27 +4711,29 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
delete on_remove_struct;
}
-/* static */
+// static
void LLWearableBridge::removeAllClothesFromAvatar()
{
// Remove COF links.
- for (S32 itype = WT_SHAPE; itype < WT_COUNT; ++itype)
+ for (S32 itype = LLWearableType::WT_SHAPE; itype < LLWearableType::WT_COUNT; ++itype)
{
- if (itype == WT_SHAPE || itype == WT_SKIN || itype == WT_HAIR || itype == WT_EYES)
+ if (itype == LLWearableType::WT_SHAPE || itype == LLWearableType::WT_SKIN || itype == LLWearableType::WT_HAIR || itype == LLWearableType::WT_EYES)
continue;
- // MULTI-WEARABLES: fixed to index 0
- LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(
- gAgentWearables.getWearableInventoryItem((EWearableType)itype, 0));
- if (!item)
- continue;
- const LLUUID &item_id = gInventory.getLinkedItemID(item->getUUID());
- const LLWearable *wearable = gAgentWearables.getWearableFromItemID(item_id);
- if (!wearable)
- continue;
-
- // Find and remove this item from the COF.
- LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false);
+ for (S32 index = gAgentWearables.getWearableCount(itype)-1; index >= 0 ; --index)
+ {
+ LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(
+ gAgentWearables.getWearableInventoryItem((LLWearableType::EType)itype, index));
+ if (!item)
+ continue;
+ const LLUUID &item_id = item->getUUID();
+ const LLWearable *wearable = gAgentWearables.getWearableFromItemID(item_id);
+ if (!wearable)
+ continue;
+
+ // Find and remove this item from the COF.
+ LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false);
+ }
}
gInventory.notifyObservers();
@@ -4962,7 +4741,7 @@ void LLWearableBridge::removeAllClothesFromAvatar()
LLAgentWearables::userRemoveAllClothes();
}
-/* static */
+// static
void LLWearableBridge::removeItemFromAvatar(LLViewerInventoryItem *item)
{
if (item)
@@ -4986,12 +4765,42 @@ void LLWearableBridge::removeFromAvatar()
// +=================================================+
+// | LLLinkItemBridge |
+// +=================================================+
+// For broken item links
+
+std::string LLLinkItemBridge::sPrefix("Link: ");
+
+void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ // *TODO: Translate
+ lldebugs << "LLLink::buildContextMenu()" << llendl;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+
+ 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);
+}
+
+#if LL_MESH_ENABLED
+// +=================================================+
// | LLMeshBridge |
// +=================================================+
LLUIImagePtr LLMeshBridge::getIcon() const
{
- return get_item_icon(LLAssetType::AT_MESH, LLInventoryType::IT_MESH, 0, FALSE);
+ return LLInventoryIcon::getIcon(LLAssetType::AT_MESH, LLInventoryType::IT_MESH, 0, FALSE);
}
void LLMeshBridge::openItem()
@@ -5041,73 +4850,104 @@ void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
hide_context_entries(menu, items, disabled_items);
}
+#endif
-
-LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type,
- const LLUUID& uuid,LLInventoryModel* model)
+// +=================================================+
+// | LLLinkBridge |
+// +=================================================+
+// For broken folder links.
+std::string LLLinkFolderBridge::sPrefix("Link: ");
+LLUIImagePtr LLLinkFolderBridge::getIcon() const
{
- LLInvFVBridgeAction* action = NULL;
- switch(asset_type)
+ LLFolderType::EType folder_type = LLFolderType::FT_NONE;
+ const LLInventoryObject *obj = getInventoryObject();
+ if (obj)
{
- 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;
-
- case LLAssetType::AT_MESH:
- action = new LLMeshBridgeAction(uuid,model);
- break;
+ LLViewerInventoryCategory* cat = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ cat = (LLViewerInventoryCategory*)model->getCategory(obj->getLinkedUUID());
+ if (cat)
+ {
+ folder_type = cat->getPreferredType();
+ }
+ }
+ }
+ return LLFolderBridge::getIcon(folder_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();
@@ -5115,7 +4955,7 @@ void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type,
}
}
-//static
+// static
void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model)
{
llassert(model);
@@ -5135,129 +4975,199 @@ 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()
+ {
+ wearOnAvatar();
+ }
+ 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
{
@@ -5275,208 +5185,123 @@ BOOL LLWearableBridgeAction::isAgentInventory() const
void LLWearableBridgeAction::wearOnAvatar()
{
- // Don't wear anything until initial wearables are loaded, can
- // destroy clothing items.
- if (!gAgentWearables.areWearablesLoaded())
- {
- LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded");
- return;
- }
+ // TODO: investigate wearables may not be loaded at this point EXT-8231
LLViewerInventoryItem* item = getItem();
if(item)
{
- if(!isAgentInventory())
- {
- LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- LLUUID::null,
- std::string(),
- cb);
- }
- else
- {
- wear_inventory_item_on_avatar(item);
- }
- }
-}
-
-//virtual
-void LLWearableBridgeAction::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->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");
- }
+ LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, true);
}
-
- LLInvFVBridgeAction::doIt();
}
-//virtual
-void LLMeshBridgeAction::doIt()
+LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type,
+ const LLUUID& uuid,
+ LLInventoryModel* model)
{
- LLViewerInventoryItem* item = getItem();
- if(item)
+ LLInvFVBridgeAction* action = NULL;
+ switch(asset_type)
{
- // do it
+ 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::remove(items.begin(), items.end(), std::string("New Body Parts")), items.end());
+ items.erase(std::remove(items.begin(), items.end(), std::string("New Clothes")), items.end());
+ items.erase(std::remove(items.begin(), items.end(), std::string("New Note")), items.end());
+ items.erase(std::remove(items.begin(), items.end(), std::string("New Gesture")), items.end());
+ items.erase(std::remove(items.begin(), items.end(), std::string("New Script")), items.end());
+ items.erase(std::remove(items.begin(), items.end(), std::string("New Folder")), items.end());
- 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