From e8ea398e123be29227275e8ca5b1d2d0ce7f1e4f Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Mon, 22 Dec 2014 16:33:47 -0800
Subject: [PATCH] DD-282 : Suppress Unassociate menu item. Confirm when
 cutting, deleting or moving a listing

---
 indra/newview/llinventorybridge.cpp                 |  9 ++++++---
 indra/newview/llinventoryfunctions.cpp              |  6 ++++++
 .../newview/skins/default/xui/en/menu_inventory.xml |  8 --------
 .../newview/skins/default/xui/en/notifications.xml  | 13 +++++++++++++
 4 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 62612c1450b..1f1017d78e9 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -887,7 +887,6 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags,
         // Options available at the Listing Folder level
         items.push_back(std::string("Marketplace Create Listing"));
         items.push_back(std::string("Marketplace Associate Listing"));
-        items.push_back(std::string("Marketplace Disassociate Listing"));
         items.push_back(std::string("Marketplace List"));
         items.push_back(std::string("Marketplace Unlist"));
         if (LLMarketplaceData::instance().isUpdating(mUUID))
@@ -895,7 +894,6 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags,
             // During SLM update, disable all marketplace related options
             disabled_items.push_back(std::string("Marketplace Create Listing"));
             disabled_items.push_back(std::string("Marketplace Associate Listing"));
-            disabled_items.push_back(std::string("Marketplace Disassociate Listing"));
             disabled_items.push_back(std::string("Marketplace List"));
             disabled_items.push_back(std::string("Marketplace Unlist"));
         }
@@ -928,7 +926,6 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags,
             }
             else
             {
-                disabled_items.push_back(std::string("Marketplace Disassociate Listing"));
                 disabled_items.push_back(std::string("Marketplace List"));
                 disabled_items.push_back(std::string("Marketplace Unlist"));
                 if (gSavedSettings.getBOOL("MarketplaceListingsLogging"))
@@ -2585,6 +2582,12 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
                     LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_dropCategoryIntoFolder, this, _1, _2, inv_cat));
                     return true;
                 }
+                if (move_is_from_marketplacelistings && LLMarketplaceData::instance().isListed(cat_id))
+                {
+                    // Moving a whole listing folder will result in archival of SLM data. Ask confirmation.
+                    LLNotificationsUtil::add("ConfirmListingCutOrDelete", 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)
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index ddcaf9d2bdb..1a75ebbbac5 100755
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -2194,6 +2194,12 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
                 LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, model, root, action));
                 return;
             }
+            // Cutting or deleting a whole listing needs confirmation as SLM will be archived and inaccessible to the user
+            else if (LLMarketplaceData::instance().isListed(viewModel->getUUID()) && (("cut" == action) || ("delete" == action)))
+            {
+                LLNotificationsUtil::add("ConfirmListingCutOrDelete", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, model, root, action));
+                return;
+           }
         }
     }
     
diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml
index e28a02550ff..63f408c05c5 100755
--- a/indra/newview/skins/default/xui/en/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory.xml
@@ -21,14 +21,6 @@
         parameter="marketplace_associate_listing" />
 	</menu_item_call>
 	<menu_item_call
-        label="Unassociate listing"
-        layout="topleft"
-        name="Marketplace Disassociate Listing">
-		<menu_item_call.on_click
-        function="Inventory.DoToSelected"
-        parameter="marketplace_disassociate_listing" />
-	</menu_item_call>
-	<menu_item_call
         label="Get (Refresh) listing"
         layout="topleft"
         name="Marketplace Get Listing">
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 5b0bdc4a0d7..4d856ed8a74 100755
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -369,6 +369,19 @@ Initialization with the Marketplace failed because of a system or network error.
         yestext="OK"/>
     </notification>
 
+    <notification
+        icon="alertmodal.tga"
+        name="ConfirmListingCutOrDelete"
+        type="alertmodal">
+        Moving or deleting a listing folder will delete your Marketplace listing. If you would like to keep the Marketplace listing, move or delete the contents of the version folder you would like to modify. Do you want to continue?
+        <tag>confirm</tag>
+        <usetemplate
+        ignoretext="Confirm before I move or delete a listing from the marketplace"
+        name="okcancelignore"
+        notext="Cancel"
+        yestext="OK"/>
+    </notification>
+    
     <notification
         icon="alertmodal.tga"
         name="ConfirmMerchantUnlist"
-- 
GitLab