From 4fdaa7fc561e9e05751373160434a61151c2b75e Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sun, 25 Jan 2015 17:10:05 -0800 Subject: DD-296 : Disable move and copy to marketplace if limit passed. Improve perf of validate_marketplaceting(). Open marketplace floater on copy or move. String fix. --- indra/newview/llinventorybridge.cpp | 68 +++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 14 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') 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("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(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())) -- cgit v1.2.3