summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-06-08 12:44:35 +0300
committerMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-06-08 12:44:35 +0300
commit29f52ad1a7c4f0d023c4b6a7dd0d43ea105e8fdb (patch)
tree51353c01386b512dca1dfa2140ffd1c5f3184100 /indra/newview
parent2f8227473514b864f7806af031d3c1168b3279aa (diff)
SL-19845 Show confirmation before deleting an item in Gallery view
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorygallerymenu.cpp45
-rw-r--r--indra/newview/llinventorygallerymenu.h1
2 files changed, 32 insertions, 14 deletions
diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp
index 6dc749fab6..e7f8b10cca 100644
--- a/indra/newview/llinventorygallerymenu.cpp
+++ b/indra/newview/llinventorygallerymenu.cpp
@@ -39,6 +39,7 @@
#include "llmarketplacefunctions.h"
#include "llmenugl.h"
#include "llnotificationsutil.h"
+#include "lltrans.h"
#include "llviewerfoldertype.h"
#include "llviewerwindow.h"
#include "llvoavatarself.h"
@@ -220,20 +221,9 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
}
else if ("delete" == action)
{
- if (is_folder)
- {
- if(get_is_category_removable(&gInventory, selected_id))
- {
- gInventory.removeCategory(selected_id);
- }
- }
- else
- {
- if(get_is_item_removable(&gInventory, selected_id))
- {
- gInventory.removeItem(selected_id);
- }
- }
+ LLSD args;
+ args["QUESTION"] = LLTrans::getString("DeleteItem");
+ LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryGalleryContextMenu::onDelete, _1, _2, selected_id));
}
else if ("copy" == action)
{
@@ -342,6 +332,33 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
}
}
+void LLInventoryGalleryContextMenu::onDelete(const LLSD& notification, const LLSD& response, const LLUUID& selected_id)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ LLInventoryObject* obj = gInventory.getObject(selected_id);
+ if (!obj)
+ {
+ return;
+ }
+ if (obj->getType() == LLAssetType::AT_CATEGORY)
+ {
+ if(get_is_category_removable(&gInventory, selected_id))
+ {
+ gInventory.removeCategory(selected_id);
+ }
+ }
+ else
+ {
+ if(get_is_item_removable(&gInventory, selected_id))
+ {
+ gInventory.removeItem(selected_id);
+ }
+ }
+ }
+}
+
void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
diff --git a/indra/newview/llinventorygallerymenu.h b/indra/newview/llinventorygallerymenu.h
index 67cf9a569a..1c56266310 100644
--- a/indra/newview/llinventorygallerymenu.h
+++ b/indra/newview/llinventorygallerymenu.h
@@ -47,6 +47,7 @@ protected:
void fileUploadLocation(const LLSD& userdata, const LLUUID& selected_id);
+ static void onDelete(const LLSD& notification, const LLSD& response, const LLUUID& selected_id);
static void onRename(const LLSD& notification, const LLSD& response);
private: