summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-01-28 18:32:47 -0800
committerMerov Linden <merov@lindenlab.com>2013-01-28 18:32:47 -0800
commitc8e76908d71a67355beecf22c4daa8d0a50ef08e (patch)
treee4e5b82f4d26de0674861d2c0a04c64ed1a5f381
parent158393c404422bcc7b21d736d15a22ba6857dd04 (diff)
MAINT-2287 : Fixed : Test the merchant/no merchant status without relying on outbox, Recreate missing outbox for a merchant, UI clean up on init.
-rw-r--r--indra/newview/llfloateroutbox.cpp104
-rw-r--r--indra/newview/llfloateroutbox.h3
-rw-r--r--indra/newview/llmarketplacefunctions.cpp12
-rw-r--r--indra/newview/llmarketplacefunctions.h5
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml5
5 files changed, 82 insertions, 47 deletions
diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp
index 540f977305..d999307f28 100644
--- a/indra/newview/llfloateroutbox.cpp
+++ b/indra/newview/llfloateroutbox.cpp
@@ -84,7 +84,7 @@ public:
if (added_category_type == LLFolderType::FT_OUTBOX)
{
- mOutboxFloater->setupOutbox(added_category->getUUID());
+ mOutboxFloater->initializeMarketPlace();
}
}
}
@@ -146,6 +146,10 @@ BOOL LLFloaterOutbox::postBuild()
LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterOutbox::onFocusReceived, this));
+ // Observe category creation to catch outbox creation (moot if already existing)
+ mCategoryAddedObserver = new LLOutboxAddedObserver(this);
+ gInventory.addObserver(mCategoryAddedObserver);
+
return TRUE;
}
@@ -162,34 +166,25 @@ void LLFloaterOutbox::onClose(bool app_quitting)
void LLFloaterOutbox::onOpen(const LLSD& key)
{
//
- // Look for an outbox and set up the inventory API
+ // Initialize the Market Place or go update the outbox
//
-
- if (mOutboxId.isNull())
+ if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
{
- const bool do_not_create_folder = false;
- const bool do_not_find_in_library = false;
-
- const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, do_not_create_folder, do_not_find_in_library);
-
- if (outbox_id.isNull())
- {
- // Observe category creation to catch outbox creation
- mCategoryAddedObserver = new LLOutboxAddedObserver(this);
- gInventory.addObserver(mCategoryAddedObserver);
- }
- else
- {
- setupOutbox(outbox_id);
- }
+ initializeMarketPlace();
+ }
+ else
+ {
+ setupOutbox();
}
+ //
+ // Update the floater view
+ //
updateView();
//
// Trigger fetch of outbox contents
//
-
fetchOutboxContents();
}
@@ -206,14 +201,23 @@ void LLFloaterOutbox::fetchOutboxContents()
}
}
-void LLFloaterOutbox::setupOutbox(const LLUUID& outboxId)
+void LLFloaterOutbox::setupOutbox()
{
- llassert(outboxId.notNull());
- llassert(mOutboxId.isNull());
- llassert(mCategoriesObserver == NULL);
-
- mOutboxId = outboxId;
-
+ if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)
+ {
+ // If we are *not* a merchant or we have no market place connection established yet, do nothing
+ return;
+ }
+
+ // We are a merchant. Get the outbox, create it if needs be.
+ mOutboxId = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, true, false);
+ if (mOutboxId.isNull())
+ {
+ // We should never get there unless the inventory fails badly
+ llerrs << "Inventory problem: failure to create the outbox for a merchant!" << llendl;
+ return;
+ }
+
// No longer need to observe new category creation
if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver))
{
@@ -221,22 +225,24 @@ void LLFloaterOutbox::setupOutbox(const LLUUID& outboxId)
delete mCategoryAddedObserver;
mCategoryAddedObserver = NULL;
}
+ llassert(!mCategoryAddedObserver);
// Create observer for outbox modifications
- mCategoriesObserver = new LLInventoryCategoriesObserver();
- gInventory.addObserver(mCategoriesObserver);
-
- mCategoriesObserver->addCategory(mOutboxId, boost::bind(&LLFloaterOutbox::onOutboxChanged, this));
+ if (mCategoriesObserver == NULL)
+ {
+ mCategoriesObserver = new LLInventoryCategoriesObserver();
+ gInventory.addObserver(mCategoriesObserver);
+ mCategoriesObserver->addCategory(mOutboxId, boost::bind(&LLFloaterOutbox::onOutboxChanged, this));
+ }
+ llassert(mCategoriesObserver);
//
// Set up the outbox inventory view
//
-
- mOutboxInventoryPanel =
- LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_outbox_inventory.xml",
- mInventoryPlaceholder->getParent(),
- LLInventoryPanel::child_registry_t::instance());
-
+ if (mOutboxInventoryPanel == NULL)
+ {
+ mOutboxInventoryPanel = LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance());
+ }
llassert(mOutboxInventoryPanel);
// Reshape the inventory to the proper size
@@ -247,8 +253,12 @@ void LLFloaterOutbox::setupOutbox(const LLUUID& outboxId)
mOutboxInventoryPanel->setSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME);
mOutboxInventoryPanel->getFilter()->markDefault();
+ // Get the content of the outbox
fetchOutboxContents();
-
+}
+
+void LLFloaterOutbox::initializeMarketPlace()
+{
//
// Initialize the marketplace import API
//
@@ -321,6 +331,7 @@ void LLFloaterOutbox::updateView()
{
mOutboxInventoryPanel->setVisible(TRUE);
mInventoryPlaceholder->setVisible(FALSE);
+ mOutboxTopLevelDropZone->setVisible(TRUE);
}
else
{
@@ -328,6 +339,9 @@ void LLFloaterOutbox::updateView()
{
mOutboxInventoryPanel->setVisible(FALSE);
}
+
+ // Show the drop zone if there is an outbox folder
+ mOutboxTopLevelDropZone->setVisible(mOutboxId.notNull());
mInventoryPlaceholder->setVisible(TRUE);
@@ -343,6 +357,12 @@ void LLFloaterOutbox::updateView()
outbox_title = LLTrans::getString("InventoryOutboxNoItemsTitle");
outbox_tooltip = LLTrans::getString("InventoryOutboxNoItemsTooltip");
}
+ else if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() <= MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING)
+ {
+ outbox_text = LLTrans::getString("InventoryOutboxInitializing", subs);
+ outbox_title = LLTrans::getString("InventoryOutboxInitializingTitle");
+ outbox_tooltip = LLTrans::getString("InventoryOutboxInitializingTooltip");
+ }
else
{
outbox_text = LLTrans::getString("InventoryOutboxNotMerchant", subs);
@@ -436,7 +456,7 @@ void LLFloaterOutbox::onImportButtonClicked()
void LLFloaterOutbox::onOutboxChanged()
{
llassert(!mOutboxId.isNull());
-
+
if (mOutboxInventoryPanel)
{
mOutboxInventoryPanel->requestSort();
@@ -475,6 +495,11 @@ void LLFloaterOutbox::importReportResults(U32 status, const LLSD& content)
void LLFloaterOutbox::importStatusChanged(bool inProgress)
{
+ if (mOutboxId.isNull() && (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT))
+ {
+ setupOutbox();
+ }
+
if (inProgress)
{
if (mImportBusy)
@@ -492,6 +517,7 @@ void LLFloaterOutbox::importStatusChanged(bool inProgress)
}
else
{
+ setStatusString("");
mImportBusy = false;
mImportButton->setEnabled(mOutboxItemCount > 0);
mInventoryImportInProgress->setVisible(false);
diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h
index 18baccf1c9..483f4d0780 100644
--- a/indra/newview/llfloateroutbox.h
+++ b/indra/newview/llfloateroutbox.h
@@ -54,7 +54,7 @@ public:
LLFloaterOutbox(const LLSD& key);
~LLFloaterOutbox();
- void setupOutbox(const LLUUID& outboxId);
+ void initializeMarketPlace();
// virtuals
BOOL postBuild();
@@ -70,6 +70,7 @@ public:
void onMouseLeave(S32 x, S32 y, MASK mask);
protected:
+ void setupOutbox();
void fetchOutboxContents();
void importReportResults(U32 status, const LLSD& content);
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index 5da615d37b..becdfa1ddc 100644
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -414,9 +414,7 @@ void LLMarketplaceInventoryImporter::reinitializeAndTriggerImport()
{
mInitialized = false;
mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED;
-
initialize();
-
mAutoTriggerImport = true;
}
@@ -468,17 +466,21 @@ void LLMarketplaceInventoryImporter::updateImport()
if (mInitialized)
{
+ mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_MERCHANT;
// Follow up with auto trigger of import
if (mAutoTriggerImport)
{
mAutoTriggerImport = false;
-
mImportInProgress = triggerImport();
}
}
- else if (mErrorInitSignal)
+ else
{
- (*mErrorInitSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults());
+ mMarketPlaceStatus = (LLMarketplaceImport::getResultStatus() == MarketplaceErrorCodes::IMPORT_FORBIDDEN ? MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT : MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE);
+ if (mErrorInitSignal && (mMarketPlaceStatus == MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE))
+ {
+ (*mErrorInitSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults());
+ }
}
}
}
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
index 092e730a88..1ea6768a02 100644
--- a/indra/newview/llmarketplacefunctions.h
+++ b/indra/newview/llmarketplacefunctions.h
@@ -61,8 +61,9 @@ namespace MarketplaceStatusCodes
{
MARKET_PLACE_NOT_INITIALIZED = 0,
MARKET_PLACE_INITIALIZING = 1,
- MARKET_PLACE_MERCHANT = 2,
- MARKET_PLACE_NOT_MERCHANT = 3,
+ MARKET_PLACE_CONNECTION_FAILURE = 2,
+ MARKET_PLACE_MERCHANT = 3,
+ MARKET_PLACE_NOT_MERCHANT = 4,
};
}
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 2157a05bbf..c375e4906c 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2190,6 +2190,11 @@ If you'd like to become a merchant, you'll need to [[MARKETPLACE_CREATE_STORE_UR
<string name="InventoryOutboxNoItems">
Drag folders to this area and click "Send to Marketplace" to list them for sale on the [[MARKETPLACE_DASHBOARD_URL] Marketplace].
</string>
+ <string name="InventoryOutboxInitializingTitle">Initializing Marketplace.</string>
+ <string name="InventoryOutboxInitializingTooltip"></string>
+ <string name="InventoryOutboxInitializing">
+We are accessing your account on the [[MARKETPLACE_CREATE_STORE_URL] Marketplace store].
+ </string>
<string name="Marketplace Error None">No errors</string>
<string name="Marketplace Error Not Merchant">Error: Before sending items to the Marketplace you will need to set yourself up as a merchant (free of charge).</string>