summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorygallerymenu.cpp
diff options
context:
space:
mode:
authorgwigz <gwigz@users.noreply.github.com>2024-10-08 18:48:54 +0100
committerErik Kundiman <erik@megapahit.org>2024-10-09 11:30:41 +0800
commit0bec080221e1002ef30b01215f7cdafd552c08f2 (patch)
tree0f0e946ad935fdc4fefe78f272b9ae4a1c1c6d17 /indra/newview/llinventorygallerymenu.cpp
parent0efe72e7993a9a23a6f8952368548775cb0ea3ef (diff)
Minimal favorite folder inventory feature
Utilizes the recent-ish "open in new window" functionality from `LLPanelMainInventory::newFolderWindow`
Diffstat (limited to 'indra/newview/llinventorygallerymenu.cpp')
-rw-r--r--indra/newview/llinventorygallerymenu.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp
index dbf4821ca1..0c35a7f695 100644
--- a/indra/newview/llinventorygallerymenu.cpp
+++ b/indra/newview/llinventorygallerymenu.cpp
@@ -92,6 +92,7 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu()
registrar.add("Inventory.DoToSelected", boost::bind(&LLInventoryGalleryContextMenu::doToSelected, this, _2));
registrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::fileUploadLocation, this, _2));
+ registrar.add("Inventory.SetFavoriteFolder", boost::bind(&LLInventoryGalleryContextMenu::setFavoriteFolder, this));
registrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));
registrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND));
registrar.add("Inventory.DoCreate", [this](LLUICtrl*, const LLSD& data)
@@ -110,6 +111,7 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu()
registrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, uuids, gFloaterView->getParentFloater(mGallery)));
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.EnvironmentEnabled", [](LLUICtrl*, const LLSD&)
{
@@ -504,6 +506,25 @@ bool LLInventoryGalleryContextMenu::canSetUploadLocation(const LLSD& userdata)
return true;
}
+void LLInventoryGalleryContextMenu::setFavoriteFolder()
+{
+ gSavedPerAccountSettings.setString("FavoriteFolder", mUUIDs.front().asString());
+}
+
+bool LLInventoryGalleryContextMenu::canSetFavoriteFolder()
+{
+ if (mUUIDs.size() != 1)
+ {
+ return false;
+ }
+ LLInventoryCategory* cat = gInventory.getCategory(mUUIDs.front());
+ if (!cat)
+ {
+ return false;
+ }
+ return true;
+}
+
bool is_inbox_folder(LLUUID item_id)
{
const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX);
@@ -769,6 +790,8 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
items.push_back(std::string("upload_def"));
}
+ items.push_back(std::string("Set favorite folder"));
+
if(is_outfits && !isRootFolder())
{
items.push_back(std::string("New Outfit"));
@@ -843,6 +866,8 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
{
disabled_items.push_back(std::string("Copy"));
}
+
+ disabled_items.push_back(std::string("Set favorite folder"));
}
if((obj->getType() == LLAssetType::AT_SETTINGS)
|| ((obj->getType() <= LLAssetType::AT_GESTURE)