From dcd1b45d2e25a68c2e3f2d199d204b669891244d Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 28 Apr 2017 15:39:04 +0300 Subject: MAINT-7354 Trash alert should display trash, not prompt to purge it all --- indra/newview/llinventorymodel.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 855f7c750e..8a605ff574 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -41,6 +41,7 @@ #include "llinventoryfunctions.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" +#include "llfloaterpreviewtrash.h" #include "llnotificationsutil.h" #include "llmarketplacefunctions.h" #include "llwindow.h" @@ -3299,9 +3300,7 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) } //---------------------------------------------------------------------------- - // Trash: LLFolderType::FT_TRASH, "ConfirmEmptyTrash" -// Trash: LLFolderType::FT_TRASH, "TrashIsFull" when trash exceeds maximum capacity // Lost&Found: LLFolderType::FT_LOST_AND_FOUND, "ConfirmEmptyLostAndFound" bool LLInventoryModel::callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type) @@ -3415,13 +3414,24 @@ void LLInventoryModel::removeObject(const LLUUID& object_id) } } +bool callback_preview_trash_folder(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) // YES + { + LLFloaterPreviewTrash::show(); + } + return false; +} + void LLInventoryModel::checkTrashOverflow() { static const U32 trash_max_capacity = gSavedSettings.getU32("InventoryTrashMaxCapacity"); const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); if (getDescendentsCountRecursive(trash_id, trash_max_capacity) >= trash_max_capacity) { - gInventory.emptyFolderType("TrashIsFull", LLFolderType::FT_TRASH); + LLNotificationsUtil::add("TrashIsFull", LLSD(), LLSD(), + boost::bind(callback_preview_trash_folder, _1, _2)); } } -- cgit v1.3 From 00529b31b722d64699615241d95ea492134bc9bf Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 4 May 2017 15:00:33 +0300 Subject: MAINT-7383 Revise notification for Empty Trash / Purge trash action to include number of items being deleted. --- indra/newview/llavataractions.cpp | 28 ++++++++++++++++++++++ indra/newview/llavataractions.h | 3 +++ indra/newview/llinventorymodel.cpp | 9 ++++++- indra/newview/llpanelmaininventory.cpp | 1 + .../skins/default/xui/en/menu_inventory.xml | 3 +-- .../newview/skins/default/xui/en/notifications.xml | 17 ++++++++++--- 6 files changed, 55 insertions(+), 6 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 2045c3e297..0d0861efcc 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -930,6 +930,16 @@ void LLAvatarActions::shareWithAvatars(LLView * panel) } +//static +void LLAvatarActions::purgeSelectedItems() +{ + const std::set inventory_selected_uuids = LLAvatarActions::getInventorySelectedUUIDs(); + if (inventory_selected_uuids.empty()) return; + LLSD args; + args["COUNT"] = (S32)inventory_selected_uuids.size(); + LLNotificationsUtil::add("PurgeSelectedItems", args, LLSD(), &callbackPurgeSelectedItems); +} + // static bool LLAvatarActions::canShareSelectedItems(LLInventoryPanel* inv_panel /* = NULL*/) { @@ -1170,6 +1180,24 @@ bool LLAvatarActions::callbackAddFriendWithMessage(const LLSD& notification, con return false; } +bool LLAvatarActions::callbackPurgeSelectedItems(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + const std::set inventory_selected_uuids = LLAvatarActions::getInventorySelectedUUIDs(); + if (inventory_selected_uuids.empty()) return false; + + std::set::const_iterator it = inventory_selected_uuids.begin(); + const std::set::const_iterator it_end = inventory_selected_uuids.end(); + for (; it != it_end; ++it) + { + remove_inventory_object(*it, NULL); + } + } + return false; +} + // static bool LLAvatarActions::handleKick(const LLSD& notification, const LLSD& response) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 256d44d820..8ff1ef073d 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -125,6 +125,8 @@ public: */ static void shareWithAvatars(LLView * panel); + static void purgeSelectedItems(); + /** * Block/unblock the avatar. */ @@ -243,6 +245,7 @@ public: private: static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); + static bool callbackPurgeSelectedItems(const LLSD& notification, const LLSD& response); static bool handleRemove(const LLSD& notification, const LLSD& response); static bool handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id); static bool handleFreezeAvatar(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 8a605ff574..0fe03583f5 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3318,7 +3318,14 @@ void LLInventoryModel::emptyFolderType(const std::string notification, LLFolderT { if (!notification.empty()) { - LLNotificationsUtil::add(notification, LLSD(), LLSD(), + LLSD args; + if(LLFolderType::FT_TRASH == preferred_type) + { + static const U32 trash_max_capacity = gSavedSettings.getU32("InventoryTrashMaxCapacity"); + const LLUUID trash_id = findCategoryUUIDForType(preferred_type); + args["COUNT"] = (S32)getDescendentsCountRecursive(trash_id, trash_max_capacity); + } + LLNotificationsUtil::add(notification, args, LLSD(), boost::bind(&LLInventoryModel::callbackEmptyFolderType, this, _1, _2, preferred_type)); } else diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index fa946ee5c7..adbcf377c0 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -118,6 +118,7 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p) mCommitCallbackRegistrar.add("Inventory.ResetFilters", boost::bind(&LLPanelMainInventory::resetFilters, this)); mCommitCallbackRegistrar.add("Inventory.SetSortBy", boost::bind(&LLPanelMainInventory::setSortBy, this, _2)); mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this)); + mCommitCallbackRegistrar.add("Inventory.Purge", boost::bind(&LLAvatarActions::purgeSelectedItems)); mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(FALSE); diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index e1f9269c70..7b3a9a2e3e 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -518,8 +518,7 @@ layout="topleft" name="Purge Item"> + function="Inventory.Purge"/> + +[COUNT] item(s) will be permanently deleted. Are you sure you want to permanently delete selected item(s) from your Trash? + confirm + + + -Are you sure you want to permanently delete the contents of your Trash? +[COUNT] items will be permanently deleted. Are you sure you want to permanently delete the contents of your Trash? confirm -- cgit v1.3 From fb7be87bebd785a7a3e7a7b59103bc952d98dc83 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 8 May 2017 18:05:10 +0300 Subject: MAINT-7354 correction to misbehaving 'purge' and notification spam. --- indra/newview/llfloaterpreviewtrash.cpp | 8 +++++++- indra/newview/llfloaterpreviewtrash.h | 1 + indra/newview/llinventorymodel.cpp | 12 ++++++++++-- indra/newview/llinventorypanel.cpp | 16 ++++++++++++++++ indra/newview/llinventorypanel.h | 1 + 5 files changed, 35 insertions(+), 3 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llfloaterpreviewtrash.cpp b/indra/newview/llfloaterpreviewtrash.cpp index 084e914c9e..717d0ddcad 100644 --- a/indra/newview/llfloaterpreviewtrash.cpp +++ b/indra/newview/llfloaterpreviewtrash.cpp @@ -60,7 +60,13 @@ LLFloaterPreviewTrash::~LLFloaterPreviewTrash() // static void LLFloaterPreviewTrash::show() { - LLFloaterReg::showTypedInstance("preview_trash"); + LLFloaterReg::showTypedInstance("preview_trash", LLSD(), TRUE); +} + +// static +bool LLFloaterPreviewTrash::isVisible() +{ + return LLFloaterReg::instanceVisible("preview_trash"); } diff --git a/indra/newview/llfloaterpreviewtrash.h b/indra/newview/llfloaterpreviewtrash.h index 6fc0fe6928..465c0c677f 100644 --- a/indra/newview/llfloaterpreviewtrash.h +++ b/indra/newview/llfloaterpreviewtrash.h @@ -35,6 +35,7 @@ class LLFloaterPreviewTrash { public: static void show(); + static bool isVisible(); LLFloaterPreviewTrash(const LLSD& key); ~LLFloaterPreviewTrash(); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 0fe03583f5..e5fd126d53 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3437,8 +3437,16 @@ void LLInventoryModel::checkTrashOverflow() const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); if (getDescendentsCountRecursive(trash_id, trash_max_capacity) >= trash_max_capacity) { - LLNotificationsUtil::add("TrashIsFull", LLSD(), LLSD(), - boost::bind(callback_preview_trash_folder, _1, _2)); + if (LLFloaterPreviewTrash::isVisible()) + { + // bring to front + LLFloaterPreviewTrash::show(); + } + else + { + LLNotificationsUtil::add("TrashIsFull", LLSD(), LLSD(), + boost::bind(callback_preview_trash_folder, _1, _2)); + } } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 9de0633edb..a00dcf02ab 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -168,6 +168,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this)); mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this)); mCommitCallbackRegistrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryPanel::fileUploadLocation, this, _2)); + mCommitCallbackRegistrar.add("Inventory.Purge", boost::bind(&LLInventoryPanel::purgeSelectedItems, this)); } LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id ) @@ -1211,6 +1212,21 @@ void LLInventoryPanel::fileUploadLocation(const LLSD& userdata) } } +void LLInventoryPanel::purgeSelectedItems() +{ + const std::set inventory_selected = mFolderRoot.get()->getSelectionList(); + if (inventory_selected.empty()) return; + + std::set::const_iterator it = inventory_selected.begin(); + const std::set::const_iterator it_end = inventory_selected.end(); + for (; it != it_end; ++it) + { + LLUUID item_id = static_cast((*it)->getViewModelItem())->getUUID(); + remove_inventory_object(item_id, NULL); + } +} + + bool LLInventoryPanel::attachObject(const LLSD& userdata) { // Copy selected item UUIDs to a vector. diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 5cb9dde47a..7f63ea97cc 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -202,6 +202,7 @@ public: void doCreate(const LLSD& userdata); bool beginIMSession(); void fileUploadLocation(const LLSD& userdata); + void purgeSelectedItems(); bool attachObject(const LLSD& userdata); static void idle(void* user_data); -- cgit v1.3