diff options
author | Leslie Linden <leslie@lindenlab.com> | 2012-01-12 17:01:23 -0800 |
---|---|---|
committer | Leslie Linden <leslie@lindenlab.com> | 2012-01-12 17:01:23 -0800 |
commit | ba41aea4b2813ac96cad2bae7c82da6e5eefd63a (patch) | |
tree | 3a57c449c2c37ebdea3242d0158c77751cac0740 /indra | |
parent | ec2b0e3af34bee7870283e5af2d16f879ad68f1b (diff) |
EXP-1795 FIX -- Update warning dialog for dragging and dropping no-copy items to Merchant Outbox
* Any drag and drop or copy operation to the merchant outbox that contains one
or more no-copy items now brings up a single modal dialog prompting the user
to move the no-copy items to the outbox or to leave them all behind.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 60 | ||||
-rw-r--r-- | indra/newview/llinventoryfunctions.h | 4 | ||||
-rw-r--r-- | indra/newview/lltooldraganddrop.cpp | 8 | ||||
-rw-r--r-- | indra/newview/lltooldraganddrop.h | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 11 |
6 files changed, 66 insertions, 28 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 1d7406883c..11e22d5226 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1323,7 +1323,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) if (!itemp) return; const LLUUID outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false); - copy_item_to_outbox(itemp, outbox_id, LLUUID::null); + copy_item_to_outbox(itemp, outbox_id, LLUUID::null, LLToolDragAndDrop::getOperationId()); } } @@ -2221,7 +2221,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } else if (move_is_into_outbox && !move_is_from_outbox) { - copy_folder_to_outbox(inv_cat, mUUID, cat_id); + copy_folder_to_outbox(inv_cat, mUUID, cat_id, LLToolDragAndDrop::getOperationId()); } else { @@ -2655,7 +2655,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) if (!cat) return; const LLUUID outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false); - copy_folder_to_outbox(cat, outbox_id, cat->getUUID()); + copy_folder_to_outbox(cat, outbox_id, cat->getUUID(), LLToolDragAndDrop::getOperationId()); } #if ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU else if (isMarketplaceSendAction(action)) @@ -3694,7 +3694,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else { - copy_item_to_outbox(inv_item, mUUID, LLUUID::null); + copy_item_to_outbox(inv_item, mUUID, LLUUID::null, LLToolDragAndDrop::getOperationId()); } } // NORMAL or TRASH folder diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index e8efac1ebf..7672f7e674 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -82,6 +82,8 @@ #include "llvoavatarself.h" #include "llwearablelist.h" +#include <boost/foreach.hpp> + BOOL LLInventoryState::sWearNewClothing = FALSE; LLUUID LLInventoryState::sWearNewClothingTransactionID; @@ -535,13 +537,10 @@ void open_outbox() LLFloaterReg::showInstance("outbox"); } -void move_to_outbox_cb(const LLSD& notification, const LLSD& response) +void move_to_outbox_cb_action(const LLSD& payload) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option != 0) return; // canceled - - LLViewerInventoryItem * viitem = gInventory.getItem(notification["payload"]["item_id"].asUUID()); - LLUUID dest_folder_id = notification["payload"]["dest_folder_id"].asUUID(); + LLViewerInventoryItem * viitem = gInventory.getItem(payload["item_id"].asUUID()); + LLUUID dest_folder_id = payload["dest_folder_id"].asUUID(); if (viitem) { @@ -560,12 +559,12 @@ void move_to_outbox_cb(const LLSD& notification, const LLSD& response) dest_folder_id, false); - LLUUID top_level_folder = notification["payload"]["top_level_folder"].asUUID(); + LLUUID top_level_folder = payload["top_level_folder"].asUUID(); if (top_level_folder != LLUUID::null) { LLViewerInventoryCategory* category; - + while (parent.notNull()) { LLInventoryModel::cat_array_t* cat_array; @@ -593,20 +592,41 @@ void move_to_outbox_cb(const LLSD& notification, const LLSD& response) parent = next_parent; } } - + open_outbox(); } } +static S32 move_to_outbox_operation_id = -1; +static std::list<LLSD> move_to_outbox_payloads; + +void move_to_outbox_cb(const LLSD& notification, const LLSD& response) +{ + const S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if (option == 0) + { + llassert(move_to_outbox_payloads.size() > 0); + + BOOST_FOREACH(const LLSD& payload, move_to_outbox_payloads) + { + move_to_outbox_cb_action(payload); + } + } + + move_to_outbox_operation_id = -1; + move_to_outbox_payloads.clear(); +} + -void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LLUUID& top_level_folder) +void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LLUUID& top_level_folder, S32 operation_id) { // Collapse links directly to items/folders LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item; LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory(); if (linked_category != NULL) { - copy_folder_to_outbox(linked_category, dest_folder, top_level_folder); + copy_folder_to_outbox(linked_category, dest_folder, top_level_folder, operation_id); } else { @@ -639,11 +659,21 @@ void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LL { LLSD args; args["ITEM_NAME"] = inv_item->getName(); + LLSD payload; payload["item_id"] = inv_item->getUUID(); payload["dest_folder_id"] = dest_folder; payload["top_level_folder"] = top_level_folder; - LLNotificationsUtil::add("ConfirmNoCopyToOutbox", args, payload, boost::bind(&move_to_outbox_cb, _1, _2)); + + if (move_to_outbox_operation_id != operation_id) + { + LLNotificationsUtil::add("ConfirmNoCopyToOutbox", args, payload, boost::bind(&move_to_outbox_cb, _1, _2)); + + move_to_outbox_operation_id = operation_id; + move_to_outbox_payloads.clear(); + } + + move_to_outbox_payloads.push_back(payload); } } } @@ -665,7 +695,7 @@ void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder) false); } -void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder) +void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder, S32 operation_id) { LLUUID new_folder_id = gInventory.createNewCategory(dest_folder, LLFolderType::FT_NONE, inv_cat->getName()); gInventory.notifyObservers(); @@ -680,7 +710,7 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) { LLInventoryItem* item = *iter; - copy_item_to_outbox(item, new_folder_id, top_level_folder); + copy_item_to_outbox(item, new_folder_id, top_level_folder, operation_id); } LLInventoryModel::cat_array_t cat_array_copy = *cat_array; @@ -688,7 +718,7 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) { LLViewerInventoryCategory* category = *iter; - copy_folder_to_outbox(category, new_folder_id, top_level_folder); + copy_folder_to_outbox(category, new_folder_id, top_level_folder, operation_id); } open_outbox(); diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 9f0ee0571a..a93446000d 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -74,10 +74,10 @@ void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::s // Generates a string containing the path to the item specified by item_id. void append_path(const LLUUID& id, std::string& path); -void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LLUUID& top_level_folder); +void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LLUUID& top_level_folder, S32 operation_id); void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder); -void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder); +void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder, S32 operation_id); /** Miscellaneous global functions ** ** diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 5a4d177709..8c32dfcb4d 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -282,6 +282,8 @@ void LLCategoryDropDescendentsObserver::done() } */ +S32 LLToolDragAndDrop::sOperationId = 0; + LLToolDragAndDrop::DragAndDropEntry::DragAndDropEntry(dragOrDrop3dImpl f_none, dragOrDrop3dImpl f_self, dragOrDrop3dImpl f_avatar, @@ -644,6 +646,12 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, mToolTipMsg.clear(); + // Increment the operation id for every drop + if (drop) + { + sOperationId++; + } + if (top_view) { handled = TRUE; diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 273d23d1a0..188d36cd1b 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -88,6 +88,7 @@ public: boost::signals2::connection setEndDragCallback( const enddrag_signal_t::slot_type& cb ) { return mEndDragSignal.connect(cb); } uuid_vec_t::size_type getCargoIDsCount() const { return mCargoIDs.size(); } + static S32 getOperationId() { return sOperationId; } protected: enum EDropTarget @@ -127,6 +128,8 @@ protected: LLUUID mSourceID; LLUUID mObjectID; + static S32 sOperationId; + LLVector3d mLastCameraPos; LLVector3d mLastHitPos; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index a7e7436256..1a4dab2ac5 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -203,14 +203,11 @@ Save changes to current clothing/body part? icon="alertmodal.tga" name="ConfirmNoCopyToOutbox" type="alertmodal"> -You don't have permission to copy this item to the Merchant Outbox. You can move it or leave it behind. - -[ITEM_NAME] +You don't have permission to copy one or more of these items to the Merchant Outbox. You can move them or leave them behind. <usetemplate - canceltext="Cancel" - name="yesnocancelbuttons" - notext="Don't move item" - yestext="Move item"/> + name="okcancelbuttons" + notext="Don't move item(s)" + yestext="Move item(s)"/> </notification> <notification |