From c8e76908d71a67355beecf22c4daa8d0a50ef08e Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 28 Jan 2013 18:32:47 -0800 Subject: MAINT-2287 : Fixed : Test the merchant/no merchant status without relying on outbox, Recreate missing outbox for a merchant, UI clean up on init. --- indra/newview/llfloateroutbox.cpp | 104 ++++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 39 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') 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("panel_outbox_inventory.xml", - mInventoryPlaceholder->getParent(), - LLInventoryPanel::child_registry_t::instance()); - + if (mOutboxInventoryPanel == NULL) + { + mOutboxInventoryPanel = LLUICtrlFactory::createFromFile("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); -- cgit v1.2.3 From 677f65b3a2f863895250f1c25f91c79e43810caf Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 31 Jan 2013 20:26:59 -0800 Subject: MAINT-2301 : WIP : Catch a bit more 4xx and 5xx error codes, display the error code in the alert. --- indra/newview/llfloateroutbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index d999307f28..2545fcbc36 100644 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -528,7 +528,7 @@ void LLFloaterOutbox::importStatusChanged(bool inProgress) void LLFloaterOutbox::initializationReportError(U32 status, const LLSD& content) { - if (status != MarketplaceErrorCodes::IMPORT_DONE) + if (status >= MarketplaceErrorCodes::IMPORT_BAD_REQUEST) { char status_string[16]; sprintf(status_string, "%d", status); -- cgit v1.2.3 From 6a8e22cf022bfc44335d6d8e6f83315d84b24c8c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 15 Feb 2013 14:02:33 -0800 Subject: MAINT-2301 : Change messaging in the Merchant Outbox panel when an error happened, so not to be confused with the not-a-merchant case. --- indra/newview/llfloateroutbox.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 2545fcbc36..d66b433834 100644 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -350,25 +350,36 @@ void LLFloaterOutbox::updateView() std::string outbox_tooltip; const LLSD& subs = getMarketplaceStringSubstitutions(); + U32 mkt_status = LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus(); if (mOutboxId.notNull()) { + // "Outbox is empty!" message strings outbox_text = LLTrans::getString("InventoryOutboxNoItems", subs); outbox_title = LLTrans::getString("InventoryOutboxNoItemsTitle"); outbox_tooltip = LLTrans::getString("InventoryOutboxNoItemsTooltip"); } - else if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() <= MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING) + else if (mkt_status <= MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING) { + // "Initializing!" message strings outbox_text = LLTrans::getString("InventoryOutboxInitializing", subs); outbox_title = LLTrans::getString("InventoryOutboxInitializingTitle"); outbox_tooltip = LLTrans::getString("InventoryOutboxInitializingTooltip"); } - else + else if (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT) { + // "Not a merchant!" message strings outbox_text = LLTrans::getString("InventoryOutboxNotMerchant", subs); outbox_title = LLTrans::getString("InventoryOutboxNotMerchantTitle"); outbox_tooltip = LLTrans::getString("InventoryOutboxNotMerchantTooltip"); } + else + { + // "Errors!" message strings + outbox_text = LLTrans::getString("InventoryOutboxError", subs); + outbox_title = LLTrans::getString("InventoryOutboxErrorTitle"); + outbox_tooltip = LLTrans::getString("InventoryOutboxErrorTooltip"); + } mInventoryText->setValue(outbox_text); mInventoryTitle->setValue(outbox_title); -- cgit v1.2.3 From e6b4b89bf12ae410fa87baf01117daa2a47754c0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 11 Nov 2013 18:39:02 -0800 Subject: MAINT-3320 : WIP : Use handle for elements that'll get deleted under us, quite a bit of debug spam to clean later --- indra/newview/llfloateroutbox.cpp | 138 +++++++++++++++++++++++++------------- 1 file changed, 90 insertions(+), 48 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 4bd0574fc1..15d078db36 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -120,7 +120,6 @@ LLFloaterOutbox::LLFloaterOutbox(const LLSD& key) , mInventoryText(NULL) , mInventoryTitle(NULL) , mOutboxId(LLUUID::null) - , mOutboxInventoryPanel(NULL) , mOutboxItemCount(0) , mOutboxTopLevelDropZone(NULL) , mWindowShade(NULL) @@ -221,13 +220,20 @@ void LLFloaterOutbox::setupOutbox() } // We are a merchant. Get the outbox, create it if needs be. - mOutboxId = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, true); - if (mOutboxId.isNull()) + LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, true); + if (outbox_id.isNull()) { // We should never get there unless the inventory fails badly llerrs << "Inventory problem: failure to create the outbox for a merchant!" << llendl; return; } + if (outbox_id == mOutboxId) + { + llinfos << "Merov : setupOutbox, we already have an outbox set = " << mOutboxId.asString() << llendl; + return; + } + mOutboxId = outbox_id; + llinfos << "Merov : setupOutbox!!!, mOutboxId = " << mOutboxId.asString() << llendl; // No longer need to observe new category creation if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) @@ -238,32 +244,37 @@ void LLFloaterOutbox::setupOutbox() } llassert(!mCategoryAddedObserver); - // Create observer for outbox modifications - if (mCategoriesObserver == NULL) + // Create observer for outbox modifications : clear the old one and create a new one + if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) { - mCategoriesObserver = new LLInventoryCategoriesObserver(); - gInventory.addObserver(mCategoriesObserver); - mCategoriesObserver->addCategory(mOutboxId, boost::bind(&LLFloaterOutbox::onOutboxChanged, this)); + gInventory.removeObserver(mCategoriesObserver); + delete mCategoriesObserver; } + mCategoriesObserver = new LLInventoryCategoriesObserver(); + gInventory.addObserver(mCategoriesObserver); + mCategoriesObserver->addCategory(mOutboxId, boost::bind(&LLFloaterOutbox::onOutboxChanged, this)); llassert(mCategoriesObserver); - // // Set up the outbox inventory view - // - if (mOutboxInventoryPanel == NULL) - { - mOutboxInventoryPanel = LLUICtrlFactory::createFromFile("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); - } - llassert(mOutboxInventoryPanel); + LLInventoryPanel* panel = mOutboxInventoryPanel.get(); + if (panel) + { + delete panel; + } + LLInventoryPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + mOutboxInventoryPanel = inventory_panel->getInventoryPanelHandle(); + llassert(mOutboxInventoryPanel.get() != NULL); // Reshape the inventory to the proper size + panel = mOutboxInventoryPanel.get(); LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); - mOutboxInventoryPanel->setShape(inventory_placeholder_rect); + panel->setShape(inventory_placeholder_rect); // Set the sort order newest to oldest - - mOutboxInventoryPanel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); - mOutboxInventoryPanel->getFilter().markDefault(); + panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + panel->getFilter().markDefault(); + + llinfos << "Merov : setupOutbox!!!, viewModel = " << panel->getFolderViewModel() << llendl; // Get the content of the outbox fetchOutboxContents(); @@ -292,18 +303,26 @@ void LLFloaterOutbox::setStatusString(const std::string& statusString) void LLFloaterOutbox::updateFolderCount() { - S32 item_count = 0; - - if (mOutboxId.notNull()) + if (mOutboxInventoryPanel.get()) { - LLInventoryModel::cat_array_t * cats; - LLInventoryModel::item_array_t * items; - gInventory.getDirectDescendentsOf(mOutboxId, cats, items); + S32 item_count = 0; - item_count = cats->count() + items->count(); - } + if (mOutboxId.notNull()) + { + LLInventoryModel::cat_array_t * cats; + LLInventoryModel::item_array_t * items; + gInventory.getDirectDescendentsOf(mOutboxId, cats, items); + + item_count = cats->count() + items->count(); + } - mOutboxItemCount = item_count; + mOutboxItemCount = item_count; + } + else + { + // If there's no outbox, the number of items in it should be set to 0 for consistency + mOutboxItemCount = 0; + } if (!mImportBusy) { @@ -313,7 +332,7 @@ void LLFloaterOutbox::updateFolderCount() void LLFloaterOutbox::updateFolderCountStatus() { - if (mOutboxInventoryPanel) + if (mOutboxInventoryPanel.get()) { switch (mOutboxItemCount) { @@ -338,18 +357,27 @@ void LLFloaterOutbox::updateFolderCountStatus() void LLFloaterOutbox::updateView() { updateFolderCount(); + LLInventoryPanel* panel = mOutboxInventoryPanel.get(); + if (panel) + { + llinfos << "Merov : LLFloaterOutbox::updateView(), panel = " << panel << ", viewModel = " << panel->getFolderViewModel() << llendl; + } + else + { + llinfos << "Merov : LLFloaterOutbox::updateView(), panel = " << panel << llendl; + } if (mOutboxItemCount > 0) { - mOutboxInventoryPanel->setVisible(TRUE); + panel->setVisible(TRUE); mInventoryPlaceholder->setVisible(FALSE); mOutboxTopLevelDropZone->setVisible(TRUE); } else { - if (mOutboxInventoryPanel) + if (panel) { - mOutboxInventoryPanel->setVisible(FALSE); + panel->setVisible(FALSE); } // Show the drop zone if there is an outbox folder @@ -366,6 +394,11 @@ void LLFloaterOutbox::updateView() if (mOutboxId.notNull()) { + // Does the outbox needs recreation? + if ((mOutboxInventoryPanel.get() == NULL) || !gInventory.getCategory(mOutboxId)) + { + setupOutbox(); + } // "Outbox is empty!" message strings outbox_text = LLTrans::getString("InventoryOutboxNoItems", subs); outbox_title = LLTrans::getString("InventoryOutboxNoItemsTitle"); @@ -410,7 +443,7 @@ BOOL LLFloaterOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EAcceptance* accept, std::string& tooltip_msg) { - if ((mOutboxInventoryPanel == NULL) || + if ((mOutboxInventoryPanel.get() == NULL) || (mWindowShade && mWindowShade->isShown()) || LLMarketplaceInventoryImporter::getInstance()->isImportInProgress()) { @@ -423,15 +456,16 @@ BOOL LLFloaterOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // Determine if the mouse is inside the inventory panel itself or just within the floater bool pointInInventoryPanel = false; bool pointInInventoryPanelChild = false; - LLFolderView* root_folder = mOutboxInventoryPanel->getRootFolder(); - if (mOutboxInventoryPanel->getVisible()) + LLInventoryPanel* panel = mOutboxInventoryPanel.get(); + LLFolderView* root_folder = panel->getRootFolder(); + if (panel->getVisible()) { S32 inv_x, inv_y; - localPointToOtherView(x, y, &inv_x, &inv_y, mOutboxInventoryPanel); + localPointToOtherView(x, y, &inv_x, &inv_y, panel); - pointInInventoryPanel = mOutboxInventoryPanel->getRect().pointInRect(inv_x, inv_y); + pointInInventoryPanel = panel->getRect().pointInRect(inv_x, inv_y); - LLView * inventory_panel_child_at_point = mOutboxInventoryPanel->childFromPoint(inv_x, inv_y, true); + LLView * inventory_panel_child_at_point = panel->childFromPoint(inv_x, inv_y, true); pointInInventoryPanelChild = (inventory_panel_child_at_point != root_folder); } @@ -471,7 +505,11 @@ void LLFloaterOutbox::onMouseLeave(S32 x, S32 y, MASK mask) void LLFloaterOutbox::onImportButtonClicked() { - mOutboxInventoryPanel->clearSelection(); + LLInventoryPanel* panel = mOutboxInventoryPanel.get(); + if (panel) + { + panel->clearSelection(); + } mImportBusy = LLMarketplaceInventoryImporter::instance().triggerImport(); } @@ -479,15 +517,19 @@ void LLFloaterOutbox::onImportButtonClicked() void LLFloaterOutbox::onOutboxChanged() { llassert(!mOutboxId.isNull()); - - //if (mOutboxInventoryPanel) - //{ - // mOutboxInventoryPanel->requestSort(); - //} - - fetchOutboxContents(); - - updateView(); + LLInventoryPanel* panel = mOutboxInventoryPanel.get(); + llinfos << "Merov : onOutboxChanged!!!, panel = " << panel << ", view model = " << (panel ? panel->getFolderViewModel() : NULL) << llendl; + LLViewerInventoryCategory* category = gInventory.getCategory(mOutboxId); + if (category) + { + fetchOutboxContents(); + updateView(); + } + else + { + llinfos << "Merov : onOutboxChanged!!!, the category disappeared!" << llendl; + //setupOutbox(); + } } void LLFloaterOutbox::importReportResults(U32 status, const LLSD& content) -- cgit v1.2.3 From 148c3780e164d5bc94fa14b418e85fee72f9fd39 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 13 Nov 2013 13:29:51 -0800 Subject: MAINT-3320 : WIP : Introduced a cleanOutbox() method to be called on outbox deletion --- indra/newview/llfloateroutbox.cpp | 43 ++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 15d078db36..f8de91715c 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -163,6 +163,38 @@ BOOL LLFloaterOutbox::postBuild() return TRUE; } +void LLFloaterOutbox::cleanOutbox() +{ + /* + // Create a new category creation observer + if (mCategoryAddedObserver == NULL) + { + mCategoryAddedObserver = new LLOutboxAddedObserver(this); + gInventory.addObserver(mCategoryAddedObserver); + } + llassert(mCategoryAddedObserver); + + // Delete the observer for outbox modifications + if (mCategoriesObserver) + { + gInventory.removeObserver(mCategoriesObserver); + delete mCategoriesObserver; + mCategoriesObserver = NULL; + } + llassert(!mCategoriesObserver); + */ + + // Clear the outbox data + mOutboxId.setNull(); + mOutboxItemCount = 0; + + // Note: we cannot delete the mOutboxInventoryPanel as that point + // as this is called through callback observers of the panel itself. + // Doing so crashes rapidly. + + llinfos << "Merov : cleanOutbox!" << llendl; +} + void LLFloaterOutbox::onClose(bool app_quitting) { if (mWindowShade) @@ -303,7 +335,7 @@ void LLFloaterOutbox::setStatusString(const std::string& statusString) void LLFloaterOutbox::updateFolderCount() { - if (mOutboxInventoryPanel.get()) + if (mOutboxInventoryPanel.get() && mOutboxId.notNull()) { S32 item_count = 0; @@ -332,7 +364,7 @@ void LLFloaterOutbox::updateFolderCount() void LLFloaterOutbox::updateFolderCountStatus() { - if (mOutboxInventoryPanel.get()) + if (mOutboxInventoryPanel.get() && mOutboxId.notNull()) { switch (mOutboxItemCount) { @@ -445,7 +477,8 @@ BOOL LLFloaterOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, { if ((mOutboxInventoryPanel.get() == NULL) || (mWindowShade && mWindowShade->isShown()) || - LLMarketplaceInventoryImporter::getInstance()->isImportInProgress()) + LLMarketplaceInventoryImporter::getInstance()->isImportInProgress() || + mOutboxId.isNull()) { return FALSE; } @@ -516,7 +549,7 @@ void LLFloaterOutbox::onImportButtonClicked() void LLFloaterOutbox::onOutboxChanged() { - llassert(!mOutboxId.isNull()); + //llassert(!mOutboxId.isNull()); LLInventoryPanel* panel = mOutboxInventoryPanel.get(); llinfos << "Merov : onOutboxChanged!!!, panel = " << panel << ", view model = " << (panel ? panel->getFolderViewModel() : NULL) << llendl; LLViewerInventoryCategory* category = gInventory.getCategory(mOutboxId); @@ -528,7 +561,7 @@ void LLFloaterOutbox::onOutboxChanged() else { llinfos << "Merov : onOutboxChanged!!!, the category disappeared!" << llendl; - //setupOutbox(); + cleanOutbox(); } } -- cgit v1.2.3 From 6ec99570cd86a89ed6367f81d6b0cccd7fe0e913 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 15 Nov 2013 15:12:11 -0800 Subject: MAINT-3320 : Fixed! Inventory panels are not resistant to folder root deletion, using handle instead of pointer and cleaning things consistently --- indra/newview/llfloateroutbox.cpp | 68 +++++++++------------------------------ 1 file changed, 15 insertions(+), 53 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index f8de91715c..fa628f2a08 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -165,34 +165,13 @@ BOOL LLFloaterOutbox::postBuild() void LLFloaterOutbox::cleanOutbox() { - /* - // Create a new category creation observer - if (mCategoryAddedObserver == NULL) - { - mCategoryAddedObserver = new LLOutboxAddedObserver(this); - gInventory.addObserver(mCategoryAddedObserver); - } - llassert(mCategoryAddedObserver); - - // Delete the observer for outbox modifications - if (mCategoriesObserver) - { - gInventory.removeObserver(mCategoriesObserver); - delete mCategoriesObserver; - mCategoriesObserver = NULL; - } - llassert(!mCategoriesObserver); - */ - - // Clear the outbox data - mOutboxId.setNull(); - mOutboxItemCount = 0; - // Note: we cannot delete the mOutboxInventoryPanel as that point // as this is called through callback observers of the panel itself. - // Doing so crashes rapidly. + // Doing so would crash rapidly. - llinfos << "Merov : cleanOutbox!" << llendl; + // Invalidate the outbox data + mOutboxId.setNull(); + mOutboxItemCount = 0; } void LLFloaterOutbox::onClose(bool app_quitting) @@ -261,11 +240,10 @@ void LLFloaterOutbox::setupOutbox() } if (outbox_id == mOutboxId) { - llinfos << "Merov : setupOutbox, we already have an outbox set = " << mOutboxId.asString() << llendl; + llwarns << "Inventory warning: Merchant outbox already set" << llendl; return; } mOutboxId = outbox_id; - llinfos << "Merov : setupOutbox!!!, mOutboxId = " << mOutboxId.asString() << llendl; // No longer need to observe new category creation if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) @@ -288,26 +266,23 @@ void LLFloaterOutbox::setupOutbox() llassert(mCategoriesObserver); // Set up the outbox inventory view - LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - if (panel) + LLInventoryPanel* inventory_panel = mOutboxInventoryPanel.get(); + if (inventory_panel) { - delete panel; + delete inventory_panel; } - LLInventoryPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + inventory_panel = LLUICtrlFactory::createFromFile("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); mOutboxInventoryPanel = inventory_panel->getInventoryPanelHandle(); llassert(mOutboxInventoryPanel.get() != NULL); // Reshape the inventory to the proper size - panel = mOutboxInventoryPanel.get(); LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); - panel->setShape(inventory_placeholder_rect); + inventory_panel->setShape(inventory_placeholder_rect); // Set the sort order newest to oldest - panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); - panel->getFilter().markDefault(); + inventory_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + inventory_panel->getFilter().markDefault(); - llinfos << "Merov : setupOutbox!!!, viewModel = " << panel->getFolderViewModel() << llendl; - // Get the content of the outbox fetchOutboxContents(); } @@ -390,14 +365,6 @@ void LLFloaterOutbox::updateView() { updateFolderCount(); LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - if (panel) - { - llinfos << "Merov : LLFloaterOutbox::updateView(), panel = " << panel << ", viewModel = " << panel->getFolderViewModel() << llendl; - } - else - { - llinfos << "Merov : LLFloaterOutbox::updateView(), panel = " << panel << llendl; - } if (mOutboxItemCount > 0) { @@ -538,10 +505,9 @@ void LLFloaterOutbox::onMouseLeave(S32 x, S32 y, MASK mask) void LLFloaterOutbox::onImportButtonClicked() { - LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - if (panel) + if (mOutboxInventoryPanel.get()) { - panel->clearSelection(); + mOutboxInventoryPanel.get()->clearSelection(); } mImportBusy = LLMarketplaceInventoryImporter::instance().triggerImport(); @@ -549,18 +515,14 @@ void LLFloaterOutbox::onImportButtonClicked() void LLFloaterOutbox::onOutboxChanged() { - //llassert(!mOutboxId.isNull()); - LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - llinfos << "Merov : onOutboxChanged!!!, panel = " << panel << ", view model = " << (panel ? panel->getFolderViewModel() : NULL) << llendl; LLViewerInventoryCategory* category = gInventory.getCategory(mOutboxId); - if (category) + if (mOutboxId.notNull() && category) { fetchOutboxContents(); updateView(); } else { - llinfos << "Merov : onOutboxChanged!!!, the category disappeared!" << llendl; cleanOutbox(); } } -- cgit v1.2.3 From 125f3f071a30f4c47feb664b21f3e380ee4e7e49 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 18 Nov 2013 16:03:22 -0800 Subject: MAINT-3319 : WIP : Introduce a consolidate folder method used for Merchant Outbox --- indra/newview/llfloateroutbox.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index fa628f2a08..90da9ad2c0 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -238,6 +238,11 @@ void LLFloaterOutbox::setupOutbox() llerrs << "Inventory problem: failure to create the outbox for a merchant!" << llendl; return; } + + // Consolidate Merchant Outbox + // 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_OUTBOX); + if (outbox_id == mOutboxId) { llwarns << "Inventory warning: Merchant outbox already set" << llendl; -- cgit v1.2.3 From 66dff9d93bca7c6bdc18d57bb16a40c9753f6711 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 26 Nov 2013 20:17:23 -0800 Subject: ACME-1220 : Fixed. Do not accumulate callbacks when reinitializing market place --- indra/newview/llfloateroutbox.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 90da9ad2c0..de96f75602 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -297,13 +297,15 @@ void LLFloaterOutbox::initializeMarketPlace() // // Initialize the marketplace import API // - LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance(); - importer.setInitializationErrorCallback(boost::bind(&LLFloaterOutbox::initializationReportError, this, _1, _2)); - importer.setStatusChangedCallback(boost::bind(&LLFloaterOutbox::importStatusChanged, this, _1)); - importer.setStatusReportCallback(boost::bind(&LLFloaterOutbox::importReportResults, this, _1, _2)); - importer.initialize(); + if (!importer.isInitialized()) + { + importer.setInitializationErrorCallback(boost::bind(&LLFloaterOutbox::initializationReportError, this, _1, _2)); + importer.setStatusChangedCallback(boost::bind(&LLFloaterOutbox::importStatusChanged, this, _1)); + importer.setStatusReportCallback(boost::bind(&LLFloaterOutbox::importReportResults, this, _1, _2)); + importer.initialize(); + } } void LLFloaterOutbox::setStatusString(const std::string& statusString) -- cgit v1.2.3