diff options
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.h | 1 | ||||
-rw-r--r-- | indra/newview/llpanelmarketplaceinbox.cpp | 43 | ||||
-rw-r--r-- | indra/newview/llsidepanelinventory.cpp | 43 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/sidepanel_inventory.xml | 1 |
5 files changed, 67 insertions, 33 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 3666c51c82..0af6451108 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -150,7 +150,10 @@ void LLInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params) { // Determine the root folder in case specified, and // build the views starting with that folder. - const LLFolderType::EType preferred_type = LLViewerFolderType::lookupTypeFromNewCategoryName(params.start_folder); + + std::string start_folder_name(params.start_folder()); + + const LLFolderType::EType preferred_type = LLViewerFolderType::lookupTypeFromNewCategoryName(start_folder_name); LLUUID root_id; @@ -164,6 +167,12 @@ void LLInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params) ? gInventory.findCategoryUUIDForType(preferred_type, false, false) : LLUUID::null; } + + if ((root_id == LLUUID::null) && !start_folder_name.empty()) + { + llwarns << "No category found that matches start_folder: " << start_folder_name << llendl; + root_id = LLUUID::generateNewID(); + } LLRect folder_rect(0, 0, @@ -184,7 +193,6 @@ void LLInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params) p.use_label_suffix = params.use_label_suffix; p.allow_multiselect = mAllowMultiSelect; mFolderRoot = LLUICtrlFactory::create<LLFolderView>(p); - } void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 864c403397..4b915484f8 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -226,7 +226,6 @@ private: BOOL mViewsInitialized; // Views have been generated // UUID of category from which hierarchy should be built. Set with the // "start_folder" xml property. Default is LLUUID::null that means total Inventory hierarchy. - std::string mStartFolderString; LLUUID mStartFolderID; }; diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 14c4c46fe7..1f3fbb40b4 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -59,7 +59,7 @@ LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() BOOL LLPanelMarketplaceInbox::postBuild()
{
mInventoryPanel = getChild<LLInventoryPanel>("inventory_inbox");
-
+
mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE);
LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this));
@@ -67,7 +67,10 @@ BOOL LLPanelMarketplaceInbox::postBuild() LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this));
mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this));
-
+
+ // Set up the note to display when the inbox is empty
+ mInventoryPanel->getFilter()->setEmptyLookupMessage("InboxNoItems");
+
return TRUE;
}
@@ -116,6 +119,12 @@ BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dr U32 LLPanelMarketplaceInbox::getFreshItemCount() const
{
#if SUPPORTING_FRESH_ITEM_COUNT
+
+ //
+ // NOTE: When turning this on, be sure to test the no inbox/outbox case because this code probably
+ // will return "2" for the Inventory and LIBRARY top-levels when that happens.
+ //
+
U32 fresh_item_count = 0;
LLFolderView * root_folder = mInventoryPanel->getRootFolder();
@@ -143,23 +152,27 @@ U32 LLPanelMarketplaceInbox::getFreshItemCount() const U32 LLPanelMarketplaceInbox::getTotalItemCount() const
{
+ U32 item_count = 0;
+
LLInventoryModel* model = mInventoryPanel->getModel();
+ const LLUUID inbox_id = model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false);
+
+ if (!inbox_id.isNull())
+ {
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
- LLInventoryModel::cat_array_t* cats;
- LLInventoryModel::item_array_t* items;
-
- model->getDirectDescendentsOf(model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false), cats, items);
-
- U32 item_count = 0;
+ model->getDirectDescendentsOf(inbox_id, cats, items);
- if (cats)
- {
- item_count += cats->size();
- }
+ if (cats)
+ {
+ item_count += cats->size();
+ }
- if (items)
- {
- item_count += items->size();
+ if (items)
+ {
+ item_count += items->size();
+ }
}
return item_count;
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index f9e029be19..f769612f3f 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -67,7 +67,7 @@ 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 MAIN_INVENTORY_LAYOUT_PANEL_NAME = "main_inventory_layout_panel"; static const char * const INBOX_INVENTORY_PANEL = "inventory_inbox"; static const char * const OUTBOX_INVENTORY_PANEL = "inventory_outbox"; @@ -177,15 +177,16 @@ BOOL LLSidepanelInventory::postBuild() { LLLayoutStack* stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME); - LLLayoutPanel * inbox_panel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME); - LLLayoutPanel * outbox_panel = getChild<LLLayoutPanel>(OUTBOX_LAYOUT_PANEL_NAME); - - 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); + stack->setPanelUserResize(MAIN_INVENTORY_LAYOUT_PANEL_NAME, false); + stack->setPanelUserResize(INBOX_LAYOUT_PANEL_NAME, false); + stack->setPanelUserResize(OUTBOX_LAYOUT_PANEL_NAME, false); + // Collapse both inbox and outbox panels + stack->collapsePanel(getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME), true); + stack->collapsePanel(getChild<LLLayoutPanel>(OUTBOX_LAYOUT_PANEL_NAME), true); + + // Set up button states and callbacks LLButton * inbox_button = getChild<LLButton>(INBOX_BUTTON_NAME); LLButton * outbox_button = getChild<LLButton>(OUTBOX_BUTTON_NAME); @@ -219,18 +220,30 @@ void LLSidepanelInventory::handleLoginComplete() 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); + + if (inbox_id.isNull() && outbox_id.isNull()) + { + return; + } 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)); + if (!outbox_id.isNull()) + { + mCategoriesObserver->addCategory(outbox_id, boost::bind(&LLSidepanelInventory::onOutboxChanged, this, outbox_id)); + } + + if (!inbox_id.isNull()) + { + mCategoriesObserver->addCategory(inbox_id, boost::bind(&LLSidepanelInventory::onInboxChanged, this, inbox_id)); - // - // Trigger a load for the entire contents of the Inbox - // + // + // Trigger a load for the entire contents of the Inbox + // - LLInventoryModelBackgroundFetch::instance().start(inbox_id); + LLInventoryModelBackgroundFetch::instance().start(inbox_id); + } } void LLSidepanelInventory::enableInbox(bool enabled) @@ -293,7 +306,7 @@ bool manageInboxOutboxPanels(LLLayoutStack * stack, stack->collapsePanel(pressedPanel, !expand); // Enable user_resize on main inventory panel only when a marketplace box is expanded - stack->setPanelUserResize(MAIN_INVENTORY_LAYOUT_PANEL, expand); + stack->setPanelUserResize(MAIN_INVENTORY_LAYOUT_PANEL_NAME, expand); return expand; } diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index 00f3135035..778daac83b 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -69,6 +69,7 @@ width="330"> <string name="InboxLabelWithArg">Received Items ([NUM])</string> <string name="InboxLabelNoArg">Received Items</string> + <string name="InboxNoItems">Items purchased through the marketplace will be delivered here.</string> <button label="Received Items" name="inbox_btn" |