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.cpp159
1 files changed, 114 insertions, 45 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index a0bc1035bf..5ca5446d23 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -614,7 +614,7 @@ BOOL LLInvFVBridge::isClipboardPasteable() const
if (cat)
{
LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, item_id);
- if (!cat_br.isItemCopyable())
+ if (!cat_br.isItemCopyable(false))
return FALSE;
// Skip to the next item in the clipboard
continue;
@@ -622,7 +622,7 @@ BOOL LLInvFVBridge::isClipboardPasteable() const
// Each item must be copyable to be pastable
LLItemBridge item_br(mInventoryPanel.get(), mRoot, item_id);
- if (!item_br.isItemCopyable())
+ if (!item_br.isItemCopyable(false))
{
return FALSE;
}
@@ -654,6 +654,11 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
{
return FALSE;
}
+
+ if (gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()))
+ {
+ return FALSE;
+ }
}
const LLViewerInventoryCategory *cat = model->getCategory(objects.at(i));
if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
@@ -729,15 +734,15 @@ void hide_context_entries(LLMenuGL& menu,
}
bool found = false;
- menuentry_vec_t::const_iterator itor2;
- for (itor2 = entries_to_show.begin(); itor2 != entries_to_show.end(); ++itor2)
- {
- if (*itor2 == name)
- {
- found = true;
- break;
- }
- }
+
+ std::string myinput;
+ std::vector<std::string> mylist{ "a", "b", "c" };
+
+ menuentry_vec_t::const_iterator itor2 = std::find(entries_to_show.begin(), entries_to_show.end(), name);
+ if (itor2 != entries_to_show.end())
+ {
+ found = true;
+ }
// Don't allow multiple separators in a row (e.g. such as if there are no items
// between two separators).
@@ -755,7 +760,21 @@ void hide_context_entries(LLMenuGL& menu,
menu_item->setVisible(FALSE);
}
- menu_item->setEnabled(FALSE);
+ if (menu_item->getEnabled())
+ {
+ // These should stay enabled unless specifically disabled
+ const menuentry_vec_t exceptions = {
+ "Detach From Yourself",
+ "Wearable And Object Wear",
+ "Wearable Add",
+ };
+
+ menuentry_vec_t::const_iterator itor2 = std::find(exceptions.begin(), exceptions.end(), name);
+ if (itor2 == exceptions.end())
+ {
+ menu_item->setEnabled(FALSE);
+ }
+ }
}
else
{
@@ -812,6 +831,12 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
{
disabled_items.push_back(std::string("Find Original"));
}
+
+ items.push_back(std::string("Cut"));
+ if (!isItemMovable() || !isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Cut"));
+ }
}
else
{
@@ -882,7 +907,8 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
disabled_items.push_back(std::string("Paste"));
}
- if (gSavedSettings.getBOOL("InventoryLinking"))
+ static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryLinking", true);
+ if (inventory_linking)
{
items.push_back(std::string("Paste As Link"));
if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0)
@@ -1224,6 +1250,16 @@ BOOL LLInvFVBridge::isLinkedObjectInTrash() const
return FALSE;
}
+bool LLInvFVBridge::isItemInOutfits() const
+{
+ const LLInventoryModel* model = getInventoryModel();
+ if(!model) return false;
+
+ const LLUUID my_outfits_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS, false);
+
+ return isCOFFolder() || (my_outfits_cat == mUUID) || model->isObjectDescendentOf(mUUID, my_outfits_cat);
+}
+
BOOL LLInvFVBridge::isLinkedObjectMissing() const
{
const LLInventoryObject *obj = getInventoryObject();
@@ -1933,9 +1969,9 @@ std::string LLItemBridge::getLabelSuffix() const
{
// String table is loaded before login screen and inventory items are
// loaded after login, so LLTrans should be ready.
- static std::string NO_COPY = LLTrans::getString("no_copy");
- static std::string NO_MOD = LLTrans::getString("no_modify");
- static std::string NO_XFER = LLTrans::getString("no_transfer");
+ static std::string NO_COPY = LLTrans::getString("no_copy_lbl");
+ static std::string NO_MOD = LLTrans::getString("no_modify_lbl");
+ static std::string NO_XFER = LLTrans::getString("no_transfer_lbl");
static std::string LINK = LLTrans::getString("link");
static std::string BROKEN_LINK = LLTrans::getString("broken_link");
std::string suffix;
@@ -1956,17 +1992,20 @@ std::string LLItemBridge::getLabelSuffix() const
BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
if (!copy)
{
+ suffix += " ";
suffix += NO_COPY;
}
BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
if (!mod)
{
- suffix += NO_MOD;
+ suffix += suffix.empty() ? " " : ",";
+ suffix += NO_MOD;
}
BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
gAgent.getID());
if (!xfer)
{
+ suffix += suffix.empty() ? " " : ",";
suffix += NO_XFER;
}
}
@@ -2059,7 +2098,8 @@ BOOL LLItemBridge::removeItem()
// 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"))
+ static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryLinking", true);
+ if (!inventory_linking)
{
if (!item->getIsLinkType())
{
@@ -2102,22 +2142,25 @@ BOOL LLItemBridge::confirmRemoveItem(const LLSD& notification, const LLSD& respo
return FALSE;
}
-BOOL LLItemBridge::isItemCopyable() const
+bool LLItemBridge::isItemCopyable(bool can_copy_as_link) const
{
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- // Can't copy worn objects.
- // Worn objects are tied to their inworld conterparts
- // Copy of modified worn object will return object with obsolete asset and inventory
- if(get_is_item_worn(mUUID))
- {
- return FALSE;
- }
+ LLViewerInventoryItem* item = getItem();
+ if (!item)
+ {
+ return false;
+ }
+ // Can't copy worn objects.
+ // Worn objects are tied to their inworld conterparts
+ // Copy of modified worn object will return object with obsolete asset and inventory
+ if (get_is_item_worn(mUUID))
+ {
+ return false;
+ }
- return item->getPermissions().allowCopyBy(gAgent.getID()) || gSavedSettings.getBOOL("InventoryLinking");
- }
- return FALSE;
+ static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryLinking", true);
+ return (can_copy_as_link && inventory_linking)
+ || (mIsLink && inventory_linking)
+ || item->getPermissions().allowCopyBy(gAgent.getID());
}
LLViewerInventoryItem* LLItemBridge::getItem() const
@@ -2131,6 +2174,21 @@ LLViewerInventoryItem* LLItemBridge::getItem() const
return item;
}
+const LLUUID& LLItemBridge::getThumbnailUUID() const
+{
+ LLViewerInventoryItem* item = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ item = (LLViewerInventoryItem*)model->getItem(mUUID);
+ }
+ if (item)
+ {
+ return item->getThumbnailUUID();
+ }
+ return LLUUID::null;
+}
+
BOOL LLItemBridge::isItemPermissive() const
{
LLViewerInventoryItem* item = getItem();
@@ -2321,8 +2379,14 @@ BOOL LLFolderBridge::isUpToDate() const
return category->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN;
}
-BOOL LLFolderBridge::isItemCopyable() const
+bool LLFolderBridge::isItemCopyable(bool can_copy_as_link) const
{
+ if (can_copy_as_link && !LLFolderType::lookupIsProtectedType(getPreferredType()))
+ {
+ // Can copy and paste unprotected folders as links
+ return true;
+ }
+
// Folders are copyable if items in them are, recursively, copyable.
// Get the content of the folder
@@ -2336,22 +2400,26 @@ BOOL LLFolderBridge::isItemCopyable() const
{
LLInventoryItem* item = *iter;
LLItemBridge item_br(mInventoryPanel.get(), mRoot, item->getUUID());
- if (!item_br.isItemCopyable())
- return FALSE;
-}
+ if (!item_br.isItemCopyable(false))
+ {
+ return false;
+ }
+ }
// Check the folders
LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
-{
+ {
LLViewerInventoryCategory* category = *iter;
LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, category->getUUID());
- if (!cat_br.isItemCopyable())
- return FALSE;
- }
-
- return TRUE;
- }
+ if (!cat_br.isItemCopyable(false))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
BOOL LLFolderBridge::isClipboardPasteable() const
{
@@ -3768,6 +3836,7 @@ void LLFolderBridge::perform_pasteFromClipboard()
LLInventoryObject *obj = model->getObject(item_id);
if (obj)
{
+
if (move_is_into_lost_and_found)
{
if (LLAssetType::AT_CATEGORY == obj->getType())
@@ -4296,7 +4365,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
items.push_back(std::string("IM All Contacts In Folder"));
}
- if (((flags & ITEM_IN_MULTI_SELECTION) == 0) && hasChildren())
+ if (((flags & ITEM_IN_MULTI_SELECTION) == 0) && hasChildren() && (type != LLFolderType::FT_OUTFIT))
{
items.push_back(std::string("Ungroup folder items"));
}
@@ -5934,7 +6003,7 @@ std::string LLCallingCardBridge::getLabelSuffix() const
LLViewerInventoryItem* item = getItem();
if( item && LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()) )
{
- return LLItemBridge::getLabelSuffix() + " (online)";
+ return LLItemBridge::getLabelSuffix() + " online";
}
else
{