diff options
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 68 | ||||
-rwxr-xr-x | indra/newview/llinventorybridge.h | 1 | ||||
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 25 | ||||
-rwxr-xr-x | indra/newview/llinventoryfunctions.h | 2 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/notifications.xml | 2 |
5 files changed, 76 insertions, 22 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index c19ed57f2a..61889d3c5e 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -733,14 +733,14 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, disabled_items.push_back(std::string("Cut")); } - if (canListOnMarketplace() && !isMarketplaceListingsFolder()) + if (canListOnMarketplace() && !isMarketplaceListingsFolder() && !isInboxFolder()) { items.push_back(std::string("Marketplace Separator")); if (gMenuHolder->getChild<LLView>("MerchantOutbox")->getVisible()) { items.push_back(std::string("Merchant Copy")); - if (!canListOnMarketplaceNow()) + if (!canListOnOutboxNow()) { disabled_items.push_back(std::string("Merchant Copy")); } @@ -749,6 +749,11 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, { items.push_back(std::string("Marketplace Copy")); items.push_back(std::string("Marketplace Move")); + if (!canListOnMarketplaceNow()) + { + disabled_items.push_back(std::string("Marketplace Copy")); + disabled_items.push_back(std::string("Marketplace Move")); + } } } } @@ -1093,6 +1098,7 @@ BOOL LLInvFVBridge::isCOFFolder() const return LLAppearanceMgr::instance().getIsInCOF(mUUID); } +// *TODO : Suppress isInboxFolder() once Merchant Outbox is fully deprecated BOOL LLInvFVBridge::isInboxFolder() const { const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, false); @@ -1380,7 +1386,7 @@ bool LLInvFVBridge::canListOnMarketplace() const { LLInventoryModel * model = getInventoryModel(); - const LLViewerInventoryCategory * cat = model->getCategory(mUUID); + LLViewerInventoryCategory * cat = model->getCategory(mUUID); if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { return false; @@ -1391,16 +1397,6 @@ bool LLInvFVBridge::canListOnMarketplace() const return false; } - if (getOutboxFolder().isNull()) - { - return false; - } - - if (isInboxFolder() || isOutboxFolder()) - { - return false; - } - LLViewerInventoryItem * item = model->getItem(mUUID); if (item) { @@ -1418,7 +1414,8 @@ bool LLInvFVBridge::canListOnMarketplace() const return true; } -bool LLInvFVBridge::canListOnMarketplaceNow() const +// *TODO : Suppress canListOnOutboxNow() once we deprecate Merchant Outbox completely +bool LLInvFVBridge::canListOnOutboxNow() const { bool can_list = true; @@ -1467,6 +1464,49 @@ bool LLInvFVBridge::canListOnMarketplaceNow() const return can_list; } +bool LLInvFVBridge::canListOnMarketplaceNow() const +{ + bool can_list = true; + + const LLInventoryObject* obj = getInventoryObject(); + can_list &= (obj != NULL); + + if (can_list) + { + const LLUUID& object_id = obj->getLinkedUUID(); + can_list = object_id.notNull(); + + if (can_list) + { + LLFolderViewFolder * object_folderp = mInventoryPanel.get() ? mInventoryPanel.get()->getFolderByID(object_id) : NULL; + if (object_folderp) + { + can_list = !static_cast<LLFolderBridge*>(object_folderp->getViewModelItem())->isLoading(); + } + } + + if (can_list) + { + std::string error_msg; + LLInventoryModel* model = getInventoryModel(); + const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + LLViewerInventoryCategory * master_folder = model->getCategory(marketplacelistings_id); + LLInventoryCategory *cat = model->getCategory(mUUID); + if (cat) + { + can_list = can_move_folder_to_marketplace(master_folder, master_folder, cat, error_msg); + } + else + { + LLInventoryItem *item = model->getItem(mUUID); + can_list = (item ? can_move_item_to_marketplace(master_folder, master_folder, item, error_msg) : false); + } + } + } + + return can_list; +} + LLToolDragAndDrop::ESource LLInvFVBridge::getDragSource() const { if (gInventory.isObjectDescendentOf(getUUID(), gInventory.getRootFolderID())) diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 82cabf43db..5ab956c1cf 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -76,6 +76,7 @@ public: bool canShare() const; bool canListOnMarketplace() const; + bool canListOnOutboxNow() const; bool canListOnMarketplaceNow() const; //-------------------------------------------------------------------- diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index cb41111b6f..40eeb01d54 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -724,6 +724,11 @@ void open_outbox() LLFloaterReg::showInstance("outbox"); } +void open_marketplace_listings() +{ + LLFloaterReg::showInstance("marketplace_listings"); +} + // Create a new folder in destFolderId with the same name as the item name and return the uuid of the new folder // Note: this is used locally in various situation where we need to wrap an item into a special folder LLUUID create_folder_for_item(LLInventoryItem* item, const LLUUID& destFolderId) @@ -1468,6 +1473,8 @@ bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU LLNotificationsUtil::add("MerchantPasteFailed", subs); return false; } + + open_marketplace_listings(); return true; } @@ -1480,7 +1487,7 @@ bool sort_alpha(const LLViewerInventoryCategory* cat1, const LLViewerInventoryCa return cat1->getName().compare(cat2->getName()) < 0; } -bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_t cb, bool fix_hierarchy) +bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_t cb, bool fix_hierarchy, S32 depth) { // Folder is valid unless issue is raised bool result = true; @@ -1488,11 +1495,17 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ // Get the type and the depth of the folder LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); const LLFolderType::EType folder_type = cat->getPreferredType(); - S32 depth = depth_nesting_in_marketplace(cat->getUUID()); if (depth < 0) { - // If the folder is not under the marketplace listings root, validation should not be applied - return result; + // If the depth argument was not provided, evaluate the depth directly + depth = depth_nesting_in_marketplace(cat->getUUID()); + } + if (depth < 0) + { + // If the folder is not under the marketplace listings root, we run validation as if it was a listing folder and prevent any hierarchy fix + // This allows the function to be used to pre-validate a folder + depth = 1; + fix_hierarchy = false; } // Set the indentation for print output (typically, audit button in marketplace folder floater) @@ -1533,7 +1546,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ LLUUID folder_uuid = gInventory.createNewCategory(parent_uuid, LLFolderType::FT_NONE, cat->getName()); LLInventoryCategory* new_cat = gInventory.getCategory(folder_uuid); gInventory.changeCategoryParent(viewer_cat, folder_uuid, false); - result &= validate_marketplacelistings(new_cat, cb, fix_hierarchy); + result &= validate_marketplacelistings(new_cat, cb, fix_hierarchy, depth + 1); return result; } else @@ -1795,7 +1808,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) { LLInventoryCategory* category = *iter; - result &= validate_marketplacelistings(category, cb, fix_hierarchy); + result &= validate_marketplacelistings(category, cb, fix_hierarchy, depth + 1); } return result && !has_bad_items; diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index ef6d76dfdd..c7384877f4 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -80,7 +80,7 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryCategory* inv_cat, std::string& tooltip_msg, S32 bundle_size = 1, bool check_items = true, bool from_paste = false); bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy = false); bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false); -bool validate_marketplacelistings(LLInventoryCategory* inv_cat, validation_callback_t cb = NULL, bool fix_hierarchy = true); +bool validate_marketplacelistings(LLInventoryCategory* inv_cat, validation_callback_t cb = NULL, bool fix_hierarchy = true, S32 depth = -1); S32 depth_nesting_in_marketplace(LLUUID cur_uuid); LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth); S32 compute_stock_count(LLUUID cat_uuid); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 4173c8b0d7..89aa69cfb4 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -373,7 +373,7 @@ Initialization with the Marketplace failed because of a system or network error. icon="alertmodal.tga" name="ConfirmMerchantMoveInventory" type="alertmodal"> - Items dragged to the Marketplace Items window are moved from their original locations, not copied. Do you want to continue? + Items dragged to the Marketplace Listings window are moved from their original locations, not copied. Do you want to continue? <tag>confirm</tag> <usetemplate ignoretext="Confirm before I move an item from the inventory to the marketplace" |