diff options
author | Merov Linden <merov@lindenlab.com> | 2014-12-26 17:37:48 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-12-26 17:37:48 -0800 |
commit | edbd73b8364f66bfce24701db5cb160ecc89e37d (patch) | |
tree | 2fe8e5c544d00efdd360b19dc3fc9cb28888c06e | |
parent | ddb9d0eeadd9d73a2719dbec2feb9c9226e2f00e (diff) |
DD-296 : Prompt the user when trying to copy a selection containing nocopy items to the marketplace
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 60 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/notifications.xml | 13 |
2 files changed, 72 insertions, 1 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 1a75ebbbac..eab9e027b4 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -130,6 +130,53 @@ S32 count_stock_folders(LLInventoryModel::cat_array_t& categories) return count; } +// Helper function : Returns true if the hierarchy contains nocopy items +bool contains_nocopy_items(const LLUUID& id) +{ + LLInventoryCategory* cat = gInventory.getCategory(id); + + if (cat) + { + // Get the content + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(id,cat_array,item_array); + + // Check all the items: returns true upon encountering a nocopy item + for (LLInventoryModel::item_array_t::iterator iter = item_array->begin(); iter != item_array->end(); iter++) + { + LLInventoryItem* item = *iter; + LLViewerInventoryItem * inv_item = (LLViewerInventoryItem *) item; + if (!inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + return true; + } + } + + // Check all the sub folders recursively + for (LLInventoryModel::cat_array_t::iterator iter = cat_array->begin(); iter != cat_array->end(); iter++) + { + LLViewerInventoryCategory* cat = *iter; + if (contains_nocopy_items(cat->getUUID())) + { + return true; + } + } + } + else + { + LLInventoryItem* item = gInventory.getItem(id); + LLViewerInventoryItem * inv_item = (LLViewerInventoryItem *) item; + if (!inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + return true; + } + } + + // Exit without meeting a nocopy item + return false; +} + // Generates a string containing the path to the item specified by // item_id. void append_path(const LLUUID& id, std::string& path) @@ -2199,7 +2246,18 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root { LLNotificationsUtil::add("ConfirmListingCutOrDelete", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, model, root, action)); return; - } + } + } + } + // Copying to the marketplace needs confirmation if nocopy items are involved + if (user_confirm && ("copy_to_marketplace_listings" == action)) + { + std::set<LLFolderViewItem*>::iterator set_iter = selected_items.begin(); + LLFolderViewModelItemInventory * viewModel = dynamic_cast<LLFolderViewModelItemInventory *>((*set_iter)->getViewModelItem()); + if (contains_nocopy_items(viewModel->getUUID())) + { + LLNotificationsUtil::add("ConfirmCopyToMarketplace", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, model, root, action)); + return; } } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index bb7f296285..6c97772d85 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -397,6 +397,19 @@ Initialization with the Marketplace failed because of a system or network error. <notification icon="alertmodal.tga" + name="ConfirmCopyToMarketplace" + type="alertmodal"> + No copy items contained in that selection will not be copied to the Marketplace. Do you want to continue? + <tag>confirm</tag> + <usetemplate + ignoretext="Confirm before I try to copy a selection containing no copy items to the marketplace" + name="okcancelignore" + notext="Cancel" + yestext="OK"/> + </notification> + + <notification + icon="alertmodal.tga" name="ConfirmMerchantUnlist" type="alertmodal"> This action will unlist this listing. Do you want to continue? |