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.cpp1895
1 files changed, 982 insertions, 913 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 27a40c6ba0..577652fc79 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -31,26 +31,29 @@
*/
#include "llviewerprecompiledheaders.h"
+#include "llinventorybridge.h"
+
// external projects
#include "lltransfersourceasset.h"
-#include "llinventorybridge.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"
#include "llinventorypanel.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
@@ -58,9 +61,11 @@
#include "llpreviewgesture.h"
#include "llpreviewtexture.h"
#include "llselectmgr.h"
+#include "llsidepanelappearance.h"
#include "llsidetray.h"
#include "lltrans.h"
#include "llviewerassettype.h"
+#include "llviewermenu.h"
#include "llviewermessage.h"
#include "llviewerobjectlist.h"
#include "llviewerwindow.h"
@@ -68,6 +73,18 @@
#include "llwearablelist.h"
#include "llpaneloutfitsinventory.h"
+typedef std::pair<LLUUID, LLUUID> two_uuids_t;
+typedef std::list<two_uuids_t> two_uuids_list_t;
+
+struct LLMoveInv
+{
+ LLUUID mObjectID;
+ LLUUID mCategoryID;
+ two_uuids_list_t mMoveList;
+ void (*mCallback)(S32, void*);
+ void* mUserData;
+};
+
using namespace LLOldEvents;
// Helpers
@@ -91,59 +108,28 @@ 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",
- "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"
-};
+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();
@@ -159,7 +145,6 @@ const std::string& LLInvFVBridge::getDisplayName() const
// Folders have full perms
PermissionMask LLInvFVBridge::getPermissionMask() const
{
-
return PERM_ALL;
}
@@ -191,10 +176,14 @@ BOOL LLInvFVBridge::isItemRemovable() const
return FALSE;
}
- // Disable delete from COF folder; have users explicitly choose "detach/take off".
- if (LLAppearanceManager::instance().getIsProtectedCOFItem(mUUID))
+ // Disable delete from COF folder; have users explicitly choose "detach/take off",
+ // unless the item is not worn but in the COF (i.e. is bugged).
+ if (LLAppearanceMgr::instance().getIsProtectedCOFItem(mUUID))
{
- return FALSE;
+ if (get_is_item_worn(mUUID))
+ {
+ return FALSE;
+ }
}
const LLInventoryObject *obj = model->getItem(mUUID);
@@ -215,6 +204,11 @@ BOOL LLInvFVBridge::isItemMovable() const
return TRUE;
}
+BOOL LLInvFVBridge::isLink() const
+{
+ return mIsLink;
+}
+
/*virtual*/
/**
* @brief Adds this item into clipboard storage
@@ -229,13 +223,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);
*/
}
@@ -259,7 +251,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc
{
if(LLAssetType::AT_GESTURE == item->getType())
{
- LLGestureManager::instance().deactivateGesture(item->getUUID());
+ LLGestureMgr::instance().deactivateGesture(item->getUUID());
}
}
}
@@ -275,7 +267,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc
{
if(LLAssetType::AT_GESTURE == descendent_items[j]->getType())
{
- LLGestureManager::instance().deactivateGesture(descendent_items[j]->getUUID());
+ LLGestureMgr::instance().deactivateGesture(descendent_items[j]->getUUID());
}
}
}
@@ -296,7 +288,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
LLMessageSystem* msg = gMessageSystem;
const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
LLViewerInventoryItem* item = NULL;
- std::vector<LLUUID> move_ids;
+ uuid_vec_t move_ids;
LLInventoryModel::update_map_t update;
bool start_new_message = true;
S32 count = batch.count();
@@ -397,8 +389,8 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
}
// move everything.
- std::vector<LLUUID>::iterator it = move_ids.begin();
- std::vector<LLUUID>::iterator end = move_ids.end();
+ uuid_vec_t::iterator it = move_ids.begin();
+ uuid_vec_t::iterator end = move_ids.end();
for(; it != end; ++it)
{
gInventory.moveObject((*it), trash_id);
@@ -474,7 +466,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;
}
@@ -483,8 +475,8 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
}
void hide_context_entries(LLMenuGL& menu,
- const menuentry_vec_t &entries_to_show,
- const menuentry_vec_t &disabled_entries)
+ const menuentry_vec_t &entries_to_show,
+ const menuentry_vec_t &disabled_entries)
{
const LLView::child_list_t *list = menu.getChildList();
@@ -592,7 +584,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID);
if (inv_item)
{
- is_asset_knowable = is_asset_id_knowable(inv_item->getType());
+ is_asset_knowable = LLAssetType::lookupIsAssetIDKnowable(inv_item->getType());
}
if ( !is_asset_knowable // disable menu item for Inventory items with unknown asset. EXT-5308
|| (! ( isItemPermissive() || gAgent.isGodlike() ) )
@@ -621,7 +613,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)
@@ -652,7 +644,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);
@@ -683,14 +681,15 @@ void LLInvFVBridge::addTrashContextMenuOptions(menuentry_vec_t &items,
void LLInvFVBridge::addDeleteContextMenuOptions(menuentry_vec_t &items,
menuentry_vec_t &disabled_items)
{
+
+ const LLInventoryObject *obj = getInventoryObject();
+
// Don't allow delete as a direct option from COF folder.
- if (isCOFFolder())
+ if (obj && obj->getIsLinkType() && isCOFFolder() && get_is_item_worn(mUUID))
{
return;
}
- const LLInventoryObject *obj = getInventoryObject();
-
// "Remove link" and "Delete" are the same operation.
if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID))
{
@@ -707,6 +706,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
{
@@ -727,7 +737,7 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
if (*type == DAD_CATEGORY)
{
- gInventory.startBackgroundFetch(obj->getUUID());
+ LLInventoryModelBackgroundFetch::instance().start(obj->getUUID());
}
rv = TRUE;
@@ -800,7 +810,7 @@ BOOL LLInvFVBridge::isAgentInventory() const
BOOL LLInvFVBridge::isCOFFolder() const
{
- return LLAppearanceManager::instance().getIsInCOF(mUUID);
+ return LLAppearanceMgr::instance().getIsInCOF(mUUID);
}
BOOL LLInvFVBridge::isItemPermissive() const
@@ -814,21 +824,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
@@ -857,21 +853,11 @@ void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model,
model->notifyObservers();
}
-
-const std::string safe_inv_type_lookup(LLInventoryType::EType inv_type)
-{
- const std::string rv= LLInventoryType::lookup(inv_type);
- if(rv.empty())
- {
- return std::string("<invalid>");
- }
- return rv;
-}
-
LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
LLAssetType::EType actual_asset_type,
LLInventoryType::EType inv_type,
LLInventoryPanel* inventory,
+ LLFolderView* root,
const LLUUID& uuid,
U32 flags)
{
@@ -881,104 +867,104 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
case LLAssetType::AT_TEXTURE:
if(!(inv_type == LLInventoryType::IT_TEXTURE || inv_type == LLInventoryType::IT_SNAPSHOT))
{
- llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
}
- new_listener = new LLTextureBridge(inventory, uuid, inv_type);
+ new_listener = new LLTextureBridge(inventory, root, uuid, inv_type);
break;
case LLAssetType::AT_SOUND:
if(!(inv_type == LLInventoryType::IT_SOUND))
{
- llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
}
- new_listener = new LLSoundBridge(inventory, uuid);
+ new_listener = new LLSoundBridge(inventory, root, uuid);
break;
case LLAssetType::AT_LANDMARK:
if(!(inv_type == LLInventoryType::IT_LANDMARK))
{
- llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
}
- new_listener = new LLLandmarkBridge(inventory, uuid, flags);
+ new_listener = new LLLandmarkBridge(inventory, root, uuid, flags);
break;
case LLAssetType::AT_CALLINGCARD:
if(!(inv_type == LLInventoryType::IT_CALLINGCARD))
{
- llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
}
- new_listener = new LLCallingCardBridge(inventory, uuid);
+ new_listener = new LLCallingCardBridge(inventory, root, uuid);
break;
case LLAssetType::AT_SCRIPT:
if(!(inv_type == LLInventoryType::IT_LSL))
{
- llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
}
- new_listener = new LLScriptBridge(inventory, uuid);
+ new_listener = new 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;
default:
llinfos << "Unhandled asset type (llassetstorage.h): "
@@ -1010,16 +996,34 @@ void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid)
}
}
-bool LLInvFVBridge::isInOutfitsSidePanel() const
+BOOL LLInvFVBridge::isInOutfitsSidePanel() 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 FALSE;
return outfit_panel->isTabPanel(my_panel);
}
+BOOL LLInvFVBridge::canShare() const
+{
+ 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);
+ }
+
+ // All categories can be given.
+ const LLViewerInventoryCategory* cat = model->getCategory(mUUID);
+ return (cat != NULL);
+}
+
// +=================================================+
// | InventoryFVBridgeBuilder |
// +=================================================+
@@ -1027,29 +1031,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;
@@ -1097,7 +1103,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();
@@ -1109,7 +1115,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();
@@ -1120,7 +1126,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();
}
@@ -1178,7 +1184,7 @@ void LLItemBridge::restoreToWorld()
}
}
-void LLItemBridge::gotoItem(LLFolderView *folder)
+void LLItemBridge::gotoItem()
{
LLInventoryObject *obj = getInventoryObject();
if (obj && obj->getIsLinkType())
@@ -1193,25 +1199,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;
}
@@ -1356,13 +1359,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))
{
@@ -1371,11 +1426,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
@@ -1395,17 +1446,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;
}
@@ -1504,14 +1549,10 @@ BOOL LLFolderBridge::isItemRemovable() const
return FALSE;
}
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if( !avatar )
- {
- return FALSE;
- }
+ if (!isAgentAvatarValid()) return FALSE;
LLInventoryCategory* category = model->getCategory(mUUID);
- if( !category )
+ if(!category)
{
return FALSE;
}
@@ -1550,6 +1591,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;
}
@@ -1659,8 +1705,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
LLInventoryModel* model = getInventoryModel();
if(!model) return FALSE;
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if(!avatar) return FALSE;
+ if (!isAgentAvatarValid()) return FALSE;
// cannot drag categories into library
if(!isAgentInventory())
@@ -1684,7 +1729,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
// Is the destination the trash?
const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
BOOL move_is_into_trash = (mUUID == trash_id)
- || model->isObjectDescendentOf(mUUID, trash_id);
+ || model->isObjectDescendentOf(mUUID, trash_id);
BOOL is_movable = (!LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()));
const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
@@ -1732,12 +1777,11 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
}
}
-
- accept = is_movable
- && (mUUID != cat_id) // Can't move a folder into itself
- && (mUUID != inv_cat->getParentUUID()) // Avoid moves that would change nothing
- && !(model->isObjectDescendentOf(mUUID, cat_id)); // Avoid circularity
- if(accept && drop)
+ accept = is_movable
+ && (mUUID != cat_id) // Can't move a folder into itself
+ && (mUUID != inv_cat->getParentUUID()) // Avoid moves that would change nothing
+ && !(model->isObjectDescendentOf(mUUID, cat_id)); // Avoid circularity
+ if (accept && drop)
{
// Look for any gestures and deactivate them
if (move_is_into_trash)
@@ -1746,9 +1790,9 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
{
LLInventoryItem* item = descendent_items[i];
if (item->getType() == LLAssetType::AT_GESTURE
- && LLGestureManager::instance().isGestureActive(item->getUUID()))
+ && LLGestureMgr::instance().isGestureActive(item->getUUID()))
{
- LLGestureManager::instance().deactivateGesture(item->getUUID());
+ LLGestureMgr::instance().deactivateGesture(item->getUUID());
}
}
}
@@ -1761,7 +1805,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
{
// traverse category and add all contents to currently worn.
BOOL append = true;
- LLAppearanceManager::instance().wearInventoryCategory(inv_cat, false, append);
+ LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append);
}
else
{
@@ -1769,28 +1813,30 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
gInventory.collectDescendents(inv_cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH);
- LLAppearanceManager::instance().linkAll(mUUID,items,NULL);
+ LLAppearanceMgr::instance().linkAll(mUUID,items,NULL);
}
}
else
{
#if SUPPORT_ENSEMBLES
- // BAP - should skip if dup.
- if (move_is_into_current_outfit)
- {
- LLAppearanceManager::instance().addEnsembleLink(inv_cat);
- }
- else
- {
- LLPointer<LLInventoryCallback> cb = NULL;
- link_inventory_item(
- gAgent.getID(),
- inv_cat->getUUID(),
- mUUID,
- inv_cat->getName(),
- LLAssetType::AT_LINK_FOLDER,
- cb);
- }
+ // BAP - should skip if dup.
+ if (move_is_into_current_outfit)
+ {
+ LLAppearanceMgr::instance().addEnsembleLink(inv_cat);
+ }
+ else
+ {
+ LLPointer<LLInventoryCallback> cb = NULL;
+ const std::string empty_description = "";
+ link_inventory_item(
+ gAgent.getID(),
+ inv_cat->getUUID(),
+ mUUID,
+ inv_cat->getName(),
+ empty_description,
+ LLAssetType::AT_LINK_FOLDER,
+ cb);
+ }
#endif
}
}
@@ -1807,7 +1853,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();
@@ -1852,7 +1898,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())
@@ -1866,8 +1912,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
@@ -1897,7 +1943,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;
@@ -1925,61 +1971,21 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
return accept;
}
-bool LLFindCOFValidItems::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
-{
- // Valid COF items are:
- // - links to wearables (body parts or clothing)
- // - links to attachments
- // - links to gestures
- // - links to ensemble folders
- LLViewerInventoryItem *linked_item = ((LLViewerInventoryItem*)item)->getLinkedItem();
- if (linked_item)
- {
- LLAssetType::EType type = linked_item->getType();
- return (type == LLAssetType::AT_CLOTHING ||
- type == LLAssetType::AT_BODYPART ||
- type == LLAssetType::AT_GESTURE ||
- type == LLAssetType::AT_OBJECT);
- }
- else
- {
- LLViewerInventoryCategory *linked_category = ((LLViewerInventoryItem*)item)->getLinkedCategory();
- // BAP remove AT_NONE support after ensembles are fully working?
- return (linked_category &&
- ((linked_category->getPreferredType() == LLFolderType::FT_NONE) ||
- (LLFolderType::lookupIsEnsembleType(linked_category->getPreferredType()))));
- }
-}
-
-
-bool LLFindWearables::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
-{
- if(item)
- {
- if((item->getType() == LLAssetType::AT_CLOTHING)
- || (item->getType() == LLAssetType::AT_BODYPART))
- {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-
//Used by LLFolderBridge as callback for directory recursion.
-class LLRightClickInventoryFetchObserver : public LLInventoryFetchObserver
+class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver
{
public:
- LLRightClickInventoryFetchObserver() :
+ LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) :
+ LLInventoryFetchItemsObserver(ids),
mCopyItems(false)
{ };
- LLRightClickInventoryFetchObserver(const LLUUID& cat_id, bool copy_items) :
+ LLRightClickInventoryFetchObserver(const uuid_vec_t& ids,
+ const LLUUID& cat_id,
+ bool copy_items) :
+ LLInventoryFetchItemsObserver(ids),
mCatID(cat_id),
mCopyItems(copy_items)
- { };
+ { };
virtual void done()
{
// we've downloaded all the items, so repaint the dialog
@@ -2000,7 +2006,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:
@@ -2011,7 +2021,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();
@@ -2025,7 +2035,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);
@@ -2043,14 +2053,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.
@@ -2063,19 +2073,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);
}*/
}
@@ -2089,7 +2099,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);
@@ -2128,7 +2139,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
if (NULL == category)
{
llwarns << "gInventory.getCategory(" << mCatID
- << ") was NULL" << llendl;
+ << ") was NULL" << llendl;
}
else
{
@@ -2136,7 +2147,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
mContentsCount)
{
gInventory.removeObserver(this);
- LLAppearanceManager::instance().wearInventoryCategory(category, FALSE, TRUE);
+ LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, TRUE);
delete this;
}
}
@@ -2147,11 +2158,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);
@@ -2186,7 +2197,7 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model
if(!model) return;
LLViewerInventoryCategory* cat = getCategory();
if(!cat) return;
- LLAppearanceManager::instance().addEnsembleLink(cat,true);
+ LLAppearanceMgr::instance().addEnsembleLink(cat,true);
return;
}
#endif
@@ -2310,23 +2321,39 @@ LLUIImagePtr LLFolderBridge::getIcon() const
return getIcon(preferred_type);
}
-LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type)
+// static
+LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type, BOOL is_link)
{
- // we only have one folder image now
- if (preferred_type == LLFolderType::FT_OUTFIT)
+ // Bypassing LLViewerFolderType::lookup() since
+ // we aren't using different system folder icons
+ if (is_link)
{
- return LLUI::getUIImage("Inv_LookFolderClosed");
+ if (preferred_type == LLFolderType::FT_OUTFIT)
+ return LLUI::getUIImage("Inv_LookFolderClosed_Link");
+ else
+ return LLUI::getUIImage("Inv_FolderClosed_Link");
}
- return LLUI::getUIImage("Inv_FolderClosed");
+ if (preferred_type == LLFolderType::FT_OUTFIT)
+ return LLUI::getUIImage("Inv_LookFolderClosed");
+ else
+ return LLUI::getUIImage("Inv_FolderClosed");
}
LLUIImagePtr LLFolderBridge::getOpenIcon() const
{
- if (getPreferredType() == LLFolderType::FT_OUTFIT)
+ // Bypassing LLViewerFolderType::lookup() since
+ // we aren't using different system folder icons
+ if (isLink())
{
- return LLUI::getUIImage("Inv_LookFolderOpen");
+ if (getPreferredType() == LLFolderType::FT_OUTFIT)
+ return LLUI::getUIImage("Inv_LookFolderOpen_Link");
+ else
+ return LLUI::getUIImage("Inv_FolderOpen_Link");
}
- return LLUI::getUIImage("Inv_FolderOpen");
+ if (getPreferredType() == LLFolderType::FT_OUTFIT)
+ return LLUI::getUIImage("Inv_LookFolderOpen");
+ else
+ return LLUI::getUIImage("Inv_FolderOpen");
}
BOOL LLFolderBridge::renameItem(const std::string& new_name)
@@ -2416,9 +2443,9 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re
const LLViewerInventoryItem* item = (*iter);
const LLUUID& item_id = item->getUUID();
if (item->getType() == LLAssetType::AT_GESTURE
- && LLGestureManager::instance().isGestureActive(item_id))
+ && LLGestureMgr::instance().isGestureActive(item_id))
{
- LLGestureManager::instance().deactivateGesture(item_id);
+ LLGestureMgr::instance().deactivateGesture(item_id);
}
}
@@ -2491,26 +2518,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));
}
@@ -2538,7 +2565,7 @@ void LLFolderBridge::folderOptionsMenu()
const bool is_system_folder = LLFolderType::lookupIsProtectedType(type);
// BAP change once we're no longer treating regular categories as ensembles.
const bool is_ensemble = (type == LLFolderType::FT_NONE ||
- LLFolderType::lookupIsEnsembleType(type));
+ LLFolderType::lookupIsEnsembleType(type));
// calling card related functionality for folders.
@@ -2668,10 +2695,17 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
const LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
if (lost_and_found_id == mUUID)
- {
+ {
// This is the lost+found folder.
- mItems.push_back(std::string("Empty Lost And Found"));
- }
+ mItems.push_back(std::string("Empty Lost And Found"));
+
+ mDisabledItems.push_back(std::string("New Folder"));
+ mDisabledItems.push_back(std::string("New Script"));
+ mDisabledItems.push_back(std::string("New Note"));
+ mDisabledItems.push_back(std::string("New Gesture"));
+ mDisabledItems.push_back(std::string("New Clothes"));
+ mDisabledItems.push_back(std::string("New Body Parts"));
+ }
if(trash_id == mUUID)
{
@@ -2689,8 +2723,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
LLViewerInventoryCategory *cat = getCategory();
// BAP removed protected check to re-enable standard ops in untyped folders.
// Not sure what the right thing is to do here.
- if (!isCOFFolder() && cat && cat->getPreferredType()!=LLFolderType::FT_OUTFIT /*&&
- LLAssetType::lookupIsProtectedCategoryType(cat->getPreferredType())*/)
+ if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT))
{
// Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694.
if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat))
@@ -2722,7 +2755,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
addDeleteContextMenuOptions(mItems, mDisabledItems);
// EXT-4030: disallow deletion of currently worn outfit
- const LLViewerInventoryItem *base_outfit_link = LLAppearanceManager::instance().getBaseOutfitLink();
+ const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink();
if (base_outfit_link && (cat == base_outfit_link->getLinkedCategory()))
{
mDisabledItems.push_back(std::string("Delete"));
@@ -2752,17 +2785,18 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
mMenu = &menu;
sSelf = this;
- LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(FALSE);
- LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+
+ uuid_vec_t folders;
LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
if (category)
{
folders.push_back(category->getUUID());
}
- fetch->fetchDescendents(folders);
+ LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE);
+ fetch->startFetch();
inc_busy_count();
- if(fetch->isEverythingComplete())
+ if(fetch->isFinished())
{
// everything is already here - call done.
fetch->done();
@@ -2785,7 +2819,13 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
mDisabledItems.push_back(std::string("Delete System Folder"));
}
-
+
+ mItems.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ mDisabledItems.push_back(std::string("Share"));
+ }
+
hide_context_entries(menu, mItems, mDisabledItems);
}
@@ -2877,71 +2917,71 @@ 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();
@@ -2951,16 +2991,16 @@ void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType 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)
+void LLFolderBridge::createWearable(const LLUUID &parent_id, LLWearableType::EType 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));
+ parent_id, wearable->getTransactionID(), wearable->getName(),
+ wearable->getDescription(), asset_type, inv_type, wearable->getType(),
+ wearable->getPermissions().getMaskNextOwner(),
+ LLPointer<LLInventoryCallback>(NULL));
}
void LLFolderBridge::modifyOutfit(BOOL append)
@@ -2970,7 +3010,7 @@ void LLFolderBridge::modifyOutfit(BOOL append)
LLViewerInventoryCategory* cat = getCategory();
if(!cat) return;
- LLAppearanceManager::instance().wearInventoryCategory( cat, FALSE, append );
+ LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, append );
}
// helper stuff
@@ -2984,7 +3024,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
@@ -2994,8 +3034,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);
}
@@ -3025,8 +3065,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
return FALSE;
}
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if(!avatar) return FALSE;
+ if (!isAgentAvatarValid()) return FALSE;
LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
BOOL accept = FALSE;
@@ -3036,11 +3075,11 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
BOOL is_movable = TRUE;
switch( inv_item->getActualType() )
{
- case LLAssetType::AT_CATEGORY:
- is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType());
- break;
- default:
- break;
+ case LLAssetType::AT_CATEGORY:
+ is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType());
+ break;
+ default:
+ break;
}
const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
@@ -3048,7 +3087,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
- const BOOL move_is_outof_current_outfit = LLAppearanceManager::instance().getIsInCOF(inv_item->getUUID());
+ const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID());
// Can't explicitly drag things out of the COF.
if (move_is_outof_current_outfit)
@@ -3080,9 +3119,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
if(accept && drop)
{
if (inv_item->getType() == LLAssetType::AT_GESTURE
- && LLGestureManager::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash)
+ && LLGestureMgr::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash)
{
- LLGestureManager::instance().deactivateGesture(inv_item->getUUID());
+ LLGestureMgr::instance().deactivateGesture(inv_item->getUUID());
}
// If an item is being dragged between windows, unselect
// everything in the active window so that we don't follow
@@ -3135,7 +3174,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
// BAP - should skip if dup.
if (move_is_into_current_outfit)
{
- LLAppearanceManager::instance().addCOFItemLink(inv_item);
+ LLAppearanceMgr::instance().addCOFItemLink(inv_item);
}
else
{
@@ -3145,6 +3184,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
inv_item->getLinkedUUID(),
mUUID,
inv_item->getName(),
+ inv_item->getDescription(),
LLAssetType::AT_LINK,
cb);
}
@@ -3205,6 +3245,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);
@@ -3218,13 +3261,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)
@@ -3247,21 +3290,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, mIsLink);
}
void LLTextureBridge::openItem()
@@ -3301,7 +3335,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);
@@ -3317,7 +3357,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)
{
@@ -3328,38 +3368,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()
@@ -3389,6 +3411,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"));
@@ -3405,11 +3432,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;
}
@@ -3417,7 +3447,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, mIsLink, mVisited, FALSE);
}
void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
@@ -3432,6 +3462,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"));
@@ -3467,7 +3502,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)
{
@@ -3491,7 +3526,7 @@ void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* mod
}
else
{
- LLItemBridge::performAction(folder, model, action);
+ LLItemBridge::performAction(model, action);
}
}
@@ -3518,35 +3553,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);
@@ -3569,7 +3602,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)
{
@@ -3595,7 +3628,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
@@ -3606,7 +3639,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, mIsLink, online, FALSE);
}
std::string LLCallingCardBridge::getLabelSuffix() const
@@ -3631,11 +3664,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());
+ }
*/
}
@@ -3651,15 +3684,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)
{
@@ -3694,16 +3732,16 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
// check the type
switch(cargo_type)
{
- case DAD_TEXTURE:
- case DAD_SOUND:
- case DAD_LANDMARK:
- case DAD_SCRIPT:
- case DAD_CLOTHING:
- case DAD_OBJECT:
- case DAD_NOTECARD:
- case DAD_BODYPART:
- case DAD_ANIMATION:
- case DAD_GESTURE:
+ case DAD_TEXTURE:
+ case DAD_SOUND:
+ case DAD_LANDMARK:
+ case DAD_SCRIPT:
+ case DAD_CLOTHING:
+ case DAD_OBJECT:
+ case DAD_NOTECARD:
+ case DAD_BODYPART:
+ case DAD_ANIMATION:
+ case DAD_GESTURE:
{
LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
const LLPermissions& perm = inv_item->getPermissions();
@@ -3713,7 +3751,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
rv = TRUE;
if(drop)
{
- LLToolDragAndDrop::giveInventory(item->getCreatorUUID(),
+ LLGiveInventory::doGiveInventoryItem(item->getCreatorUUID(),
(LLInventoryItem*)cargo_data);
}
}
@@ -3726,7 +3764,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() ) )
@@ -3734,7 +3772,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
rv = TRUE;
if(drop)
{
- LLToolDragAndDrop::giveInventoryCategory(
+ LLGiveInventory::doGiveInventoryCategory(
item->getCreatorUUID(),
inv_cat);
}
@@ -3748,8 +3786,8 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
}
break;
}
- default:
- break;
+ default:
+ break;
}
}
return rv;
@@ -3759,42 +3797,22 @@ 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( LLGestureManager::instance().isGestureActive(mUUID) )
+ if( LLGestureMgr::instance().isGestureActive(mUUID) )
{
return LLFontGL::BOLD;
}
@@ -3806,9 +3824,11 @@ LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
std::string LLGestureBridge::getLabelSuffix() const
{
- if( LLGestureManager::instance().isGestureActive(mUUID) )
+ if( LLGestureMgr::instance().isGestureActive(mUUID) )
{
- return LLItemBridge::getLabelSuffix() + " (active)";
+ LLStringUtil::format_map_t args;
+ args["[GESLABEL]"] = LLItemBridge::getLabelSuffix();
+ return LLTrans::getString("ActiveGesture", args);
}
else
{
@@ -3817,11 +3837,11 @@ std::string LLGestureBridge::getLabelSuffix() const
}
// virtual
-void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLGestureBridge::performAction(LLInventoryModel* model, std::string action)
{
if (isAddAction(action))
{
- LLGestureManager::instance().activateGesture(mUUID);
+ LLGestureMgr::instance().activateGesture(mUUID);
LLViewerInventoryItem* item = gInventory.getItem(mUUID);
if (!item) return;
@@ -3833,7 +3853,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
}
else if (isRemoveAction(action))
{
- LLGestureManager::instance().deactivateGesture(mUUID);
+ LLGestureMgr::instance().deactivateGesture(mUUID);
LLViewerInventoryItem* item = gInventory.getItem(mUUID);
if (!item) return;
@@ -3845,17 +3865,17 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
}
else if("play" == action)
{
- if(!LLGestureManager::instance().isGestureActive(mUUID))
+ if(!LLGestureMgr::instance().isGestureActive(mUUID))
{
// we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList.
BOOL inform_server = TRUE;
BOOL deactivate_similar = FALSE;
- LLGestureManager::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID));
+ LLGestureMgr::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID));
LLViewerInventoryItem* item = gInventory.getItem(mUUID);
llassert(item);
if (item)
{
- LLGestureManager::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar);
+ LLGestureMgr::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar);
}
}
else
@@ -3863,7 +3883,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
playGesture(mUUID);
}
}
- else LLItemBridge::performAction(folder, model, action);
+ else LLItemBridge::performAction(model, action);
}
void LLGestureBridge::openItem()
@@ -3875,12 +3895,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);
+ }
*/
}
@@ -3897,7 +3917,7 @@ BOOL LLGestureBridge::removeItem()
// This will also force close the preview window, if it exists.
// This may actually delete *this, if mUUID is in the COF.
- LLGestureManager::instance().deactivateGesture(item_id);
+ LLGestureMgr::instance().deactivateGesture(item_id);
// If deactivateGesture deleted *this, then return out immediately.
if (!model->getObject(item_id))
@@ -3919,18 +3939,23 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
else
{
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
bool is_sidepanel = isInOutfitsSidePanel();
if (!is_sidepanel)
{
- items.push_back(std::string("Open"));
+ addOpenRightClickMenuOption(items);
items.push_back(std::string("Properties"));
}
getClipboardEntries(true, items, disabled_items, flags);
items.push_back(std::string("Gesture Separator"));
- if (LLGestureManager::instance().isGestureActive(getUUID()))
+ if (LLGestureMgr::instance().isGestureActive(getUUID()))
{
items.push_back(std::string("Deactivate"));
}
@@ -3945,13 +3970,13 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
// static
void LLGestureBridge::playGesture(const LLUUID& item_id)
{
- if (LLGestureManager::instance().isGesturePlaying(item_id))
+ if (LLGestureMgr::instance().isGesturePlaying(item_id))
{
- LLGestureManager::instance().stopGesture(item_id);
+ LLGestureMgr::instance().stopGesture(item_id);
}
else
{
- LLGestureManager::instance().playGesture(item_id);
+ LLGestureMgr::instance().playGesture(item_id);
}
}
@@ -3960,11 +3985,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;
@@ -3977,6 +3997,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"));
@@ -3992,7 +4017,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"))
{
@@ -4011,7 +4036,7 @@ void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* mo
}
else
{
- LLItemBridge::performAction(folder, model, action);
+ LLItemBridge::performAction(model, action);
}
}
@@ -4024,11 +4049,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);
+ }
*/
}
@@ -4039,17 +4064,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, mIsLink, mAttachPt, mIsMultiObject);
}
LLInventoryObject* LLObjectBridge::getObject() const
@@ -4064,7 +4093,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))
{
@@ -4075,7 +4104,7 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
{
rez_attachment(item, NULL);
}
- else if(item && item->isComplete())
+ else if(item && item->isFinished())
{
// must be in library. copy it to our inventory and put it on.
LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0);
@@ -4108,26 +4137,14 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
}
}
}
- 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);
- */
+ // object double-click action is to wear/unwear object
+ performAction(getInventoryModel(),
+ get_is_item_worn(mUUID) ? "detach" : "attach");
}
LLFontGL::StyleFlags LLObjectBridge::getLabelStyle() const
@@ -4152,12 +4169,11 @@ std::string LLObjectBridge::getLabelSuffix() const
{
if (get_is_item_worn(mUUID))
{
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- std::string attachment_point_name = avatar->getAttachedPointName(mUUID);
+ std::string attachment_point_name = gAgentAvatarp->getAttachedPointName(mUUID);
// e.g. "(worn on ...)" / "(attached to ...)"
LLStringUtil::format_map_t args;
- args["[ATTACHMENT_POINT]"] = attachment_point_name.c_str();
+ args["[ATTACHMENT_POINT]"] = LLTrans::getString(attachment_point_name);
return LLItemBridge::getLabelSuffix() + LLTrans::getString("WornOnAttachmentPoint", args);
}
else
@@ -4172,10 +4188,10 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
payload["item_id"] = item->getLinkedUUID(); // Wear the base object in case this is a link.
S32 attach_pt = 0;
- if (gAgent.getAvatarObject() && attachment)
+ if (isAgentAvatarValid() && attachment)
{
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin();
- iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter)
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
{
if (iter->second == attachment)
{
@@ -4201,9 +4217,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response)
{
- LLVOAvatar *avatarp = gAgent.getAvatarObject();
-
- if (!avatarp->canAttachMoreObjects())
+ if (!gAgentAvatarp->canAttachMoreObjects())
{
LLSD args;
args["MAX_ATTACHMENTS"] = llformat("%d", MAX_AGENT_ATTACHMENTS);
@@ -4251,6 +4265,11 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
else
{
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
bool is_sidepanel = isInOutfitsSidePanel();
if (!is_sidepanel)
@@ -4265,18 +4284,14 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
LLInventoryItem *item = getItem();
if(item)
{
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if( !avatarp )
- {
- return;
- }
+ if (!isAgentAvatarValid()) return;
if( get_is_item_worn( mUUID ) )
{
items.push_back(std::string("Attach Separator"));
items.push_back(std::string("Detach From Yourself"));
}
- else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing())
+ else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder())
{
items.push_back(std::string("Attach Separator"));
items.push_back(std::string("Object Wear"));
@@ -4285,7 +4300,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
// commented out for DEV-32347
//items.push_back(std::string("Restore to Last Position"));
- if (!avatarp->canAttachMoreObjects())
+ if (!gAgentAvatarp->canAttachMoreObjects())
{
disabled_items.push_back(std::string("Object Wear"));
disabled_items.push_back(std::string("Attach To"));
@@ -4293,15 +4308,14 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", TRUE);
LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", TRUE);
- LLVOAvatar *avatarp = gAgent.getAvatarObject();
if (attach_menu
&& (attach_menu->getChildCount() == 0)
&& attach_hud_menu
&& (attach_hud_menu->getChildCount() == 0)
- && avatarp)
+ && isAgentAvatarValid())
{
- for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
- iter != avatarp->mAttachmentPoints.end(); )
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
@@ -4351,11 +4365,10 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
model->notifyObservers();
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if( avatar )
+ if (isAgentAvatarValid())
{
- LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() );
- if( obj )
+ LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
+ if(obj)
{
LLSelectMgr::getInstance()->deselectAll();
LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE );
@@ -4373,11 +4386,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();
@@ -4386,19 +4394,25 @@ void LLLSLTextBridge::openItem()
{
LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
}
- /*
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES);
- }
- */
}
// +=================================================+
// | LLWearableBridge |
// +=================================================+
+LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ LLAssetType::EType asset_type,
+ LLInventoryType::EType inv_type,
+ LLWearableType::EType wearable_type) :
+ LLItemBridge(inventory, root, uuid),
+ mAssetType( asset_type ),
+ mWearableType(wearable_type)
+{
+ mInvType = inv_type;
+}
+
// *NOTE: hack to get from avatar inventory to avatar
void wear_inventory_item_on_avatar( LLInventoryItem* item )
{
@@ -4407,7 +4421,7 @@ void wear_inventory_item_on_avatar( LLInventoryItem* item )
lldebugs << "wear_inventory_item_on_avatar( " << item->getName()
<< " )" << llendl;
- LLAppearanceManager::instance().addCOFItemLink(item);
+ LLAppearanceMgr::getInstance()->wearItemOnAvatar(item->getUUID(), true, false);
}
}
@@ -4419,10 +4433,10 @@ void wear_add_inventory_item_on_avatar( LLInventoryItem* item )
<< " )" << llendl;
LLWearableList::instance().getAsset(item->getAssetUUID(),
- item->getName(),
- item->getType(),
- LLWearableBridge::onWearAddOnAvatarArrived,
- new LLUUID(item->getUUID()));
+ item->getName(),
+ item->getType(),
+ LLWearableBridge::onWearAddOnAvatarArrived,
+ new LLUUID(item->getUUID()));
}
}
@@ -4433,15 +4447,13 @@ void remove_inventory_category_from_avatar( LLInventoryCategory* category )
<< " )" << llendl;
- if( gFloaterCustomize )
+ if (gAgentCamera.cameraCustomizeAvatar())
{
- gFloaterCustomize->askToSaveIfDirty(
- boost::bind(remove_inventory_category_from_avatar_step2, _1, category->getUUID()));
- }
- else
- {
- 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
@@ -4500,7 +4512,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()))
{
@@ -4544,7 +4556,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_
LLViewerInventoryItem *gest_item = gest_item_array.get(i);
if (get_is_item_worn(gest_item->getUUID()))
{
- LLGestureManager::instance().deactivateGesture( gest_item->getLinkedUUID() );
+ LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() );
gInventory.updateItem( gest_item );
gInventory.notifyObservers();
}
@@ -4578,11 +4590,11 @@ std::string LLWearableBridge::getLabelSuffix() const
LLUIImagePtr LLWearableBridge::getIcon() const
{
- return get_item_icon(mAssetType, mInvType, mWearableType, FALSE);
+ return LLInventoryIcon::getIcon(mAssetType, mInvType, mIsLink, mWearableType, FALSE);
}
// virtual
-void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLWearableBridge::performAction(LLInventoryModel* model, std::string action)
{
if (isAddAction(action))
{
@@ -4602,7 +4614,7 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod
removeFromAvatar();
return;
}
- else LLItemBridge::performAction(folder, model, action);
+ else LLItemBridge::performAction(model, action);
}
void LLWearableBridge::openItem()
@@ -4613,42 +4625,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)
@@ -4676,11 +4652,16 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
can_open = FALSE;
}
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
bool is_sidepanel = isInOutfitsSidePanel();
if (can_open && !is_sidepanel)
{
- items.push_back(std::string("Open"));
+ addOpenRightClickMenuOption(items);
}
if (!is_sidepanel)
@@ -4702,7 +4683,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
disabled_items.push_back(std::string("Wearable Edit"));
}
// Don't allow items to be worn if their baseobj is in the trash.
- if (isLinkedObjectInTrash() || isLinkedObjectMissing())
+ if (isLinkedObjectInTrash() || isLinkedObjectMissing() || isCOFFolder())
{
disabled_items.push_back(std::string("Wearable Wear"));
disabled_items.push_back(std::string("Wearable Add"));
@@ -4747,7 +4728,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));
}
@@ -4896,19 +4877,12 @@ void LLWearableBridge::onEditOnAvatar(void* user_data)
void LLWearableBridge::editOnAvatar()
{
- LLUUID linked_id = gInventory.getLinkedItemID(mUUID);
- const LLWearable* wearable = gAgentWearables.getWearableFromItemID(linked_id);
+ LLWearable* wearable = gAgentWearables.getWearableFromItemID(mUUID);
if( wearable )
{
- // Set the tab to the right wearable.
- if (gFloaterCustomize)
- gFloaterCustomize->setCurrentWearableType( wearable->getType() );
+ LLPanel * panel = LLSideTray::getInstance()->getPanel("sidepanel_appearance");
- if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() )
- {
- // Start Avatar Customization
- gAgent.changeCameraToCustomizeAvatar();
- }
+ LLSidepanelAppearance::editWearable(wearable, panel);
}
}
@@ -4953,71 +4927,47 @@ 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 )) )
{
- // MULTI_WEARABLE: FIXME HACK - always remove all
bool do_remove_all = false;
- gAgentWearables.removeWearable( type, do_remove_all, 0 );
+ U32 index = gAgentWearables.getWearableIndex(wearable);
+ gAgentWearables.removeWearable( type, do_remove_all, index );
}
}
}
// Find and remove this item from the COF.
- // FIXME 2.1 - call removeCOFItemLinks in llappearancemgr instead.
- LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(item_id, LLAppearanceManager::instance().getCOF());
- if (items.size() != 1)
- {
- llwarns << "Found " << items.size() << " COF links to " << item_id.asString() << ", expected 1" << llendl;
- }
- for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
- iter != items.end();
- ++iter)
- {
- const LLViewerInventoryItem *linked_item = (*iter);
- const LLUUID &item_id = linked_item->getUUID();
- gInventory.purgeObject(item_id);
- }
+ LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false);
gInventory.notifyObservers();
delete on_remove_struct;
}
-/* static */
+// static
void LLWearableBridge::removeAllClothesFromAvatar()
{
// Remove COF links.
- 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)
- 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)
+ if (itype == LLWearableType::WT_SHAPE || itype == LLWearableType::WT_SKIN || itype == LLWearableType::WT_HAIR || itype == LLWearableType::WT_EYES)
continue;
- // Find and remove this item from the COF.
- LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(
- item_id, LLAppearanceManager::instance().getCOF());
- if (items.size() != 1)
+ for (S32 index = gAgentWearables.getWearableCount(itype)-1; index >= 0 ; --index)
{
- llwarns << "Found " << items.size() << " COF links to " << item_id.asString() << ", expected 1" << llendl;
- }
- for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
- iter != items.end();
- ++iter)
- {
- const LLViewerInventoryItem *linked_item = (*iter);
- const LLUUID &item_id = linked_item->getUUID();
- gInventory.purgeObject(item_id);
+ 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();
@@ -5026,7 +4976,7 @@ void LLWearableBridge::removeAllClothesFromAvatar()
LLAgentWearables::userRemoveAllClothes();
}
-/* static */
+// static
void LLWearableBridge::removeItemFromAvatar(LLViewerInventoryItem *item)
{
if (item)
@@ -5048,65 +4998,131 @@ void LLWearableBridge::removeFromAvatar()
}
}
-LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type,
- const LLUUID& uuid,LLInventoryModel* model)
-{
- LLInvFVBridgeAction* action = NULL;
- switch(asset_type)
- {
- 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;
+// +=================================================+
+// | LLLinkItemBridge |
+// +=================================================+
+// For broken item links
- case LLAssetType::AT_ANIMATION:
- action = new LLAnimationBridgeAction(uuid,model);
- break;
+std::string LLLinkItemBridge::sPrefix("Link: ");
- case LLAssetType::AT_GESTURE:
- action = new LLGestureBridgeAction(uuid,model);
- break;
+void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ // *TODO: Translate
+ lldebugs << "LLLink::buildContextMenu()" << llendl;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
- case LLAssetType::AT_LSL_TEXT:
- action = new LLLSLTextBridgeAction(uuid,model);
- break;
+ 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);
+}
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_BODYPART:
- action = new LLWearableBridgeAction(uuid,model);
+// +=================================================+
+// | LLLinkBridge |
+// +=================================================+
+// For broken folder links.
+std::string LLLinkFolderBridge::sPrefix("Link: ");
+LLUIImagePtr LLLinkFolderBridge::getIcon() const
+{
+ LLFolderType::EType folder_type = LLFolderType::FT_NONE;
+ const LLInventoryObject *obj = getInventoryObject();
+ if (obj)
+ {
+ 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, TRUE);
+}
- break;
+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);
}
- return action;
+ 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();
+ }
+ }
+}
+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;
+}
+
+/********************************************************************************
+ **
+ ** BRIDGE ACTIONS
+ **/
-//static
+// 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();
@@ -5114,7 +5130,7 @@ void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type,
}
}
-//static
+// static
void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model)
{
llassert(model);
@@ -5134,129 +5150,232 @@ void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model)
LLViewerInventoryItem* LLInvFVBridgeAction::getItem() const
{
- if(mModel)
+ if (mModel)
return (LLViewerInventoryItem*)mModel->getItem(mUUID);
return NULL;
}
-//virtual
-void LLTextureBridgeAction::doIt()
+class LLTextureBridgeAction: public LLInvFVBridgeAction
{
- if (getItem())
+ friend class LLInvFVBridgeAction;
+public:
+ virtual void doIt()
{
- LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES);
+ if (getItem())
+ {
+ LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+ LLInvFVBridgeAction::doIt();
}
+ virtual ~LLTextureBridgeAction(){}
+protected:
+ LLTextureBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
- LLInvFVBridgeAction::doIt();
-}
-
-//virtual
-void LLSoundBridgeAction::doIt()
+class LLSoundBridgeAction: public LLInvFVBridgeAction
{
- LLViewerInventoryItem* item = getItem();
- if(item)
+ friend class LLInvFVBridgeAction;
+public:
+ virtual void doIt()
{
- LLFloaterReg::showInstance("preview_sound", LLSD(mUUID), TAKE_FOCUS_YES);
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_sound", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+ LLInvFVBridgeAction::doIt();
}
+ virtual ~LLSoundBridgeAction(){}
+protected:
+ LLSoundBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
- LLInvFVBridgeAction::doIt();
-}
-
-
-//virtual
-void LLLandmarkBridgeAction::doIt()
+class LLLandmarkBridgeAction: public LLInvFVBridgeAction
{
- LLViewerInventoryItem* item = getItem();
- if( item )
+ friend class LLInvFVBridgeAction;
+public:
+ virtual void doIt()
{
- // Opening (double-clicking) a landmark immediately teleports,
- // but warns you the first time.
- LLSD payload;
- payload["asset_id"] = item->getAssetUUID();
-
- LLSD args;
- args["LOCATION"] = item->getName();
-
- LLNotificationsUtil::add("TeleportFromLandmark", args, payload);
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ // Opening (double-clicking) a landmark immediately teleports,
+ // but warns you the first time.
+ LLSD payload;
+ payload["asset_id"] = item->getAssetUUID();
+
+ LLSD args;
+ args["LOCATION"] = item->getName();
+
+ LLNotificationsUtil::add("TeleportFromLandmark", args, payload);
+ }
+ LLInvFVBridgeAction::doIt();
}
+ virtual ~LLLandmarkBridgeAction(){}
+protected:
+ LLLandmarkBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
- LLInvFVBridgeAction::doIt();
-}
-
-
-//virtual
-void LLCallingCardBridgeAction::doIt()
+class LLCallingCardBridgeAction: public LLInvFVBridgeAction
{
- LLViewerInventoryItem* item = getItem();
- if(item && item->getCreatorUUID().notNull())
+ friend class LLInvFVBridgeAction;
+public:
+ virtual void doIt()
{
- LLAvatarActions::showProfile(item->getCreatorUUID());
+ LLViewerInventoryItem* item = getItem();
+ if (item && item->getCreatorUUID().notNull())
+ {
+ LLAvatarActions::showProfile(item->getCreatorUUID());
+ }
+ LLInvFVBridgeAction::doIt();
}
+ virtual ~LLCallingCardBridgeAction(){}
+protected:
+ LLCallingCardBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
- LLInvFVBridgeAction::doIt();
-}
+};
-//virtual
-void
-LLNotecardBridgeAction::doIt()
+class LLNotecardBridgeAction
+: public LLInvFVBridgeAction
{
- LLViewerInventoryItem* item = getItem();
- if (item)
+ friend class LLInvFVBridgeAction;
+public:
+ virtual void doIt()
{
- LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
+ }
+ LLInvFVBridgeAction::doIt();
}
+ virtual ~LLNotecardBridgeAction(){}
+protected:
+ LLNotecardBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
- LLInvFVBridgeAction::doIt();
-}
-
-//virtual
-void LLGestureBridgeAction::doIt()
+class LLGestureBridgeAction: public LLInvFVBridgeAction
{
- LLViewerInventoryItem* item = getItem();
- if (item)
+ friend class LLInvFVBridgeAction;
+public:
+ virtual void doIt()
{
- LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null);
- preview->setFocus(TRUE);
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null);
+ preview->setFocus(TRUE);
+ }
+ LLInvFVBridgeAction::doIt();
}
+ virtual ~LLGestureBridgeAction(){}
+protected:
+ LLGestureBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
- LLInvFVBridgeAction::doIt();
-}
-
-//virtual
-void LLAnimationBridgeAction::doIt()
+class LLAnimationBridgeAction: public LLInvFVBridgeAction
{
- LLViewerInventoryItem* item = getItem();
- if (item)
+ friend class LLInvFVBridgeAction;
+public:
+ virtual void doIt()
{
- LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+ LLInvFVBridgeAction::doIt();
}
+ virtual ~LLAnimationBridgeAction(){}
+protected:
+ LLAnimationBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
- LLInvFVBridgeAction::doIt();
-}
-
-
-//virtual
-void LLObjectBridgeAction::doIt()
+class LLObjectBridgeAction: public LLInvFVBridgeAction
{
- /*
- LLFloaterReg::showInstance("properties", mUUID);
- */
- LLInvFVBridgeAction::doIt();
-}
-
+ friend class LLInvFVBridgeAction;
+public:
+ virtual void doIt()
+ {
+ /*
+ LLFloaterReg::showInstance("properties", mUUID);
+ */
+ LLInvFVBridgeAction::doIt();
+ }
+ virtual ~LLObjectBridgeAction(){}
+protected:
+ LLObjectBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
-//virtual
-void LLLSLTextBridgeAction::doIt()
+class LLLSLTextBridgeAction: public LLInvFVBridgeAction
{
- LLViewerInventoryItem* item = getItem();
- if (item)
+ friend class LLInvFVBridgeAction;
+public:
+ virtual void doIt()
{
- LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES);
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+ LLInvFVBridgeAction::doIt();
}
+ virtual ~LLLSLTextBridgeAction(){}
+protected:
+ LLLSLTextBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
- LLInvFVBridgeAction::doIt();
-}
-
+class LLWearableBridgeAction: public LLInvFVBridgeAction
+{
+ friend class LLInvFVBridgeAction;
+public:
+ virtual void doIt()
+ {
+ if(isItemInTrash())
+ {
+ LLNotificationsUtil::add("CannotWearTrash");
+ }
+ else if(isAgentInventory())
+ {
+ if(!get_is_item_worn(mUUID))
+ {
+ wearOnAvatar();
+ }
+ }
+ else
+ {
+ // must be in the inventory library. copy it to our inventory
+ // and put it on right away.
+ LLViewerInventoryItem* item = getItem();
+ if(item && item->isFinished())
+ {
+ LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ else if(item)
+ {
+ // *TODO: We should fetch the item details, and then do
+ // the operation above.
+ LLNotificationsUtil::add("CannotWearInfoNotComplete");
+ }
+ }
+ LLInvFVBridgeAction::doIt();
+ }
+ virtual ~LLWearableBridgeAction(){}
+protected:
+ LLWearableBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+ BOOL isItemInTrash() const;
+ // return true if the item is in agent inventory. if false, it
+ // must be lost or in the inventory library.
+ BOOL isAgentInventory() const;
+ void wearOnAvatar();
+};
BOOL LLWearableBridgeAction::isItemInTrash() const
{
@@ -5303,164 +5422,114 @@ void LLWearableBridgeAction::wearOnAvatar()
}
}
-//virtual
-void LLWearableBridgeAction::doIt()
+LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type,
+ const LLUUID& uuid,
+ LLInventoryModel* model)
{
- if(isItemInTrash())
- {
- LLNotificationsUtil::add("CannotWearTrash");
- }
- else if(isAgentInventory())
- {
- if(!get_is_item_worn(mUUID))
- {
- wearOnAvatar();
- }
- }
- else
+ LLInvFVBridgeAction* action = NULL;
+ switch(asset_type)
{
- // must be in the inventory library. copy it to our inventory
- // and put it on right away.
- LLViewerInventoryItem* item = getItem();
- if(item && item->isComplete())
- {
- LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- LLUUID::null,
- std::string(),
- cb);
- }
- else if(item)
- {
- // *TODO: We should fetch the item details, and then do
- // the operation above.
- LLNotificationsUtil::add("CannotWearInfoNotComplete");
- }
+ case LLAssetType::AT_TEXTURE:
+ action = new LLTextureBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_SOUND:
+ action = new LLSoundBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_LANDMARK:
+ action = new LLLandmarkBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_CALLINGCARD:
+ action = new LLCallingCardBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_OBJECT:
+ action = new LLObjectBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_NOTECARD:
+ action = new LLNotecardBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_ANIMATION:
+ action = new LLAnimationBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_GESTURE:
+ action = new LLGestureBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_LSL_TEXT:
+ action = new LLLSLTextBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_BODYPART:
+ action = new LLWearableBridgeAction(uuid,model);
+ break;
+ default:
+ break;
}
-
- LLInvFVBridgeAction::doIt();
+ return action;
}
-// +=================================================+
-// | LLLinkItemBridge |
-// +=================================================+
-// For broken links
+/** Bridge Actions
+ **
+ ********************************************************************************/
-std::string LLLinkItemBridge::sPrefix("Link: ");
-
-
-LLUIImagePtr LLLinkItemBridge::getIcon() const
+/************************************************************************/
+/* Recent Inventory Panel related classes */
+/************************************************************************/
+void LLRecentItemsFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- if (LLViewerInventoryItem *item = getItem())
- {
- return get_item_icon(item->getActualType(), item->getInventoryType(), 0, FALSE);
- }
- return get_item_icon(LLAssetType::AT_LINK, LLInventoryType::IT_NONE, 0, FALSE);
-}
+ LLFolderBridge::buildContextMenu(menu, flags);
-void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
-{
- // *TODO: Translate
- lldebugs << "LLLink::buildContextMenu()" << llendl;
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
+ menuentry_vec_t disabled_items, items = getMenuItems();
+
+ items.erase(std::find(items.begin(), items.end(), std::string("New Folder")));
+ items.erase(std::find(items.begin(), items.end(), std::string("New Script")));
+ items.erase(std::find(items.begin(), items.end(), std::string("New Note")));
+ items.erase(std::find(items.begin(), items.end(), std::string("New Gesture")));
+ items.erase(std::find(items.begin(), items.end(), std::string("New Clothes")));
+ items.erase(std::find(items.begin(), items.end(), std::string("New Body Parts")));
- items.push_back(std::string("Find Original"));
- disabled_items.push_back(std::string("Find Original"));
-
- if(isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
- else
- {
- items.push_back(std::string("Properties"));
- addDeleteContextMenuOptions(items, disabled_items);
- }
hide_context_entries(menu, items, disabled_items);
}
-
-// +=================================================+
-// | LLLinkBridge |
-// +=================================================+
-// For broken links.
-
-std::string LLLinkFolderBridge::sPrefix("Link: ");
-
-
-LLUIImagePtr LLLinkFolderBridge::getIcon() const
+LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge(
+ LLAssetType::EType asset_type,
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags /*= 0x00*/ ) const
{
- LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
- if (LLViewerInventoryItem *item = getItem())
+ LLInvFVBridge* new_listener = NULL;
+ switch(asset_type)
{
- if (const LLViewerInventoryCategory* cat = item->getLinkedCategory())
- {
- preferred_type = cat->getPreferredType();
+ case LLAssetType::AT_CATEGORY:
+ if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
+ {
+ // *TODO: Create a link folder handler instead if it is necessary
+ new_listener = LLInventoryFVBridgeBuilder::createBridge(
+ asset_type,
+ actual_asset_type,
+ inv_type,
+ inventory,
+ root,
+ uuid,
+ flags);
+ break;
}
+ new_listener = new LLRecentItemsFolderBridge(inv_type, inventory, root, uuid);
+ break;
+ default:
+ new_listener = LLInventoryFVBridgeBuilder::createBridge(
+ asset_type,
+ actual_asset_type,
+ inv_type,
+ inventory,
+ root,
+ uuid,
+ flags);
}
- return LLFolderBridge::getIcon(preferred_type);
-}
-
-void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
-{
- // *TODO: Translate
- lldebugs << "LLLink::buildContextMenu()" << llendl;
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
-
- if (isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
- else
- {
- items.push_back(std::string("Find Original"));
- addDeleteContextMenuOptions(items, disabled_items);
- }
- hide_context_entries(menu, items, disabled_items);
-}
+ return new_listener;
-void LLLinkFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
-{
- if ("goto" == action)
- {
- gotoItem(folder);
- return;
- }
- LLItemBridge::performAction(folder,model,action);
}
-void LLLinkFolderBridge::gotoItem(LLFolderView *folder)
-{
- const LLUUID &cat_uuid = getFolderID();
- if (!cat_uuid.isNull())
- {
- if (LLFolderViewItem *base_folder = folder->getItemByID(cat_uuid))
- {
- if (LLInventoryModel* model = getInventoryModel())
- {
- model->fetchDescendentsOf(cat_uuid);
- }
- base_folder->setOpen(TRUE);
- folder->setSelectionFromRoot(base_folder,TRUE);
- folder->scrollToShowSelection();
- }
- }
-}
-const LLUUID &LLLinkFolderBridge::getFolderID() const
-{
- if (LLViewerInventoryItem *link_item = getItem())
- {
- if (const LLViewerInventoryCategory *cat = link_item->getLinkedCategory())
- {
- const LLUUID& cat_uuid = cat->getUUID();
- return cat_uuid;
- }
- }
- return LLUUID::null;
-}
+// EOF