diff options
| author | Callum Prentice <callum@lindenlab.com> | 2025-08-22 17:12:03 -0700 | 
|---|---|---|
| committer | Callum Prentice <callum@lindenlab.com> | 2025-08-22 17:12:03 -0700 | 
| commit | e935a8aebca4ae014b5f6b438612ac5674678fe6 (patch) | |
| tree | 531498d040a62c01d444fe91eb99afb091c7fff4 /indra/newview/llinventorybridge.cpp | |
| parent | bebd1b208e1b342fabf59844851124a91513e83b (diff) | |
| parent | cefee59b0e5fff683a50fe61633a9c14493d7145 (diff) | |
Merge branch 'develop' into callum/viewer-cef-2025-08
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
| -rw-r--r-- | indra/newview/llinventorybridge.cpp | 133 | 
1 files changed, 125 insertions, 8 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index f9e9049119..331754d009 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -829,6 +829,8 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,  {      const LLInventoryObject *obj = getInventoryObject();      bool single_folder_root = (mRoot == NULL); +    bool is_cof = isCOFFolder(); +    bool is_inbox = isInboxFolder();      if (obj)      { @@ -843,7 +845,8 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,              disabled_items.push_back(std::string("Copy"));          } -        if (isAgentInventory() && !single_folder_root && !isMarketplaceListingsFolder()) +        bool is_agent_inventory = isAgentInventory(); +        if (is_agent_inventory && !single_folder_root && !is_cof && !is_inbox)          {              items.push_back(std::string("New folder from selected"));              items.push_back(std::string("Subfolder Separator")); @@ -856,6 +859,19 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,              }          } +        if (isFavorite()) +        { +            items.push_back(std::string("Remove from Favorites")); +        } +        else if (is_agent_inventory && !gInventory.isObjectDescendentOf(mUUID, gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH))) +        { +            items.push_back(std::string("Add to Favorites")); +            if (gInventory.getRootFolderID() == mUUID) +            { +                disabled_items.push_back(std::string("Add to Favorites")); +            } +        } +          if (obj->getIsLinkType())          {              items.push_back(std::string("Find Original")); @@ -868,6 +884,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,              if (!isItemMovable() || !canMenuCut())              {                  disabled_items.push_back(std::string("Cut")); +                disabled_items.push_back(std::string("New folder from selected"));              }          }          else @@ -877,7 +894,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,                  items.push_back(std::string("Find Links"));              } -            if (!isInboxFolder() && !single_folder_root) +            if (!is_inbox && !single_folder_root)              {                  items.push_back(std::string("Rename"));                  if (!isItemRenameable() || ((flags & FIRST_SELECTED_ITEM) == 0)) @@ -917,6 +934,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,              if (!isItemMovable() || !canMenuCut())              {                  disabled_items.push_back(std::string("Cut")); +                disabled_items.push_back(std::string("New folder from selected"));              }              if (canListOnMarketplace() && !isMarketplaceListingsFolder() && !isInboxFolder()) @@ -939,7 +957,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,      }      // Don't allow items to be pasted directly into the COF or the inbox -    if (!isCOFFolder() && !isInboxFolder()) +    if (!is_cof && !is_inbox)      {          items.push_back(std::string("Paste"));      } @@ -1333,6 +1351,13 @@ bool LLInvFVBridge::isAgentInventory() const      return model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID());  } +bool LLInvFVBridge::isAgentInventoryRoot() const +{ +    const LLInventoryModel* model = getInventoryModel(); +    if(!model) return false; +    return gInventory.getRootFolderID() == mUUID; +} +  bool LLInvFVBridge::isCOFFolder() const  {      return LLAppearanceMgr::instance().getIsInCOF(mUUID); @@ -2280,7 +2305,21 @@ const LLUUID& LLItemBridge::getThumbnailUUID() const      return LLUUID::null;  } -// virtual +bool LLItemBridge::isFavorite() const +{ +    LLViewerInventoryItem* item = NULL; +    LLInventoryModel* model = getInventoryModel(); +    if (model) +    { +        item = model->getItem(mUUID); +    } +    if (item) +    { +        return get_is_favorite(item); +    } +    return false; +} +  bool LLItemBridge::isItemPermissive() const  {      if (LLViewerInventoryItem* item = getItem()) @@ -2425,6 +2464,16 @@ const LLUUID& LLFolderBridge::getThumbnailUUID() const      return LLUUID::null;  } +bool LLFolderBridge::isFavorite() const +{ +    LLViewerInventoryCategory* cat = getCategory(); +    if (cat) +    { +        return cat->getIsFavorite(); +    } +    return false; +} +  void LLFolderBridge::update()  {      // we know we have children but  haven't  fetched them (doesn't obey filter) @@ -4420,6 +4469,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t&   items          }          disabled_items.push_back(std::string("New Folder")); +        disabled_items.push_back(std::string("upload_options"));          disabled_items.push_back(std::string("upload_def"));          disabled_items.push_back(std::string("create_new"));      } @@ -4445,6 +4495,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t&   items      {          disabled_items.push_back(std::string("New Folder"));          disabled_items.push_back(std::string("New Listing Folder")); +        disabled_items.push_back(std::string("upload_options"));          disabled_items.push_back(std::string("upload_def"));          disabled_items.push_back(std::string("create_new"));      } @@ -4504,6 +4555,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t&   items                  items.push_back(std::string("Rename"));                  items.push_back(std::string("thumbnail")); +                addInventoryFavoritesMenuOptions(items);                  addDeleteContextMenuOptions(items, disabled_items);                  // EXT-4030: disallow deletion of currently worn outfit                  const LLViewerInventoryItem* base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink(); @@ -4521,6 +4573,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t&   items                  EMyOutfitsSubfolderType in_my_outfits = myoutfit_object_subfolder_type(model, mUUID, outfits_id);                  if (in_my_outfits != MY_OUTFITS_NO)                  { +                    // Either an outfit or a subfolder inside MY_OUTFITS                      if (in_my_outfits == MY_OUTFITS_SUBFOLDER)                      {                          // Not inside an outfit, but inside 'my outfits' @@ -4530,6 +4583,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t&   items                      items.push_back(std::string("Rename"));                      items.push_back(std::string("thumbnail")); +                    addInventoryFavoritesMenuOptions(items);                      addDeleteContextMenuOptions(items, disabled_items);                  }                  else @@ -4546,6 +4600,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t&   items                          }                          if (!isMarketplaceListingsFolder())                          { +                            items.push_back(std::string("upload_options"));                              items.push_back(std::string("upload_def"));                              items.push_back(std::string("create_new"));                              items.push_back(std::string("New Script")); @@ -4577,6 +4632,8 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t&   items          if (model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT) == mUUID)          {              items.push_back(std::string("Copy outfit list to clipboard")); +            addInventoryFavoritesMenuOptions(items); +              addOpenFolderMenuOptions(flags, items);          } @@ -4835,6 +4892,18 @@ void LLFolderBridge::addOpenFolderMenuOptions(U32 flags, menuentry_vec_t& items)      }  } +void LLFolderBridge::addInventoryFavoritesMenuOptions(menuentry_vec_t& items) +{ +    if (isFavorite()) +    { +        items.push_back(std::string("Remove from Favorites")); +    } +    else +    { +        items.push_back(std::string("Add to Favorites")); +    } +} +  bool LLFolderBridge::hasChildren() const  {      LLInventoryModel* model = getInventoryModel(); @@ -7089,12 +7158,13 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action)          item = (LLViewerInventoryItem*)gInventory.getItem(object_id);          if(item && gInventory.isObjectDescendentOf(object_id, gInventory.getRootFolderID()))          { -            rez_attachment(item, NULL, true); // Replace if "Wear"ing. +            static LLCachedControl<bool> replace_item(gSavedSettings, "InventoryAddAttachmentBehavior", false); +            rez_attachment(item, NULL, ("attach" == action) ? replace_item() : true); // Replace if "Wear"ing.          }          else if(item && item->isFinished())          {              // must be in library. copy it to our inventory and put it on. -            LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0)); +            LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0, true));              copy_inventory_item(                  gAgent.getID(),                  item->getPermissions().getOwner(), @@ -8219,7 +8289,8 @@ void LLObjectBridgeAction::attachOrDetach()      }      else      { -        LLAppearanceMgr::instance().wearItemOnAvatar(mUUID, true, false); // Don't replace if adding. +        static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryAddAttachmentBehavior", false); +        LLAppearanceMgr::instance().wearItemOnAvatar(mUUID, true, inventory_linking()); // Don't replace if adding.      }  } @@ -8410,6 +8481,7 @@ void LLRecentItemsFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)          buildContextMenuOptions(flags, items, disabled_items);      items.erase(std::remove(items.begin(), items.end(), std::string("New Folder")), items.end()); +    items.erase(std::remove(items.begin(), items.end(), std::string("New folder from selected")), items.end());      hide_context_entries(menu, items, disabled_items);  } @@ -8444,6 +8516,51 @@ LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge(      return new_listener;  } +/************************************************************************/ +/* Favorites Inventory Panel related classes                               */ +/************************************************************************/ +void LLFavoritesFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) +{ +    // todo: consider things that should be disabled +    menuentry_vec_t disabled_items, items; +    buildContextMenuOptions(flags, items, disabled_items); + +    items.erase(std::remove(items.begin(), items.end(), std::string("New Folder")), items.end()); +    items.erase(std::remove(items.begin(), items.end(), std::string("New folder from selected")), items.end()); + +    hide_context_entries(menu, items, disabled_items); +} + +LLInvFVBridge* LLFavoritesInventoryBridgeBuilder::createBridge( +    LLAssetType::EType asset_type, +    LLAssetType::EType actual_asset_type, +    LLInventoryType::EType inv_type, +    LLInventoryPanel* inventory, +    LLFolderViewModelInventory* view_model, +    LLFolderView* root, +    const LLUUID& uuid, +    U32 flags /*= 0x00*/) const +{ +    LLInvFVBridge* new_listener = NULL; +    if (asset_type == LLAssetType::AT_CATEGORY +        && actual_asset_type != LLAssetType::AT_LINK_FOLDER) +    { +        new_listener = new LLFavoritesFolderBridge(inv_type, inventory, root, uuid); +    } +    else +    { +        new_listener = LLInventoryFolderViewModelBuilder::createBridge(asset_type, +            actual_asset_type, +            inv_type, +            inventory, +            view_model, +            root, +            uuid, +            flags); +    } +    return new_listener; +} +  LLFolderViewGroupedItemBridge::LLFolderViewGroupedItemBridge()  {  } @@ -8454,7 +8571,7 @@ void LLFolderViewGroupedItemBridge::groupFilterContextMenu(folder_view_item_dequ      menuentry_vec_t disabled_items;      if (get_selection_item_uuids(selected_items, ids))      { -        if (!LLAppearanceMgr::instance().canAddWearables(ids) && canWearSelected(ids)) +        if (!LLAppearanceMgr::instance().canAddWearables(ids, false) && canWearSelected(ids))          {              disabled_items.push_back(std::string("Wearable And Object Wear"));              disabled_items.push_back(std::string("Wearable Add"));  | 
