summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-04-16 02:28:25 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-04-17 00:22:33 +0300
commit505ed20da32df3ab96f8b199e30be3c50e88a1e2 (patch)
treedb37b62ae652ab725634928ceded9d0d61b248af /indra
parent79b560dcfb33f71da04ecc6c1290e39819ecaf11 (diff)
viewer#1216 Library settings can be deleted via My Environments
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatermyenvironment.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp
index bc12a5707c..9f42655c83 100644
--- a/indra/newview/llfloatermyenvironment.cpp
+++ b/indra/newview/llfloatermyenvironment.cpp
@@ -399,6 +399,30 @@ bool LLFloaterMyEnvironment::canApply(const std::string &context)
return false;
}
+bool can_delete(const LLUUID& id)
+{
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if (id == trash_id || gInventory.isObjectDescendentOf(id, trash_id))
+ {
+ return false;
+ }
+
+ LLViewerInventoryCategory* cat = gInventory.getCategory(id);
+ if (cat)
+ {
+ if (!get_is_category_removable(&gInventory, id))
+ {
+ return false;
+ }
+ }
+ else if (!get_is_item_removable(&gInventory, id))
+ {
+ return false;
+ }
+
+ return true;
+}
+
//-------------------------------------------------------------------------
void LLFloaterMyEnvironment::refreshButtonStates()
{
@@ -409,7 +433,14 @@ void LLFloaterMyEnvironment::refreshButtonStates()
getChild<LLUICtrl>(BUTTON_GEAR)->setEnabled(settings_ok);
getChild<LLUICtrl>(BUTTON_NEWSETTINGS)->setEnabled(true);
- getChild<LLUICtrl>(BUTTON_DELETE)->setEnabled(settings_ok && !selected.empty());
+
+ bool enable_delete = false;
+ if(settings_ok && !selected.empty())
+ {
+ enable_delete = can_delete(selected.front());
+ }
+
+ getChild<LLUICtrl>(BUTTON_DELETE)->setEnabled(enable_delete);
}
//-------------------------------------------------------------------------