SL-19845 Show confirmation before deleting an item in Gallery view

meow-7.2.2
Maxim Nikolenko 2023-06-08 12:44:35 +03:00
parent 2f82274735
commit 29f52ad1a7
2 changed files with 32 additions and 14 deletions

View File

@ -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);

View File

@ -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: