From a1afe50feb1c42cc21c7f89b4187a8f7abe0c9fc Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Fri, 30 May 2014 12:20:07 -0700
Subject: DD-84 : Prompt the user for active listing edits (Cut, Paste and
 Delete).

---
 indra/newview/llinventoryfunctions.cpp | 36 +++++++++++++++++++++++++++++++---
 indra/newview/llinventoryfunctions.h   |  3 ++-
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index b56383e48f..7a7d910a23 100755
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1912,13 +1912,45 @@ void LLOpenFoldersWithSelection::doFolder(LLFolderViewFolder* folder)
 	}
 }
 
-void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action)
+// Callback for doToSelected if DAMA required...
+void LLInventoryAction::callback_doToSelected(const LLSD& notification, const LLSD& response, class LLInventoryModel* model, class LLFolderView* root, const std::string& action)
+{
+    S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+    if (option == 0) // YES
+    {
+        doToSelected(model, root, action, FALSE);
+    }
+}
+
+void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, BOOL user_confirm)
 {
 	if ("rename" == action)
 	{
 		root->startRenamingSelectedItem();
 		return;
 	}
+    
+	std::set<LLFolderViewItem*> selected_items = root->getSelectionList();
+        
+    // Prompt the user for some marketplace active listing edits
+	if (user_confirm && (("paste" == action) || ("cut" == action) || ("delete" == action)))
+    {
+        std::set<LLFolderViewItem*>::iterator set_iter = selected_items.begin();
+        for (; set_iter != selected_items.end(); ++set_iter)
+        {
+            LLFolderViewModelItemInventory * viewModel = dynamic_cast<LLFolderViewModelItemInventory *>((*set_iter)->getViewModelItem());
+            if (viewModel && LLMarketplaceData::instance().isInActiveFolder(viewModel->getUUID()))
+            {
+                break;
+            }
+        }
+        if (set_iter != selected_items.end())
+        {
+            LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, model, root, action));
+            return;
+        }
+    }
+    
 	if ("delete" == action)
 	{
 		LLSD args;
@@ -1945,8 +1977,6 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
 	}
 
 
-	std::set<LLFolderViewItem*> selected_items = root->getSelectionList();
-
 	LLMultiPreview* multi_previewp = NULL;
 	LLMultiProperties* multi_propertiesp = NULL;
 
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index ae99eb0ad4..5dd317e218 100755
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -445,7 +445,8 @@ public:
 
 struct LLInventoryAction
 {
-	static void doToSelected(class LLInventoryModel* model, class LLFolderView* root, const std::string& action);
+	static void doToSelected(class LLInventoryModel* model, class LLFolderView* root, const std::string& action, BOOL user_confirm = TRUE);
+    static void callback_doToSelected(const LLSD& notification, const LLSD& response, class LLInventoryModel* model, class LLFolderView* root, const std::string& action);
 
 	static void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLFolderView* root);
     static void removeItemFromDND(LLFolderView* root);
-- 
cgit v1.2.3