From 95b8020d21b1ad60f82c767df7d7aac019ad8353 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Mon, 23 May 2011 16:11:50 -0700 Subject: adding marketplace inbox and outbox reviewed by Leslie --- indra/newview/llsidepanelinventory.cpp | 49 +++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 31ea542743..7f5a2e64bf 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -42,6 +42,7 @@ #include "lltabcontainer.h" #include "llselectmgr.h" #include "llweb.h" +#include "lllayoutstack.h" static LLRegisterPanelClassWrapper t_inventory("sidepanel_inventory"); @@ -118,10 +119,56 @@ BOOL LLSidepanelInventory::postBuild() back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this)); } } - + + getChild("inbox_btn")->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this)); + getChild("outbox_btn")->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleOutboxBtn, this)); + + LLLayoutStack* stack = getChild("inventory_layout_stack"); + + stack->collapsePanel(getChild("inbox_layout_panel"), true); + stack->collapsePanel(getChild("outbox_layout_panel"), true); + getChild("outbox_btn")->setToggleState(false); + getChild("inbox_btn")->setToggleState(false); + return TRUE; } + +void LLSidepanelInventory::onToggleInboxBtn() +{ + LLLayoutStack* stack = getChild("inventory_layout_stack"); + bool collapse = !getChild("inbox_btn")->getToggleState(); + + if (stack) + { + stack->collapsePanel(getChild("inbox_layout_panel"), collapse); + } + if (!collapse) + { + stack->collapsePanel(getChild("outbox_layout_panel"), true); + getChild("outbox_btn")->setToggleState(false); + } +} + +void LLSidepanelInventory::onToggleOutboxBtn() +{ + LLLayoutStack* stack = getChild("inventory_layout_stack"); + bool collapse = !getChild("outbox_btn")->getToggleState(); + + if (stack) + { + stack->collapsePanel(getChild("outbox_layout_panel"), collapse); + } + + if (!collapse) + { + stack->collapsePanel(getChild("inbox_layout_panel"), true); + getChild("inbox_btn")->setToggleState(false); + } + +} + + void LLSidepanelInventory::onOpen(const LLSD& key) { LLFirstUse::newInventory(false); -- cgit v1.2.3 From 33e4a2c7b1ab3a06f1adb5edd9850523c897ea77 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 25 May 2011 10:39:34 -0700 Subject: Updated Marketplace Inbox & Outbox panel to maintain size when one is expanded vs the other --- indra/newview/llsidepanelinventory.cpp | 49 +++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 7f5a2e64bf..9247611257 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -134,38 +134,45 @@ BOOL LLSidepanelInventory::postBuild() } -void LLSidepanelInventory::onToggleInboxBtn() +void manageInboxOutboxPanels(LLLayoutStack * stack, + LLButton * pressedButton, LLLayoutPanel * pressedPanel, + LLButton * otherButton, LLLayoutPanel * otherPanel) { - LLLayoutStack* stack = getChild("inventory_layout_stack"); - bool collapse = !getChild("inbox_btn")->getToggleState(); + bool expand = pressedButton->getToggleState(); + bool otherExpanded = otherButton->getToggleState(); - if (stack) - { - stack->collapsePanel(getChild("inbox_layout_panel"), collapse); - } - if (!collapse) + if (expand && otherExpanded) { - stack->collapsePanel(getChild("outbox_layout_panel"), true); - getChild("outbox_btn")->setToggleState(false); + // Reshape pressedPanel to the otherPanel's height so we preserve the marketplace panel size + pressedPanel->reshape(pressedPanel->getRect().getWidth(), otherPanel->getRect().getHeight()); + + stack->collapsePanel(otherPanel, true); + otherButton->setToggleState(false); } + + stack->collapsePanel(pressedPanel, !expand); } -void LLSidepanelInventory::onToggleOutboxBtn() +void LLSidepanelInventory::onToggleInboxBtn() { LLLayoutStack* stack = getChild("inventory_layout_stack"); - bool collapse = !getChild("outbox_btn")->getToggleState(); + LLButton* pressedButton = getChild("inbox_btn"); + LLLayoutPanel* pressedPanel = getChild("inbox_layout_panel"); + LLButton* otherButton = getChild("outbox_btn"); + LLLayoutPanel* otherPanel = getChild("outbox_layout_panel"); - if (stack) - { - stack->collapsePanel(getChild("outbox_layout_panel"), collapse); - } + manageInboxOutboxPanels(stack, pressedButton, pressedPanel, otherButton, otherPanel); +} - if (!collapse) - { - stack->collapsePanel(getChild("inbox_layout_panel"), true); - getChild("inbox_btn")->setToggleState(false); - } +void LLSidepanelInventory::onToggleOutboxBtn() +{ + LLLayoutStack* stack = getChild("inventory_layout_stack"); + LLButton* pressedButton = getChild("outbox_btn"); + LLLayoutPanel* pressedPanel = getChild("outbox_layout_panel"); + LLButton* otherButton = getChild("inbox_btn"); + LLLayoutPanel* otherPanel = getChild("inbox_layout_panel"); + manageInboxOutboxPanels(stack, pressedButton, pressedPanel, otherButton, otherPanel); } -- cgit v1.2.3 From 651a9587f82a143764856a4c2603d89c5d392cb6 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 1 Jun 2011 13:50:14 -0700 Subject: EXP-862 FIX -- Disable marketplace inbox/outbox panel separator when inbox and outbox are collapsed Marketplace panel is only resizable now when inbox or outbox is expanded. Reviewed by Leyla --- indra/newview/llsidepanelinventory.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 9247611257..301322d24b 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -120,15 +120,22 @@ BOOL LLSidepanelInventory::postBuild() } } - getChild("inbox_btn")->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this)); - getChild("outbox_btn")->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleOutboxBtn, this)); + // Marketplace inbox/outbox setup + { + LLButton * inboxButton = getChild("inbox_btn"); + LLButton * outboxButton = getChild("outbox_btn"); - LLLayoutStack* stack = getChild("inventory_layout_stack"); + inboxButton->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this)); + outboxButton->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleOutboxBtn, this)); + + LLLayoutStack* stack = getChild("inventory_layout_stack"); - stack->collapsePanel(getChild("inbox_layout_panel"), true); - stack->collapsePanel(getChild("outbox_layout_panel"), true); - getChild("outbox_btn")->setToggleState(false); - getChild("inbox_btn")->setToggleState(false); + stack->collapsePanel(getChild("inbox_layout_panel"), true); + stack->collapsePanel(getChild("outbox_layout_panel"), true); + + inboxButton->setToggleState(false); + outboxButton->setToggleState(false); + } return TRUE; } @@ -151,6 +158,9 @@ void manageInboxOutboxPanels(LLLayoutStack * stack, } stack->collapsePanel(pressedPanel, !expand); + + // Enable user_resize on main inventory panel when at least one marketplace box is expanded + stack->setPanelUserResize("main_inventory_layout_panel", expand); } void LLSidepanelInventory::onToggleInboxBtn() -- cgit v1.2.3 From 98bcd9e2efe4cc0dc5e51da09c6f18424b9d9144 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 6 Jun 2011 17:00:59 -0700 Subject: EXP-859 FIX -- Save setting for last time inbox expanded EXP-841 PROGRESS -- Create outbox sync button with basic enable/disable logic and animation EXP-866 PROGRESS -- Create inbox observer to dynamically update inbox item count and badge value EXP-872 PROGRESS -- Hide inbox and outbox unless applicable Inbox expansion time is now saved as setting variable "LastInventoryInboxExpand". New outbox sync button art. Observers for items and categories are now implemented in the LLSidepanelInventory but the exact method of use is still to be determined. Functions are in place to show and hide the inbox and outbox panels but the logic around the decision is TBD. The resize bar for the inbox/outbox is now disabled when both inbox and outbox are collapsed. Reviewed by Leyla. --- indra/newview/llsidepanelinventory.cpp | 235 ++++++++++++++++++++++++++++----- 1 file changed, 205 insertions(+), 30 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 301322d24b..ae2ac4b5e5 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -31,32 +31,116 @@ #include "llappearancemgr.h" #include "llavataractions.h" #include "llbutton.h" +#include "lldate.h" #include "llfirstuse.h" +#include "llfoldertype.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" +#include "llinventorymodel.h" +#include "llinventorymodelbackgroundfetch.h" +#include "llinventoryobserver.h" #include "llinventorypanel.h" +#include "lllayoutstack.h" #include "lloutfitobserver.h" #include "llpanelmaininventory.h" +#include "llselectmgr.h" #include "llsidepaneliteminfo.h" #include "llsidepaneltaskinfo.h" #include "lltabcontainer.h" -#include "llselectmgr.h" #include "llweb.h" -#include "lllayoutstack.h" static LLRegisterPanelClassWrapper t_inventory("sidepanel_inventory"); -LLSidepanelInventory::LLSidepanelInventory() - : LLPanel(), - mItemPanel(NULL), - mPanelMainInventory(NULL) +// +// Constants +// + +static const char * const INBOX_EXPAND_TIME_SETTING = "LastInventoryInboxExpand"; + +static const char * const INBOX_BUTTON_NAME = "inbox_btn"; +static const char * const OUTBOX_BUTTON_NAME = "outbox_btn"; + +static const char * const INBOX_LAYOUT_PANEL_NAME = "inbox_layout_panel"; +static const char * const OUTBOX_LAYOUT_PANEL_NAME = "outbox_layout_panel"; +static const char * const MAIN_INVENTORY_LAYOUT_PANEL = "main_inventory_layout_panel"; + +static const char * const INVENTORY_LAYOUT_STACK_NAME = "inventory_layout_stack"; + +// +// Helpers +// + +class LLInboxOutboxInventoryAddedObserver : public LLInventoryAddedObserver { +public: + LLInboxOutboxInventoryAddedObserver(LLSidepanelInventory * sidepanelInventory) + : LLInventoryAddedObserver() + , mSidepanelInventory(sidepanelInventory) + {} + +protected: + virtual void done() + { + uuid_vec_t::const_iterator it = mAdded.begin(); + uuid_vec_t::const_iterator it_end = mAdded.end(); + + for(; it != it_end; ++it) + { + LLInventoryObject* item = gInventory.getObject(*it); + + // NOTE: This doesn't actually work because folder creation does not trigger this observer + if (item && item->getType() == LLAssetType::AT_CATEGORY) + { + // Check for FolderType FT_INBOX or FT_OUTBOX and report back to mSidepanelInventory + LLInventoryCategory * item_cat = static_cast(item); + LLFolderType::EType folderType = item_cat->getPreferredType(); + + if (folderType == LLFolderType::FT_INBOX) + { + mSidepanelInventory->enableInbox(true); + } + else if (folderType == LLFolderType::FT_OUTBOX) + { + mSidepanelInventory->enableOutbox(true); + } + } + } + + mAdded.clear(); + } +private: + LLSidepanelInventory * mSidepanelInventory; +}; + +// +// Implementation +// + +LLSidepanelInventory::LLSidepanelInventory() + : LLPanel() + , mItemPanel(NULL) + , mPanelMainInventory(NULL) + , mInventoryFetched(false) + , mCategoriesObserver(NULL) + , mInboxOutboxAddedObserver(NULL) +{ //buildFromFile( "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() } LLSidepanelInventory::~LLSidepanelInventory() { + if (mInboxOutboxAddedObserver && gInventory.containsObserver(mInboxOutboxAddedObserver)) + { + gInventory.removeObserver(mInboxOutboxAddedObserver); + } + delete mInboxOutboxAddedObserver; + + if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) + { + gInventory.removeObserver(mCategoriesObserver); + } + delete mCategoriesObserver; } BOOL LLSidepanelInventory::postBuild() @@ -122,32 +206,110 @@ BOOL LLSidepanelInventory::postBuild() // Marketplace inbox/outbox setup { - LLButton * inboxButton = getChild("inbox_btn"); - LLButton * outboxButton = getChild("outbox_btn"); + LLButton * inbox_button = getChild(INBOX_BUTTON_NAME); + LLButton * outbox_button = getChild(OUTBOX_BUTTON_NAME); + + LLLayoutStack* stack = getChild(INVENTORY_LAYOUT_STACK_NAME); + + LLLayoutPanel * inbox_panel = getChild(INBOX_LAYOUT_PANEL_NAME); + LLLayoutPanel * outbox_panel = getChild(OUTBOX_LAYOUT_PANEL_NAME); + + stack->collapsePanel(inbox_panel, true); + stack->collapsePanel(outbox_panel, true); - inboxButton->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this)); - outboxButton->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleOutboxBtn, this)); + inbox_button->setToggleState(false); + outbox_button->setToggleState(false); - LLLayoutStack* stack = getChild("inventory_layout_stack"); + inbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this)); + outbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleOutboxBtn, this)); + + // TODO: Hide inbox/outbox panels until we determine the status of the feature + //inbox_panel->setVisible(false); + //outbox_panel->setVisible(false); - stack->collapsePanel(getChild("inbox_layout_panel"), true); - stack->collapsePanel(getChild("outbox_layout_panel"), true); + // Track added items + mInboxOutboxAddedObserver = new LLInboxOutboxInventoryAddedObserver(this); + gInventory.addObserver(mInboxOutboxAddedObserver); - inboxButton->setToggleState(false); - outboxButton->setToggleState(false); + // Track inbox and outbox folder changes + const bool do_not_create_folder = false; + const bool do_not_find_in_library = false; + + const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, do_not_create_folder, do_not_find_in_library); + const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, do_not_create_folder, do_not_find_in_library); + + mCategoriesObserver = new LLInventoryCategoriesObserver(); + gInventory.addObserver(mCategoriesObserver); + + mCategoriesObserver->addCategory(inbox_id, boost::bind(&LLSidepanelInventory::onInboxChanged, this, inbox_id)); + mCategoriesObserver->addCategory(outbox_id, boost::bind(&LLSidepanelInventory::onOutboxChanged, this, outbox_id)); } return TRUE; } +void LLSidepanelInventory::draw() +{ + if (!mInventoryFetched && LLInventoryModelBackgroundFetch::instance().isEverythingFetched()) + { + mInventoryFetched = true; + + updateInboxOutboxPanels(); + } + + LLPanel::draw(); +} + +void LLSidepanelInventory::updateInboxOutboxPanels() +{ + // Iterate through gInventory looking for inbox and outbox + const bool do_not_create_folder = false; + const bool do_not_find_in_library = false; + + const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, do_not_create_folder, do_not_find_in_library); + const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, do_not_create_folder, do_not_find_in_library); + + enableInbox(inbox_id.notNull()); + enableOutbox(outbox_id.notNull()); +} + +void LLSidepanelInventory::enableInbox(bool enabled) +{ + getChild(INBOX_LAYOUT_PANEL_NAME)->setVisible(enabled); +} + +void LLSidepanelInventory::enableOutbox(bool enabled) +{ + getChild(OUTBOX_LAYOUT_PANEL_NAME)->setVisible(enabled); +} -void manageInboxOutboxPanels(LLLayoutStack * stack, +void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id) +{ + // Perhaps use this to track inbox changes? +} + +void LLSidepanelInventory::onOutboxChanged(const LLUUID& outbox_id) +{ + // Perhaps use this to track outbox changes? +} + +bool manageInboxOutboxPanels(LLLayoutStack * stack, LLButton * pressedButton, LLLayoutPanel * pressedPanel, LLButton * otherButton, LLLayoutPanel * otherPanel) { bool expand = pressedButton->getToggleState(); bool otherExpanded = otherButton->getToggleState(); + // + // NOTE: Ideally we could have two panel sizes stored for a collapsed and expanded minimum size. + // For now, leave this code disabled because it creates some bad artifacts when expanding + // and collapsing the inbox/outbox. + // + //S32 smallMinSize = (expand ? pressedPanel->getMinDim() : otherPanel->getMinDim()); + //S32 pressedMinSize = (expand ? 2 * smallMinSize : smallMinSize); + //otherPanel->setMinDim(smallMinSize); + //pressedPanel->setMinDim(pressedMinSize); + if (expand && otherExpanded) { // Reshape pressedPanel to the otherPanel's height so we preserve the marketplace panel size @@ -159,33 +321,46 @@ void manageInboxOutboxPanels(LLLayoutStack * stack, stack->collapsePanel(pressedPanel, !expand); - // Enable user_resize on main inventory panel when at least one marketplace box is expanded - stack->setPanelUserResize("main_inventory_layout_panel", expand); + // Enable user_resize on main inventory panel only when a marketplace box is expanded + stack->setPanelUserResize(MAIN_INVENTORY_LAYOUT_PANEL, expand); + + return expand; } void LLSidepanelInventory::onToggleInboxBtn() { - LLLayoutStack* stack = getChild("inventory_layout_stack"); - LLButton* pressedButton = getChild("inbox_btn"); - LLLayoutPanel* pressedPanel = getChild("inbox_layout_panel"); - LLButton* otherButton = getChild("outbox_btn"); - LLLayoutPanel* otherPanel = getChild("outbox_layout_panel"); + LLLayoutStack* stack = getChild(INVENTORY_LAYOUT_STACK_NAME); + LLButton* pressedButton = getChild(INBOX_BUTTON_NAME); + LLLayoutPanel* pressedPanel = getChild(INBOX_LAYOUT_PANEL_NAME); + LLButton* otherButton = getChild(OUTBOX_BUTTON_NAME); + LLLayoutPanel* otherPanel = getChild(OUTBOX_LAYOUT_PANEL_NAME); - manageInboxOutboxPanels(stack, pressedButton, pressedPanel, otherButton, otherPanel); + bool inboxExpanded = manageInboxOutboxPanels(stack, pressedButton, pressedPanel, otherButton, otherPanel); + + if (inboxExpanded) + { + // Save current time as a setting for future new-ness tests + gSavedSettings.setString(INBOX_EXPAND_TIME_SETTING, LLDate::now().asString()); + + // TODO: Hide inbox badge + } + else + { + // TODO: Show inbox badge + } } void LLSidepanelInventory::onToggleOutboxBtn() { - LLLayoutStack* stack = getChild("inventory_layout_stack"); - LLButton* pressedButton = getChild("outbox_btn"); - LLLayoutPanel* pressedPanel = getChild("outbox_layout_panel"); - LLButton* otherButton = getChild("inbox_btn"); - LLLayoutPanel* otherPanel = getChild("inbox_layout_panel"); + LLLayoutStack* stack = getChild(INVENTORY_LAYOUT_STACK_NAME); + LLButton* pressedButton = getChild(OUTBOX_BUTTON_NAME); + LLLayoutPanel* pressedPanel = getChild(OUTBOX_LAYOUT_PANEL_NAME); + LLButton* otherButton = getChild(INBOX_BUTTON_NAME); + LLLayoutPanel* otherPanel = getChild(INBOX_LAYOUT_PANEL_NAME); manageInboxOutboxPanels(stack, pressedButton, pressedPanel, otherButton, otherPanel); } - void LLSidepanelInventory::onOpen(const LLSD& key) { LLFirstUse::newInventory(false); -- cgit v1.2.3 From 142c2fc29c9645df1bff924d6a61c09f04713a7b Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 14 Jun 2011 16:35:15 -0700 Subject: EXP-896 FIX -- Inbox not opened by default when new items are received EXP-894 FIX -- When scrolling to the bottom of the inbox, the last item is c... EXP-856 FIX -- Inbox item count reflected as badge on inventory button * Inbox auto-expands when "fresh" items are reported * Logic for "fresh" item determination is still in progress but works for purchases while logged in * Badges now only displayed when the inventory side panel is collapsed or when inventory not visible Reviewed by Leyla --- indra/newview/llsidepanelinventory.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 6ac845385b..33d512d89e 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -43,6 +43,7 @@ #include "lllayoutstack.h" #include "lloutfitobserver.h" #include "llpanelmaininventory.h" +#include "llpanelmarketplaceinbox.h" #include "llselectmgr.h" #include "llsidepaneliteminfo.h" #include "llsidepaneltaskinfo.h" @@ -341,12 +342,6 @@ void LLSidepanelInventory::onToggleInboxBtn() { // Save current time as a setting for future new-ness tests gSavedSettings.setString(INBOX_EXPAND_TIME_SETTING, LLDate::now().asString()); - - // TODO: Hide inbox badge - } - else - { - // TODO: Show inbox badge } } @@ -365,6 +360,14 @@ void LLSidepanelInventory::onOpen(const LLSD& key) { LLFirstUse::newInventory(false); + // Expand the inbox if we have fresh items + LLPanelMarketplaceInbox * inbox = getChild("marketplace_inbox"); + if (inbox && (inbox->getFreshItemCount() > 0)) + { + getChild(INBOX_BUTTON_NAME)->setToggleState(true); + onToggleInboxBtn(); + } + if(key.size() == 0) return; -- cgit v1.2.3 From 5e3d344fba6f73959d9a8caeac68984d2ae99004 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 15 Jun 2011 16:21:19 -0700 Subject: EXP-872 FIX -- Hide inbox and outbox unless applicable EXP-893 FIX -- Single order purchases not sorted with most recent item delivered at top of list EXP-904 FIX -- Newness/Freshness value out of synch with new items in Inbox on next login when ordering in bulk with Inventory window open * Inbox and outbox can now be forced on by setting the debug variables "InventoryDisplayInbox" and "InventoryDisplayOutbox" * Inbox is only displayed when logging into a grid that has a marketplace that returns pup as a merchant * Inbox contents is now a forced download when the user logs in, rather than the typical lazy load of the rest of the inventory Reviewed by Leyla --- indra/newview/llsidepanelinventory.cpp | 131 ++++++++++++++------------------- 1 file changed, 57 insertions(+), 74 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 33d512d89e..d916c430a8 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -29,8 +29,10 @@ #include "llagent.h" #include "llappearancemgr.h" +#include "llappviewer.h" #include "llavataractions.h" #include "llbutton.h" +#include "llcurl.h" #include "lldate.h" #include "llfirstuse.h" #include "llfoldertype.h" @@ -47,7 +49,9 @@ #include "llselectmgr.h" #include "llsidepaneliteminfo.h" #include "llsidepaneltaskinfo.h" +#include "llstring.h" #include "lltabcontainer.h" +#include "llviewernetwork.h" #include "llweb.h" static LLRegisterPanelClassWrapper t_inventory("sidepanel_inventory"); @@ -71,47 +75,27 @@ static const char * const INVENTORY_LAYOUT_STACK_NAME = "inventory_layout_stack" // Helpers // -class LLInboxOutboxInventoryAddedObserver : public LLInventoryAddedObserver +class LLInventoryUserStatusResponder : public LLHTTPClient::Responder { public: - LLInboxOutboxInventoryAddedObserver(LLSidepanelInventory * sidepanelInventory) - : LLInventoryAddedObserver() + LLInventoryUserStatusResponder(LLSidepanelInventory * sidepanelInventory) + : LLCurl::Responder() , mSidepanelInventory(sidepanelInventory) - {} + { + } -protected: - virtual void done() + void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - uuid_vec_t::const_iterator it = mAdded.begin(); - uuid_vec_t::const_iterator it_end = mAdded.end(); - - for(; it != it_end; ++it) - { - LLInventoryObject* item = gInventory.getObject(*it); - - // NOTE: This doesn't actually work because folder creation does not trigger this observer - if (item && item->getType() == LLAssetType::AT_CATEGORY) - { - // Check for FolderType FT_INBOX or FT_OUTBOX and report back to mSidepanelInventory - LLInventoryCategory * item_cat = static_cast(item); - LLFolderType::EType folderType = item_cat->getPreferredType(); - - if (folderType == LLFolderType::FT_INBOX) - { - mSidepanelInventory->enableInbox(true); - } - else if (folderType == LLFolderType::FT_OUTBOX) - { - mSidepanelInventory->enableOutbox(true); - } - } - } + llinfos << "Marketplace Inbox Disabled" << llendl; + } - mAdded.clear(); + void result(const LLSD& content) + { + mSidepanelInventory->enableInbox(true); } private: - LLSidepanelInventory * mSidepanelInventory; + LLSidepanelInventory * mSidepanelInventory; }; // @@ -124,19 +108,12 @@ LLSidepanelInventory::LLSidepanelInventory() , mPanelMainInventory(NULL) , mInventoryFetched(false) , mCategoriesObserver(NULL) - , mInboxOutboxAddedObserver(NULL) { //buildFromFile( "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() } LLSidepanelInventory::~LLSidepanelInventory() { - if (mInboxOutboxAddedObserver && gInventory.containsObserver(mInboxOutboxAddedObserver)) - { - gInventory.removeObserver(mInboxOutboxAddedObserver); - } - delete mInboxOutboxAddedObserver; - if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) { gInventory.removeObserver(mCategoriesObserver); @@ -207,9 +184,6 @@ BOOL LLSidepanelInventory::postBuild() // Marketplace inbox/outbox setup { - LLButton * inbox_button = getChild(INBOX_BUTTON_NAME); - LLButton * outbox_button = getChild(OUTBOX_BUTTON_NAME); - LLLayoutStack* stack = getChild(INVENTORY_LAYOUT_STACK_NAME); LLLayoutPanel * inbox_panel = getChild(INBOX_LAYOUT_PANEL_NAME); @@ -217,61 +191,69 @@ BOOL LLSidepanelInventory::postBuild() stack->collapsePanel(inbox_panel, true); stack->collapsePanel(outbox_panel, true); + + // Disable user_resize on main inventory panel by default + stack->setPanelUserResize(MAIN_INVENTORY_LAYOUT_PANEL, false); + + LLButton * inbox_button = getChild(INBOX_BUTTON_NAME); + LLButton * outbox_button = getChild(OUTBOX_BUTTON_NAME); inbox_button->setToggleState(false); outbox_button->setToggleState(false); inbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this)); outbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleOutboxBtn, this)); - - // TODO: Hide inbox/outbox panels until we determine the status of the feature - //inbox_panel->setVisible(false); - //outbox_panel->setVisible(false); - - // Track added items - mInboxOutboxAddedObserver = new LLInboxOutboxInventoryAddedObserver(this); - gInventory.addObserver(mInboxOutboxAddedObserver); - // Track inbox and outbox folder changes - const bool do_not_create_folder = false; - const bool do_not_find_in_library = false; + // Set the inbox and outbox visible based on debug settings (final setting comes from http request below) + inbox_panel->setVisible(gSavedSettings.getBOOL("InventoryDisplayInbox")); + outbox_panel->setVisible(gSavedSettings.getBOOL("InventoryDisplayOutbox")); - const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, do_not_create_folder, do_not_find_in_library); - const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, do_not_create_folder, do_not_find_in_library); - - mCategoriesObserver = new LLInventoryCategoriesObserver(); - gInventory.addObserver(mCategoriesObserver); - - mCategoriesObserver->addCategory(inbox_id, boost::bind(&LLSidepanelInventory::onInboxChanged, this, inbox_id)); - mCategoriesObserver->addCategory(outbox_id, boost::bind(&LLSidepanelInventory::onOutboxChanged, this, outbox_id)); + // Trigger callback for after login so we can setup to track inbox and outbox changes after initial inventory load + LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::handleLoginComplete, this)); } return TRUE; } -void LLSidepanelInventory::draw() +void LLSidepanelInventory::handleLoginComplete() { - if (!mInventoryFetched && LLInventoryModelBackgroundFetch::instance().isEverythingFetched()) + // + // Hard coding this as a temporary way to determine whether or not to display the inbox + // + + std::string url = "https://marketplace.secondlife.com/"; + + if (!LLGridManager::getInstance()->isInProductionGrid()) { - mInventoryFetched = true; - - updateInboxOutboxPanels(); + std::string gridLabel = LLGridManager::getInstance()->getGridLabel(); + url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str()); } - LLPanel::draw(); -} + std::string url_suffix = "api/1/users/b72d31f8-d03c-4a3b-a002-3dd7b4a712b8/user_status"; + + LLHTTPClient::get(url + url_suffix, new LLInventoryUserStatusResponder(this)); + + // + // Track inbox and outbox folder changes + // -void LLSidepanelInventory::updateInboxOutboxPanels() -{ - // Iterate through gInventory looking for inbox and outbox const bool do_not_create_folder = false; const bool do_not_find_in_library = false; const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, do_not_create_folder, do_not_find_in_library); const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, do_not_create_folder, do_not_find_in_library); - enableInbox(inbox_id.notNull()); - enableOutbox(outbox_id.notNull()); + mCategoriesObserver = new LLInventoryCategoriesObserver(); + gInventory.addObserver(mCategoriesObserver); + + mCategoriesObserver->addCategory(inbox_id, boost::bind(&LLSidepanelInventory::onInboxChanged, this, inbox_id)); + mCategoriesObserver->addCategory(outbox_id, boost::bind(&LLSidepanelInventory::onOutboxChanged, this, outbox_id)); + + // + // Trigger a load for the entire contents of the Inbox + // + + LLInventoryModelBackgroundFetch::instance().start(inbox_id); } void LLSidepanelInventory::enableInbox(bool enabled) @@ -286,7 +268,8 @@ void LLSidepanelInventory::enableOutbox(bool enabled) void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id) { - // Perhaps use this to track inbox changes? + // Trigger a load of the entire inbox so we always know the contents and their creation dates for sorting + LLInventoryModelBackgroundFetch::instance().start(inbox_id); } void LLSidepanelInventory::onOutboxChanged(const LLUUID& outbox_id) -- cgit v1.2.3 From 0d246c0c5fc3ddef2022572b560eaec0018a722e Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 16 Jun 2011 17:14:51 -0700 Subject: EXP-872 PROGRESS -- Hide Inbox unless applicable EXP-910 FIX -- Newness badge shown on suitcase inventory icon when InventoryDisplayInbox is set to False EXP-895 FIX -- Selecting items in Marketplace Inbox does not change focus in inventory panel away from items selected in inventory panel * Main inventory, outbox and inbox all clear the selection of the others when they gain focus * The Fresh Item Count badge is no longer displayed on the inventory side tab button when the inbox is disabled * The New Item Count text is no longer displayed. (we will enable it again when freshness is supported) --- indra/newview/llsidepanelinventory.cpp | 37 ++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index d916c430a8..32394da042 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -32,10 +32,10 @@ #include "llappviewer.h" #include "llavataractions.h" #include "llbutton.h" -#include "llcurl.h" #include "lldate.h" #include "llfirstuse.h" #include "llfoldertype.h" +#include "llhttpclient.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" @@ -69,6 +69,9 @@ static const char * const INBOX_LAYOUT_PANEL_NAME = "inbox_layout_panel"; static const char * const OUTBOX_LAYOUT_PANEL_NAME = "outbox_layout_panel"; static const char * const MAIN_INVENTORY_LAYOUT_PANEL = "main_inventory_layout_panel"; +static const char * const INBOX_INVENTORY_PANEL = "inventory_inbox"; +static const char * const OUTBOX_INVENTORY_PANEL = "inventory_outbox"; + static const char * const INVENTORY_LAYOUT_STACK_NAME = "inventory_layout_stack"; // @@ -84,14 +87,23 @@ public: { } - void errorWithContent(U32 status, const std::string& reason, const LLSD& content) + void completed(U32 status, const std::string& reason, const LLSD& content) { - llinfos << "Marketplace Inbox Disabled" << llendl; - } - - void result(const LLSD& content) - { - mSidepanelInventory->enableInbox(true); + if (isGoodStatus(status)) + { + // Complete success + mSidepanelInventory->enableInbox(true); + } + else if (status == 401) + { + // API is available for use but OpenID authorization failed + mSidepanelInventory->enableInbox(true); + } + else + { + // API in unavailable + llinfos << "Marketplace API is unavailable -- Inbox Disabled" << llendl; + } } private: @@ -106,7 +118,8 @@ LLSidepanelInventory::LLSidepanelInventory() : LLPanel() , mItemPanel(NULL) , mPanelMainInventory(NULL) - , mInventoryFetched(false) + , mInboxEnabled(false) + , mOutboxEnabled(false) , mCategoriesObserver(NULL) { //buildFromFile( "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() @@ -205,8 +218,8 @@ BOOL LLSidepanelInventory::postBuild() outbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleOutboxBtn, this)); // Set the inbox and outbox visible based on debug settings (final setting comes from http request below) - inbox_panel->setVisible(gSavedSettings.getBOOL("InventoryDisplayInbox")); - outbox_panel->setVisible(gSavedSettings.getBOOL("InventoryDisplayOutbox")); + enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox")); + enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox")); // Trigger callback for after login so we can setup to track inbox and outbox changes after initial inventory load LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::handleLoginComplete, this)); @@ -258,11 +271,13 @@ void LLSidepanelInventory::handleLoginComplete() void LLSidepanelInventory::enableInbox(bool enabled) { + mInboxEnabled = enabled; getChild(INBOX_LAYOUT_PANEL_NAME)->setVisible(enabled); } void LLSidepanelInventory::enableOutbox(bool enabled) { + mOutboxEnabled = enabled; getChild(OUTBOX_LAYOUT_PANEL_NAME)->setVisible(enabled); } -- cgit v1.2.3 From 6215e6ba2542633afc5f8957817015f4bcf9f3cf Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 17 Jun 2011 13:22:13 -0700 Subject: EXP-872 PROGRESS -- Hide inbox unless applicable * Updated to use the current user's agent id instead of Pup's Reviewed by Leyla :) --- indra/newview/llsidepanelinventory.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 32394da042..787ebd29c2 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -241,10 +241,12 @@ void LLSidepanelInventory::handleLoginComplete() std::string gridLabel = LLGridManager::getInstance()->getGridLabel(); url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str()); } + + url += "api/1/users/"; + url += gAgent.getID().getString(); + url += "/user_status"; - std::string url_suffix = "api/1/users/b72d31f8-d03c-4a3b-a002-3dd7b4a712b8/user_status"; - - LLHTTPClient::get(url + url_suffix, new LLInventoryUserStatusResponder(this)); + LLHTTPClient::get(url, new LLInventoryUserStatusResponder(this)); // // Track inbox and outbox folder changes -- cgit v1.2.3 From 149b160a6d544824401348e8e97a64339815d8c1 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Mon, 20 Jun 2011 18:14:26 -0700 Subject: EXP-872 Hide inbox unless applicable --- indra/newview/llsidepanelinventory.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 787ebd29c2..864637d744 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -51,6 +51,7 @@ #include "llsidepaneltaskinfo.h" #include "llstring.h" #include "lltabcontainer.h" +#include "llviewermedia.h" #include "llviewernetwork.h" #include "llweb.h" @@ -245,8 +246,13 @@ void LLSidepanelInventory::handleLoginComplete() url += "api/1/users/"; url += gAgent.getID().getString(); url += "/user_status"; + + LLSD headers = LLSD::emptyMap(); + headers["Accept"] = "*/*"; + headers["Cookie"] = LLViewerMedia::getOpenIDCookie(); + headers["User-Agent"] = LLViewerMedia::getCurrentUserAgent(); - LLHTTPClient::get(url, new LLInventoryUserStatusResponder(this)); + LLHTTPClient::get(url, new LLInventoryUserStatusResponder(this), headers); // // Track inbox and outbox folder changes -- cgit v1.2.3 From e2f9276a083f5883e250b0edcc5c68273985be8b Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 21 Jun 2011 15:18:05 -0700 Subject: EXP-877 Profile button not active when selecting items in Marketplace inbox --- indra/newview/llsidepanelinventory.cpp | 80 ++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 32 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 864637d744..79d68de289 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -246,11 +246,11 @@ void LLSidepanelInventory::handleLoginComplete() url += "api/1/users/"; url += gAgent.getID().getString(); url += "/user_status"; - - LLSD headers = LLSD::emptyMap(); - headers["Accept"] = "*/*"; - headers["Cookie"] = LLViewerMedia::getOpenIDCookie(); - headers["User-Agent"] = LLViewerMedia::getCurrentUserAgent(); + + LLSD headers = LLSD::emptyMap(); + headers["Accept"] = "*/*"; + headers["Cookie"] = LLViewerMedia::getOpenIDCookie(); + headers["User-Agent"] = LLViewerMedia::getCurrentUserAgent(); LLHTTPClient::get(url, new LLInventoryUserStatusResponder(this), headers); @@ -423,22 +423,24 @@ void LLSidepanelInventory::performActionOnSelection(const std::string &action) LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem(); if (!current_item) { - return; + LLInventoryPanel* inbox = findChild("inventory_inbox"); + if (inbox) + { + current_item = inbox->getRootFolder()->getCurSelectedItem(); + if (!current_item) + { + return; + } + } } + current_item->getListener()->performAction(panel_main_inventory->getActivePanel()->getModel(), action); } void LLSidepanelInventory::onWearButtonClicked() { - LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild("panel_main_inventory"); - if (!panel_main_inventory) - { - llassert(panel_main_inventory != NULL); - return; - } - // Get selected items set. - const std::set selected_uuids_set = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(); + const std::set selected_uuids_set = LLAvatarActions::getInventorySelectedUUIDs(); if (selected_uuids_set.empty()) return; // nothing selected // Convert the set to a vector. @@ -574,34 +576,29 @@ void LLSidepanelInventory::updateVerbs() bool LLSidepanelInventory::canShare() { + bool can_share = false; + LLPanelMainInventory* panel_main_inventory = mInventoryPanel->findChild("panel_main_inventory"); - if (!panel_main_inventory) - { - llwarns << "Failed to get the main inventory panel" << llendl; - return false; - } + LLInventoryPanel* inbox = findChild("inventory_inbox"); - LLInventoryPanel* active_panel = panel_main_inventory->getActivePanel(); + return ( (panel_main_inventory ? LLAvatarActions::canShareSelectedItems(panel_main_inventory->getActivePanel()) : false) + || (inbox ? LLAvatarActions::canShareSelectedItems(inbox) : false) ); + // Avoid flicker in the Recent tab while inventory is being loaded. - if (!active_panel->getRootFolder()->hasVisibleChildren()) return false; - - return LLAvatarActions::canShareSelectedItems(active_panel); + //if (!active_panel->getRootFolder()->hasVisibleChildren()) return false; } + bool LLSidepanelInventory::canWearSelected() { - LLPanelMainInventory* panel_main_inventory = - mInventoryPanel->findChild("panel_main_inventory"); - if (!panel_main_inventory) - { - llassert(panel_main_inventory != NULL); + std::set selected_uuids = LLAvatarActions::getInventorySelectedUUIDs(); + + if (selected_uuids.empty()) return false; - } - std::set selected_uuids = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(); for (std::set::const_iterator it = selected_uuids.begin(); it != selected_uuids.end(); ++it) @@ -618,7 +615,15 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem() LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem(); if (!current_item) { - return NULL; + LLInventoryPanel* inbox = findChild("inventory_inbox"); + if (inbox) + { + current_item = inbox->getRootFolder()->getCurSelectedItem(); + if (!current_item) + { + return NULL; + } + } } const LLUUID &item_id = current_item->getListener()->getUUID(); LLInventoryItem *item = gInventory.getItem(item_id); @@ -627,9 +632,20 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem() U32 LLSidepanelInventory::getSelectedCount() { + int count = 0; + LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild("panel_main_inventory"); std::set selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(); - return selection_list.size(); + count += selection_list.size(); + + LLInventoryPanel* inbox = findChild("inventory_inbox"); + if (inbox) + { + selection_list = inbox->getRootFolder()->getSelectionList(); + count += selection_list.size(); + } + + return count; } LLInventoryPanel *LLSidepanelInventory::getActivePanel() -- cgit v1.2.3 From 57017a7a6e65c885b6124849fd5da3eae68717f8 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 22 Jun 2011 14:26:15 -0400 Subject: EXP-920 FIX -- Received Items panel is not opened if closed when a new Direct Delivery items is delivered when user has Inventory panel open * Mac build fix by removing an unused variable * Inbox panel now auto-expands when new item delivered Reviewed by Richard --- indra/newview/llsidepanelinventory.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 79d68de289..1182e5db34 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -75,6 +75,8 @@ static const char * const OUTBOX_INVENTORY_PANEL = "inventory_outbox"; static const char * const INVENTORY_LAYOUT_STACK_NAME = "inventory_layout_stack"; +static const char * const MARKETPLACE_INBOX_PANEL = "marketplace_inbox"; + // // Helpers // @@ -293,6 +295,14 @@ void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id) { // Trigger a load of the entire inbox so we always know the contents and their creation dates for sorting LLInventoryModelBackgroundFetch::instance().start(inbox_id); + + // Expand the inbox since we have fresh items + LLPanelMarketplaceInbox * inbox = getChild(MARKETPLACE_INBOX_PANEL); + if (inbox && (inbox->getFreshItemCount() > 0)) + { + getChild(INBOX_BUTTON_NAME)->setToggleState(true); + onToggleInboxBtn(); + } } void LLSidepanelInventory::onOutboxChanged(const LLUUID& outbox_id) @@ -367,7 +377,7 @@ void LLSidepanelInventory::onOpen(const LLSD& key) LLFirstUse::newInventory(false); // Expand the inbox if we have fresh items - LLPanelMarketplaceInbox * inbox = getChild("marketplace_inbox"); + LLPanelMarketplaceInbox * inbox = getChild(MARKETPLACE_INBOX_PANEL); if (inbox && (inbox->getFreshItemCount() > 0)) { getChild(INBOX_BUTTON_NAME)->setToggleState(true); @@ -576,8 +586,6 @@ void LLSidepanelInventory::updateVerbs() bool LLSidepanelInventory::canShare() { - bool can_share = false; - LLPanelMainInventory* panel_main_inventory = mInventoryPanel->findChild("panel_main_inventory"); -- cgit v1.2.3 From 5999574c106d0d2566d191c754f6a630d8407787 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 22 Jun 2011 16:12:01 -0700 Subject: making it so that inbox shows up quicker --- indra/newview/llsidepanelinventory.cpp | 64 +++++----------------------------- 1 file changed, 9 insertions(+), 55 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 79d68de289..19c8ee0123 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -52,7 +52,6 @@ #include "llstring.h" #include "lltabcontainer.h" #include "llviewermedia.h" -#include "llviewernetwork.h" #include "llweb.h" static LLRegisterPanelClassWrapper t_inventory("sidepanel_inventory"); @@ -79,37 +78,6 @@ static const char * const INVENTORY_LAYOUT_STACK_NAME = "inventory_layout_stack" // Helpers // -class LLInventoryUserStatusResponder : public LLHTTPClient::Responder -{ -public: - LLInventoryUserStatusResponder(LLSidepanelInventory * sidepanelInventory) - : LLCurl::Responder() - , mSidepanelInventory(sidepanelInventory) - { - } - - void completed(U32 status, const std::string& reason, const LLSD& content) - { - if (isGoodStatus(status)) - { - // Complete success - mSidepanelInventory->enableInbox(true); - } - else if (status == 401) - { - // API is available for use but OpenID authorization failed - mSidepanelInventory->enableInbox(true); - } - else - { - // API in unavailable - llinfos << "Marketplace API is unavailable -- Inbox Disabled" << llendl; - } - } - -private: - LLSidepanelInventory * mSidepanelInventory; -}; // // Implementation @@ -135,6 +103,13 @@ LLSidepanelInventory::~LLSidepanelInventory() delete mCategoriesObserver; } +void handleInventoryDisplayInboxChanged() +{ + LLSidepanelInventory* sidepanel_inventory = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + + sidepanel_inventory->enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox")); +} + BOOL LLSidepanelInventory::postBuild() { // UI elements from inventory panel @@ -226,34 +201,13 @@ BOOL LLSidepanelInventory::postBuild() LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::handleLoginComplete, this)); } + gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged)); + return TRUE; } void LLSidepanelInventory::handleLoginComplete() { - // - // Hard coding this as a temporary way to determine whether or not to display the inbox - // - - std::string url = "https://marketplace.secondlife.com/"; - - if (!LLGridManager::getInstance()->isInProductionGrid()) - { - std::string gridLabel = LLGridManager::getInstance()->getGridLabel(); - url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str()); - } - - url += "api/1/users/"; - url += gAgent.getID().getString(); - url += "/user_status"; - - LLSD headers = LLSD::emptyMap(); - headers["Accept"] = "*/*"; - headers["Cookie"] = LLViewerMedia::getOpenIDCookie(); - headers["User-Agent"] = LLViewerMedia::getCurrentUserAgent(); - - LLHTTPClient::get(url, new LLInventoryUserStatusResponder(this), headers); - // // Track inbox and outbox folder changes // -- cgit v1.2.3