diff options
author | andreykproductengine <akleshchev@productengine.com> | 2015-11-13 19:05:17 +0200 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2015-11-13 19:05:17 +0200 |
commit | 219d6820829d1ed164e6ed96c22b9eec0f69ae91 (patch) | |
tree | 8bb99feb0e8526e46c0f40a65178902fda9e3edd /indra | |
parent | c4a3eb3c421efafba64cef4beff9cab50a3d307e (diff) |
MAINT-5495 FIXED Drag and Drop no copy items from object contents to inventory creates multiple pop ups
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index adc0fced5a..2f392933a9 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -80,6 +80,8 @@ #include "lllandmarkactions.h" #include "llpanellandmarks.h" +#include <boost/shared_ptr.hpp> + void copy_slurl_to_clipboard_callback_inv(const std::string& slurl); typedef std::pair<LLUUID, LLUUID> two_uuids_t; @@ -99,7 +101,7 @@ struct LLMoveInv using namespace LLOldEvents; // Function declarations -bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv*); +bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, boost::shared_ptr<LLMoveInv>); bool confirm_attachment_rez(const LLSD& notification, const LLSD& response); void teleport_via_landmark(const LLUUID& asset_id); static BOOL can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit); @@ -2793,7 +2795,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, return accept; } -void warn_move_inventory(LLViewerObject* object, LLMoveInv* move_inv) +void warn_move_inventory(LLViewerObject* object, boost::shared_ptr<LLMoveInv> move_inv) { const char* dialog = NULL; if (object->flagScripted()) @@ -2804,7 +2806,34 @@ void warn_move_inventory(LLViewerObject* object, LLMoveInv* move_inv) { dialog = "MoveInventoryFromObject"; } - LLNotificationsUtil::add(dialog, LLSD(), LLSD(), boost::bind(move_task_inventory_callback, _1, _2, move_inv)); + + static LLNotificationPtr notification_ptr = NULL; + static boost::shared_ptr<LLMoveInv> inv_ptr; + + // Notification blocks user from interacting with inventories so everything that comes after first message + // is part of this message - don'r show it again + // Note: workaround for MAINT-5495 untill proper refactoring and warning system for Drag&Drop can be made. + if (notification_ptr == NULL + || !notification_ptr->isActive() + || LLNotificationsUtil::find(notification_ptr->getID()) == NULL + || inv_ptr->mCategoryID != move_inv->mCategoryID + || inv_ptr->mObjectID != move_inv->mObjectID) + { + notification_ptr = LLNotificationsUtil::add(dialog, LLSD(), LLSD(), boost::bind(move_task_inventory_callback, _1, _2, move_inv)); + inv_ptr = move_inv; + } + else + { + // Notification is alive and not responded, operating inv_ptr should be safe so attach new data + two_uuids_list_t::iterator move_it; + for (move_it = move_inv->mMoveList.begin(); + move_it != move_inv->mMoveList.end(); + ++move_it) + { + inv_ptr->mMoveList.push_back(*move_it); + } + move_inv.reset(); + } } // Move/copy all inventory items from the Contents folder of an in-world @@ -2892,7 +2921,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, if(drop && accept) { it = inventory_objects.begin(); - LLMoveInv* move_inv = new LLMoveInv; + boost::shared_ptr<LLMoveInv> move_inv(new LLMoveInv); move_inv->mObjectID = object_id; move_inv->mCategoryID = category_id; move_inv->mCallback = callback; @@ -4408,7 +4437,7 @@ LLFontGL::StyleFlags LLMarketplaceFolderBridge::getLabelStyle() const // helper stuff -bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv* move_inv) +bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, boost::shared_ptr<LLMoveInv> move_inv) { LLFloaterOpenObject::LLCatAndWear* cat_and_wear = (LLFloaterOpenObject::LLCatAndWear* )move_inv->mUserData; LLViewerObject* object = gObjectList.findObject(move_inv->mObjectID); @@ -4444,7 +4473,7 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response move_inv->mCallback(option, move_inv->mUserData); } - delete move_inv; + move_inv.reset(); //since notification will persist return false; } @@ -4860,7 +4889,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if (accept && drop) { - LLMoveInv* move_inv = new LLMoveInv; + boost::shared_ptr<LLMoveInv> move_inv (new LLMoveInv()); move_inv->mObjectID = inv_item->getParentUUID(); two_uuids_t item_pair(mUUID, inv_item->getUUID()); move_inv->mMoveList.push_back(item_pair); |