From 9de02b0cd3ac05ce172e12dbc2d288a5deccba11 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 10 Mar 2014 18:49:40 -0700 Subject: DD-17 : WIP : some work on the suffix for Listing folders --- indra/newview/llinventorybridge.cpp | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 44943d8722..c2f6ce8fb1 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -959,6 +959,18 @@ BOOL LLInvFVBridge::isInboxFolder() const return gInventory.isObjectDescendentOf(mUUID, inbox_id); } +BOOL LLInvFVBridge::isMerchantItemsFolder() const +{ + const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MERCHANT_ITEMS, false); + + if (folder_id.isNull()) + { + return FALSE; + } + + return gInventory.isObjectDescendentOf(mUUID, folder_id); +} + BOOL LLInvFVBridge::isOutboxFolder() const { const LLUUID outbox_id = getOutboxFolder(); @@ -1931,6 +1943,38 @@ void LLFolderBridge::buildDisplayName() const } } +std::string LLFolderBridge::getLabelSuffix() const +{ + /* + + LLInventoryCategory* cat = gInventory.getCategory(getUUID()); + if(cat) + { + const LLUUID& parent_folder_id = cat->getParentUUID(); + accessories = (parent_folder_id == gInventory.getLibraryRootFolderID()); + } + */ + if (isMerchantItemsFolder()) + { + if (LLMarketplaceData::instance().isListed(getUUID())) + { + llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; + std::string suffix = " (" + LLMarketplaceData::instance().getListingID(getUUID()) + ")"; + return LLInvFVBridge::getLabelSuffix() + suffix; + } + else + { + llinfos << "Merov : in merchant folder but not listed : id = " << getUUID() << llendl; + return LLInvFVBridge::getLabelSuffix(); + } + } + else + { + llinfos << "Merov : not in merchant folder : id = " << getUUID() << llendl; + return LLInvFVBridge::getLabelSuffix(); + } +} + void LLFolderBridge::update() { -- cgit v1.3 From 705d4182c8a84728e7f00cf48110c8f9720e4c29 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 13 Mar 2014 16:45:52 -0700 Subject: DD-42 : Rename merchant items to marketplace listings to be consistent with spec --- indra/llcommon/llfoldertype.cpp | 2 +- indra/llcommon/llfoldertype.h | 2 +- indra/newview/llfloateroutbox.cpp | 114 +++++++++---------- indra/newview/llfloateroutbox.h | 12 +- indra/newview/llinventorybridge.cpp | 6 +- indra/newview/llinventorybridge.h | 2 +- indra/newview/llinventorypanel.cpp | 4 +- indra/newview/llviewerfloaterreg.cpp | 2 +- indra/newview/llviewerfoldertype.cpp | 2 +- .../xui/en/floater_marketplace_listings.xml | 121 +++++++++++++++++++++ .../default/xui/en/floater_merchant_items.xml | 121 --------------------- indra/newview/skins/default/xui/en/menu_viewer.xml | 6 +- .../en/panel_marketplace_listings_inventory.xml | 32 ++++++ .../xui/en/panel_merchant_items_inventory.xml | 32 ------ indra/newview/skins/default/xui/en/strings.xml | 6 +- 15 files changed, 232 insertions(+), 232 deletions(-) create mode 100755 indra/newview/skins/default/xui/en/floater_marketplace_listings.xml delete mode 100755 indra/newview/skins/default/xui/en/floater_merchant_items.xml create mode 100755 indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml delete mode 100755 indra/newview/skins/default/xui/en/panel_merchant_items_inventory.xml (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp index 64bc17c422..5b80189d2a 100755 --- a/indra/llcommon/llfoldertype.cpp +++ b/indra/llcommon/llfoldertype.cpp @@ -97,7 +97,7 @@ LLFolderDictionary::LLFolderDictionary() addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", TRUE)); - addEntry(LLFolderType::FT_MERCHANT_ITEMS, new FolderEntry("merchant", FALSE)); + addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new FolderEntry("merchant", FALSE)); addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); }; diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h index 81f9c0b678..91dc1da543 100644 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llcommon/llfoldertype.h @@ -87,7 +87,7 @@ public: FT_BASIC_ROOT = 52, - FT_MERCHANT_ITEMS = 53, + FT_MARKETPLACE_LISTINGS = 53, FT_COUNT, diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 8f4daa83f9..2ed4605e0c 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -1,8 +1,8 @@ /** * @file llfloateroutbox.cpp - * @brief Implementation of the merchant outbox window and of the merchant items window + * @brief Implementation of the merchant outbox window and of the marketplace listings window * - * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermerchantitems + * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermarketplacelistings * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -107,15 +107,15 @@ private: }; ///---------------------------------------------------------------------------- -/// LLMerchantItemsAddedObserver helper class +/// LLMarketplaceListingsAddedObserver helper class ///---------------------------------------------------------------------------- -class LLMerchantItemsAddedObserver : public LLInventoryCategoryAddedObserver +class LLMarketplaceListingsAddedObserver : public LLInventoryCategoryAddedObserver { public: - LLMerchantItemsAddedObserver(LLFloaterMerchantItems * merchant_items_floater) + LLMarketplaceListingsAddedObserver(LLFloaterMarketplaceListings * marketplace_listings_floater) : LLInventoryCategoryAddedObserver() - , mMerchantItemsFloater(merchant_items_floater) + , mMarketplaceListingsFloater(marketplace_listings_floater) { } @@ -127,15 +127,15 @@ public: LLFolderType::EType added_category_type = added_category->getPreferredType(); - if (added_category_type == LLFolderType::FT_MERCHANT_ITEMS) + if (added_category_type == LLFolderType::FT_MARKETPLACE_LISTINGS) { - mMerchantItemsFloater->initializeMarketPlace(); + mMarketplaceListingsFloater->initializeMarketPlace(); } } } private: - LLFloaterMerchantItems * mMerchantItemsFloater; + LLFloaterMarketplaceListings * mMarketplaceListingsFloater; }; @@ -653,10 +653,10 @@ void LLFloaterOutbox::showNotification(const LLNotificationPtr& notification) } ///---------------------------------------------------------------------------- -/// LLFloaterMerchantItems +/// LLFloaterMarketplaceListings ///---------------------------------------------------------------------------- -LLFloaterMerchantItems::LLFloaterMerchantItems(const LLSD& key) +LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key) : LLFloater(key) , mCategoriesObserver(NULL) , mCategoryAddedObserver(NULL) @@ -668,7 +668,7 @@ LLFloaterMerchantItems::LLFloaterMerchantItems(const LLSD& key) { } -LLFloaterMerchantItems::~LLFloaterMerchantItems() +LLFloaterMarketplaceListings::~LLFloaterMarketplaceListings() { if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) { @@ -683,18 +683,18 @@ LLFloaterMerchantItems::~LLFloaterMerchantItems() delete mCategoryAddedObserver; } -BOOL LLFloaterMerchantItems::postBuild() +BOOL LLFloaterMarketplaceListings::postBuild() { - mInventoryPlaceholder = getChild("merchant_items_inventory_placeholder_panel"); - mInventoryText = mInventoryPlaceholder->getChild("merchant_items_inventory_placeholder_text"); - mInventoryTitle = mInventoryPlaceholder->getChild("merchant_items_inventory_placeholder_title"); + mInventoryPlaceholder = getChild("marketplace_listings_inventory_placeholder_panel"); + mInventoryText = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_text"); + mInventoryTitle = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_title"); - mTopLevelDropZone = getChild("merchant_items_generic_drag_target"); + mTopLevelDropZone = getChild("marketplace_listings_generic_drag_target"); - LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMerchantItems::onFocusReceived, this)); + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMarketplaceListings::onFocusReceived, this)); - // Observe category creation to catch merchant items creation (moot if already existing) - mCategoryAddedObserver = new LLMerchantItemsAddedObserver(this); + // Observe category creation to catch marketplace listings creation (moot if already existing) + mCategoryAddedObserver = new LLMarketplaceListingsAddedObserver(this); gInventory.addObserver(mCategoryAddedObserver); // Merov : Debug : fetch aggressively so we can create test data right onOpen() @@ -704,7 +704,7 @@ BOOL LLFloaterMerchantItems::postBuild() return TRUE; } -void LLFloaterMerchantItems::clean() +void LLFloaterMarketplaceListings::clean() { // Note: we cannot delete the mOutboxInventoryPanel as that point // as this is called through callback observers of the panel itself. @@ -714,11 +714,11 @@ void LLFloaterMerchantItems::clean() mRootFolderId.setNull(); } -void LLFloaterMerchantItems::onClose(bool app_quitting) +void LLFloaterMarketplaceListings::onClose(bool app_quitting) { } -void LLFloaterMerchantItems::onOpen(const LLSD& key) +void LLFloaterMarketplaceListings::onOpen(const LLSD& key) { // // Initialize the Market Place or go update the outbox @@ -763,12 +763,12 @@ void LLFloaterMerchantItems::onOpen(const LLSD& key) fetchContents(); } -void LLFloaterMerchantItems::onFocusReceived() +void LLFloaterMarketplaceListings::onFocusReceived() { fetchContents(); } -void LLFloaterMerchantItems::fetchContents() +void LLFloaterMarketplaceListings::fetchContents() { if (mRootFolderId.notNull()) { @@ -776,7 +776,7 @@ void LLFloaterMerchantItems::fetchContents() } } -void LLFloaterMerchantItems::setup() +void LLFloaterMarketplaceListings::setup() { if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT) { @@ -784,24 +784,24 @@ void LLFloaterMerchantItems::setup() return; } - // We are a merchant. Get the Merchant items folder, create it if needs be. - LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MERCHANT_ITEMS, true); + // We are a merchant. Get the Marketplace listings folder, create it if needs be. + LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, true); if (outbox_id.isNull()) { // We should never get there unless the inventory fails badly - llinfos << "Merov : Inventory problem: failure to create the merchant items folder for a merchant!" << llendl; - llerrs << "Inventory problem: failure to create the merchant items folder for a merchant!" << llendl; + llinfos << "Merov : Inventory problem: failure to create the marketplace listings folder for a merchant!" << llendl; + llerrs << "Inventory problem: failure to create the marketplace listings folder for a merchant!" << llendl; return; } - // Consolidate Merchant items + // Consolidate Marketplace listings // We shouldn't have to do that but with a client/server system relying on a "well known folder" convention, things get messy and conventions get broken down eventually - gInventory.consolidateForType(outbox_id, LLFolderType::FT_MERCHANT_ITEMS); + gInventory.consolidateForType(outbox_id, LLFolderType::FT_MARKETPLACE_LISTINGS); if (outbox_id == mRootFolderId) { - llinfos << "Merov : Inventory warning: Merchant items folder already set" << llendl; - llwarns << "Inventory warning: Merchant items folder already set" << llendl; + llinfos << "Merov : Inventory warning: Marketplace listings folder already set" << llendl; + llwarns << "Inventory warning: Marketplace listings folder already set" << llendl; return; } mRootFolderId = outbox_id; @@ -815,7 +815,7 @@ void LLFloaterMerchantItems::setup() } llassert(!mCategoryAddedObserver); - // Create observer for merchant items modifications : clear the old one and create a new one + // Create observer for marketplace listings modifications : clear the old one and create a new one if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) { gInventory.removeObserver(mCategoriesObserver); @@ -823,16 +823,16 @@ void LLFloaterMerchantItems::setup() } mCategoriesObserver = new LLInventoryCategoriesObserver(); gInventory.addObserver(mCategoriesObserver); - mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMerchantItems::onChanged, this)); + mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMarketplaceListings::onChanged, this)); llassert(mCategoriesObserver); - // Set up the merchant items inventory view + // Set up the marketplace listings inventory view LLInventoryPanel* inventory_panel = mInventoryPanel.get(); if (inventory_panel) { delete inventory_panel; } - inventory_panel = LLUICtrlFactory::createFromFile("panel_merchant_items_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); mInventoryPanel = inventory_panel->getInventoryPanelHandle(); llassert(mInventoryPanel.get() != NULL); @@ -844,11 +844,11 @@ void LLFloaterMerchantItems::setup() inventory_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); inventory_panel->getFilter().markDefault(); - // Get the content of the merchant items folder + // Get the content of the marketplace listings folder fetchContents(); } -void LLFloaterMerchantItems::initializeMarketPlace() +void LLFloaterMarketplaceListings::initializeMarketPlace() { // // Initialize the marketplace import API @@ -857,14 +857,14 @@ void LLFloaterMerchantItems::initializeMarketPlace() if (!importer.isInitialized()) { - importer.setInitializationErrorCallback(boost::bind(&LLFloaterMerchantItems::initializationReportError, this, _1, _2)); - importer.setStatusChangedCallback(boost::bind(&LLFloaterMerchantItems::importStatusChanged, this, _1)); - importer.setStatusReportCallback(boost::bind(&LLFloaterMerchantItems::importReportResults, this, _1, _2)); + importer.setInitializationErrorCallback(boost::bind(&LLFloaterMarketplaceListings::initializationReportError, this, _1, _2)); + importer.setStatusChangedCallback(boost::bind(&LLFloaterMarketplaceListings::importStatusChanged, this, _1)); + importer.setStatusReportCallback(boost::bind(&LLFloaterMarketplaceListings::importReportResults, this, _1, _2)); importer.initialize(); } } -S32 LLFloaterMerchantItems::getFolderCount() +S32 LLFloaterMarketplaceListings::getFolderCount() { if (mInventoryPanel.get() && mRootFolderId.notNull()) { @@ -880,7 +880,7 @@ S32 LLFloaterMerchantItems::getFolderCount() } } -void LLFloaterMerchantItems::updateView() +void LLFloaterMarketplaceListings::updateView() { LLInventoryPanel* panel = mInventoryPanel.get(); @@ -915,10 +915,10 @@ void LLFloaterMerchantItems::updateView() { setup(); } - // "Merchant items is empty!" message strings - text = LLTrans::getString("InventoryMerchantItemsNoItems", subs); - title = LLTrans::getString("InventoryMerchantItemsNoItemsTitle"); - tooltip = LLTrans::getString("InventoryMerchantItemsNoItemsTooltip"); + // "Marketplace listings is empty!" message strings + text = LLTrans::getString("InventoryMarketplaceListingsNoItems", subs); + title = LLTrans::getString("InventoryMarketplaceListingsNoItemsTitle"); + tooltip = LLTrans::getString("InventoryMarketplaceListingsNoItemsTooltip"); } else if (mkt_status <= MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING) { @@ -948,14 +948,14 @@ void LLFloaterMerchantItems::updateView() } } -bool LLFloaterMerchantItems::isAccepted(EAcceptance accept) +bool LLFloaterMarketplaceListings::isAccepted(EAcceptance accept) { // *TODO : Need a bit more test on what we accept: depends of what and where... return (accept >= ACCEPT_YES_COPY_SINGLE); } -BOOL LLFloaterMerchantItems::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -1006,21 +1006,21 @@ BOOL LLFloaterMerchantItems::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dro return handled; } -BOOL LLFloaterMerchantItems::handleHover(S32 x, S32 y, MASK mask) +BOOL LLFloaterMarketplaceListings::handleHover(S32 x, S32 y, MASK mask) { mTopLevelDropZone->setBackgroundVisible(FALSE); return LLFloater::handleHover(x, y, mask); } -void LLFloaterMerchantItems::onMouseLeave(S32 x, S32 y, MASK mask) +void LLFloaterMarketplaceListings::onMouseLeave(S32 x, S32 y, MASK mask) { mTopLevelDropZone->setBackgroundVisible(FALSE); LLFloater::onMouseLeave(x, y, mask); } -void LLFloaterMerchantItems::onChanged() +void LLFloaterMarketplaceListings::onChanged() { LLViewerInventoryCategory* category = gInventory.getCategory(mRootFolderId); if (mRootFolderId.notNull() && category) @@ -1034,12 +1034,12 @@ void LLFloaterMerchantItems::onChanged() } } -void LLFloaterMerchantItems::initializationReportError(U32 status, const LLSD& content) +void LLFloaterMarketplaceListings::initializationReportError(U32 status, const LLSD& content) { updateView(); } -void LLFloaterMerchantItems::importStatusChanged(bool inProgress) +void LLFloaterMarketplaceListings::importStatusChanged(bool inProgress) { if (mRootFolderId.isNull() && (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)) { @@ -1071,7 +1071,7 @@ void LLFloaterMerchantItems::importStatusChanged(bool inProgress) updateView(); } -void LLFloaterMerchantItems::importReportResults(U32 status, const LLSD& content) +void LLFloaterMarketplaceListings::importReportResults(U32 status, const LLSD& content) { updateView(); } diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index 1b1e1e0439..e28fb320ea 100755 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -1,8 +1,8 @@ /** * @file llfloateroutbox.h - * @brief Implementation of the merchant outbox window and of the merchant items window + * @brief Implementation of the merchant outbox window and of the marketplace listings window * - * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermerchantitems + * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermarketplacelistings * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -115,14 +115,14 @@ private: }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLFloaterMerchantItems +// Class LLFloaterMarketplaceListings //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLFloaterMerchantItems : public LLFloater +class LLFloaterMarketplaceListings : public LLFloater { public: - LLFloaterMerchantItems(const LLSD& key); - ~LLFloaterMerchantItems(); + LLFloaterMarketplaceListings(const LLSD& key); + ~LLFloaterMarketplaceListings(); void initializeMarketPlace(); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index c2f6ce8fb1..9d9279ce90 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -959,9 +959,9 @@ BOOL LLInvFVBridge::isInboxFolder() const return gInventory.isObjectDescendentOf(mUUID, inbox_id); } -BOOL LLInvFVBridge::isMerchantItemsFolder() const +BOOL LLInvFVBridge::isMarketplaceListingsFolder() const { - const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MERCHANT_ITEMS, false); + const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); if (folder_id.isNull()) { @@ -1954,7 +1954,7 @@ std::string LLFolderBridge::getLabelSuffix() const accessories = (parent_folder_id == gInventory.getLibraryRootFolderID()); } */ - if (isMerchantItemsFolder()) + if (isMarketplaceListingsFolder()) { if (LLMarketplaceData::instance().isListed(getUUID())) { diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 199a46d275..d9533b537c 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -160,7 +160,7 @@ protected: BOOL isInboxFolder() const; // true if COF or descendant of marketplace inbox BOOL isOutboxFolder() const; // true if COF or descendant of marketplace outbox BOOL isOutboxFolderDirectParent() const; - BOOL isMerchantItemsFolder() const; // true if descendant of Merchant items folder + BOOL isMarketplaceListingsFolder() const; // true if descendant of Marketplace listings folder const LLUUID getOutboxFolder() const; virtual BOOL isItemPermissive() const; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index c1607fbbc0..bf8f7819ef 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -288,7 +288,7 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) { getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_INBOX)); getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_OUTBOX)); - getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_MERCHANT_ITEMS)); + getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_MARKETPLACE_LISTINGS)); } // set the filter for the empty folder if the debug setting is on @@ -1490,6 +1490,6 @@ namespace LLInitParam declare(LLFolderType::lookup(LLFolderType::FT_INBOX) , LLFolderType::FT_INBOX); declare(LLFolderType::lookup(LLFolderType::FT_OUTBOX) , LLFolderType::FT_OUTBOX); declare(LLFolderType::lookup(LLFolderType::FT_BASIC_ROOT) , LLFolderType::FT_BASIC_ROOT); - declare(LLFolderType::lookup(LLFolderType::FT_MERCHANT_ITEMS) , LLFolderType::FT_MERCHANT_ITEMS); + declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_LISTINGS) , LLFolderType::FT_MARKETPLACE_LISTINGS); } } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index f55de790d8..853d98693b 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -243,7 +243,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("tex_fetch_debugger", "floater_texture_fetch_debugger.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); } LLFloaterReg::add("media_settings", "floater_media_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("merchant_items", "floater_merchant_items.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("marketplace_listings", "floater_marketplace_listings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index 413814cec0..ee8f85782f 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -141,7 +141,7 @@ LLViewerFolderDictionary::LLViewerFolderDictionary() addEntry(LLFolderType::FT_BASIC_ROOT, new ViewerFolderEntry("Basic Root", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_MERCHANT_ITEMS, new ViewerFolderEntry("Merchant items", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible)); + addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new ViewerFolderEntry("Marketplace listings", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible)); addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false, "default")); diff --git a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml new file mode 100755 index 0000000000..94a9466c16 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml @@ -0,0 +1,121 @@ + + + + + + + Loading... + + + + + + + + Drag items you want to sell + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/floater_merchant_items.xml b/indra/newview/skins/default/xui/en/floater_merchant_items.xml deleted file mode 100755 index 2e54ed2ce3..0000000000 --- a/indra/newview/skins/default/xui/en/floater_merchant_items.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - Loading... - - - - - - - - Drag items you want to sell - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 2dc974eff1..a8e02a9d02 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -182,11 +182,11 @@ parameter="outbox" /> + label="Marketplace listings..." + name="MarketplaceListings"> + parameter="marketplace_listings" /> + + + + diff --git a/indra/newview/skins/default/xui/en/panel_merchant_items_inventory.xml b/indra/newview/skins/default/xui/en/panel_merchant_items_inventory.xml deleted file mode 100755 index a013516267..0000000000 --- a/indra/newview/skins/default/xui/en/panel_merchant_items_inventory.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 515e912ee5..387ad138d9 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2219,9 +2219,9 @@ We are accessing your account on the [[MARKETPLACE_CREATE_STORE_URL] Marketplace The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. - Your Merchant Items folder is empty. - - + Your Marketplace Listings folder is empty. + + Drag folders to this area to list them for sale on the [[MARKETPLACE_DASHBOARD_URL] Marketplace]. -- cgit v1.3 From 68dbb5692f11eed39175ebf3313d96b5430231f9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 14 Mar 2014 17:34:15 -0700 Subject: DD-17 : WIP : Add live status to active listing folders, clean up getLabelSuffix() code a bit --- indra/newview/llfloateroutbox.cpp | 11 +++++++---- indra/newview/llinventorybridge.cpp | 12 ++++++++++-- indra/newview/skins/default/xui/en/strings.xml | 3 +++ 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 2ed4605e0c..d9bc3a1ce0 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -743,12 +743,15 @@ void LLFloaterMarketplaceListings::onOpen(const LLSD& key) for (LLInventoryModel::cat_array_t::iterator iter = cats->begin(); iter != cats->end(); iter++, index++) { LLViewerInventoryCategory* category = *iter; - LLMarketplaceData::instance().addTestItem(category->getUUID()); - if (index%2) + if (index%3) { - LLMarketplaceData::instance().setListingID(category->getUUID(),"TestingID1234"); + LLMarketplaceData::instance().addTestItem(category->getUUID()); + if (index%3 == 1) + { + LLMarketplaceData::instance().setListingID(category->getUUID(),"TestingID1234"); + } + LLMarketplaceData::instance().setActivation(category->getUUID(),(index%2)); } - LLMarketplaceData::instance().setActivation(category->getUUID(),(index%3 == 0)); } } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 9d9279ce90..38dcb24477 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1959,7 +1959,16 @@ std::string LLFolderBridge::getLabelSuffix() const if (LLMarketplaceData::instance().isListed(getUUID())) { llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; - std::string suffix = " (" + LLMarketplaceData::instance().getListingID(getUUID()) + ")"; + std::string suffix = LLMarketplaceData::instance().getListingID(getUUID()); + if (suffix.empty()) + { + suffix = LLTrans::getString("MarketplaceNoID"); + } + suffix = " (" + suffix + ")"; + if (LLMarketplaceData::instance().getActivationState(getUUID())) + { + suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; + } return LLInvFVBridge::getLabelSuffix() + suffix; } else @@ -1970,7 +1979,6 @@ std::string LLFolderBridge::getLabelSuffix() const } else { - llinfos << "Merov : not in merchant folder : id = " << getUUID() << llendl; return LLInvFVBridge::getLabelSuffix(); } } diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 387ad138d9..1d3c112495 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2235,6 +2235,9 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. Error: This item can not be sold on the marketplace. Error: There was a problem with this item. Try again later. + no Mkt ID + live + Open landmarks -- cgit v1.3 From 28fe8352549c0fd99da0c3f0119d96386e52a703 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 18 Mar 2014 13:03:04 -0700 Subject: DD-17, DD-40 : Style active listings in bold, implement a working initialization indicator --- indra/newview/llfloateroutbox.cpp | 28 ++++++++++------------ indra/newview/llfloateroutbox.h | 3 +++ indra/newview/llinventorybridge.cpp | 14 ++++++++++- indra/newview/llinventorybridge.h | 1 + .../xui/en/floater_marketplace_listings.xml | 16 ++++++++++++- 5 files changed, 45 insertions(+), 17 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index d9bc3a1ce0..281e9124e7 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -661,6 +661,8 @@ LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key) , mCategoriesObserver(NULL) , mCategoryAddedObserver(NULL) , mRootFolderId(LLUUID::null) +, mInventoryStatus(NULL) +, mInventoryInitializationInProgress(NULL) , mInventoryPlaceholder(NULL) , mInventoryText(NULL) , mInventoryTitle(NULL) @@ -685,6 +687,8 @@ LLFloaterMarketplaceListings::~LLFloaterMarketplaceListings() BOOL LLFloaterMarketplaceListings::postBuild() { + mInventoryStatus = getChild("marketplace_status"); + mInventoryInitializationInProgress = getChild("initialization_progress_indicator"); mInventoryPlaceholder = getChild("marketplace_listings_inventory_placeholder_panel"); mInventoryText = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_text"); mInventoryTitle = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_title"); @@ -883,6 +887,11 @@ S32 LLFloaterMarketplaceListings::getFolderCount() } } +void LLFloaterMarketplaceListings::setStatusString(const std::string& statusString) +{ + mInventoryStatus->setText(statusString); +} + void LLFloaterMarketplaceListings::updateView() { LLInventoryPanel* panel = mInventoryPanel.get(); @@ -1048,28 +1057,17 @@ void LLFloaterMarketplaceListings::importStatusChanged(bool inProgress) { setup(); } - /* + if (inProgress) { - if (mImportBusy) - { - setStatusString(getString("OutboxImporting")); - } - else - { - setStatusString(getString("OutboxInitializing")); - } - - mImportBusy = true; - mInventoryImportInProgress->setVisible(true); + setStatusString(getString("MarketplaceListingsInitializing")); + mInventoryInitializationInProgress->setVisible(true); } else { setStatusString(""); - mImportBusy = false; - mInventoryImportInProgress->setVisible(false); + mInventoryInitializationInProgress->setVisible(false); } - */ updateView(); } diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index e28fb320ea..04a9f91f51 100755 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -147,6 +147,7 @@ protected: void importReportResults(U32 status, const LLSD& content); void importStatusChanged(bool inProgress); void initializationReportError(U32 status, const LLSD& content); + void setStatusString(const std::string& statusString); void onClose(bool app_quitting); void onOpen(const LLSD& key); @@ -163,6 +164,8 @@ private: LLInventoryCategoriesObserver * mCategoriesObserver; LLInventoryCategoryAddedObserver * mCategoryAddedObserver; + LLTextBox * mInventoryStatus; + LLView * mInventoryInitializationInProgress; LLView * mInventoryPlaceholder; LLTextBox * mInventoryText; LLTextBox * mInventoryTitle; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 38dcb24477..3d418105e3 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1945,8 +1945,8 @@ void LLFolderBridge::buildDisplayName() const std::string LLFolderBridge::getLabelSuffix() const { + // *TODO : We need to display some suffix also for the version folder! /* - LLInventoryCategory* cat = gInventory.getCategory(getUUID()); if(cat) { @@ -1983,6 +1983,18 @@ std::string LLFolderBridge::getLabelSuffix() const } } +LLFontGL::StyleFlags LLFolderBridge::getLabelStyle() const +{ + if (isMarketplaceListingsFolder() && LLMarketplaceData::instance().getActivationState(getUUID())) + { + return LLFontGL::BOLD; + } + else + { + return LLFontGL::NORMAL; + } +} + void LLFolderBridge::update() { diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index d9533b537c..26c48fdc57 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -276,6 +276,7 @@ public: virtual LLUIImagePtr getIconOpen() const; virtual LLUIImagePtr getIconOverlay() const; virtual std::string getLabelSuffix() const; + virtual LLFontGL::StyleFlags getLabelStyle() const; static LLUIImagePtr getIcon(LLFolderType::EType preferred_type); virtual BOOL renameItem(const std::string& new_name); diff --git a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml index 94a9466c16..b212518f85 100755 --- a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml +++ b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml @@ -13,6 +13,7 @@ reuse_instance="true" title="MARKETPLACE LISTINGS" width="333"> + Initializing... + - + -- cgit v1.3 From 0ec8fbec6deaa24506391ef239c50009eebe1eef Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 28 Mar 2014 15:54:36 -0700 Subject: DD-24 : Add FT_MARKETPLACE_STOCK as a new type for folders, implement the promotion code for Drag and Drop, display of stock folders and embryonic marketplace validation --- indra/llcommon/llfoldertype.cpp | 1 + indra/llcommon/llfoldertype.h | 1 + indra/newview/llinventorybridge.cpp | 56 ++++++++-- indra/newview/llinventoryfunctions.cpp | 149 +++++++++++++++++++++++++ indra/newview/llinventoryfunctions.h | 6 +- indra/newview/llinventorymodel.cpp | 4 +- indra/newview/llinventorypanel.cpp | 1 + indra/newview/llviewerfoldertype.cpp | 3 +- indra/newview/skins/default/xui/en/strings.xml | 1 + 9 files changed, 210 insertions(+), 12 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp index 5b80189d2a..afa9e59832 100755 --- a/indra/llcommon/llfoldertype.cpp +++ b/indra/llcommon/llfoldertype.cpp @@ -98,6 +98,7 @@ LLFolderDictionary::LLFolderDictionary() addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", TRUE)); addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new FolderEntry("merchant", FALSE)); + addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new FolderEntry("stock", FALSE)); addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); }; diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h index 91dc1da543..20925eede0 100644 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llcommon/llfoldertype.h @@ -88,6 +88,7 @@ public: FT_BASIC_ROOT = 52, FT_MARKETPLACE_LISTINGS = 53, + FT_MARKETPLACE_STOCK = 54, FT_COUNT, diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 3d418105e3..d0abe6db29 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1958,7 +1958,7 @@ std::string LLFolderBridge::getLabelSuffix() const { if (LLMarketplaceData::instance().isListed(getUUID())) { - llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; + //llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; std::string suffix = LLMarketplaceData::instance().getListingID(getUUID()); if (suffix.empty()) { @@ -1971,9 +1971,15 @@ std::string LLFolderBridge::getLabelSuffix() const } return LLInvFVBridge::getLabelSuffix() + suffix; } + else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + //llinfos << "Merov : in merchant folder and is a stock folder : id = " << getUUID() << llendl; + std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ")"; + return LLInvFVBridge::getLabelSuffix() + suffix; + } else { - llinfos << "Merov : in merchant folder but not listed : id = " << getUUID() << llendl; + //llinfos << "Merov : in merchant folder but not listed : id = " << getUUID() << llendl; return LLInvFVBridge::getLabelSuffix(); } } @@ -2316,10 +2322,13 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, const LLUUID &cat_id = inv_cat->getUUID(); const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); + const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_from_outbox = model->isObjectDescendentOf(cat_id, outbox_id); + const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); // check to make sure source is agent inventory, and is represented there. LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); @@ -2499,6 +2508,12 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } } } + if (is_movable && move_is_into_marketplacelistings) + { + // *TODO : Merov : Add here the logic to prevent huge nesting in marketplace listings + // For the moment, we just take in anything + is_movable = TRUE; + } if (is_movable) { @@ -2601,6 +2616,10 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, { copy_folder_to_outbox(inv_cat, mUUID, cat_id, LLToolDragAndDrop::getOperationId()); } + else if (move_is_into_marketplacelistings && !move_is_from_marketplacelistings) + { + move_folder_to_marketplacelistings(inv_cat, mUUID); + } else { if (model->isObjectDescendentOf(cat_id, model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false))) @@ -2620,7 +2639,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } else if (LLToolDragAndDrop::SOURCE_WORLD == source) { - if (move_is_into_outbox) + if (move_is_into_outbox || move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); accept = FALSE; @@ -2632,7 +2651,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } else if (LLToolDragAndDrop::SOURCE_LIBRARY == source) { - if (move_is_into_outbox) + if (move_is_into_outbox || move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); accept = FALSE; @@ -3248,6 +3267,9 @@ void LLFolderBridge::pasteFromClipboard() const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); + // *TODO : Add marketplace listings case + //const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + //const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); LLDynamicArray objects; LLClipboard::instance().pasteFromClipboard(objects); @@ -3372,12 +3394,14 @@ void LLFolderBridge::pasteLinkFromClipboard() { const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); + const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); + const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); - if (move_is_into_outbox) + if (move_is_into_outbox || move_is_into_marketplacelistings) { // Notify user of failure somehow -- play error sound? modal dialog? return; @@ -4047,6 +4071,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE, false); const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); + const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_favorites = (mUUID == favorites_id); @@ -4054,6 +4079,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_from_outbox = model->isObjectDescendentOf(inv_item->getUUID(), outbox_id); + const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); BOOL accept = FALSE; @@ -4150,6 +4176,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } } } + else if (move_is_into_marketplacelistings) + { + // *TODO : Add here any logic that may prevent an item to be copied into the marketplace listings + // For the moment, we let anything go + accept = TRUE; + } LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); @@ -4208,6 +4240,8 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { dropToOutfit(inv_item, move_is_into_current_outfit); } + // MERCHANT OUTBOX folder + // Move the item else if (move_is_into_outbox) { if (move_is_from_outbox) @@ -4219,6 +4253,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, copy_item_to_outbox(inv_item, mUUID, LLUUID::null, LLToolDragAndDrop::getOperationId()); } } + // MARKETPLACE LISTINGS folder + // Move the item + else if (move_is_into_marketplacelistings) + { + move_item_to_marketplacelistings(inv_item, mUUID); + } // NORMAL or TRASH folder // (move the item, restamp if into trash) else @@ -4285,7 +4325,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { accept = FALSE; } - else if (move_is_into_outbox) + else if (move_is_into_outbox || move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); accept = FALSE; @@ -4323,7 +4363,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else if(LLToolDragAndDrop::SOURCE_NOTECARD == source) { - if (move_is_into_outbox) + if (move_is_into_outbox || move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); accept = FALSE; @@ -4357,7 +4397,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { accept = TRUE; - if (move_is_into_outbox) + if (move_is_into_outbox || move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); accept = FALSE; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 203eb4ec4e..fe55f8955f 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -686,6 +686,155 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold open_outbox(); } +void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder) +{ + // Collapse links into items/folders + LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item; + LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory(); + + if (linked_category != NULL) + { + // Move the linked folder directly + move_folder_to_marketplacelistings(linked_category, dest_folder); + } + else + { + // Grab the linked item if any + LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem(); + viewer_inv_item = (linked_item != NULL ? linked_item : viewer_inv_item); + + // Check that the agent has copy permission on the item: this is required as a resident cannot + // put on sale items she has no right about. Proceed with move if we have permission. + // *TODO : Check that this is adequate (copied from the Merchant Outbox permission check so should be OK...) + if (viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + // When moving an isolated item directly under the marketplace listings root, we create a new folder with that name + if (dest_folder == gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false)) + { + // *TODO : This method is not specific to the outbox folder so make it more generic + dest_folder = create_folder_in_outbox_for_item(inv_item, dest_folder, 0); + } + + // Reparent the item + gInventory.changeItemParent(viewer_inv_item, dest_folder, false); + + // Check the item for no copy permission and promote the destination folder if necessary + if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY)) + { + llinfos << "Merov : item is no copy -> change the destination folder type!" << llendl; + LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (gInventory.getCategory(dest_folder)); + viewer_cat->changeType(LLFolderType::FT_MARKETPLACE_STOCK); + } + } + else + { + // *TODO : signal an error to the user (UI for this TBD) + llinfos << "Merov : user doesn't have the correct permission to put this item on sale -> move aborted!" << llendl; + } + } +} + +void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder) +{ + // Check that we have adequate permission on all items being moved. Proceed if we do. + if (has_correct_permissions_for_sale(inv_cat)) + { + + // Reparent the folder + LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; + gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + + // Check the destination folder recursively for no copy items and promote the including folders if any + validate_marketplacelistings(inv_cat); + } +} + +// Returns true if all items within the argument folder are fit for sale, false otherwise +bool has_correct_permissions_for_sale(LLInventoryCategory* cat) +{ + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array); + + LLInventoryModel::item_array_t item_array_copy = *item_array; + + for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) + { + LLInventoryItem* item = *iter; + LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) item; + LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory(); + LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem(); + // Linked items and folders cannot be put for sale + if (linked_category || linked_item) + { + llinfos << "Merov : linked items in this folder -> not allowed to sell!" << llendl; + return false; + } + // *TODO : Check that this is adequate (copied from the Merchant Outbox permission check so should be OK...) + if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + llinfos << "Merov : wrong permissions on items in this folder -> not allowed to sell!" << llendl; + return false; + } + } + + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; + + for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) + { + LLInventoryCategory* category = *iter; + if (!has_correct_permissions_for_sale(category)) + { + return false; + } + } + return true; +} + +// Make all relevant business logic checks on the marketplace listings starting with the folder as argument +// This function does no deletion or move but a mere audit and raises issues to the user +// The only thing that's done is to modify the type of folders containing no-copy items to stock folders +// *TODO : Signal the errors to the user somewhat (UI still TBD) +// *TODO : Add the rest of the SLM/AIS business logic (limit of nesting depth, stock folder consistency, overall limit on listings, etc...) +void validate_marketplacelistings(LLInventoryCategory* cat) +{ + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array); + + LLInventoryModel::item_array_t item_array_copy = *item_array; + + for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) + { + LLInventoryItem* item = *iter; + LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) item; + LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory(); + LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem(); + if (linked_category || linked_item) + { + llinfos << "Merov : Validation error: there are linked items in this listing!" << llendl; + } + if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + llinfos << "Merov : Validation error: there are items with incorrect permissions in this listing!" << llendl; + } + if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY)) + { + llinfos << "Merov : Validation warning : item is no copy -> change the folder type to stock!" << llendl; + LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); + viewer_cat->changeType(LLFolderType::FT_MARKETPLACE_STOCK); + } + } + + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; + + for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) + { + LLInventoryCategory* category = *iter; + validate_marketplacelistings(category); + } +} + ///---------------------------------------------------------------------------- /// LLInventoryCollectFunctor implementations ///---------------------------------------------------------------------------- diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 1443c186cf..006cc3de68 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -70,9 +70,13 @@ void append_path(const LLUUID& id, std::string& path); void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LLUUID& top_level_folder, S32 operation_id); void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, S32 operation_id); - void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder, S32 operation_id); +void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder); +void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder); +bool has_correct_permissions_for_sale(LLInventoryCategory* cat); +void validate_marketplacelistings(LLInventoryCategory* inv_cat); + /** Miscellaneous global functions ** ** *******************************************************************************/ diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index ed7fd3cd34..37e11123c6 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2160,12 +2160,12 @@ void LLInventoryModel::buildParentChildMap() // implement it, we would need a set or map of uuid pairs // which would be (folder_id, new_parent_id) to be sent up // to the server. - llinfos << "Lost categroy: " << cat->getUUID() << " - " + llinfos << "Lost category: " << cat->getUUID() << " - " << cat->getName() << llendl; ++lost; // plop it into the lost & found. LLFolderType::EType pref = cat->getPreferredType(); - if(LLFolderType::FT_NONE == pref) + if ((LLFolderType::FT_NONE == pref) || (LLFolderType::FT_MARKETPLACE_STOCK == pref)) { cat->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND)); } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index bf8f7819ef..6305275a08 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1491,5 +1491,6 @@ namespace LLInitParam declare(LLFolderType::lookup(LLFolderType::FT_OUTBOX) , LLFolderType::FT_OUTBOX); declare(LLFolderType::lookup(LLFolderType::FT_BASIC_ROOT) , LLFolderType::FT_BASIC_ROOT); declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_LISTINGS) , LLFolderType::FT_MARKETPLACE_LISTINGS); + declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_STOCK), LLFolderType::FT_MARKETPLACE_STOCK); } } diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index ee8f85782f..b82f954e91 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -142,7 +142,8 @@ LLViewerFolderDictionary::LLViewerFolderDictionary() addEntry(LLFolderType::FT_BASIC_ROOT, new ViewerFolderEntry("Basic Root", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new ViewerFolderEntry("Marketplace listings", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible)); - + addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new ViewerFolderEntry("New Stock", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false, "default")); + addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false, "default")); #if SUPPORT_ENSEMBLES diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 80b520622a..ce9bbbc8d2 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2273,6 +2273,7 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. no Mkt ID live + stock Open landmarks -- cgit v1.3 From ec290cd059d80519ff6891149306586819ac008d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 31 Mar 2014 16:17:10 -0700 Subject: DD-18 : WIP : Implement stock folder counting but no propagation so far, also update is not working --- indra/newview/llinventorybridge.cpp | 5 +++-- indra/newview/llinventoryfunctions.cpp | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d0abe6db29..bf56be320f 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1973,8 +1973,9 @@ std::string LLFolderBridge::getLabelSuffix() const } else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) { - //llinfos << "Merov : in merchant folder and is a stock folder : id = " << getUUID() << llendl; - std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ")"; + llinfos << "Merov : in merchant folder and is a stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; + std::string stock = llformat("%d", getCategory()->getDescendentCount()); + std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ") (" + stock + ")"; return LLInvFVBridge::getLabelSuffix() + suffix; } else diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index de7a79502d..5e4fb557d5 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -733,6 +733,8 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol // Reparent the item gInventory.changeItemParent(viewer_inv_item, dest_folder, false); + gInventory.updateCategory(category); + gInventory.notifyObservers(); // Validate the destination : note that this will run the validation code only on one listing folder at most... validate_marketplacelistings(category); @@ -754,6 +756,8 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU // Reparent the folder LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + gInventory.updateCategory(viewer_inv_cat); + gInventory.notifyObservers(); // Check the destination folder recursively for no copy items and promote the including folders if any validate_marketplacelistings(inv_cat); @@ -815,7 +819,8 @@ void validate_marketplacelistings(LLInventoryCategory* cat) LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); const LLFolderType::EType folder_type = cat->getPreferredType(); - LLUUID stock_folder; + LLUUID stock_folder_uuid; + LLViewerInventoryCategory* stock_folder_cat = NULL; LLInventoryModel::item_array_t item_array_copy = *item_array; @@ -836,19 +841,24 @@ void validate_marketplacelistings(LLInventoryCategory* cat) if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY) && (folder_type != LLFolderType::FT_MARKETPLACE_STOCK)) { llinfos << "Merov : Validation warning : no copy item found in non stock folder -> reparent to relevant stock folder!" << llendl; - if (stock_folder.isNull()) + if (stock_folder_uuid.isNull()) { llinfos << "Merov : Validation warning : no appropriate existing stock folder -> create a new stock folder!" << llendl; - stock_folder = gInventory.createNewCategory(viewer_cat->getParentUUID(), LLFolderType::FT_MARKETPLACE_STOCK, viewer_cat->getName()); + stock_folder_uuid = gInventory.createNewCategory(viewer_cat->getParentUUID(), LLFolderType::FT_MARKETPLACE_STOCK, viewer_cat->getName()); + stock_folder_cat = gInventory.getCategory(stock_folder_uuid); } - gInventory.changeItemParent(viewer_inv_item, stock_folder, false); + gInventory.changeItemParent(viewer_inv_item, stock_folder_uuid, false); + gInventory.updateCategory(viewer_cat); + gInventory.updateCategory(stock_folder_cat); + gInventory.notifyObservers(); } } - if (stock_folder.notNull() && (viewer_cat->getDescendentCount() == 0)) + if (stock_folder_uuid.notNull() && (viewer_cat->getDescendentCount() == 0)) { llinfos << "Merov : Validation warning : folder content completely moved to stock folder -> remove empty folder!" << llendl; gInventory.removeCategory(cat->getUUID()); + gInventory.notifyObservers(); return; } -- cgit v1.3 From f66de28a7cf735df15d167df270943547bdbde81 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 1 Apr 2014 21:41:18 -0700 Subject: DD-20 : WIP : Implemented the cut and paste code for marketplace. Stock update still not working as expected. --- indra/newview/llinventorybridge.cpp | 90 +++++++++++++++++++++++----------- indra/newview/llinventoryfunctions.cpp | 47 +++++++++++++++--- indra/newview/llinventoryfunctions.h | 4 +- indra/newview/llinventorymodel.cpp | 3 ++ 4 files changed, 105 insertions(+), 39 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index bf56be320f..5462b2bef4 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3264,13 +3264,12 @@ void LLFolderBridge::pasteFromClipboard() { const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); + const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); - // *TODO : Add marketplace listings case - //const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); - //const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); LLDynamicArray objects; LLClipboard::instance().pasteFromClipboard(objects); @@ -3342,21 +3341,35 @@ void LLFolderBridge::pasteFromClipboard() LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id); llassert(vicat); if (vicat) - { - //changeCategoryParent() implicity calls dirtyFilter - changeCategoryParent(model, vicat, parent_id, FALSE); + { + if (move_is_into_marketplacelistings) + { + move_folder_to_marketplacelistings(vicat, parent_id); + } + else + { + //changeCategoryParent() implicity calls dirtyFilter + changeCategoryParent(model, vicat, parent_id, FALSE); + } } } else - { - LLViewerInventoryItem* viitem = dynamic_cast(item); - llassert(viitem); - if (viitem) - { - //changeItemParent() implicity calls dirtyFilter - changeItemParent(model, viitem, parent_id, FALSE); - } - } + { + LLViewerInventoryItem* viitem = dynamic_cast(item); + llassert(viitem); + if (viitem) + { + if (move_is_into_marketplacelistings) + { + move_item_to_marketplacelistings(viitem, parent_id); + } + else + { + //changeItemParent() implicity calls dirtyFilter + changeItemParent(model, viitem, parent_id, FALSE); + } + } + } } else { @@ -3367,22 +3380,41 @@ void LLFolderBridge::pasteFromClipboard() llassert(vicat); if (vicat) { - copy_inventory_category(model, vicat, parent_id); + if (move_is_into_marketplacelistings) + { + move_folder_to_marketplacelistings(vicat, parent_id, true); + } + else + { + copy_inventory_category(model, vicat, parent_id); + } } } - else - { - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - parent_id, - std::string(), - LLPointer(NULL)); - } - } - } - } + else + { + LLViewerInventoryItem* viitem = dynamic_cast(item); + llassert(viitem); + if (viitem) + { + if (move_is_into_marketplacelistings) + { + move_item_to_marketplacelistings(viitem, parent_id, true); + } + else + { + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + parent_id, + std::string(), + LLPointer(NULL)); + } + } + } + } + } + } // Change mode to paste for next paste LLClipboard::instance().setCutMode(false); } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 17bcd333f8..8216830336 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -688,7 +688,15 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold open_outbox(); } -void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder) +///---------------------------------------------------------------------------- +// Marketplace functions +// +// Handles Copy and Move to or within the Marketplace listings folder. +// Handles creation of stock folders, nesting of listings and version folders, +// permission checking and listings validation. +///---------------------------------------------------------------------------- + +void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings, exit with error if none const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); @@ -705,7 +713,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol if (linked_category != NULL) { // Move the linked folder directly - move_folder_to_marketplacelistings(linked_category, dest_folder); + move_folder_to_marketplacelistings(linked_category, dest_folder, copy); } else { @@ -733,10 +741,25 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol // Get the parent folder of the moved item : we may have to update it LLUUID src_folder = viewer_inv_item->getParentUUID(); - LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); + LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); - // Reparent the item - gInventory.changeItemParent(viewer_inv_item, dest_folder, false); + if (copy) + { + // Copy the item + copy_inventory_item( + gAgent.getID(), + viewer_inv_item->getPermissions().getOwner(), + viewer_inv_item->getUUID(), + dest_folder, + std::string(), + LLPointer(NULL)); + + } + else + { + // Reparent the item + gInventory.changeItemParent(viewer_inv_item, dest_folder, false); + } // Update the modified folders gInventory.updateCategory(src_cat); @@ -754,7 +777,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol } } -void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder) +void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy) { // Check that we have adequate permission on all items being moved. Proceed if we do. if (has_correct_permissions_for_sale(inv_cat)) @@ -767,9 +790,17 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU LLUUID src_folder = inv_cat->getParentUUID(); LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); - // Reparent the folder LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; - gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + if (copy) + { + // Copy the folder + copy_inventory_category(&gInventory, viewer_inv_cat, dest_folder); + } + else + { + // Reparent the folder + gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + } // Update the modified folders gInventory.updateCategory(src_cat); diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 006cc3de68..e6f9ef6d89 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -72,8 +72,8 @@ void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LL void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, S32 operation_id); void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder, S32 operation_id); -void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder); -void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder); +void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy = false); +void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false); bool has_correct_permissions_for_sale(LLInventoryCategory* cat); void validate_marketplacelistings(LLInventoryCategory* inv_cat); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 96a2db5afb..afddde02a4 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1056,7 +1056,10 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); if (marketplace_id.notNull() && isObjectDescendentOf(cat->getUUID(), marketplace_id)) { + // *TODO : Need some internal analysis to be less brutal with updates mask |= LLInventoryObserver::LABEL; + mask |= LLInventoryObserver::STRUCTURE; + mask |= LLInventoryObserver::INTERNAL; } old_cat->copyViewerCategory(cat); addChangedMask(mask, cat->getUUID()); -- cgit v1.3 From a98346b0c3b90e75858f6ef98985c1246ad30418 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 2 Apr 2014 18:06:22 -0700 Subject: DD-20 : WIP : Improve Cut and Paste for marketplace. Still some use cases that are not working well --- indra/newview/llinventorybridge.cpp | 22 +++++++++++++++++++--- indra/newview/llinventorybridge.h | 1 + indra/newview/llinventoryfunctions.cpp | 15 ++++++++++++--- indra/newview/llinventorymodel.cpp | 4 +--- 4 files changed, 33 insertions(+), 9 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 5462b2bef4..68418063e7 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1186,6 +1186,22 @@ void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid) } } +void LLInvFVBridge::removeObject(LLInventoryModel *model, const LLUUID &uuid) +{ + // Keep track of the parent + LLInventoryItem* itemp = model->getItem(uuid); + LLUUID parent_id = (itemp ? itemp->getParentUUID() : LLUUID::null); + // Remove the object + model->removeObject(uuid); + // Get the parent updated + if (parent_id.notNull()) + { + LLViewerInventoryCategory* parent_cat = model->getCategory(parent_id); + model->updateCategory(parent_cat); + model->notifyObservers(); + } +} + bool LLInvFVBridge::canShare() const { bool can_share = false; @@ -1406,7 +1422,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - gInventory.removeObject(mUUID); + removeObject(model, mUUID); return; } else if ("copy" == action) @@ -1973,7 +1989,7 @@ std::string LLFolderBridge::getLabelSuffix() const } else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) { - llinfos << "Merov : in merchant folder and is a stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; + //llinfos << "Merov : getLabelSuffix : stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; std::string stock = llformat("%d", getCategory()->getDescendentCount()); std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ") (" + stock + ")"; return LLInvFVBridge::getLabelSuffix() + suffix; @@ -3026,7 +3042,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - gInventory.removeObject(mUUID); + removeObject(model, mUUID); return; } else if ("copy" == action) diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 26c48fdc57..2c0b620395 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -184,6 +184,7 @@ protected: mutable std::string mSearchableName; void purgeItem(LLInventoryModel *model, const LLUUID &uuid); + void removeObject(LLInventoryModel *model, const LLUUID &uuid); virtual void buildDisplayName() const {} }; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 8216830336..aef05fead5 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -90,6 +90,14 @@ BOOL LLInventoryState::sWearNewClothing = FALSE; LLUUID LLInventoryState::sWearNewClothingTransactionID; +// Helper function : callback to update a folder after inventory action happened in the background +void update_folder_cb(const LLUUID& dest_folder) +{ + LLViewerInventoryCategory* dest_cat = gInventory.getCategory(dest_folder); + gInventory.updateCategory(dest_cat); + gInventory.notifyObservers(); +} + // Generates a string containing the path to the item specified by // item_id. void append_path(const LLUUID& id, std::string& path) @@ -163,13 +171,14 @@ void copy_inventory_category(LLInventoryModel* model, for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) { LLInventoryItem* item = *iter; + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid)); copy_inventory_item( gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), new_cat_uuid, std::string(), - LLPointer(NULL)); + cb); } // Copy all the folders @@ -746,14 +755,14 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol if (copy) { // Copy the item + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, dest_folder)); copy_inventory_item( gAgent.getID(), viewer_inv_item->getPermissions().getOwner(), viewer_inv_item->getUUID(), dest_folder, std::string(), - LLPointer(NULL)); - + cb); } else { diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index afddde02a4..269542d383 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1056,11 +1056,9 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); if (marketplace_id.notNull() && isObjectDescendentOf(cat->getUUID(), marketplace_id)) { - // *TODO : Need some internal analysis to be less brutal with updates mask |= LLInventoryObserver::LABEL; - mask |= LLInventoryObserver::STRUCTURE; - mask |= LLInventoryObserver::INTERNAL; } + llinfos << "Merov : updateCategory : " << cat->getName() << llendl; old_cat->copyViewerCategory(cat); addChangedMask(mask, cat->getUUID()); } -- cgit v1.3 From 39659f3c034c5cb335e185d1411e808d272f8065 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 3 Apr 2014 15:17:31 -0700 Subject: DD-20 : Handle edge cases a bit more cleanly --- indra/newview/llfloatermarketplacelistings.cpp | 2 +- indra/newview/llinventorybridge.cpp | 3 +-- indra/newview/llinventorymodel.cpp | 1 - indra/newview/llinventorypanel.cpp | 3 ++- 4 files changed, 4 insertions(+), 5 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 814f1b218a..e8257e52c4 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -466,7 +466,7 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO BOOL handled = (handled_view != NULL); // Pass all drag and drop for this floater to the marketplace listings inventory control - if (!handled || !isAccepted(*accept)) + if (!handled && isAccepted(*accept) && !mPanelListings->getVisible() && mRootFolderId.notNull()) { LLFolderView* root_folder = mPanelListings->getRootFolder(); handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 68418063e7..09fd0527b9 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2345,7 +2345,6 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_from_outbox = model->isObjectDescendentOf(cat_id, outbox_id); const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); - const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); // check to make sure source is agent inventory, and is represented there. LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); @@ -2633,7 +2632,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, { copy_folder_to_outbox(inv_cat, mUUID, cat_id, LLToolDragAndDrop::getOperationId()); } - else if (move_is_into_marketplacelistings && !move_is_from_marketplacelistings) + else if (move_is_into_marketplacelistings) { move_folder_to_marketplacelistings(inv_cat, mUUID); } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 269542d383..96a2db5afb 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1058,7 +1058,6 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) { mask |= LLInventoryObserver::LABEL; } - llinfos << "Merov : updateCategory : " << cat->getName() << llendl; old_cat->copyViewerCategory(cat); addChangedMask(mask, cat->getUUID()); } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 6305275a08..7d774110bd 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -568,7 +568,8 @@ void LLInventoryPanel::modelChanged(U32 mask) else if (!model_item && view_item && viewmodel_item) { // Remove the item's UI. - removeItemID(viewmodel_item->getUUID()); + const LLUUID& idp = viewmodel_item->getUUID(); + removeItemID(idp); view_item->destroyView(); } } -- cgit v1.3 From 6263a4fe6f38bd860e583f3819fb38c5c1d37efd Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 4 Apr 2014 12:33:40 -0700 Subject: DD-45 : Add Activate right click menu item to marketplace listings folders --- indra/newview/llinventorybridge.cpp | 26 ++++++++++++++++++++++ indra/newview/llinventorybridge.h | 3 +++ .../skins/default/xui/en/menu_inventory.xml | 8 +++++++ 3 files changed, 37 insertions(+) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 09fd0527b9..ceb54b3dcd 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -744,6 +744,10 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Share")); @@ -845,6 +849,15 @@ void LLInvFVBridge::addOutboxContextMenuOptions(U32 flags, #endif // ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU } +void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, + menuentry_vec_t &items, + menuentry_vec_t &disabled_items) +{ + items.push_back(std::string("Marketplace Separator")); + items.push_back(std::string("Marketplace Activate")); +} + + // *TODO: remove this BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const { @@ -3069,6 +3082,15 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) restoreItem(); return; } + else if ("marketplace_activate" == action) + { + if (!LLMarketplaceData::instance().isListed(mUUID)) + { + LLMarketplaceData::instance().addTestItem(mUUID); + } + LLMarketplaceData::instance().setActivation(mUUID,true); + return; + } #ifndef LL_RELEASE_FOR_DOWNLOAD else if ("delete_system_folder" == action) { @@ -3563,6 +3585,10 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else if(isAgentInventory()) // do not allow creating in library { LLViewerInventoryCategory *cat = getCategory(); diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 2c0b620395..72b92b6911 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -146,6 +146,9 @@ protected: virtual void addOutboxContextMenuOptions(U32 flags, menuentry_vec_t &items, menuentry_vec_t &disabled_items); + virtual void addMarketplaceContextMenuOptions(U32 flags, + menuentry_vec_t &items, + menuentry_vec_t &disabled_items); protected: LLInvFVBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid); diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 6fa45d7d66..aa115c1ad1 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -726,6 +726,14 @@ parameter="send_to_marketplace" /> + + + -- cgit v1.3 From e1d2f71d348bafe0be783dcb3dfbeb56bc877c12 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 4 Apr 2014 16:56:17 -0700 Subject: DD-14 : Add all right click menu items for marketplace. Make Add, Activate and Deactivate work. Right click fails on non folder items though in marketplace --- indra/newview/llfloatermarketplacelistings.cpp | 23 ----- indra/newview/llinventorybridge.cpp | 113 +++++++++++++++++++-- indra/newview/llinventoryfunctions.cpp | 27 +++++ indra/newview/llinventoryfunctions.h | 1 + .../skins/default/xui/en/menu_inventory.xml | 51 ++++++++-- 5 files changed, 174 insertions(+), 41 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 42e49f5d7d..10c6045f87 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -246,29 +246,6 @@ void LLFloaterMarketplaceListings::onOpen(const LLSD& key) setup(); } - // Merov : Debug : Create fake Marketplace data if none is present - if (LLMarketplaceData::instance().isEmpty() && (getFolderCount() > 0)) - { - LLInventoryModel::cat_array_t* cats; - LLInventoryModel::item_array_t* items; - gInventory.getDirectDescendentsOf(mRootFolderId, cats, items); - - int index = 0; - for (LLInventoryModel::cat_array_t::iterator iter = cats->begin(); iter != cats->end(); iter++, index++) - { - LLViewerInventoryCategory* category = *iter; - if (index%3) - { - LLMarketplaceData::instance().addTestItem(category->getUUID()); - if (index%3 == 1) - { - LLMarketplaceData::instance().setListingID(category->getUUID(),"TestingID1234"); - } - LLMarketplaceData::instance().setActivation(category->getUUID(),(index%2)); - } - } - } - // // Update the floater view // diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ceb54b3dcd..cd3e51a0ea 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -744,10 +744,6 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } - else if (isMarketplaceListingsFolder()) - { - addMarketplaceContextMenuOptions(flags, items, disabled_items); - } else { items.push_back(std::string("Share")); @@ -853,8 +849,49 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, menuentry_vec_t &items, menuentry_vec_t &disabled_items) { - items.push_back(std::string("Marketplace Separator")); - items.push_back(std::string("Marketplace Activate")); + S32 depth = depth_nesting_in_marketplace(mUUID); + llinfos << "Merov : adding marketplace menu at depth = " << depth << llendl; + if (depth <= 1) + { + // Options available at the Listing Folder level only + items.push_back(std::string("Marketplace Add Listing")); + items.push_back(std::string("Marketplace Attach Listing")); + if (LLMarketplaceData::instance().isListed(mUUID)) + { + disabled_items.push_back(std::string("Marketplace Add Listing")); + disabled_items.push_back(std::string("Marketplace Attach Listing")); + } + } + if (depth <= 2) + { + // Options available at the Listing Folder and Version Folder levels + items.push_back(std::string("Marketplace Activate")); + items.push_back(std::string("Marketplace Deactivate")); + if (LLMarketplaceData::instance().isListed(mUUID)) + { + if (LLMarketplaceData::instance().getActivationState(mUUID)) + { + disabled_items.push_back(std::string("Marketplace Activate")); + } + else + { + disabled_items.push_back(std::string("Marketplace Deactivate")); + } + } + else + { + disabled_items.push_back(std::string("Marketplace Activate")); + disabled_items.push_back(std::string("Marketplace Deactivate")); + } + } + // Options available at all levels on all items + items.push_back(std::string("Marketplace Show Listing")); + if (!LLMarketplaceData::instance().isListed(mUUID)) + { + disabled_items.push_back(std::string("Marketplace Show Listing")); + } + // Separator + items.push_back(std::string("Marketplace Listings Separator")); } @@ -3084,13 +3121,33 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } else if ("marketplace_activate" == action) { - if (!LLMarketplaceData::instance().isListed(mUUID)) - { - LLMarketplaceData::instance().addTestItem(mUUID); - } LLMarketplaceData::instance().setActivation(mUUID,true); return; } + else if ("marketplace_deactivate" == action) + { + LLMarketplaceData::instance().setActivation(mUUID,false); + return; + } + else if ("marketplace_add_listing" == action) + { + // *TODO : Do something a bit smarter... + LLMarketplaceData::instance().addTestItem(mUUID); + return; + } + else if ("marketplace_attach_listing" == action) + { + // *TODO : Get a list of listing IDs and let the user choose one, delist the old one and relist the new one + LLMarketplaceData::instance().addTestItem(mUUID); + return; + } + else if ("marketplace_show_listing" == action) + { + // *TODO : Need to show a browser window with the info for the listing + // Get the listing id (i.e. go up the hierarchy to find the listing folder + // Show the listing folder in a browser window + return; + } #ifndef LL_RELEASE_FOR_DOWNLOAD else if ("delete_system_folder" == action) { @@ -4644,6 +4701,10 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Share")); @@ -4711,6 +4772,10 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { if (isItemInTrash()) @@ -4769,6 +4834,10 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { if(isItemInTrash()) @@ -5019,6 +5088,10 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Delete")); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Share")); @@ -5286,6 +5359,10 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Delete")); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Share")); @@ -5340,6 +5417,10 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Delete")); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { if(isItemInTrash()) @@ -5619,6 +5700,10 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Delete")); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Share")); @@ -5841,6 +5926,10 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Delete")); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere BOOL can_open = ((flags & SUPPRESS_OPEN_ITEM) != SUPPRESS_OPEN_ITEM); @@ -6141,6 +6230,10 @@ void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Properties")); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index d99193067d..e57519d67a 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -705,6 +705,33 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold // permission checking and listings validation. ///---------------------------------------------------------------------------- +S32 depth_nesting_in_marketplace(LLUUID cur_uuid) +{ + // Get the marketplace listings root, exit with -1 (i.e. not under the marketplace listings root) if none + const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + if (marketplace_listings_uuid.isNull()) + { + return -1; + } + // If not a descendent of the marketplace listings root, then the nesting depth is -1 by definition + if (!gInventory.isObjectDescendentOf(cur_uuid, marketplace_listings_uuid)) + { + return -1; + } + + // Iterate through the parents till we hit the marketplace listings root + // Note that the marketplace listings root itself will return 0 + S32 depth = 0; + LLInventoryObject* cur_object = gInventory.getObject(cur_uuid); + while (cur_uuid != marketplace_listings_uuid) + { + depth++; + cur_uuid = cur_object->getParentUUID(); + cur_object = gInventory.getCategory(cur_uuid); + } + return depth; +} + void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings, exit with error if none diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index e6f9ef6d89..aab4db8adf 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -76,6 +76,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false); bool has_correct_permissions_for_sale(LLInventoryCategory* cat); void validate_marketplacelistings(LLInventoryCategory* inv_cat); +S32 depth_nesting_in_marketplace(LLUUID cur_uuid); /** Miscellaneous global functions ** ** diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index aa115c1ad1..cde14e72f0 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -4,6 +4,49 @@ layout="topleft" name="Popup" visible="false"> + + + + + + + + + + + + + + + + - - - -- cgit v1.3 From a38bc63da24994b51cfd3487d4011c8e608cd41d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sun, 6 Apr 2014 22:03:58 -0700 Subject: DD-15 : Allow version folder to be made active/inactive, add new methods to marketplace to make all that a bit more clear and clean --- indra/newview/llinventorybridge.cpp | 74 +++++++++++++------- indra/newview/llinventoryfunctions.cpp | 20 +++++- indra/newview/llinventoryfunctions.h | 1 + indra/newview/llmarketplacefunctions.cpp | 112 ++++++++++++++++++++++++++----- indra/newview/llmarketplacefunctions.h | 26 ++++--- 5 files changed, 179 insertions(+), 54 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index cd3e51a0ea..9c9f195875 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -851,24 +851,17 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, { S32 depth = depth_nesting_in_marketplace(mUUID); llinfos << "Merov : adding marketplace menu at depth = " << depth << llendl; - if (depth <= 1) + if (depth == 1) { - // Options available at the Listing Folder level only + // Options available at the Listing Folder level items.push_back(std::string("Marketplace Add Listing")); items.push_back(std::string("Marketplace Attach Listing")); - if (LLMarketplaceData::instance().isListed(mUUID)) - { - disabled_items.push_back(std::string("Marketplace Add Listing")); - disabled_items.push_back(std::string("Marketplace Attach Listing")); - } - } - if (depth <= 2) - { - // Options available at the Listing Folder and Version Folder levels items.push_back(std::string("Marketplace Activate")); items.push_back(std::string("Marketplace Deactivate")); if (LLMarketplaceData::instance().isListed(mUUID)) { + disabled_items.push_back(std::string("Marketplace Add Listing")); + disabled_items.push_back(std::string("Marketplace Attach Listing")); if (LLMarketplaceData::instance().getActivationState(mUUID)) { disabled_items.push_back(std::string("Marketplace Activate")); @@ -884,9 +877,28 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, disabled_items.push_back(std::string("Marketplace Deactivate")); } } + if (depth == 2) + { + // Options available at the Version Folder levels + LLInventoryObject* object = gInventory.getObject(mUUID); + if (LLMarketplaceData::instance().isListed(object->getParentUUID())) + { + items.push_back(std::string("Marketplace Activate")); + items.push_back(std::string("Marketplace Deactivate")); + if (LLMarketplaceData::instance().getActivationState(mUUID)) + { + disabled_items.push_back(std::string("Marketplace Activate")); + } + else + { + disabled_items.push_back(std::string("Marketplace Deactivate")); + } + } + } // Options available at all levels on all items items.push_back(std::string("Marketplace Show Listing")); - if (!LLMarketplaceData::instance().isListed(mUUID)) + LLUUID listing_folder_id = nested_parent_id(mUUID,depth); + if (!LLMarketplaceData::instance().isListed(listing_folder_id)) { disabled_items.push_back(std::string("Marketplace Show Listing")); } @@ -2011,17 +2023,9 @@ void LLFolderBridge::buildDisplayName() const std::string LLFolderBridge::getLabelSuffix() const { - // *TODO : We need to display some suffix also for the version folder! - /* - LLInventoryCategory* cat = gInventory.getCategory(getUUID()); - if(cat) - { - const LLUUID& parent_folder_id = cat->getParentUUID(); - accessories = (parent_folder_id == gInventory.getLibraryRootFolderID()); - } - */ if (isMarketplaceListingsFolder()) { + // Listing folder case if (LLMarketplaceData::instance().isListed(getUUID())) { //llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; @@ -2037,6 +2041,17 @@ std::string LLFolderBridge::getLabelSuffix() const } return LLInvFVBridge::getLabelSuffix() + suffix; } + // Version folder case + else if (LLMarketplaceData::instance().isVersionFolder(getUUID())) + { + std::string suffix; + if (LLMarketplaceData::instance().getActivationState(getUUID())) + { + suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; + } + return LLInvFVBridge::getLabelSuffix() + suffix; + } + // Stock folder case else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) { //llinfos << "Merov : getLabelSuffix : stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; @@ -3121,7 +3136,17 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } else if ("marketplace_activate" == action) { - LLMarketplaceData::instance().setActivation(mUUID,true); + S32 depth = depth_nesting_in_marketplace(mUUID); + if (depth == 2) + { + LLInventoryCategory* category = gInventory.getCategory(mUUID); + LLMarketplaceData::instance().setVersionFolderID(category->getParentUUID(), mUUID); + LLMarketplaceData::instance().setActivation(mUUID,true); + } + else if (depth == 1) + { + LLMarketplaceData::instance().setActivation(mUUID,true); + } return; } else if ("marketplace_deactivate" == action) @@ -3131,14 +3156,13 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } else if ("marketplace_add_listing" == action) { - // *TODO : Do something a bit smarter... - LLMarketplaceData::instance().addTestItem(mUUID); + LLMarketplaceData::instance().addListing(mUUID); return; } else if ("marketplace_attach_listing" == action) { // *TODO : Get a list of listing IDs and let the user choose one, delist the old one and relist the new one - LLMarketplaceData::instance().addTestItem(mUUID); + LLMarketplaceData::instance().addListing(mUUID); return; } else if ("marketplace_show_listing" == action) diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index e57519d67a..aef3bc9cca 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -125,8 +125,11 @@ void update_marketplace_category(const LLUUID& cat_id) // for all observers of the folder to, possibly, change the display label of said folder. // At least that's the status for the moment so, even if that function seems small, we // prefer to encapsulate that behavior here. - gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); - gInventory.notifyObservers(); + if (cat_id.notNull()) + { + gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); + gInventory.notifyObservers(); + } } void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name) @@ -732,6 +735,19 @@ S32 depth_nesting_in_marketplace(LLUUID cur_uuid) return depth; } +LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth) +{ + LLInventoryObject* cur_object = gInventory.getObject(cur_uuid); + cur_uuid = (depth < 1 ? LLUUID::null : cur_uuid); + while (depth > 1) + { + depth--; + cur_uuid = cur_object->getParentUUID(); + cur_object = gInventory.getCategory(cur_uuid); + } + return cur_uuid; +} + void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings, exit with error if none diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index aab4db8adf..69219c7c42 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -77,6 +77,7 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU bool has_correct_permissions_for_sale(LLInventoryCategory* cat); void validate_marketplacelistings(LLInventoryCategory* inv_cat); S32 depth_nesting_in_marketplace(LLUUID cur_uuid); +LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth); /** Miscellaneous global functions ** ** diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 6f35cc217d..29ce5361f0 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -535,25 +535,25 @@ void LLMarketplaceInventoryImporter::updateImport() // Tuple == Item LLMarketplaceTuple::LLMarketplaceTuple() : - mFolderListingId(), + mListingFolderId(), mListingId(""), - mActiveVersionFolderId(), + mVersionFolderId(), mIsActive(false) { } LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id) : - mFolderListingId(folder_id), + mListingFolderId(folder_id), mListingId(""), - mActiveVersionFolderId(), + mVersionFolderId(), mIsActive(false) { } LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, std::string listing_id, const LLUUID& version_id, bool is_listed) : - mFolderListingId(folder_id), + mListingFolderId(folder_id), mListingId(listing_id), - mActiveVersionFolderId(version_id), + mVersionFolderId(version_id), mIsActive(is_listed) { } @@ -564,28 +564,85 @@ LLMarketplaceData::LLMarketplaceData() { } +// Creation / Deletion +bool LLMarketplaceData::addListing(const LLUUID& folder_id) +{ + if (isListed(folder_id)) + { + // Listing already exists -> exit with error + return false; + } + mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); + update_marketplace_category(folder_id); + return true; +} + +bool LLMarketplaceData::deleteListing(const LLUUID& folder_id) +{ + if (!isListed(folder_id)) + { + // Listing doesn't exist -> exit with error + return false; + } + mMarketplaceItems.erase(folder_id); + update_marketplace_category(folder_id); + return true; +} + // Accessors bool LLMarketplaceData::getActivationState(const LLUUID& folder_id) { - marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); - return (it == mMarketplaceItems.end() ? false : (it->second).mIsActive); + // Listing folder case + if (isListed(folder_id)) + { + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + return (it->second).mIsActive; + } + // We need to iterate through the list to check it's not a version folder + marketplace_items_list_t::iterator it = mMarketplaceItems.begin(); + while (it != mMarketplaceItems.end()) + { + if ((it->second).mVersionFolderId == folder_id) + { + return (it->second).mIsActive; + } + it++; + } + return false; } + std::string LLMarketplaceData::getListingID(const LLUUID& folder_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); return (it == mMarketplaceItems.end() ? "" : (it->second).mListingId); } + LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); - return (it == mMarketplaceItems.end() ? LLUUID::null : (it->second).mActiveVersionFolderId); + return (it == mMarketplaceItems.end() ? LLUUID::null : (it->second).mVersionFolderId); } + bool LLMarketplaceData::isListed(const LLUUID& folder_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); return (it != mMarketplaceItems.end()); } +bool LLMarketplaceData::isVersionFolder(const LLUUID& folder_id) +{ + marketplace_items_list_t::iterator it = mMarketplaceItems.begin(); + while (it != mMarketplaceItems.end()) + { + if ((it->second).mVersionFolderId == folder_id) + { + return true; + } + it++; + } + return false; +} + // Modifiers bool LLMarketplaceData::setListingID(const LLUUID& folder_id, std::string listing_id) { @@ -601,6 +658,7 @@ bool LLMarketplaceData::setListingID(const LLUUID& folder_id, std::string listin return true; } } + bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); @@ -610,24 +668,42 @@ bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID } else { - (it->second).mActiveVersionFolderId = version_id; - update_marketplace_category(folder_id); + LLUUID old_version_id = (it->second).mVersionFolderId; + if (old_version_id != version_id) + { + (it->second).mVersionFolderId = version_id; + update_marketplace_category(old_version_id); + update_marketplace_category(version_id); + } return true; } } + bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) { - marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); - if (it == mMarketplaceItems.end()) - { - return false; - } - else + // Listing folder case + if (isListed(folder_id)) { + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); (it->second).mIsActive = activate; - update_marketplace_category(folder_id); + update_marketplace_category((it->second).mListingFolderId); + update_marketplace_category((it->second).mVersionFolderId); return true; } + // We need to iterate through the list to check it's not a version folder + marketplace_items_list_t::iterator it = mMarketplaceItems.begin(); + while (it != mMarketplaceItems.end()) + { + if ((it->second).mVersionFolderId == folder_id) + { + (it->second).mIsActive = activate; + update_marketplace_category((it->second).mListingFolderId); + update_marketplace_category((it->second).mVersionFolderId); + return true; + } + it++; + } + return false; } // Test methods diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 00840c6e23..d76072da1f 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -113,7 +113,8 @@ private: // * implement the Marketplace API (TBD) // * cache the current Marketplace data (tuples) // * provide methods to get Marketplace data on any inventory item -// * signal marketplace updates to inventory +// * set Marketplace data +// * signal Marketplace updates to inventory class LLMarketplaceData; // A Marketplace item is known by its tuple @@ -128,15 +129,16 @@ public: private: // Representation of a marketplace item in the Marketplace DB (well, what we know of it...) - LLUUID mFolderListingId; + LLUUID mListingFolderId; std::string mListingId; - LLUUID mActiveVersionFolderId; + LLUUID mVersionFolderId; bool mIsActive; }; -// Note: the folder UUID is used as a key to this map. It could therefore be taken off the object themselves +// Note: The listing folder UUID is used as a key to this map. It could therefore be taken off the LLMarketplaceTuple objects themselves typedef std::map marketplace_items_list_t; -// There's one and only one possible set of Marketplace data per agent and per session +// Session cache of Marketplace tuples +// Note: There's one and only one possible set of Marketplace dataset per agent and per session class LLMarketplaceData : public LLSingleton { @@ -145,14 +147,20 @@ public: bool isEmpty() { return (mMarketplaceItems.size() == 0); } - // Access Marketplace Data : each method returns a default value if the folder_id can't be found + // Probe the Marketplace data set to identify folders + bool isListed(const LLUUID& folder_id); // returns true if folder_id is a Listing folder + bool isVersionFolder(const LLUUID& folder_id); // returns true if folder_id is a Version folder + + // Create/Delete Marketplace data set : each method returns true if the function succeeds, false if error + bool addListing(const LLUUID& folder_id); + bool deleteListing(const LLUUID& folder_id); + + // Access Marketplace data set : each method returns a default value if the folder_id can't be found bool getActivationState(const LLUUID& folder_id); std::string getListingID(const LLUUID& folder_id); LLUUID getVersionFolderID(const LLUUID& folder_id); - bool isListed(const LLUUID& folder_id); // returns true if folder_id is in the items map - - // Modify Marketplace Data : each method returns true if the function succeeds, false if error + // Modify Marketplace data set : each method returns true if the function succeeds, false if error bool setListingID(const LLUUID& folder_id, std::string listing_id); bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id); bool setActivation(const LLUUID& folder_id, bool activate); -- cgit v1.3 From 8d20027ff904a29c9fb573372f89839bcab5a0c0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 7 Apr 2014 14:54:34 -0700 Subject: DD-41 : Clean up and add back into contextual menu the clipboard options, as well as Rename and Properties --- indra/newview/llinventorybridge.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 9c9f195875..8d87b40e4e 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -650,8 +650,9 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, if (!isInboxFolder()) { items.push_back(std::string("Rename")); - if (!isItemRenameable() || (flags & FIRST_SELECTED_ITEM) == 0) + if (!isItemRenameable() || ((flags & FIRST_SELECTED_ITEM) == 0)) { + llinfos << "Merov : rename disable, renameable = " << isItemRenameable() << ", flags = " << flags << llendl; disabled_items.push_back(std::string("Rename")); } } @@ -688,7 +689,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, disabled_items.push_back(std::string("Cut")); } - if (canListOnMarketplace()) + if (canListOnMarketplace() && !isMarketplaceListingsFolder()) { items.push_back(std::string("Marketplace Separator")); @@ -879,9 +880,9 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, } if (depth == 2) { - // Options available at the Version Folder levels - LLInventoryObject* object = gInventory.getObject(mUUID); - if (LLMarketplaceData::instance().isListed(object->getParentUUID())) + // Options available at the Version Folder levels and only for folders + LLInventoryCategory* cat = gInventory.getCategory(mUUID); + if (cat && LLMarketplaceData::instance().isListed(cat->getParentUUID())) { items.push_back(std::string("Marketplace Activate")); items.push_back(std::string("Marketplace Deactivate")); @@ -3669,6 +3670,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + getClipboardEntries(false, items, disabled_items, flags); } else if(isAgentInventory()) // do not allow creating in library { @@ -3747,7 +3749,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items disabled_items.push_back(std::string("Delete System Folder")); } - if (!isOutboxFolder()) + if (!isOutboxFolder() && !isMarketplaceListingsFolder()) { items.push_back(std::string("Share")); if (!canShare()) @@ -3757,7 +3759,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items } // Add menu items that are dependent on the contents of the folder. LLViewerInventoryCategory* category = (LLViewerInventoryCategory *) model->getCategory(mUUID); - if (category) + if (category && !isMarketplaceListingsFolder()) { uuid_vec_t folders; folders.push_back(category->getUUID()); @@ -4728,6 +4730,8 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -4799,6 +4803,8 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -4861,6 +4867,8 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -5115,6 +5123,8 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -5386,6 +5396,8 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -5444,6 +5456,8 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -5727,6 +5741,8 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -5953,6 +5969,8 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere @@ -6257,6 +6275,8 @@ void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { -- cgit v1.3 From fc4e9d2572635903449ade6ebf2a45aa9e971023 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 8 Apr 2014 18:12:48 -0700 Subject: DD-18 : Compute stock for all levels, get folders to update more consistently on all actions in the marketplace --- indra/newview/llinventorybridge.cpp | 24 +++---- indra/newview/llinventoryfunctions.cpp | 87 ++++++++++++++++++++------ indra/newview/llinventoryfunctions.h | 1 + indra/newview/llinventorymodel.cpp | 2 +- indra/newview/skins/default/xui/en/strings.xml | 1 + 5 files changed, 78 insertions(+), 37 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 8d87b40e4e..7ff0a445e8 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -652,7 +652,6 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, items.push_back(std::string("Rename")); if (!isItemRenameable() || ((flags & FIRST_SELECTED_ITEM) == 0)) { - llinfos << "Merov : rename disable, renameable = " << isItemRenameable() << ", flags = " << flags << llendl; disabled_items.push_back(std::string("Rename")); } } @@ -851,7 +850,6 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, menuentry_vec_t &disabled_items) { S32 depth = depth_nesting_in_marketplace(mUUID); - llinfos << "Merov : adding marketplace menu at depth = " << depth << llendl; if (depth == 1) { // Options available at the Listing Folder level @@ -2026,11 +2024,11 @@ std::string LLFolderBridge::getLabelSuffix() const { if (isMarketplaceListingsFolder()) { + std::string suffix = ""; // Listing folder case if (LLMarketplaceData::instance().isListed(getUUID())) { - //llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; - std::string suffix = LLMarketplaceData::instance().getListingID(getUUID()); + suffix = LLMarketplaceData::instance().getListingID(getUUID()); if (suffix.empty()) { suffix = LLTrans::getString("MarketplaceNoID"); @@ -2040,31 +2038,25 @@ std::string LLFolderBridge::getLabelSuffix() const { suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; } - return LLInvFVBridge::getLabelSuffix() + suffix; } // Version folder case else if (LLMarketplaceData::instance().isVersionFolder(getUUID())) { - std::string suffix; if (LLMarketplaceData::instance().getActivationState(getUUID())) { suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; } - return LLInvFVBridge::getLabelSuffix() + suffix; } - // Stock folder case - else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + S32 stock_count = compute_stock_count(getUUID()); + if (stock_count == 0) { - //llinfos << "Merov : getLabelSuffix : stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; - std::string stock = llformat("%d", getCategory()->getDescendentCount()); - std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ") (" + stock + ")"; - return LLInvFVBridge::getLabelSuffix() + suffix; + suffix += " (" + LLTrans::getString("MarketplaceNoStock") + ")"; } - else + else if (stock_count != -1) { - //llinfos << "Merov : in merchant folder but not listed : id = " << getUUID() << llendl; - return LLInvFVBridge::getLabelSuffix(); + suffix += " (" + LLTrans::getString("MarketplaceStock") + "=" + llformat("%d", stock_count) + ")"; } + return LLInvFVBridge::getLabelSuffix() + suffix; } else { diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index aef3bc9cca..20cbb06f07 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -122,14 +122,31 @@ void append_path(const LLUUID& id, std::string& path) void update_marketplace_category(const LLUUID& cat_id) { // When changing the marketplace status of a folder, the only thing that needs to happen is - // for all observers of the folder to, possibly, change the display label of said folder. - // At least that's the status for the moment so, even if that function seems small, we - // prefer to encapsulate that behavior here. - if (cat_id.notNull()) + // for all observers of the folder to, possibly, change the display label of the folder + // as well as, potentially, change the display label of all parent folders up to the marketplace root. + + const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + // No marketplace, likely called in error then... + // Or not a descendent of the marketplace listings root, then just do the regular category update + if (marketplace_listings_uuid.isNull() || !gInventory.isObjectDescendentOf(cat_id, marketplace_listings_uuid)) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); + gInventory.updateCategory(cat); + gInventory.notifyObservers(); + return; + } + // Explore all the hierarchy of folders up to the root to get them to update + // Note: this is not supposed to be deeper than 4 + LLUUID cur_id = cat_id; + LLInventoryCategory* cur_cat = gInventory.getCategory(cur_id); + while (cur_id != marketplace_listings_uuid) { - gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); + gInventory.addChangedMask(LLInventoryObserver::LABEL, cur_id); gInventory.notifyObservers(); + cur_id = cur_cat->getParentUUID(); + cur_cat = gInventory.getCategory(cur_id); } + return; } void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name) @@ -748,6 +765,41 @@ LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth) return cur_uuid; } +S32 compute_stock_count(LLUUID cat_uuid) +{ + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat_uuid,cat_array,item_array); + + // "-1" denotes a folder that doesn't countain any stock folders in its descendents + S32 curr_count = -1; + + LLInventoryCategory* cat = gInventory.getCategory(cat_uuid); + + if (cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + // Note: stock folders are *not* supposed to have nested subfolders so we stop recursion here + LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); + curr_count = viewer_cat->getDescendentCount(); + } + else + { + // Note: marketplace listings have a maximum depth nesting of 4 + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; + for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) + { + LLInventoryCategory* category = *iter; + S32 count = compute_stock_count(category->getUUID()); + if ((curr_count == -1) || ((count != -1) && (count < curr_count))) + { + curr_count = count; + } + } + } + + return curr_count; +} + void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings, exit with error if none @@ -792,7 +844,6 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol // Get the parent folder of the moved item : we may have to update it LLUUID src_folder = viewer_inv_item->getParentUUID(); - LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); if (copy) { @@ -812,13 +863,12 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol gInventory.changeItemParent(viewer_inv_item, dest_folder, false); } - // Update the modified folders - gInventory.updateCategory(src_cat); - gInventory.updateCategory(dest_cat); - gInventory.notifyObservers(); - // Validate the destination : note that this will run the validation code only on one listing folder at most... validate_marketplacelistings(dest_cat); + + // Update the modified folders + update_marketplace_category(src_folder); + update_marketplace_category(dest_folder); } else { @@ -839,7 +889,6 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU // Get the parent folder of the moved item : we may have to update it LLUUID src_folder = inv_cat->getParentUUID(); - LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; if (copy) @@ -853,13 +902,12 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); } - // Update the modified folders - gInventory.updateCategory(src_cat); - gInventory.updateCategory(dest_cat); - gInventory.notifyObservers(); - // Check the destination folder recursively for no copy items and promote the including folders if any validate_marketplacelistings(dest_cat); + + // Update the modified folders + update_marketplace_category(src_folder); + update_marketplace_category(dest_folder); } } @@ -948,9 +996,8 @@ void validate_marketplacelistings(LLInventoryCategory* cat) stock_folder_cat = gInventory.getCategory(stock_folder_uuid); } gInventory.changeItemParent(viewer_inv_item, stock_folder_uuid, false); - gInventory.updateCategory(viewer_cat); - gInventory.updateCategory(stock_folder_cat); - gInventory.notifyObservers(); + update_marketplace_category(viewer_cat->getUUID()); + update_marketplace_category(stock_folder_uuid); } } diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 69219c7c42..66f1c99630 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -78,6 +78,7 @@ bool has_correct_permissions_for_sale(LLInventoryCategory* cat); void validate_marketplacelistings(LLInventoryCategory* inv_cat); S32 depth_nesting_in_marketplace(LLUUID cur_uuid); LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth); +S32 compute_stock_count(LLUUID cat_uuid); /** Miscellaneous global functions ** ** diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 96a2db5afb..c0aedd3881 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1013,7 +1013,7 @@ LLInventoryModel::item_array_t* LLInventoryModel::getUnlockedItemArray(const LLU // an existing item with the matching id, or it will add the category. void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) { - if(cat->getUUID().isNull()) + if(!cat || cat->getUUID().isNull()) { return; } diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index ce9bbbc8d2..55272750e7 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2274,6 +2274,7 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. no Mkt ID live stock + out of stock Open landmarks -- cgit v1.3 From 748bbeaf982c456b120d4b3f4d33aa6dce576908 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 9 Apr 2014 14:19:38 -0700 Subject: DD-13 : Clean up Associate/Disassociate listing. Also clarify the update folder code in marketplace --- indra/newview/llinventorybridge.cpp | 19 ++++++-- indra/newview/llinventoryfunctions.cpp | 55 ++++++++++++++++------ indra/newview/llmarketplacefunctions.cpp | 18 ------- indra/newview/llmarketplacefunctions.h | 5 -- .../skins/default/xui/en/menu_inventory.xml | 14 ++++-- 5 files changed, 67 insertions(+), 44 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 7ff0a445e8..3af734ba27 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -65,6 +65,7 @@ #include "llsidepanelappearance.h" #include "lltooldraganddrop.h" #include "lltrans.h" +#include "llurlaction.h" #include "llviewerassettype.h" #include "llviewerfoldertype.h" #include "llviewermenu.h" @@ -853,13 +854,14 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, if (depth == 1) { // Options available at the Listing Folder level - items.push_back(std::string("Marketplace Add Listing")); + items.push_back(std::string("Marketplace Associate Listing")); items.push_back(std::string("Marketplace Attach Listing")); + items.push_back(std::string("Marketplace Disassociate Listing")); items.push_back(std::string("Marketplace Activate")); items.push_back(std::string("Marketplace Deactivate")); if (LLMarketplaceData::instance().isListed(mUUID)) { - disabled_items.push_back(std::string("Marketplace Add Listing")); + disabled_items.push_back(std::string("Marketplace Associate Listing")); disabled_items.push_back(std::string("Marketplace Attach Listing")); if (LLMarketplaceData::instance().getActivationState(mUUID)) { @@ -872,6 +874,7 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, } else { + disabled_items.push_back(std::string("Marketplace Disassociate Listing")); disabled_items.push_back(std::string("Marketplace Activate")); disabled_items.push_back(std::string("Marketplace Deactivate")); } @@ -3147,11 +3150,16 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) LLMarketplaceData::instance().setActivation(mUUID,false); return; } - else if ("marketplace_add_listing" == action) + else if ("marketplace_associate_listing" == action) { LLMarketplaceData::instance().addListing(mUUID); return; } + else if ("marketplace_disassociate_listing" == action) + { + LLMarketplaceData::instance().deleteListing(mUUID); + return; + } else if ("marketplace_attach_listing" == action) { // *TODO : Get a list of listing IDs and let the user choose one, delist the old one and relist the new one @@ -3163,6 +3171,11 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) // *TODO : Need to show a browser window with the info for the listing // Get the listing id (i.e. go up the hierarchy to find the listing folder // Show the listing folder in a browser window + // https://marketplace.secondlife.com/p/Nounours/4438852 + // https://marketplace.secondlife.com/p/Un-autre-nounours/4447997?preview=true + // https://marketplace.secondlife.com/p//?preview=true + std::string url("https://marketplace.secondlife.com/p/Un-autre-nounours/4447997?preview=true"); + LLUrlAction::openURL(url); return; } #ifndef LL_RELEASE_FOR_DOWNLOAD diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index ad9326965b..ff38017d6f 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -120,33 +120,58 @@ void append_path(const LLUUID& id, std::string& path) path.append(temp); } -void update_marketplace_category(const LLUUID& cat_id) +void update_marketplace_folder_hierarchy(const LLUUID cat_id) { // When changing the marketplace status of a folder, the only thing that needs to happen is // for all observers of the folder to, possibly, change the display label of the folder - // as well as, potentially, change the display label of all parent folders up to the marketplace root. + // so that's the only thing we change on the update mask. + gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); + gInventory.notifyObservers(); + + // Update all descendent folders down + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array); + + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; + for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) + { + LLInventoryCategory* category = *iter; + update_marketplace_folder_hierarchy(category->getUUID()); + } + return; +} + +void update_marketplace_category(const LLUUID& cat_id) +{ + // When changing the marketplace status of a folder, we usually have to change the status of all + // folders in the same listing. This is because the display of each folder is affected by the + // overall status of the whole listing. + // Consequently, the only way to correctly update a folder anywhere in the marketplace is to + // update the whole listing from its listing root. + // This is not as bad as it seems as we only update folders, not items, and the folder nesting depth + // is limited to 4. + // We also take care of degenerated cases so we don't update all folders in the inventory by mistake. const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); - // No marketplace, likely called in error then... - // Or not a descendent of the marketplace listings root, then just do the regular category update + // No marketplace -> likely called too early... or + // Not a descendent of the marketplace listings root -> likely called in error then... if (marketplace_listings_uuid.isNull() || !gInventory.isObjectDescendentOf(cat_id, marketplace_listings_uuid)) { + // In those cases, just do the regular category update LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); gInventory.updateCategory(cat); gInventory.notifyObservers(); return; } - // Explore all the hierarchy of folders up to the root to get them to update - // Note: this is not supposed to be deeper than 4 - LLUUID cur_id = cat_id; - LLInventoryCategory* cur_cat = gInventory.getCategory(cur_id); - while (cur_id != marketplace_listings_uuid) - { - gInventory.addChangedMask(LLInventoryObserver::LABEL, cur_id); - gInventory.notifyObservers(); - cur_id = cur_cat->getParentUUID(); - cur_cat = gInventory.getCategory(cur_id); - } + + // Grab marketplace listing data for this folder + S32 depth = depth_nesting_in_marketplace(cat_id); + LLUUID listing_uuid = nested_parent_id(cat_id, depth); + + // Update all descendents starting from the listing root + update_marketplace_folder_hierarchy(listing_uuid); + return; } diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 29ce5361f0..b7c84dc714 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -687,7 +687,6 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); (it->second).mIsActive = activate; update_marketplace_category((it->second).mListingFolderId); - update_marketplace_category((it->second).mVersionFolderId); return true; } // We need to iterate through the list to check it's not a version folder @@ -698,7 +697,6 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) { (it->second).mIsActive = activate; update_marketplace_category((it->second).mListingFolderId); - update_marketplace_category((it->second).mVersionFolderId); return true; } it++; @@ -706,20 +704,4 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) return false; } -// Test methods -void LLMarketplaceData::addTestItem(const LLUUID& folder_id) -{ - llinfos << "Merov : addTestItem, id = " << folder_id << llendl; - mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); - update_marketplace_category(folder_id); -} -void LLMarketplaceData::addTestItem(const LLUUID& folder_id, const LLUUID& version_id) -{ - llinfos << "Merov : addTestItem, id = " << folder_id << ", version = " << version_id << llendl; - mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); - setVersionFolderID(folder_id, version_id); - update_marketplace_category(folder_id); - update_marketplace_category(version_id); -} - diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index d76072da1f..0b1066a558 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -165,11 +165,6 @@ public: bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id); bool setActivation(const LLUUID& folder_id, bool activate); - // Merov : DD Development : methods to populate the items list with something usefull using - // inventory IDs and some pseudo random code so we can play with the UI... - void addTestItem(const LLUUID& folder_id); - void addTestItem(const LLUUID& folder_id, const LLUUID& version_id); - private: marketplace_items_list_t mMarketplaceItems; }; diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index cde14e72f0..0be5509333 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -5,12 +5,12 @@ name="Popup" visible="false"> + name="Marketplace Associate Listing"> + parameter="marketplace_associate_listing" /> + + + -- cgit v1.3 From 45ec0833c2f11b7c59b6e250fd63f55fb2317cb5 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 11 Apr 2014 14:13:33 -0700 Subject: DD-57 : Update stock folder count when item moved back to inventory --- indra/newview/llinventorybridge.cpp | 17 +++++++++++++++-- indra/newview/llinventoryfunctions.cpp | 1 - 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 3af734ba27..d38f6cffca 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2401,11 +2401,13 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + const LLUUID from_folder_uuid = inv_cat->getParentUUID(); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_from_outbox = model->isObjectDescendentOf(cat_id, outbox_id); const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); // check to make sure source is agent inventory, and is represented there. LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); @@ -2712,6 +2714,10 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, mUUID, move_is_into_trash); } + if (move_is_from_marketplacelistings) + { + update_marketplace_category(from_folder_uuid); + } } } else if (LLToolDragAndDrop::SOURCE_WORLD == source) @@ -4234,6 +4240,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + const LLUUID from_folder_uuid = inv_item->getParentUUID(); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_favorites = (mUUID == favorites_id); @@ -4242,6 +4249,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_from_outbox = model->isObjectDescendentOf(inv_item->getUUID(), outbox_id); const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(inv_item->getUUID(), marketplacelistings_id); LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); BOOL accept = FALSE; @@ -4384,7 +4392,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, LLFolderViewItem* itemp = destination_panel->getRootFolder()->getDraggingOverItem(); if (itemp) { - LLUUID srcItemId = inv_item->getUUID(); + LLUUID srcItemId = inv_item->getUUID(); LLUUID destItemId = static_cast(itemp->getViewModelItem())->getUUID(); LLFavoritesOrderStorage::instance().rearrangeFavoriteLandmarks(srcItemId, destItemId); } @@ -4437,8 +4445,13 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, mUUID, move_is_into_trash); } + + if (move_is_from_marketplacelistings) + { + update_marketplace_category(from_folder_uuid); + } - // + // //-------------------------------------------------------------------------------- } } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 57e1b6d9bc..757dcb4992 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -805,7 +805,6 @@ S32 compute_stock_count(LLUUID cat_uuid) { // Note: stock folders are *not* supposed to have nested subfolders so we stop recursion here // Note: we *always* give a stock count for stock folders, it's useful even if the listing is unassociated - //LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); return cat->getDescendentCount(); } -- cgit v1.3 From 22c8ed2f80a2a6645f3148362566aa2f46ae38fd Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sat, 12 Apr 2014 17:37:50 -0700 Subject: DD-64 : Add New Folder to right click menu on marketplace --- indra/newview/llfloatermarketplacelistings.cpp | 11 +++++- indra/newview/llfloatermarketplacelistings.h | 1 + indra/newview/llinventorybridge.cpp | 48 ++++++++++++++------------ 3 files changed, 36 insertions(+), 24 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index dcf27baae7..59e3e8442e 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -65,20 +65,24 @@ BOOL LLPanelMarketplaceListings::postBuild() LLInventoryPanel* panel = getChild("All Items"); panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); panel->getFilter().markDefault(); - + panel->setSelectCallback(boost::bind(&LLPanelMarketplaceListings::onSelectionChange, this, panel, _1, _2)); + // Set filters on the 3 prefiltered panels panel = getChild("Active Items"); panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); panel->getFilter().setFilterMarketplaceActiveFolders(); panel->getFilter().markDefault(); + panel->setSelectCallback(boost::bind(&LLPanelMarketplaceListings::onSelectionChange, this, panel, _1, _2)); panel = getChild("Inactive Items"); panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); panel->getFilter().setFilterMarketplaceInactiveFolders(); panel->getFilter().markDefault(); + panel->setSelectCallback(boost::bind(&LLPanelMarketplaceListings::onSelectionChange, this, panel, _1, _2)); panel = getChild("Unassociated Items"); panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); panel->getFilter().setFilterMarketplaceUnassociatedFolders(); panel->getFilter().markDefault(); + panel->setSelectCallback(boost::bind(&LLPanelMarketplaceListings::onSelectionChange, this, panel, _1, _2)); return LLPanel::postBuild(); } @@ -88,6 +92,11 @@ void LLPanelMarketplaceListings::draw() LLPanel::draw(); } +void LLPanelMarketplaceListings::onSelectionChange(LLInventoryPanel *panel, const std::deque& items, BOOL user_action) +{ + panel->onSelectionChange(items, user_action); +} + void LLPanelMarketplaceListings::onAddButtonClicked() { LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, true); diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index 03c4fa6818..c9fe68a70c 100755 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -55,6 +55,7 @@ private: void onViewSortMenuItemClicked(const LLSD& userdata); bool onViewSortMenuItemCheck(const LLSD& userdata); void onAddButtonClicked(); + void onSelectionChange(LLInventoryPanel *panel, const std::deque& items, BOOL user_action); LLInventoryPanel* mAllPanel; LLInventoryFilter::ESortOrderType mSortOrder; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d38f6cffca..4283643c76 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -897,7 +897,7 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, } } } - // Options available at all levels on all items + // Options available at all levels on items and categories items.push_back(std::string("Marketplace Show Listing")); LLUUID listing_folder_id = nested_parent_id(mUUID,depth); if (!LLMarketplaceData::instance().isListed(listing_folder_id)) @@ -3663,6 +3663,10 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items { disabled_items.push_back(std::string("New Folder")); } + if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } if(trash_id == mUUID) { // This is the trash. @@ -3678,11 +3682,6 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items { addOutboxContextMenuOptions(flags, items, disabled_items); } - else if (isMarketplaceListingsFolder()) - { - addMarketplaceContextMenuOptions(flags, items, disabled_items); - getClipboardEntries(false, items, disabled_items, flags); - } else if(isAgentInventory()) // do not allow creating in library { LLViewerInventoryCategory *cat = getCategory(); @@ -3697,12 +3696,14 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items { items.push_back(std::string("New Folder")); } - - items.push_back(std::string("New Script")); - items.push_back(std::string("New Note")); - items.push_back(std::string("New Gesture")); - items.push_back(std::string("New Clothes")); - items.push_back(std::string("New Body Parts")); + if (!isMarketplaceListingsFolder()) + { + items.push_back(std::string("New Script")); + items.push_back(std::string("New Note")); + items.push_back(std::string("New Gesture")); + items.push_back(std::string("New Clothes")); + items.push_back(std::string("New Body Parts")); + } } #if SUPPORT_ENSEMBLES // Changing folder types is an unfinished unsupported feature @@ -3746,9 +3747,9 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items LLIsType is_object( LLAssetType::AT_OBJECT ); LLIsType is_gesture( LLAssetType::AT_GESTURE ); - if (checkFolderForContentsOfType(model, is_wearable) || - checkFolderForContentsOfType(model, is_object) || - checkFolderForContentsOfType(model, is_gesture) ) + if (checkFolderForContentsOfType(model, is_wearable) || + checkFolderForContentsOfType(model, is_object) || + checkFolderForContentsOfType(model, is_gesture) ) { mWearables=TRUE; } @@ -3770,7 +3771,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items } // Add menu items that are dependent on the contents of the folder. LLViewerInventoryCategory* category = (LLViewerInventoryCategory *) model->getCategory(mUUID); - if (category && !isMarketplaceListingsFolder()) + if (category) { uuid_vec_t folders; folders.push_back(category->getUUID()); @@ -3789,8 +3790,8 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items { // it's all on its way - add an observer, and the inventory will call done for us when everything is here. gInventory.addObserver(fetch); - } -} + } + } } void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items) @@ -3807,6 +3808,12 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& if (isItemInTrash()) return; if (!isAgentInventory()) return; if (isOutboxFolder()) return; + + if (!isItemRemovable()) + { + disabled_items.push_back(std::string("Delete")); + } + if (isMarketplaceListingsFolder()) return; LLFolderType::EType type = category->getPreferredType(); const bool is_system_folder = LLFolderType::lookupIsProtectedType(type); @@ -3826,11 +3833,6 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& } } - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Delete")); - } - #ifndef LL_RELEASE_FOR_DOWNLOAD if (LLFolderType::lookupIsProtectedType(type)) { -- cgit v1.3 From 65e53b70f276ff765fdd38b511563508459d0768 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 14 Apr 2014 16:58:41 -0700 Subject: DD-20 : Prevent dropping incompatible items in stock folders --- indra/newview/llinventorybridge.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 4283643c76..e740a16d49 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2589,9 +2589,9 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } if (is_movable && move_is_into_marketplacelistings) { - // *TODO : Merov : Add here the logic to prevent huge nesting in marketplace listings - // For the moment, we just take in anything - is_movable = TRUE; + // One cannot move a folder into a stock folder + is_movable = (getPreferredType() != LLFolderType::FT_MARKETPLACE_STOCK); + // *TODO : Merov : Add case if (nesting depth source + depth destination) > marketplace limit -> FALSE } if (is_movable) @@ -4350,9 +4350,23 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else if (move_is_into_marketplacelistings) { - // *TODO : Add here any logic that may prevent an item to be copied into the marketplace listings - // For the moment, we let anything go - accept = TRUE; + // If destination folder type is stock, check perm and type of item, if not compatible -> FALSE + if (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + // If the item is copyable (i.e. non stock) do not accept the drop in a stock folder + if (inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + accept = FALSE; + } + else + { + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(mUUID,cat_array,item_array); + // Destination stock folder must be empty OR types must be identical + accept = (!item_array->count() || (item_array->get(0)->getInventoryType() == inv_item->getInventoryType())); + } + } } LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); -- cgit v1.3 From 545b408618388c0484b16d7dff22b9aeb6421530 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 14 Apr 2014 22:58:14 -0700 Subject: DD-20 : Prevent pasting incompatible items in stock folders --- indra/newview/llinventorybridge.cpp | 18 +----------------- indra/newview/llinventoryfunctions.cpp | 15 ++++++++++++++- indra/newview/llviewerinventory.cpp | 23 +++++++++++++++++++++++ indra/newview/llviewerinventory.h | 3 +++ 4 files changed, 41 insertions(+), 18 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index e740a16d49..520a840f74 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4350,23 +4350,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else if (move_is_into_marketplacelistings) { - // If destination folder type is stock, check perm and type of item, if not compatible -> FALSE - if (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) - { - // If the item is copyable (i.e. non stock) do not accept the drop in a stock folder - if (inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) - { - accept = FALSE; - } - else - { - LLInventoryModel::cat_array_t* cat_array; - LLInventoryModel::item_array_t* item_array; - gInventory.getDirectDescendentsOf(mUUID,cat_array,item_array); - // Destination stock folder must be empty OR types must be identical - accept = (!item_array->count() || (item_array->get(0)->getInventoryType() == inv_item->getInventoryType())); - } - } + accept = (getCategory() && getCategory()->acceptItem(inv_item)); } LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index c7cd38b20e..7a16cf5e74 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -913,6 +913,13 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol } LLViewerInventoryCategory* dest_cat = gInventory.getCategory(dest_folder); + // Verify we can have this item in that destination category + if (!dest_cat->acceptItem(viewer_inv_item)) + { + llinfos << "Merov : Marketplace error : Cannot move item in that stock folder -> move aborted!" << llendl; + return; + } + // When moving a no copy item into a first level listing folder, we create a stock folder for it if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && (dest_cat->getParentUUID() == marketplace_listings_uuid)) { @@ -961,9 +968,15 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU if (has_correct_permissions_for_sale(inv_cat)) { // Get the destination folder - // *TODO : check that this folder is not full of no-copy items under its root... LLViewerInventoryCategory* dest_cat = gInventory.getCategory(dest_folder); + // Check it's not a stock folder + if (dest_cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + llinfos << "Merov : Marketplace error : Cannot move folder in stock folder -> move aborted!" << llendl; + return; + } + // Get the parent folder of the moved item : we may have to update it LLUUID src_folder = inv_cat->getParentUUID(); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index fff9821e86..4ca569e78c 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -816,6 +816,29 @@ bool LLViewerInventoryCategory::exportFileLocal(LLFILE* fp) const return true; } +bool LLViewerInventoryCategory::acceptItem(LLInventoryItem* inv_item) +{ + bool accept = true; + // Only stock folders have limitation on which item they will accept + if (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + // If the item is copyable (i.e. non stock) do not accept the drop in a stock folder + if (inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + accept = false; + } + else + { + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(getUUID(),cat_array,item_array); + // Destination stock folder must be empty OR types of incoming and existing items must be identical + accept = (!item_array->count() || (item_array->get(0)->getInventoryType() == inv_item->getInventoryType())); + } + } + return accept; +} + void LLViewerInventoryCategory::determineFolderType() { /* Do NOT uncomment this code. This is for future 2.1 support of ensembles. diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index ab19a12014..6b33ef0672 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -225,6 +225,9 @@ public: bool importFileLocal(LLFILE* fp); void determineFolderType(); void changeType(LLFolderType::EType new_folder_type); + + // returns true if the category object will accept the incoming item + bool acceptItem(LLInventoryItem* inv_item); private: friend class LLInventoryModel; -- cgit v1.3 From 851912b9f8a5fc9f604adf8c43941b7fe27aae09 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 15 Apr 2014 12:12:10 -0700 Subject: DD-65, DD-55: Treat activation/deactivation separately for listing and version folders. Also use max instead of stock for suffix for non stock folders. --- indra/newview/llinventorybridge.cpp | 35 +++++++++++++++++++------- indra/newview/llinventoryfunctions.cpp | 4 +-- indra/newview/skins/default/xui/en/strings.xml | 4 ++- 3 files changed, 31 insertions(+), 12 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 520a840f74..374d09ce98 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -887,7 +887,7 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, { items.push_back(std::string("Marketplace Activate")); items.push_back(std::string("Marketplace Deactivate")); - if (LLMarketplaceData::instance().getActivationState(mUUID)) + if (LLMarketplaceData::instance().isVersionFolder(mUUID)) { disabled_items.push_back(std::string("Marketplace Activate")); } @@ -2039,17 +2039,15 @@ std::string LLFolderBridge::getLabelSuffix() const suffix = " (" + suffix + ")"; if (LLMarketplaceData::instance().getActivationState(getUUID())) { - suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; + suffix += " (" + LLTrans::getString("MarketplaceLive") + ")"; } } // Version folder case else if (LLMarketplaceData::instance().isVersionFolder(getUUID())) { - if (LLMarketplaceData::instance().getActivationState(getUUID())) - { - suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; - } + suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; } + // Add stock amount S32 stock_count = compute_stock_count(getUUID()); if (stock_count == 0) { @@ -2057,7 +2055,14 @@ std::string LLFolderBridge::getLabelSuffix() const } else if (stock_count != -1) { - suffix += " (" + LLTrans::getString("MarketplaceStock") + "=" + llformat("%d", stock_count) + ")"; + if (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + suffix += " (" + LLTrans::getString("MarketplaceStock") + "=" + llformat("%d", stock_count) + ")"; + } + else + { + suffix += " (" + LLTrans::getString("MarketplaceMax") + "=" + llformat("%d", stock_count) + ")"; + } } return LLInvFVBridge::getLabelSuffix() + suffix; } @@ -3141,19 +3146,31 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) S32 depth = depth_nesting_in_marketplace(mUUID); if (depth == 2) { + // At the version folder level, "activate" means "set this as the version folder" LLInventoryCategory* category = gInventory.getCategory(mUUID); LLMarketplaceData::instance().setVersionFolderID(category->getParentUUID(), mUUID); - LLMarketplaceData::instance().setActivation(mUUID,true); } else if (depth == 1) { + // At the listing folder level, "activate" means "put it for sale on the marketplace" LLMarketplaceData::instance().setActivation(mUUID,true); } return; } else if ("marketplace_deactivate" == action) { - LLMarketplaceData::instance().setActivation(mUUID,false); + S32 depth = depth_nesting_in_marketplace(mUUID); + if (depth == 2) + { + // At the version folder level, "deactivate" means "zap the version folder" + LLInventoryCategory* category = gInventory.getCategory(mUUID); + LLMarketplaceData::instance().setVersionFolderID(category->getParentUUID(), LLUUID::null); + } + else if (depth == 1) + { + // At the listing folder level, "deactivate" means "take this out of the marketplace" + LLMarketplaceData::instance().setActivation(mUUID,false); + } return; } else if ("marketplace_associate_listing" == action) diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 7a16cf5e74..e6f863d46e 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -155,8 +155,8 @@ void update_marketplace_category(const LLUUID& cat_id) const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); // No marketplace -> likely called too early... or - // Not a descendent of the marketplace listings root and not part of marketplace -> likely called in error then... - if (marketplace_listings_uuid.isNull() || (!gInventory.isObjectDescendentOf(cat_id, marketplace_listings_uuid) && !LLMarketplaceData::instance().isListed(cat_id) && !LLMarketplaceData::instance().isVersionFolder(cat_id))) + // Not a descendent of the marketplace listings root -> likely called in error then... + if (marketplace_listings_uuid.isNull() || !gInventory.isObjectDescendentOf(cat_id, marketplace_listings_uuid)) { // In those cases, just do the regular category update LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 55272750e7..74c85bcd6b 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2272,7 +2272,9 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. Error: There was a problem with this item. Try again later. no Mkt ID - live + live + active + max stock out of stock -- cgit v1.3 From a4f6fc8ee1a4231d2b81d28035b21b8f8b3fd8fd Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 16 Apr 2014 16:56:01 -0700 Subject: DD-11 : Implement getListingURL() and parametrize it correctly. Change Show Listing to Edit Listing. --- indra/newview/llinventorybridge.cpp | 13 +++++----- indra/newview/llmarketplacefunctions.cpp | 30 ++++++++++++++++++++++ indra/newview/llmarketplacefunctions.h | 2 ++ .../skins/default/xui/en/menu_inventory.xml | 2 +- 4 files changed, 39 insertions(+), 8 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 374d09ce98..128f0e1b91 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1546,6 +1546,11 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) { doActionOnCurSelectedLandmark(boost::bind(&LLItemBridge::doShowOnMap, this, _1)); } + else if ("marketplace_show_listing" == action) + { + std::string url = LLMarketplaceData::instance().getListingURL(mUUID); + LLUrlAction::openURL(url); + } } void LLItemBridge::doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb) @@ -3191,13 +3196,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } else if ("marketplace_show_listing" == action) { - // *TODO : Need to show a browser window with the info for the listing - // Get the listing id (i.e. go up the hierarchy to find the listing folder - // Show the listing folder in a browser window - // https://marketplace.secondlife.com/p/Nounours/4438852 - // https://marketplace.secondlife.com/p/Un-autre-nounours/4447997?preview=true - // https://marketplace.secondlife.com/p//?preview=true - std::string url("https://marketplace.secondlife.com/p/Un-autre-nounours/4447997?preview=true"); + std::string url = LLMarketplaceData::instance().getListingURL(mUUID); LLUrlAction::openURL(url); return; } diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index b7c84dc714..4a3abe5f22 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -617,6 +617,18 @@ std::string LLMarketplaceData::getListingID(const LLUUID& folder_id) return (it == mMarketplaceItems.end() ? "" : (it->second).mListingId); } +std::string LLMarketplaceData::getListingName(const LLUUID& folder_id) +{ + std::string listing_name = ""; + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + if (it != mMarketplaceItems.end()) + { + // *TODO : Call the MKT API to get the name of a listing + llinfos << "Merov : Marketplace warning : No API to get Listing name for : " << folder_id << llendl; + } + return listing_name; +} + LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); @@ -643,6 +655,24 @@ bool LLMarketplaceData::isVersionFolder(const LLUUID& folder_id) return false; } +std::string LLMarketplaceData::getListingURL(const LLUUID& folder_id) +{ + // Get the listing id (i.e. go up the hierarchy to find the listing folder + // URL format will be something like : https://marketplace.secondlife.com/p// + std::string marketplace_url = getMarketplaceURL("MarketplaceURL"); + + S32 depth = depth_nesting_in_marketplace(folder_id); + LLUUID listing_uuid = nested_parent_id(folder_id, depth); + std::string listing_name = getListingName(listing_uuid); + std::string listing_id = getListingID(listing_uuid); + + if (!listing_name.empty() && !listing_id.empty()) + { + marketplace_url += "p/" + listing_name + "/" + listing_id; + } + return marketplace_url; +} + // Modifiers bool LLMarketplaceData::setListingID(const LLUUID& folder_id, std::string listing_id) { diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 0b1066a558..68f5dafbbd 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -158,7 +158,9 @@ public: // Access Marketplace data set : each method returns a default value if the folder_id can't be found bool getActivationState(const LLUUID& folder_id); std::string getListingID(const LLUUID& folder_id); + std::string getListingName(const LLUUID& folder_id); LLUUID getVersionFolderID(const LLUUID& folder_id); + std::string getListingURL(const LLUUID& folder_id); // Modify Marketplace data set : each method returns true if the function succeeds, false if error bool setListingID(const LLUUID& folder_id, std::string listing_id); diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 0be5509333..78418909e8 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -29,7 +29,7 @@ parameter="marketplace_disassociate_listing" /> Date: Thu, 17 Apr 2014 11:44:04 -0700 Subject: DD-70 : Use List/Delist for listing folders and Activate/Deactivate for version folders. Also create test SLM ID when creating listing. --- indra/newview/llinventorybridge.cpp | 58 +++++++++++----------- indra/newview/llmarketplacefunctions.cpp | 7 +++ indra/newview/llmarketplacefunctions.h | 5 ++ .../skins/default/xui/en/menu_inventory.xml | 32 +++++++++--- .../default/xui/en/panel_marketplace_listings.xml | 18 +++---- indra/newview/skins/default/xui/en/strings.xml | 2 +- 6 files changed, 76 insertions(+), 46 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 128f0e1b91..749fcd7a71 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -854,29 +854,29 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, if (depth == 1) { // Options available at the Listing Folder level + items.push_back(std::string("Marketplace Create Listing")); items.push_back(std::string("Marketplace Associate Listing")); - items.push_back(std::string("Marketplace Attach Listing")); items.push_back(std::string("Marketplace Disassociate Listing")); - items.push_back(std::string("Marketplace Activate")); - items.push_back(std::string("Marketplace Deactivate")); + items.push_back(std::string("Marketplace List")); + items.push_back(std::string("Marketplace Unlist")); if (LLMarketplaceData::instance().isListed(mUUID)) { + disabled_items.push_back(std::string("Marketplace Create Listing")); disabled_items.push_back(std::string("Marketplace Associate Listing")); - disabled_items.push_back(std::string("Marketplace Attach Listing")); if (LLMarketplaceData::instance().getActivationState(mUUID)) { - disabled_items.push_back(std::string("Marketplace Activate")); + disabled_items.push_back(std::string("Marketplace List")); } else { - disabled_items.push_back(std::string("Marketplace Deactivate")); + disabled_items.push_back(std::string("Marketplace Unlist")); } } else { disabled_items.push_back(std::string("Marketplace Disassociate Listing")); - disabled_items.push_back(std::string("Marketplace Activate")); - disabled_items.push_back(std::string("Marketplace Deactivate")); + disabled_items.push_back(std::string("Marketplace List")); + disabled_items.push_back(std::string("Marketplace Unlist")); } } if (depth == 2) @@ -898,11 +898,11 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, } } // Options available at all levels on items and categories - items.push_back(std::string("Marketplace Show Listing")); + items.push_back(std::string("Marketplace Edit Listing")); LLUUID listing_folder_id = nested_parent_id(mUUID,depth); if (!LLMarketplaceData::instance().isListed(listing_folder_id)) { - disabled_items.push_back(std::string("Marketplace Show Listing")); + disabled_items.push_back(std::string("Marketplace Edit Listing")); } // Separator items.push_back(std::string("Marketplace Listings Separator")); @@ -1546,7 +1546,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) { doActionOnCurSelectedLandmark(boost::bind(&LLItemBridge::doShowOnMap, this, _1)); } - else if ("marketplace_show_listing" == action) + else if ("marketplace_edit_listing" == action) { std::string url = LLMarketplaceData::instance().getListingURL(mUUID); LLUrlAction::openURL(url); @@ -3146,39 +3146,41 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) restoreItem(); return; } + else if ("marketplace_list" == action) + { + if (depth_nesting_in_marketplace(mUUID) == 1) + { + LLMarketplaceData::instance().setActivation(mUUID,true); + } + return; + } else if ("marketplace_activate" == action) { - S32 depth = depth_nesting_in_marketplace(mUUID); - if (depth == 2) + if (depth_nesting_in_marketplace(mUUID) == 2) { - // At the version folder level, "activate" means "set this as the version folder" LLInventoryCategory* category = gInventory.getCategory(mUUID); LLMarketplaceData::instance().setVersionFolderID(category->getParentUUID(), mUUID); } - else if (depth == 1) + return; + } + else if ("marketplace_unlist" == action) + { + if (depth_nesting_in_marketplace(mUUID) == 1) { - // At the listing folder level, "activate" means "put it for sale on the marketplace" - LLMarketplaceData::instance().setActivation(mUUID,true); + LLMarketplaceData::instance().setActivation(mUUID,false); } return; } else if ("marketplace_deactivate" == action) { - S32 depth = depth_nesting_in_marketplace(mUUID); - if (depth == 2) + if (depth_nesting_in_marketplace(mUUID) == 2) { - // At the version folder level, "deactivate" means "zap the version folder" LLInventoryCategory* category = gInventory.getCategory(mUUID); LLMarketplaceData::instance().setVersionFolderID(category->getParentUUID(), LLUUID::null); - } - else if (depth == 1) - { - // At the listing folder level, "deactivate" means "take this out of the marketplace" - LLMarketplaceData::instance().setActivation(mUUID,false); } return; } - else if ("marketplace_associate_listing" == action) + else if ("marketplace_create_listing" == action) { LLMarketplaceData::instance().addListing(mUUID); return; @@ -3188,13 +3190,13 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) LLMarketplaceData::instance().deleteListing(mUUID); return; } - else if ("marketplace_attach_listing" == action) + else if ("marketplace_associate_listing" == action) { // *TODO : Get a list of listing IDs and let the user choose one, delist the old one and relist the new one LLMarketplaceData::instance().addListing(mUUID); return; } - else if ("marketplace_show_listing" == action) + else if ("marketplace_edit_listing" == action) { std::string url = LLMarketplaceData::instance().getListingURL(mUUID); LLUrlAction::openURL(url); diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 4a3abe5f22..4a6914ee9c 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -562,6 +562,7 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, std::string list // Data map LLMarketplaceData::LLMarketplaceData() { + mTestCurrentMarketplaceID = 1234567; } // Creation / Deletion @@ -573,6 +574,12 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id) return false; } mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); + + // *TODO : Create the listing on SLM and get the ID (blocking?) + // For the moment, we use that wonky test ID generator... + std::string listing_id = llformat ("%d", LLMarketplaceData::instance().getTestMarketplaceID()); + + setListingID(folder_id,listing_id); update_marketplace_category(folder_id); return true; } diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 68f5dafbbd..2b90dd678f 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -167,8 +167,13 @@ public: bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id); bool setActivation(const LLUUID& folder_id, bool activate); + // Merov : Test method while waiting for SLM API + S32 getTestMarketplaceID() { return mTestCurrentMarketplaceID++; } + private: marketplace_items_list_t mMarketplaceItems; + // Merov : This is for test only, waiting for SLM API + S32 mTestCurrentMarketplaceID; }; diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 78418909e8..b621d53a6c 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -5,20 +5,20 @@ name="Popup" visible="false"> + name="Marketplace Create Listing"> + parameter="marketplace_create_listing" /> + name="Marketplace Associate Listing"> + parameter="marketplace_associate_listing" /> + name="Marketplace Edit Listing"> + + + + + + + parameter="marketplace_unlist" /> + height="440"> + height="400"> Error: There was a problem with this item. Try again later. no Mkt ID - live + listed active max stock -- cgit v1.3 From 8ceed54eea0d91598479356a33fc5a4263338cce Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 17 Apr 2014 18:09:31 -0700 Subject: DD-54 : Prevent right click actions to destroy live listings or list things without version folders --- indra/newview/llinventorybridge.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 749fcd7a71..6dd181501a 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -863,13 +863,21 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, { disabled_items.push_back(std::string("Marketplace Create Listing")); disabled_items.push_back(std::string("Marketplace Associate Listing")); - if (LLMarketplaceData::instance().getActivationState(mUUID)) + if (LLMarketplaceData::instance().getVersionFolderID(mUUID).isNull()) { disabled_items.push_back(std::string("Marketplace List")); + disabled_items.push_back(std::string("Marketplace Unlist")); } else { - disabled_items.push_back(std::string("Marketplace Unlist")); + if (LLMarketplaceData::instance().getActivationState(mUUID)) + { + disabled_items.push_back(std::string("Marketplace List")); + } + else + { + disabled_items.push_back(std::string("Marketplace Unlist")); + } } } else @@ -890,6 +898,10 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, if (LLMarketplaceData::instance().isVersionFolder(mUUID)) { disabled_items.push_back(std::string("Marketplace Activate")); + if (LLMarketplaceData::instance().getActivationState(mUUID)) + { + disabled_items.push_back(std::string("Marketplace Deactivate")); + } } else { @@ -2175,6 +2187,11 @@ BOOL LLFolderBridge::isItemRemovable() const return FALSE; } } + + if (isMarketplaceListingsFolder() && LLMarketplaceData::instance().getActivationState(mUUID)) + { + return FALSE; + } return TRUE; } -- cgit v1.3 From a99e2475443bebb6b9c9d2c8998300ce50f254a8 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 18 Apr 2014 14:41:32 -0700 Subject: DD-58 : Implement associate listing UI and primitive --- indra/newview/llfloatermarketplacelistings.cpp | 65 ++++++++++++++++++++++ indra/newview/llfloatermarketplacelistings.h | 24 ++++++++ indra/newview/llinventorybridge.cpp | 4 +- indra/newview/llmarketplacefunctions.cpp | 37 ++++++++++++ indra/newview/llmarketplacefunctions.h | 2 + indra/newview/llviewerfloaterreg.cpp | 1 + .../default/xui/en/floater_associate_listing.xml | 53 ++++++++++++++++++ 7 files changed, 184 insertions(+), 2 deletions(-) create mode 100755 indra/newview/skins/default/xui/en/floater_associate_listing.xml (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 7db78ff290..be48005e67 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -510,4 +510,69 @@ void LLFloaterMarketplaceListings::importReportResults(U32 status, const LLSD& c updateView(); } +//----------------------------------------------------------------------------- +// LLFloaterAssociateListing() +//----------------------------------------------------------------------------- + +LLFloaterAssociateListing::LLFloaterAssociateListing(const LLSD& key) +: LLFloater(key) +, mUUID() +{ +} + +LLFloaterAssociateListing::~LLFloaterAssociateListing() +{ + gFocusMgr.releaseFocusIfNeeded( this ); +} + +BOOL LLFloaterAssociateListing::postBuild() +{ + getChild("OK")->setCommitCallback(boost::bind(&LLFloaterAssociateListing::apply, this)); + getChild("Cancel")->setCommitCallback(boost::bind(&LLFloaterAssociateListing::cancel, this)); + center(); + + return LLFloater::postBuild(); +} + +BOOL LLFloaterAssociateListing::handleKeyHere(KEY key, MASK mask) +{ + if (key == KEY_RETURN && mask == MASK_NONE) + { + apply(); + return TRUE; + } + else if (key == KEY_ESCAPE && mask == MASK_NONE) + { + cancel(); + return TRUE; + } + + return LLFloater::handleKeyHere(key, mask); +} + +// static +LLFloaterAssociateListing* LLFloaterAssociateListing::show(const LLUUID& folder_id) +{ + LLFloaterAssociateListing* floater = LLFloaterReg::showTypedInstance("associate_listing"); + + floater->mUUID = folder_id; + + return floater; +} + +void LLFloaterAssociateListing::apply() +{ + if (mUUID.notNull()) + { + const std::string& id = getChild("listing_id")->getValue().asString(); + LLMarketplaceData::instance().associateListing(mUUID,id); + } + closeFloater(); +} + +void LLFloaterAssociateListing::cancel() +{ + closeFloater(); +} + diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index 960b6c55e0..f2ff58a712 100755 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -122,4 +122,28 @@ private: LLPanelMarketplaceListings * mPanelListings; }; + +//----------------------------------------------------------------------------- +// LLFloaterAssociateListing() +//----------------------------------------------------------------------------- +class LLFloaterAssociateListing : public LLFloater +{ + friend class LLFloaterReg; +public: + virtual BOOL postBuild(); + virtual BOOL handleKeyHere(KEY key, MASK mask); + + static LLFloaterAssociateListing* show(const LLUUID& folder_id); + +private: + LLFloaterAssociateListing(const LLSD& key); + virtual ~LLFloaterAssociateListing(); + + // UI Callbacks + void apply(); + void cancel(); + + LLUUID mUUID; +}; + #endif // LL_LLFLOATERMARKETPLACELISTINGS_H diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 6dd181501a..1eb647b1b2 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -40,6 +40,7 @@ #include "llfavoritesbar.h" // management of favorites folder #include "llfloateropenobject.h" #include "llfloaterreg.h" +#include "llfloatermarketplacelistings.h" #include "llfloatersidepanelcontainer.h" #include "llfloaterworldmap.h" #include "llfolderview.h" @@ -3209,8 +3210,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } else if ("marketplace_associate_listing" == action) { - // *TODO : Get a list of listing IDs and let the user choose one, delist the old one and relist the new one - LLMarketplaceData::instance().addListing(mUUID); + LLFloaterAssociateListing::show(mUUID); return; } else if ("marketplace_edit_listing" == action) diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 9465401d88..6ff6ba6714 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -584,6 +584,28 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id) return true; } +bool LLMarketplaceData::associateListing(const LLUUID& folder_id, std::string listing_id) +{ + if (isListed(folder_id)) + { + // Listing already exists -> exit with error + return false; + } + mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); + + // Check that the listing ID is not already associated to some other record + LLUUID old_listing = getListingFolder(listing_id); + if (old_listing.notNull()) + { + // If it is already used, unlist the old record (we can't have 2 listings with the same listing ID) + deleteListing(old_listing); + } + + setListingID(folder_id,listing_id); + update_marketplace_category(folder_id); + return true; +} + bool LLMarketplaceData::deleteListing(const LLUUID& folder_id) { if (!isListed(folder_id)) @@ -630,6 +652,21 @@ LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id) return (it == mMarketplaceItems.end() ? LLUUID::null : (it->second).mVersionFolderId); } +// Reverse lookup : find the listing folder id from the listing id +LLUUID LLMarketplaceData::getListingFolder(std::string listing_id) +{ + marketplace_items_list_t::iterator it = mMarketplaceItems.begin(); + while (it != mMarketplaceItems.end()) + { + if ((it->second).mListingId == listing_id) + { + return (it->second).mListingFolderId; + } + it++; + } + return LLUUID::null; +} + bool LLMarketplaceData::isListed(const LLUUID& folder_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 9485311b66..f279c24fb2 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -153,6 +153,7 @@ public: // Create/Delete Marketplace data set : each method returns true if the function succeeds, false if error bool addListing(const LLUUID& folder_id); + bool associateListing(const LLUUID& folder_id, std::string listing_id); bool deleteListing(const LLUUID& folder_id); // Access Marketplace data set : each method returns a default value if the folder_id can't be found @@ -160,6 +161,7 @@ public: std::string getListingID(const LLUUID& folder_id); LLUUID getVersionFolderID(const LLUUID& folder_id); std::string getListingURL(const LLUUID& folder_id); + LLUUID getListingFolder(std::string listing_id); // Modify Marketplace data set : each method returns true if the function succeeds, false if error bool setListingID(const LLUUID& folder_id, std::string listing_id); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 9bb6153e56..e5f19d3cce 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -178,6 +178,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("fast_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("associate_listing", "floater_associate_listing.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar", "floater_avatar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_associate_listing.xml b/indra/newview/skins/default/xui/en/floater_associate_listing.xml new file mode 100755 index 0000000000..e019ed58dd --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_associate_listing.xml @@ -0,0 +1,53 @@ + + + + Listing ID: + + + Type ID here + +