diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2017-05-22 21:09:07 +0100 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2017-05-22 21:09:07 +0100 |
commit | 806fd24704b69e5e51dae108952937cc05840f6c (patch) | |
tree | 2047cbf2ad5364b5e803c06b2702216023d2d17d /indra/newview/llinventorypanel.cpp | |
parent | 8528a9ae131dff09865eccd672efce621571c5e5 (diff) | |
parent | 48af8529a80052e9bc42f81f36896739f8aff861 (diff) |
merge
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index bd15ba4975..4b117941a0 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -43,6 +43,7 @@ #include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" +#include "llnotificationsutil.h" #include "llpreview.h" #include "llsidepanelinventory.h" #include "lltrans.h" @@ -1211,6 +1212,33 @@ void LLInventoryPanel::fileUploadLocation(const LLSD& userdata) } } +void LLInventoryPanel::purgeSelectedItems() +{ + const std::set<LLFolderViewItem*> inventory_selected = mFolderRoot.get()->getSelectionList(); + if (inventory_selected.empty()) return; + LLSD args; + args["COUNT"] = (S32)inventory_selected.size(); + LLNotificationsUtil::add("PurgeSelectedItems", args, LLSD(), boost::bind(&LLInventoryPanel::callbackPurgeSelectedItems, this, _1, _2)); +} + +void LLInventoryPanel::callbackPurgeSelectedItems(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + const std::set<LLFolderViewItem*> inventory_selected = mFolderRoot.get()->getSelectionList(); + if (inventory_selected.empty()) return; + + std::set<LLFolderViewItem*>::const_iterator it = inventory_selected.begin(); + const std::set<LLFolderViewItem*>::const_iterator it_end = inventory_selected.end(); + for (; it != it_end; ++it) + { + LLUUID item_id = static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID(); + remove_inventory_object(item_id, NULL); + } + } +} + bool LLInventoryPanel::attachObject(const LLSD& userdata) { // Copy selected item UUIDs to a vector. @@ -1448,6 +1476,11 @@ void LLInventoryPanel::updateSelection() void LLInventoryPanel::doToSelected(const LLSD& userdata) { + if (("purge" == userdata.asString())) + { + purgeSelectedItems(); + return; + } LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), userdata.asString()); return; @@ -1482,7 +1515,9 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) } break; case KEY_DELETE: +#if LL_DARWIN case KEY_BACKSPACE: +#endif // Delete selected items if delete or backspace key hit on the inventory panel // Note: on Mac laptop keyboards, backspace and delete are one and the same if (isSelectionRemovable() && (mask == MASK_NONE)) |