summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorygallerymenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorygallerymenu.cpp')
-rw-r--r--indra/newview/llinventorygallerymenu.cpp107
1 files changed, 82 insertions, 25 deletions
diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp
index 3fede1a001..6bea648380 100644
--- a/indra/newview/llinventorygallerymenu.cpp
+++ b/indra/newview/llinventorygallerymenu.cpp
@@ -112,6 +112,7 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu()
enable_registrar.add("Inventory.CanSetUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::canSetUploadLocation, this, _2));
enable_registrar.add("Inventory.CanSetFavoriteFolder", boost::bind(&LLInventoryGalleryContextMenu::canSetFavoriteFolder, this));
+ enable_registrar.add("Inventory.FileUploadLocation.Check", boost::bind(&LLInventoryGalleryContextMenu::isUploadLocationSelected, this, _2));
enable_registrar.add("Inventory.EnvironmentEnabled", [](LLUICtrl*, const LLSD&)
{
@@ -252,6 +253,20 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata)
{
ungroup_folder_items(mUUIDs.front());
}
+ else if ("add_to_favorites" == action)
+ {
+ for (const LLUUID& id : mUUIDs)
+ {
+ set_favorite(id, true);
+ }
+ }
+ else if ("remove_from_favorites" == action)
+ {
+ for (const LLUUID& id : mUUIDs)
+ {
+ set_favorite(id, false);
+ }
+ }
else if ("replaceoutfit" == action)
{
modify_outfit(false, mUUIDs.front(), &gInventory);
@@ -474,22 +489,13 @@ void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLS
void LLInventoryGalleryContextMenu::fileUploadLocation(const LLSD& userdata)
{
const std::string param = userdata.asString();
- if (param == "model")
- {
- gSavedPerAccountSettings.setString("ModelUploadFolder", mUUIDs.front().asString());
- }
- else if (param == "texture")
- {
- gSavedPerAccountSettings.setString("TextureUploadFolder", mUUIDs.front().asString());
- }
- else if (param == "sound")
- {
- gSavedPerAccountSettings.setString("SoundUploadFolder", mUUIDs.front().asString());
- }
- else if (param == "animation")
- {
- gSavedPerAccountSettings.setString("AnimationUploadFolder", mUUIDs.front().asString());
- }
+ LLInventoryAction::fileUploadLocation(mUUIDs.front(), param);
+}
+
+bool LLInventoryGalleryContextMenu::isUploadLocationSelected(const LLSD& userdata)
+{
+ const std::string param = userdata.asString();
+ return LLInventoryAction::isFileUploadLocation(mUUIDs.front(), param);
}
bool LLInventoryGalleryContextMenu::canSetUploadLocation(const LLSD& userdata)
@@ -618,20 +624,23 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
bool has_children = false;
bool is_full_perm_item = false;
bool is_copyable = false;
- LLViewerInventoryItem* selected_item = gInventory.getItem(selected_id);
+
+ LLViewerInventoryCategory* selected_category = nullptr;
+ LLViewerInventoryItem* selected_item = nullptr;
if(is_folder)
{
- LLInventoryCategory* category = gInventory.getCategory(selected_id);
- if (category)
+ selected_category = dynamic_cast<LLViewerInventoryCategory*>(obj);
+ if (selected_category)
{
- folder_type = category->getPreferredType();
+ folder_type = selected_category->getPreferredType();
is_system_folder = LLFolderType::lookupIsProtectedType(folder_type);
has_children = (gInventory.categoryHasChildren(selected_id) != LLInventoryModel::CHILDREN_NO);
}
}
else
{
+ selected_item = dynamic_cast<LLViewerInventoryItem*>(obj);
if (selected_item)
{
is_full_perm_item = selected_item->getIsFullPerm();
@@ -750,8 +759,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
{
if (is_agent_inventory && !is_inbox && !is_cof && !is_in_favorites && !is_outfits && !is_in_outfits)
{
- LLViewerInventoryCategory* category = gInventory.getCategory(selected_id);
- if (!category || !LLFriendCardsManager::instance().isCategoryInFriendFolder(category))
+ if (!selected_category || !LLFriendCardsManager::instance().isCategoryInFriendFolder(selected_category))
{
items.push_back(std::string("New Folder"));
}
@@ -779,6 +787,22 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
if (inventory_linking)
{
items.push_back(std::string("Paste As Link"));
+
+ if (selected_item)
+ {
+ if (!LLAssetType::lookupCanLink(selected_item->getActualType()))
+ {
+ disabled_items.push_back(std::string("Paste As Link"));
+ }
+ else if (gInventory.isObjectDescendentOf(selected_item->getUUID(), gInventory.getLibraryRootFolderID()))
+ {
+ disabled_items.push_back(std::string("Paste As Link"));
+ }
+ }
+ else if (selected_category && LLFolderType::lookupIsProtectedType(selected_category->getPreferredType()))
+ {
+ disabled_items.push_back(std::string("Paste As Link"));
+ }
}
}
if (is_folder && is_agent_inventory)
@@ -789,6 +813,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
{
items.push_back(std::string("New Folder"));
}
+ items.push_back(std::string("upload_options"));
items.push_back(std::string("upload_def"));
}
@@ -810,6 +835,18 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
}
}
+ if (!is_trash && !is_in_trash && gInventory.getRootFolderID() != selected_id)
+ {
+ if (get_is_favorite(obj))
+ {
+ items.push_back(std::string("Remove from Favorites"));
+ }
+ else
+ {
+ items.push_back(std::string("Add to Favorites"));
+ }
+ }
+
items.push_back(std::string("Subfolder Separator"));
if (!is_system_folder && !isRootFolder() && !is_outfits)
{
@@ -855,6 +892,17 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
if(is_agent_inventory)
{
items.push_back(std::string("Cut"));
+ if (!is_in_trash)
+ {
+ if (get_is_favorite(obj))
+ {
+ items.push_back(std::string("Remove from Favorites"));
+ }
+ else
+ {
+ items.push_back(std::string("Add to Favorites"));
+ }
+ }
if (!is_link || !is_cof || !get_is_item_worn(selected_id))
{
items.push_back(std::string("Delete"));
@@ -993,6 +1041,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
}
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"));
}
@@ -1014,9 +1063,8 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
{
if (is_folder)
{
- LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id);
- if (cat
- && !LLFolderType::lookupIsProtectedType(cat->getPreferredType())
+ if (selected_category
+ && !LLFolderType::lookupIsProtectedType(selected_category->getPreferredType())
&& gInventory.isObjectDescendentOf(selected_id, gInventory.getRootFolderID()))
{
can_list = true;
@@ -1043,6 +1091,15 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
disabled_items.push_back(std::string("Marketplace Move"));
}
}
+
+ if (get_is_favorite(obj))
+ {
+ items.push_back(std::string("Remove from Favorites"));
+ }
+ else if (is_agent_inventory)
+ {
+ items.push_back(std::string("Add to Favorites"));
+ }
}
hide_context_entries(*menu, items, disabled_items);