summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-10-04 22:15:53 -0700
committerMerov Linden <merov@lindenlab.com>2014-10-04 22:15:53 -0700
commit31d5383417000738a29c8f664124e140b1afce5d (patch)
treea2caf3dcf7439bcae8f9e6f965b095d52dcaf9cc /indra/newview
parent86e16d49b44f7ece4232388ce6f920352d1b5984 (diff)
DD-213 : Differentiate pasting from moving when verifying if action is legit. Also takes into account moving within the same version folder when moving items
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llinventorybridge.cpp4
-rwxr-xr-xindra/newview/llinventoryfunctions.cpp12
-rwxr-xr-xindra/newview/llinventoryfunctions.h4
3 files changed, 13 insertions, 7 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index e77326dbf4..fa49f23364 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -3419,11 +3419,11 @@ void LLFolderBridge::perform_pasteFromClipboard()
LLInventoryItem *item = model->getItem(item_id);
LLInventoryCategory *cat = model->getCategory(item_id);
- if (item && !can_move_item_to_marketplace(master_folder, dest_folder, item, error_msg, objects.size()))
+ if (item && !can_move_item_to_marketplace(master_folder, dest_folder, item, error_msg, objects.size(), true))
{
break;
}
- if (cat && !can_move_folder_to_marketplace(master_folder, dest_folder, cat, error_msg, objects.size()))
+ if (cat && !can_move_folder_to_marketplace(master_folder, dest_folder, cat, error_msg, objects.size(), true, true))
{
break;
}
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 110806f41b..1ca658ebd2 100755
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1084,7 +1084,7 @@ bool has_correct_permissions_for_sale(LLInventoryCategory* cat, std::string& err
// Returns true if inv_item can be dropped in dest_folder, a folder nested in marketplace listings (or merchant inventory) under the root_folder root
// If returns is false, tooltip_msg contains an error message to display to the user (localized and all).
// bundle_size is the amount of sibling items that are getting moved to the marketplace at the same time.
-bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryItem* inv_item, std::string& tooltip_msg, S32 bundle_size)
+bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryItem* inv_item, std::string& tooltip_msg, S32 bundle_size, bool from_paste)
{
// Check stock folder type matches item type in marketplace listings or merchant outbox (even if of no use there for the moment)
LLViewerInventoryCategory* view_folder = dynamic_cast<LLViewerInventoryCategory*>(dest_folder);
@@ -1110,6 +1110,12 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve
if (version_folder)
{
+ if (!from_paste && gInventory.isObjectDescendentOf(inv_item->getUUID(), version_folder->getUUID()))
+ {
+ // Clear those counts or they will be counted twice because we're already inside the version category
+ existing_item_count = 0;
+ }
+
LLInventoryModel::cat_array_t existing_categories;
LLInventoryModel::item_array_t existing_items;
@@ -1134,7 +1140,7 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve
// Returns true if inv_cat can be dropped in dest_folder, a folder nested in marketplace listings (or merchant inventory) under the root_folder root
// If returns is false, tooltip_msg contains an error message to display to the user (localized and all).
// bundle_size is the amount of sibling items that are getting moved to the marketplace at the same time.
-bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryCategory* inv_cat, std::string& tooltip_msg, S32 bundle_size, bool check_items)
+bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryCategory* inv_cat, std::string& tooltip_msg, S32 bundle_size, bool check_items, bool from_paste)
{
bool accept = true;
@@ -1171,7 +1177,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn
if (version_folder)
{
- if (gInventory.isObjectDescendentOf(inv_cat->getUUID(), version_folder->getUUID()))
+ if (!from_paste && gInventory.isObjectDescendentOf(inv_cat->getUUID(), version_folder->getUUID()))
{
// Clear those counts or they will be counted twice because we're already inside the version category
dragged_folder_count = 0;
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index bd183172fe..b2497fb055 100755
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -76,8 +76,8 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold
typedef boost::function<void(std::string& validation_message, LLError::ELevel log_level)> validation_callback_t;
-bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryItem* inv_item, std::string& tooltip_msg, S32 bundle_size = 1);
-bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryCategory* inv_cat, std::string& tooltip_msg, S32 bundle_size = 1, bool check_items = true);
+bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryItem* inv_item, std::string& tooltip_msg, S32 bundle_size = 1, bool from_paste = false);
+bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryCategory* inv_cat, std::string& tooltip_msg, S32 bundle_size = 1, bool check_items = true, bool from_paste = false);
bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy = false);
bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false);
bool validate_marketplacelistings(LLInventoryCategory* inv_cat, validation_callback_t cb = NULL, bool fix_hierarchy = true);