summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryfunctions.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-04-23 23:28:58 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-04-27 00:39:49 +0300
commit384d694aba523218490ec48c22d97b63acbffd6f (patch)
tree927ba7855b75ff603bfa312da4365ce102963457 /indra/newview/llinventoryfunctions.cpp
parenta0b0f207779d1c8c3354af0a41d05dc6b188a033 (diff)
viewer#1300 Inventory favorites context menu
Diffstat (limited to 'indra/newview/llinventoryfunctions.cpp')
-rw-r--r--indra/newview/llinventoryfunctions.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index ea0566f5c4..b95d75a782 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -2344,6 +2344,26 @@ void ungroup_folder_items(const LLUUID& folder_id)
gInventory.notifyObservers();
}
+void set_favorite(const LLUUID& obj_id, bool favorite)
+{
+ LLInventoryObject* obj = gInventory.getObject(obj_id);
+ if (obj->getIsFavorite() != favorite)
+ {
+ LLSD updates;
+ updates["favorite"] = LLSD().with("toggled", favorite);
+ LLViewerInventoryCategory* view_folder = dynamic_cast<LLViewerInventoryCategory*>(obj);
+ if (view_folder)
+ {
+ update_inventory_category(obj_id, updates, NULL);
+ }
+ LLViewerInventoryItem* view_item = dynamic_cast<LLViewerInventoryItem*>(obj);
+ if (view_item)
+ {
+ update_inventory_item(obj_id, updates, NULL);
+ }
+ }
+}
+
std::string get_searchable_description(LLInventoryModel* model, const LLUUID& item_id)
{
if (model)
@@ -3322,6 +3342,20 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
ungroup_folder_items(*ids.begin());
}
}
+ else if ("add_to_favorites" == action)
+ {
+ for (const LLUUID& id : ids)
+ {
+ set_favorite(id, true);
+ }
+ }
+ else if ("remove_from_favorites" == action)
+ {
+ for (const LLUUID& id : ids)
+ {
+ set_favorite(id, false);
+ }
+ }
else
{
std::set<LLFolderViewItem*>::iterator set_iter;