From b9407199462c0b56a7d49c2e19657e87ec149d8c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 29 May 2014 16:56:15 -0700 Subject: DD-84 : WIP : Get DAMA to display for drag and drop. Note that, because of current SLM issues, it works on version folders, active or not. --- indra/newview/llinventorybridge.cpp | 62 ++++++++++++++++++++++++++++---- indra/newview/llinventorybridge.h | 6 ++-- indra/newview/llinventoryfunctions.cpp | 30 +--------------- indra/newview/llmarketplacefunctions.cpp | 11 ++++++ indra/newview/llmarketplacefunctions.h | 1 + 5 files changed, 73 insertions(+), 37 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 4da8fd4b86..29432c26e0 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2317,7 +2317,8 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, BOOL drop, - std::string& tooltip_msg) + std::string& tooltip_msg, + BOOL user_confirm) { LLInventoryModel* model = getInventoryModel(); @@ -2488,6 +2489,16 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (accept && drop) { + // Dropping in or out of marketplace needs (sometimes) confirmation + if (user_confirm && (move_is_from_marketplacelistings || move_is_into_marketplacelistings)) + { + if ((move_is_from_marketplacelistings && LLMarketplaceData::instance().isInActiveFolder(cat_id)) || + (move_is_into_marketplacelistings && LLMarketplaceData::instance().isInActiveFolder(mUUID))) + { + LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_dropCategoryIntoFolder, this, _1, _2, inv_cat)); + return true; + } + } // Look for any gestures and deactivate them if (move_is_into_trash) { @@ -2571,8 +2582,11 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (move_is_from_marketplacelistings) { update_marketplace_category(from_folder_uuid); - // Clear the folder from the marketplace in case it was a listing folder (moot if not listed) - LLMarketplaceData::instance().clearListing(cat_id); + // Clear the folder from the marketplace in case it is a listing folder + if (LLMarketplaceData::instance().isListed(cat_id)) + { + LLMarketplaceData::instance().clearListing(cat_id); + } } } } @@ -3334,8 +3348,11 @@ void LLFolderBridge::pasteFromClipboard() llassert(vicat); if (vicat) { - // Clear the cut folder from the marketplace if it was a listing folder (moot if not listed) - LLMarketplaceData::instance().clearListing(item_id); + // Clear the cut folder from the marketplace if it is a listing folder + if (LLMarketplaceData::instance().isListed(item_id)) + { + LLMarketplaceData::instance().clearListing(item_id); + } if (move_is_into_marketplacelistings) { move_folder_to_marketplacelistings(vicat, parent_id); @@ -4090,12 +4107,35 @@ void LLFolderBridge::dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_c } } +// Callback for drop item if DAMA required... +void LLFolderBridge::callback_dropItemIntoFolder(const LLSD& notification, const LLSD& response, LLInventoryItem* inv_item) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) // YES + { + std::string tooltip_msg; + dragItemIntoFolder(inv_item, TRUE, tooltip_msg, FALSE); + } +} + +// Callback for drop category if DAMA required... +void LLFolderBridge::callback_dropCategoryIntoFolder(const LLSD& notification, const LLSD& response, LLInventoryCategory* inv_category) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) // YES + { + std::string tooltip_msg; + dragCategoryIntoFolder(inv_category, TRUE, tooltip_msg, FALSE); + } +} + // This is used both for testing whether an item can be dropped // into the folder, as well as performing the actual drop, depending // if drop == TRUE. BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, - std::string& tooltip_msg) + std::string& tooltip_msg, + BOOL user_confirm) { LLInventoryModel* model = getInventoryModel(); @@ -4227,6 +4267,16 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { active_panel->unSelectAll(); } + // Dropping in or out of marketplace needs (sometimes) confirmation + if (user_confirm && (move_is_from_marketplacelistings || move_is_into_marketplacelistings)) + { + if ((move_is_from_marketplacelistings && LLMarketplaceData::instance().isInActiveFolder(inv_item->getUUID())) || + (move_is_into_marketplacelistings && LLMarketplaceData::instance().isInActiveFolder(mUUID))) + { + LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_dropItemIntoFolder, this, _1, _2, inv_item)); + return true; + } + } //-------------------------------------------------------------------------------- // Destination folder logic diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 72b92b6911..eeaedc197f 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -263,8 +263,10 @@ public: mIsLoading(false) {} - BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg); - BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop, std::string& tooltip_msg); + BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg, BOOL user_confirm = TRUE); + BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop, std::string& tooltip_msg, BOOL user_confirm = TRUE); + void callback_dropItemIntoFolder(const LLSD& notification, const LLSD& response, LLInventoryItem* inv_item); + void callback_dropCategoryIntoFolder(const LLSD& notification, const LLSD& response, LLInventoryCategory* inv_category); virtual void buildDisplayName() const; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index baf2a40590..b56383e48f 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -1185,8 +1185,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn return accept; } -// Local : perform the move at last... -bool perform_move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) +bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings depth of the destination folder, exit with error if not under marketplace S32 depth = depth_nesting_in_marketplace(dest_folder); @@ -1287,33 +1286,6 @@ bool perform_move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID return true; } -// Local : Callback for the move item if DAMA required... -bool callback_move_item_to_marketplacelistings(const LLSD& notification, const LLSD& response, LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option == 0) // YES - { - return perform_move_item_to_marketplacelistings(inv_item, dest_folder, copy); - } - return false; - } - -// Public interface: Check if confirmation dialog is required (DAMA) and call it or call the move item function directly -bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) -{ - // Merov : Use the following weak test for testing... - //if (LLMarketplaceData::instance().isVersionFolder(dest_folder)) - if (LLMarketplaceData::instance().getActivationState(dest_folder)) - { - LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(callback_move_item_to_marketplacelistings, _1, _2, inv_item, dest_folder, copy)); - return true; - } - else - { - return perform_move_item_to_marketplacelistings(inv_item, dest_folder, copy); - } -} - bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy) { // Check that we have adequate permission on all items being moved. Proceed if we do. diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 957e96e866..75853b2cc0 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -1426,6 +1426,17 @@ bool LLMarketplaceData::isVersionFolder(const LLUUID& folder_id) return false; } +bool LLMarketplaceData::isInActiveFolder(const LLUUID& obj_id) +{ + S32 depth = depth_nesting_in_marketplace(obj_id); + LLUUID listing_uuid = nested_parent_id(obj_id, depth); + // *TODO: use true activation status once SLM is in decent shape again + //bool active = getActivationState(listing_uuid); Hack waiting for SLM to allow activation again... + bool active = true; + LLUUID version_uuid = getVersionFolder(listing_uuid); + return (active && gInventory.isObjectDescendentOf(obj_id, version_uuid)); +} + // Private Modifiers bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id) { diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 8151d3aa40..fd3d9ccfdb 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -198,6 +198,7 @@ public: // Probe the Marketplace data set to identify folders bool isListed(const LLUUID& folder_id); // returns true if folder_id is a Listing folder bool isVersionFolder(const LLUUID& folder_id); // returns true if folder_id is a Version folder + bool isInActiveFolder(const LLUUID& obj_id); // returns true if the obj_id is buried in an active version folder // Access Marketplace data set : each method returns a default value if the argument can't be found bool getActivationState(const LLUUID& folder_id); -- cgit v1.2.3