diff options
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 9e5a831555..5bfad0695c 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -515,7 +515,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, if (obj && obj->getIsLinkType()) { items.push_back(std::string("Find Original")); - if (LLAssetType::lookupIsLinkType(obj->getType())) + if (isLinkedObjectMissing()) { disabled_items.push_back(std::string("Find Original")); } @@ -665,6 +665,20 @@ BOOL LLInvFVBridge::isLinkedObjectInTrash() const return FALSE; } +BOOL LLInvFVBridge::isLinkedObjectMissing() const +{ + const LLInventoryObject *obj = getInventoryObject(); + if (!obj) + { + return TRUE; + } + if (obj->getIsLinkType() && LLAssetType::lookupIsLinkType(obj->getType())) + { + return TRUE; + } + return FALSE; +} + BOOL LLInvFVBridge::isAgentInventory() const { const LLInventoryModel* model = getInventoryModel(); @@ -1309,6 +1323,16 @@ BOOL LLItemBridge::isItemPermissive() const return FALSE; } +bool LLItemBridge::isAddAction(std::string action) const +{ + return ("wear" == action || "attach" == action || "activate" == action); +} + +bool LLItemBridge::isRemoveAction(std::string action) const +{ + return ("take_off" == action || "detach" == action || "deactivate" == action); +} + // +=================================================+ // | LLFolderBridge | // +=================================================+ @@ -3669,7 +3693,7 @@ std::string LLGestureBridge::getLabelSuffix() const // virtual void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { - if ("activate" == action) + if (isAddAction(action)) { LLGestureManager::instance().activateGesture(mUUID); @@ -3681,7 +3705,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode gInventory.updateItem(item); gInventory.notifyObservers(); } - else if ("deactivate" == action) + else if (isRemoveAction(action)) { LLGestureManager::instance().deactivateGesture(mUUID); @@ -3866,7 +3890,7 @@ LLInventoryObject* LLObjectBridge::getObject() const // virtual void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { - if ("attach" == action) + if (isAddAction(action)) { LLUUID object_id = mUUID; LLViewerInventoryItem* item; @@ -3889,7 +3913,7 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model } gFocusMgr.setKeyboardFocus(NULL); } - else if ("detach" == action) + else if (isRemoveAction(action)) { LLInventoryItem* item = gInventory.getItem(mUUID); if(item) @@ -4077,7 +4101,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Detach From Yourself")); } else - if( !isInTrash() && !isLinkedObjectInTrash() ) + if( !isInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing()) { items.push_back(std::string("Attach Separator")); items.push_back(std::string("Object Wear")); @@ -4382,7 +4406,7 @@ LLUIImagePtr LLWearableBridge::getIcon() const // virtual void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { - if ("wear" == action) + if (isAddAction(action)) { wearOnAvatar(); } @@ -4395,7 +4419,7 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod editOnAvatar(); return; } - else if ("take_off" == action) + else if (isRemoveAction(action)) { if(gAgentWearables.isWearingItem(mUUID)) { @@ -4476,16 +4500,20 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere - BOOL no_open = ((flags & SUPPRESS_OPEN_ITEM) == SUPPRESS_OPEN_ITEM); + BOOL can_open = ((flags & SUPPRESS_OPEN_ITEM) != SUPPRESS_OPEN_ITEM); // If we have clothing, don't add "Open" as it's the same action as "Wear" SL-18976 LLViewerInventoryItem* item = getItem(); - if( !no_open && item ) + if (can_open && item) + { + can_open = (item->getType() != LLAssetType::AT_CLOTHING) && + (item->getType() != LLAssetType::AT_BODYPART); + } + if (isLinkedObjectMissing()) { - no_open = (item->getType() == LLAssetType::AT_CLOTHING) || - (item->getType() == LLAssetType::AT_BODYPART); + can_open = FALSE; } - if (!no_open) + if (can_open) { items.push_back(std::string("Open")); } @@ -4505,7 +4533,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()) + if (isLinkedObjectInTrash() || isLinkedObjectMissing()) { disabled_items.push_back(std::string("Wearable Wear")); disabled_items.push_back(std::string("Wearable Add")); @@ -5089,6 +5117,9 @@ void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags) std::vector<std::string> items; std::vector<std::string> disabled_items; + items.push_back(std::string("Find Original")); + disabled_items.push_back(std::string("Find Original")); + if(isInTrash()) { items.push_back(std::string("Purge Item")); @@ -5101,6 +5132,7 @@ void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Properties")); items.push_back(std::string("Delete")); if (!isItemRemovable()) { |