summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatermarketplacelistings.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-03-07 22:39:36 +0200
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-03-10 19:32:47 +0200
commit811da7dbb1bdbf04a2dceb02ad4d296db4274076 (patch)
tree26e85b0e51e0df8e9799d5bcc54957e5082c9984 /indra/newview/llfloatermarketplacelistings.cpp
parenta777a0b27ed6adfa99d708e289e704915f2b62b7 (diff)
SL-18629 WIP Replacing UDP creation messages with callback based AIS #2
findCategory and move_item_to_marketplacelistings
Diffstat (limited to 'indra/newview/llfloatermarketplacelistings.cpp')
-rw-r--r--indra/newview/llfloatermarketplacelistings.cpp49
1 files changed, 40 insertions, 9 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp
index 88fff58fc8..9110d9e902 100644
--- a/indra/newview/llfloatermarketplacelistings.cpp
+++ b/indra/newview/llfloatermarketplacelistings.cpp
@@ -230,7 +230,7 @@ void LLPanelMarketplaceListings::onTabChange()
void LLPanelMarketplaceListings::onAddButtonClicked()
{
- LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
+ LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
llassert(marketplacelistings_id.notNull());
LLFolderType::EType preferred_type = LLFolderType::lookup("category");
LLHandle<LLPanel> handle = getHandle();
@@ -375,6 +375,7 @@ LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key)
, mInventoryTitle(NULL)
, mPanelListings(NULL)
, mPanelListingsSet(false)
+, mRootFolderCreating(false)
{
}
@@ -460,15 +461,39 @@ void LLFloaterMarketplaceListings::setRootFolder()
// If we are *not* a merchant or we have no market place connection established yet, do nothing
return;
}
+ if (!gInventory.isInventoryUsable())
+ {
+ return;
+ }
+ LLFolderType::EType preferred_type = LLFolderType::FT_MARKETPLACE_LISTINGS;
// We are a merchant. Get the Marketplace listings folder, create it if needs be.
- LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, true);
- if (marketplacelistings_id.isNull())
- {
- // We should never get there unless the inventory fails badly
- LL_ERRS("SLM") << "Inventory problem: failure to create the marketplace listings folder for a merchant!" << LL_ENDL;
- return;
- }
+ LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(preferred_type);
+
+ if (marketplacelistings_id.isNull())
+ {
+ if (!mRootFolderCreating)
+ {
+ mRootFolderCreating = true;
+ gInventory.createNewCategory(
+ gInventory.getRootFolderID(),
+ preferred_type,
+ LLStringUtil::null,
+ [preferred_type](const LLUUID &new_cat_id)
+ {
+ LLFloaterMarketplaceListings *marketplace = LLFloaterReg::findTypedInstance<LLFloaterMarketplaceListings>("marketplace_listings");
+ if (marketplace)
+ {
+ // will call setRootFolder again
+ marketplace->updateView();
+ }
+ }
+ );
+ }
+ return;
+ }
+
+ mRootFolderCreating = false;
// No longer need to observe new category creation
if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver))
@@ -486,6 +511,7 @@ void LLFloaterMarketplaceListings::setRootFolder()
}
mRootFolderId = marketplacelistings_id;
+ mRootFolderCreating = true;
}
void LLFloaterMarketplaceListings::setPanels()
@@ -556,6 +582,11 @@ void LLFloaterMarketplaceListings::updateView()
{
setRootFolder();
}
+ if (mRootFolderCreating)
+ {
+ // waiting for callback
+ return;
+ }
// Update the bottom initializing status and progress dial if we are initializing or if we're a merchant and still loading
if ((mkt_status <= MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING) || (is_merchant && (data_fetched <= MarketplaceFetchCodes::MARKET_FETCH_LOADING)) )
@@ -859,7 +890,7 @@ void LLFloaterMarketplaceValidation::onOpen(const LLSD& key)
LLUUID cat_id(key.asUUID());
if (cat_id.isNull())
{
- cat_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
+ cat_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
}
// Validates the folder