From 735ae02583558544a4a3b65f72cdf52fe7d27677 Mon Sep 17 00:00:00 2001 From: pavelkproductengine Date: Tue, 30 May 2017 20:35:05 +0300 Subject: MAINT-7356 Feature - Force item delete warning to prompt once per session --- indra/newview/llinventoryfunctions.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index bccc654fbf..2bb6fb853c 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -92,6 +92,8 @@ BOOL LLInventoryState::sWearNewClothing = FALSE; LLUUID LLInventoryState::sWearNewClothingTransactionID; std::list LLInventoryAction::sMarketplaceFolders; +const int LLInventoryAction::sConfirmOnDeleteItemsNumber = 5; + // Helper function : callback to update a folder after inventory action happened in the background void update_folder_cb(const LLUUID& dest_folder) { @@ -2297,6 +2299,33 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root { LLSD args; args["QUESTION"] = LLTrans::getString(root->getSelectedCount() > 1 ? "DeleteItems" : "DeleteItem"); + static bool sDisplayedAtSession = false; + std::set::iterator set_iter = selected_items.begin(); + LLFolderViewModelItemInventory * viewModel = NULL; + bool has_folder_items = false; + for (; set_iter != selected_items.end(); ++set_iter) + { + viewModel = dynamic_cast((*set_iter)->getViewModelItem()); + if (viewModel && viewModel->hasChildren()) + { + has_folder_items = true; + break; + } + } + if (root->getSelectedCount() >= sConfirmOnDeleteItemsNumber || has_folder_items) + { + bool ignore = !(LLUI::sSettingGroups["ignores"]->getBOOL("DeleteItems")); + if (ignore) + { + + if (!sDisplayedAtSession) + { + LLUI::sSettingGroups["ignores"]->setBOOL("DeleteItems", TRUE); + sDisplayedAtSession = true; + } + + } + } LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle())); // Note: marketplace listings will be updated in the callback if delete confirmed return; -- cgit v1.2.3 From d7edeb2df8b225c39727bf506b4e5126852e2d5d Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Fri, 2 Jun 2017 16:44:00 +0200 Subject: STORM-2149: Add a warning notification when deleting a folder of filtered content --- indra/newview/llinventoryfunctions.cpp | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 2bb6fb853c..90d6e9b8a8 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -2297,15 +2297,12 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root if ("delete" == action) { - LLSD args; - args["QUESTION"] = LLTrans::getString(root->getSelectedCount() > 1 ? "DeleteItems" : "DeleteItem"); static bool sDisplayedAtSession = false; - std::set::iterator set_iter = selected_items.begin(); - LLFolderViewModelItemInventory * viewModel = NULL; + bool has_folder_items = false; - for (; set_iter != selected_items.end(); ++set_iter) + for (std::set::iterator set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter) { - viewModel = dynamic_cast((*set_iter)->getViewModelItem()); + LLFolderViewModelItemInventory * viewModel = dynamic_cast((*set_iter)->getViewModelItem()); if (viewModel && viewModel->hasChildren()) { has_folder_items = true; @@ -2317,16 +2314,34 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root bool ignore = !(LLUI::sSettingGroups["ignores"]->getBOOL("DeleteItems")); if (ignore) { - if (!sDisplayedAtSession) { LLUI::sSettingGroups["ignores"]->setBOOL("DeleteItems", TRUE); sDisplayedAtSession = true; } - } } - LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle())); + + LLAllDescendentsPassedFilter f; + for (std::set::iterator it = selected_items.begin(); (it != selected_items.end()) && (f.allDescendentsPassedFilter()); ++it) + { + if (LLFolderViewFolder* folder = dynamic_cast(*it)) + { + folder->applyFunctorRecursively(f); + } + } + + // Fall through to the generic confirmation if the user choose to ignore the specialized one + if ( (!f.allDescendentsPassedFilter()) && (!LLNotifications::instance().getIgnored("DeleteFilteredItems")) ) + { + LLNotificationsUtil::add("DeleteFilteredItems", LLSD(), LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle())); + } + else + { + LLSD args; + args["QUESTION"] = LLTrans::getString(root->getSelectedCount() > 1 ? "DeleteItems" : "DeleteItem"); + LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle())); + } // Note: marketplace listings will be updated in the callback if delete confirmed return; } -- cgit v1.2.3 From 2efa40fa6089dabbaccc228d331679c8c92f797f Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Fri, 21 Jul 2017 05:29:51 +0300 Subject: MAINT-7356 Logic fix and cleanup --- indra/newview/llinventoryfunctions.cpp | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 90d6e9b8a8..d282240bfb 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -92,8 +92,6 @@ BOOL LLInventoryState::sWearNewClothing = FALSE; LLUUID LLInventoryState::sWearNewClothingTransactionID; std::list LLInventoryAction::sMarketplaceFolders; -const int LLInventoryAction::sConfirmOnDeleteItemsNumber = 5; - // Helper function : callback to update a folder after inventory action happened in the background void update_folder_cb(const LLUUID& dest_folder) { @@ -2298,29 +2296,6 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root if ("delete" == action) { static bool sDisplayedAtSession = false; - - bool has_folder_items = false; - for (std::set::iterator set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter) - { - LLFolderViewModelItemInventory * viewModel = dynamic_cast((*set_iter)->getViewModelItem()); - if (viewModel && viewModel->hasChildren()) - { - has_folder_items = true; - break; - } - } - if (root->getSelectedCount() >= sConfirmOnDeleteItemsNumber || has_folder_items) - { - bool ignore = !(LLUI::sSettingGroups["ignores"]->getBOOL("DeleteItems")); - if (ignore) - { - if (!sDisplayedAtSession) - { - LLUI::sSettingGroups["ignores"]->setBOOL("DeleteItems", TRUE); - sDisplayedAtSession = true; - } - } - } LLAllDescendentsPassedFilter f; for (std::set::iterator it = selected_items.begin(); (it != selected_items.end()) && (f.allDescendentsPassedFilter()); ++it) @@ -2330,7 +2305,6 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root folder->applyFunctorRecursively(f); } } - // Fall through to the generic confirmation if the user choose to ignore the specialized one if ( (!f.allDescendentsPassedFilter()) && (!LLNotifications::instance().getIgnored("DeleteFilteredItems")) ) { @@ -2338,6 +2312,12 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root } else { + if (!sDisplayedAtSession) // ask for the confirmation at least once per session + { + LLNotifications::instance().setIgnored("DeleteItems", false); + sDisplayedAtSession = true; + } + LLSD args; args["QUESTION"] = LLTrans::getString(root->getSelectedCount() > 1 ? "DeleteItems" : "DeleteItem"); LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle())); -- cgit v1.2.3