diff options
20 files changed, 461 insertions, 137 deletions
| diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index 6046188c1e..f9b47e29ee 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -547,6 +547,7 @@ public:  	folders_t::const_iterator getFoldersBegin() const { return mFolders.begin(); }  	folders_t::const_iterator getFoldersEnd() const { return mFolders.end(); } +	folders_t::size_type getFoldersCount() const { return mFolders.size(); }  };  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 6bf19e346d..ceba4a0191 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -601,6 +601,34 @@ void LLInventoryAddedObserver::changed(U32 mask)  	}  } +void LLInventoryCategoryAddedObserver::changed(U32 mask) +{ +	if (!(mask & LLInventoryObserver::ADD)) +	{ +		return; +	} +	 +	const LLInventoryModel::changed_items_t& changed_ids = gInventory.getChangedIDs(); +	 +	for (LLInventoryModel::changed_items_t::const_iterator cit = changed_ids.begin(); cit != changed_ids.end(); ++cit) +	{ +		LLViewerInventoryCategory* cat = gInventory.getCategory(*cit); +		 +		if (cat) +		{ +			mAddedCategories.push_back(cat); +		} +	} +	 +	if (!mAddedCategories.empty()) +	{ +		done(); +		 +		mAddedCategories.clear(); +	} +} + +  LLInventoryTransactionObserver::LLInventoryTransactionObserver(const LLTransactionID& transaction_id) :  	mTransactionID(transaction_id)  { diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 2d9021961e..aa1eae84d7 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -219,6 +219,28 @@ protected:  };  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLInventoryCategoryAddedObserver +// +//   Base class for doing something when a new category is created in the +//   inventory. +//   It does not watch for a certain UUID, rather it acts when anything is added +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLInventoryCategoryAddedObserver : public LLInventoryObserver +{ +public: +	 +	typedef std::vector<LLViewerInventoryCategory*>	cat_vec_t; +	 +	LLInventoryCategoryAddedObserver() : mAddedCategories() {} +	/*virtual*/ void changed(U32 mask); +	 +protected: +	virtual void done() = 0; +	 +	cat_vec_t	mAddedCategories; +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  // Class LLInventoryTransactionObserver  //  //   Base class for doing something when an inventory transaction completes. diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 834da49c61..864e6a181e 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -161,6 +161,49 @@ void LLInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params)  	{  		root_id = gInventory.getLibraryRootFolderID();  	} +	// leslie -- temporary HACK to work around sim not creating inbox and outbox with proper system folder type +	else if (preferred_type == LLFolderType::FT_INBOX) +	{ +		LLInventoryModel::cat_array_t* cats; +		LLInventoryModel::item_array_t* items; +		 +		gInventory.getDirectDescendentsOf(gInventory.getRootFolderID(), cats, items); +		 +		if (cats) +		{ +			for (LLInventoryModel::cat_array_t::const_iterator cat_it = cats->begin(); cat_it != cats->end(); ++cat_it) +			{ +				LLInventoryCategory* cat = *cat_it; +				 +				if (cat->getName() == "Received Items") +				{ +					root_id = cat->getUUID(); +				} +			} +		} +	} +	// leslie -- temporary HACK to work around sim not creating inbox and outbox with proper system folder type +	else if (preferred_type == LLFolderType::FT_OUTBOX) +	{ +		LLInventoryModel::cat_array_t* cats; +		LLInventoryModel::item_array_t* items; +		 +		gInventory.getDirectDescendentsOf(gInventory.getRootFolderID(), cats, items); +		 +		if (cats) +		{ +			for (LLInventoryModel::cat_array_t::const_iterator cat_it = cats->begin(); cat_it != cats->end(); ++cat_it) +			{ +				LLInventoryCategory* cat = *cat_it; +				 +				if (cat->getName() == "Merchant Outbox") +				{ +					root_id = cat->getUUID(); +				} +			} +		} +	} +	// leslie -- end temporary HACK  	else  	{  		root_id = (preferred_type != LLFolderType::FT_NONE) diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index f39fbfc498..1920cc2940 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -95,8 +95,8 @@ private:  /// LLPanelMainInventory  ///---------------------------------------------------------------------------- -LLPanelMainInventory::LLPanelMainInventory() -	: LLPanel(), +LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p) +	: LLPanel(p),  	  mActivePanel(NULL),  	  mSavedFolderState(NULL),  	  mFilterText(""), diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 86b2c87e0b..899931aa89 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -57,7 +57,7 @@ class LLPanelMainInventory : public LLPanel, LLInventoryObserver  public:  	friend class LLFloaterInventoryFinder; -	LLPanelMainInventory(); +	LLPanelMainInventory(const LLPanel::Params& p = getDefaultParams());  	~LLPanelMainInventory();  	BOOL postBuild(); diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 2b04987084..4e7e72a469 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -58,18 +58,9 @@ LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox()  // virtual
  BOOL LLPanelMarketplaceInbox::postBuild()
  {
 -	mInventoryPanel = getChild<LLInventoryPanel>("inventory_inbox");
 -	
 -	mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE);
 -
  	LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this));
  	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;
  }
 @@ -88,6 +79,31 @@ void LLPanelMarketplaceInbox::handleLoginComplete()  	LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this);
  }
 +void LLPanelMarketplaceInbox::setupInventoryPanel()
 +{
 +	LLView * inbox_inventory_placeholder = getChild<LLView>("inbox_inventory_placeholder");
 +	LLView * inbox_inventory_parent = inbox_inventory_placeholder->getParent();
 +
 +	mInventoryPanel = 
 +		LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_inbox_inventory.xml",
 +														  inbox_inventory_parent,
 +														  LLInventoryPanel::child_registry_t::instance());
 +	
 +	// Reshape the inventory to the proper size
 +	LLRect inventory_placeholder_rect = inbox_inventory_placeholder->getRect();
 +	mInventoryPanel->setShape(inventory_placeholder_rect);
 +	
 +	// Set the sort order newest to oldest, and a selection change callback
 +	mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE);	
 +	mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this));
 +
 +	// Set up the note to display when the inbox is empty
 +	mInventoryPanel->getFilter()->setEmptyLookupMessage("InventoryInboxNoItems");
 +	
 +	// Hide the placeholder text
 +	inbox_inventory_placeholder->setVisible(FALSE);
 +}
 +
  void LLPanelMarketplaceInbox::onFocusReceived()
  {
  	LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel<LLSidepanelInventory>("sidepanel_inventory");
 @@ -107,9 +123,9 @@ void LLPanelMarketplaceInbox::onFocusReceived()  		{
  			outbox_panel->clearSelection();
  		}
 +		
 +		sidepanel_inventory->updateVerbs();
  	}
 -
 -	sidepanel_inventory->updateVerbs();
  }
  BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg)
 @@ -129,20 +145,25 @@ U32 LLPanelMarketplaceInbox::getFreshItemCount() const  	U32 fresh_item_count = 0;
 -	LLFolderView * root_folder = mInventoryPanel->getRootFolder();
 -
 -	const LLFolderViewFolder * inbox_folder = *(root_folder->getFoldersBegin());
 -
 -	LLFolderViewFolder::folders_t::const_iterator folders_it = inbox_folder->getFoldersBegin();
 -	LLFolderViewFolder::folders_t::const_iterator folders_end = inbox_folder->getFoldersEnd();
 -
 -	for (; folders_it != folders_end; ++folders_it)
 +	if (mInventoryPanel)
  	{
 -		const LLFolderViewFolder * folder = *folders_it;
 -
 -		if (folder->getCreationDate() > 1500)
 +		const LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder();
 +		
 +		if (inbox_folder)
  		{
 -			fresh_item_count++;
 +			LLFolderViewFolder::folders_t::const_iterator folders_it = inbox_folder->getFoldersBegin();
 +			LLFolderViewFolder::folders_t::const_iterator folders_end = inbox_folder->getFoldersEnd();
 +
 +			for (; folders_it != folders_end; ++folders_it)
 +			{
 +				const LLFolderViewFolder * folder = *folders_it;
 +
 +				// TODO: Replace this check with new "fresh" flag
 +				if (folder->getCreationDate() > 1500)
 +				{
 +					fresh_item_count++;
 +				}
 +			}
  		}
  	}
 @@ -156,27 +177,16 @@ 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())
 +	if (mInventoryPanel)
  	{
 -		LLInventoryModel::cat_array_t* cats;
 -		LLInventoryModel::item_array_t* items;
 -
 -		model->getDirectDescendentsOf(inbox_id, cats, items);
 -
 -		if (cats)
 -		{
 -			item_count += cats->size();
 -		}
 -
 -		if (items)
 +		const LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder();
 +		
 +		if (inbox_folder)
  		{
 -			item_count += items->size();
 +			item_count += inbox_folder->getFoldersCount();
  		}
  	}
 -
 +	
  	return item_count;
  }
 diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h index b176d57d3f..4ecea29304 100644 --- a/indra/newview/llpanelmarketplaceinbox.h +++ b/indra/newview/llpanelmarketplaceinbox.h @@ -54,6 +54,8 @@ public:  	/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg);  	/*virtual*/ void draw(); +	 +	void setupInventoryPanel();  	U32 getFreshItemCount() const;  	U32 getTotalItemCount() const; diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp index c8752b3e0f..74d0de3b30 100644 --- a/indra/newview/llpanelmarketplaceoutbox.cpp +++ b/indra/newview/llpanelmarketplaceoutbox.cpp @@ -28,6 +28,7 @@  #include "llpanelmarketplaceoutbox.h" +#include "llappviewer.h"  #include "llbutton.h"  #include "llcoros.h"  #include "lleventcoro.h" @@ -41,9 +42,15 @@  static LLRegisterPanelClassWrapper<LLPanelMarketplaceOutbox> t_panel_marketplace_outbox("panel_marketplace_outbox"); +const LLPanelMarketplaceOutbox::Params& LLPanelMarketplaceOutbox::getDefaultParams()  +{  +	return LLUICtrlFactory::getDefaultParams<LLPanelMarketplaceOutbox>();  +} +  // protected -LLPanelMarketplaceOutbox::LLPanelMarketplaceOutbox() -	: LLPanel() +LLPanelMarketplaceOutbox::LLPanelMarketplaceOutbox(const Params& p) +	: LLPanel(p) +	, mInventoryPanel(NULL)  	, mSyncButton(NULL)  	, mSyncIndicator(NULL)  	, mSyncInProgress(false) @@ -57,18 +64,22 @@ LLPanelMarketplaceOutbox::~LLPanelMarketplaceOutbox()  // virtual  BOOL LLPanelMarketplaceOutbox::postBuild()  { -	mSyncButton = getChild<LLButton>("outbox_sync_btn"); -	mSyncButton->setCommitCallback(boost::bind(&LLPanelMarketplaceOutbox::onSyncButtonClicked, this)); - -	mSyncIndicator = getChild<LLLoadingIndicator>("outbox_sync_indicator"); - -	mSyncButton->setEnabled(!isOutboxEmpty()); - +	LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceOutbox::handleLoginComplete, this)); +	  	LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceOutbox::onFocusReceived, this));  	return TRUE;  } +void LLPanelMarketplaceOutbox::handleLoginComplete() +{ +	mSyncButton = getChild<LLButton>("outbox_sync_btn"); +	mSyncButton->setCommitCallback(boost::bind(&LLPanelMarketplaceOutbox::onSyncButtonClicked, this)); +	mSyncButton->setEnabled(!isOutboxEmpty()); +	 +	mSyncIndicator = getChild<LLLoadingIndicator>("outbox_sync_indicator"); +} +  void LLPanelMarketplaceOutbox::onFocusReceived()  {  	LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel<LLSidepanelInventory>("sidepanel_inventory"); @@ -88,9 +99,43 @@ void LLPanelMarketplaceOutbox::onFocusReceived()  		{  			inbox_panel->clearSelection();  		} +		 +		sidepanel_inventory->updateVerbs();  	}  } +void LLPanelMarketplaceOutbox::onSelectionChange() +{ +	LLSidepanelInventory* sidepanel_inventory = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); +	 +	sidepanel_inventory->updateVerbs(); +} + +void LLPanelMarketplaceOutbox::setupInventoryPanel() +{ +	LLView * outbox_inventory_placeholder = getChild<LLView>("outbox_inventory_placeholder"); +	LLView * outbox_inventory_parent = outbox_inventory_placeholder->getParent(); +	 +	mInventoryPanel =  +		LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_outbox_inventory.xml", +														  outbox_inventory_parent, +														  LLInventoryPanel::child_registry_t::instance()); +	 +	// Reshape the inventory to the proper size +	LLRect inventory_placeholder_rect = outbox_inventory_placeholder->getRect(); +	mInventoryPanel->setShape(inventory_placeholder_rect); +	 +	// Set the sort order newest to oldest, and a selection change callback +	mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE);	 +	mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceOutbox::onSelectionChange, this)); +	 +	// Set up the note to display when the outbox is empty +	mInventoryPanel->getFilter()->setEmptyLookupMessage("InventoryOutboxNoItems"); +	 +	// Hide the placeholder text +	outbox_inventory_placeholder->setVisible(FALSE); +} +  bool LLPanelMarketplaceOutbox::isOutboxEmpty() const  {  	// TODO: Check for contents of outbox diff --git a/indra/newview/llpanelmarketplaceoutbox.h b/indra/newview/llpanelmarketplaceoutbox.h index 94bc066224..1b502127ef 100644 --- a/indra/newview/llpanelmarketplaceoutbox.h +++ b/indra/newview/llpanelmarketplaceoutbox.h @@ -31,20 +31,31 @@  class LLButton; +class LLInventoryPanel;  class LLLoadingIndicator;  class LLPanelMarketplaceOutbox : public LLPanel  {  public: - +	 +	struct Params :	public LLInitParam::Block<Params, LLPanel::Params> +	{ +		Params() {} +	}; +	  	LOG_CLASS(LLPanelMarketplaceOutbox); -	LLPanelMarketplaceOutbox(); +	// RN: for some reason you can't just use LLUICtrlFactory::getDefaultParams as a default argument in VC8 +	static const LLPanelMarketplaceOutbox::Params& getDefaultParams(); +	 +	LLPanelMarketplaceOutbox(const Params& p = getDefaultParams());  	~LLPanelMarketplaceOutbox();  	/*virtual*/ BOOL postBuild(); +	void setupInventoryPanel(); +  	bool isOutboxEmpty() const;  	bool isSyncInProgress() const; @@ -54,9 +65,13 @@ protected:  	void onSyncButtonClicked();  	void updateSyncButtonStatus(); +	void handleLoginComplete();  	void onFocusReceived(); +	void onSelectionChange();  private: +	LLInventoryPanel *		mInventoryPanel; +  	LLButton *				mSyncButton;  	LLLoadingIndicator *	mSyncIndicator;  	bool					mSyncInProgress; diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index caadefeaf3..fc049f1854 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -46,6 +46,7 @@  #include "lloutfitobserver.h"  #include "llpanelmaininventory.h"  #include "llpanelmarketplaceinbox.h" +#include "llpanelmarketplaceoutbox.h"  #include "llselectmgr.h"  #include "llsidepaneliteminfo.h"  #include "llsidepaneltaskinfo.h" @@ -75,11 +76,56 @@ 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"; +static const char * const MARKETPLACE_OUTBOX_PANEL = "marketplace_outbox";  //  // Helpers  // +class LLInboxOutboxAddedObserver : public LLInventoryCategoryAddedObserver +{ +public: +	LLInboxOutboxAddedObserver(LLSidepanelInventory * sidepanelInventory) +		: LLInventoryCategoryAddedObserver() +		, mSidepanelInventory(sidepanelInventory) +	{ +	} +	 +	void done() +	{ +		for (cat_vec_t::iterator it = mAddedCategories.begin(); it != mAddedCategories.end(); ++it) +		{ +			LLViewerInventoryCategory* added_category = *it; +			 +			LLFolderType::EType added_category_type = added_category->getPreferredType(); +			 +			switch (added_category_type) +			{ +				case LLFolderType::FT_INBOX: +					mSidepanelInventory->observeInboxModifications(added_category->getUUID()); +					break; +				case LLFolderType::FT_OUTBOX: +					mSidepanelInventory->observeOutboxModifications(added_category->getUUID()); +					break; +				case LLFolderType::FT_NONE: +					// HACK until sim update to properly create folder with system type +					if (added_category->getName() == "Received Items") +					{ +						mSidepanelInventory->observeInboxModifications(added_category->getUUID()); +					} +					else if (added_category->getName() == "Merchant Outbox") +					{ +						mSidepanelInventory->observeOutboxModifications(added_category->getUUID()); +					} +				default: +					break; +			} +		} +	} +	 +private: +	LLSidepanelInventory * mSidepanelInventory; +};  //  // Implementation @@ -92,6 +138,7 @@ LLSidepanelInventory::LLSidepanelInventory()  	, mInboxEnabled(false)  	, mOutboxEnabled(false)  	, mCategoriesObserver(NULL) +	, mInboxOutboxAddedObserver(NULL)  {  	//buildFromFile( "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()  } @@ -103,6 +150,12 @@ LLSidepanelInventory::~LLSidepanelInventory()  		gInventory.removeObserver(mCategoriesObserver);  	}  	delete mCategoriesObserver; +	 +	if (mInboxOutboxAddedObserver && gInventory.containsObserver(mInboxOutboxAddedObserver)) +	{ +		gInventory.removeObserver(mInboxOutboxAddedObserver); +	} +	delete mInboxOutboxAddedObserver;  }  void handleInventoryDisplayInboxChanged() @@ -139,7 +192,7 @@ BOOL LLSidepanelInventory::postBuild()  		mOverflowBtn = mInventoryPanel->getChild<LLButton>("overflow_btn");  		mOverflowBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onOverflowButtonClicked, this)); -		mPanelMainInventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); +		mPanelMainInventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");  		mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2));  		LLTabContainer* tabs = mPanelMainInventory->getChild<LLTabContainer>("inventory filter tabs");  		tabs->setCommitCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this)); @@ -157,7 +210,7 @@ BOOL LLSidepanelInventory::postBuild()  	// UI elements from item panel  	{ -		mItemPanel = findChild<LLSidepanelItemInfo>("sidepanel__item_panel"); +		mItemPanel = getChild<LLSidepanelItemInfo>("sidepanel__item_panel");  		LLButton* back_btn = mItemPanel->getChild<LLButton>("back_btn");  		back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this)); @@ -221,29 +274,100 @@ 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()) +	// Set up observer to listen for creation of inbox and outbox if at least one of them doesn't exist +	if (inbox_id.isNull() || outbox_id.isNull())  	{ -		return; +		observeInboxOutboxCreation();  	} -	mCategoriesObserver = new LLInventoryCategoriesObserver(); -	gInventory.addObserver(mCategoriesObserver); - +	// Set up observer for inbox changes, if we have an inbox already +	if (!inbox_id.isNull()) +	{ +		observeInboxModifications(inbox_id); +	} +	 +	// Set up observer for outbox changes, if we have an outbox already  	if (!outbox_id.isNull())  	{ -		mCategoriesObserver->addCategory(outbox_id, boost::bind(&LLSidepanelInventory::onOutboxChanged, this, outbox_id)); +		observeOutboxModifications(outbox_id);  	} +} + +void LLSidepanelInventory::observeInboxOutboxCreation() +{ +	// +	// Set up observer to track inbox and outbox folder creation +	// -	if (!inbox_id.isNull()) +	if (mInboxOutboxAddedObserver == NULL) +	{ +		mInboxOutboxAddedObserver = new LLInboxOutboxAddedObserver(this); +		 +		gInventory.addObserver(mInboxOutboxAddedObserver); +	} +} + +void LLSidepanelInventory::observeInboxModifications(const LLUUID& inboxID) +{ +	// +	// Track inbox and outbox folder changes +	// +	 +	if (inboxID.isNull()) +	{ +		llwarns << "Attempting to track modifications to non-existant inbox" << llendl; +		return; +	} +	 +	if (mCategoriesObserver == NULL)  	{ -		mCategoriesObserver->addCategory(inbox_id, boost::bind(&LLSidepanelInventory::onInboxChanged, this, inbox_id)); +		mCategoriesObserver = new LLInventoryCategoriesObserver(); +		gInventory.addObserver(mCategoriesObserver); +	} +	 +	mCategoriesObserver->addCategory(inboxID, boost::bind(&LLSidepanelInventory::onInboxChanged, this, inboxID)); +	 +	// +	// Trigger a load for the entire contents of the Inbox +	// +	 +	LLInventoryModelBackgroundFetch::instance().start(inboxID); +	 +	// +	// Set up the inbox inventory view +	// +	 +	LLPanelMarketplaceInbox * inbox = getChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL); +	inbox->setupInventoryPanel(); +} -		// -		// Trigger a load for the entire contents of the Inbox -		// -		LLInventoryModelBackgroundFetch::instance().start(inbox_id); +void LLSidepanelInventory::observeOutboxModifications(const LLUUID& outboxID) +{ +	// +	// Track outbox folder changes +	// +	 +	if (outboxID.isNull()) +	{ +		llwarns << "Attempting to track modifications to non-existant outbox" << llendl; +		return;  	} +	 +	if (mCategoriesObserver == NULL) +	{ +		mCategoriesObserver = new LLInventoryCategoriesObserver(); +		gInventory.addObserver(mCategoriesObserver); +	} +	 +	mCategoriesObserver->addCategory(outboxID, boost::bind(&LLSidepanelInventory::onOutboxChanged, this, outboxID)); +	 +	// +	// Set up the outbox inventory view +	// +	 +	LLPanelMarketplaceOutbox * outbox = getChild<LLPanelMarketplaceOutbox>(MARKETPLACE_OUTBOX_PANEL); +	outbox->setupInventoryPanel();  }  void LLSidepanelInventory::enableInbox(bool enabled) @@ -264,7 +388,7 @@ void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id)  	LLInventoryModelBackgroundFetch::instance().start(inbox_id);  	// Expand the inbox since we have fresh items -	LLPanelMarketplaceInbox * inbox = getChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL); +	LLPanelMarketplaceInbox * inbox = findChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);  	if (inbox && (inbox->getFreshItemCount() > 0))  	{  		getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true); @@ -344,7 +468,7 @@ void LLSidepanelInventory::onOpen(const LLSD& key)  	LLFirstUse::newInventory(false);  	// Expand the inbox if we have fresh items -	LLPanelMarketplaceInbox * inbox = getChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL); +	LLPanelMarketplaceInbox * inbox = findChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);  	if (inbox && (inbox->getFreshItemCount() > 0))  	{  		getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true); @@ -396,7 +520,7 @@ void LLSidepanelInventory::onShopButtonClicked()  void LLSidepanelInventory::performActionOnSelection(const std::string &action)  { -	LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); +	LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");  	LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();  	if (!current_item)  	{ @@ -404,10 +528,11 @@ void LLSidepanelInventory::performActionOnSelection(const std::string &action)  		if (inbox)  		{  			current_item = inbox->getRootFolder()->getCurSelectedItem(); -			if (!current_item) -			{ -				return; -			} +		} + +		if (!current_item) +		{ +			return;  		}  	} @@ -590,7 +715,7 @@ bool LLSidepanelInventory::canWearSelected()  LLInventoryItem *LLSidepanelInventory::getSelectedItem()  { -	LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); +	LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");  	LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();  	if (!current_item)  	{ @@ -598,10 +723,11 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem()  		if (inbox)  		{  			current_item = inbox->getRootFolder()->getCurSelectedItem(); -			if (!current_item) -			{ -				return NULL; -			} +		} + +		if (!current_item) +		{ +			return NULL;  		}  	}  	const LLUUID &item_id = current_item->getListener()->getUUID(); @@ -613,7 +739,7 @@ U32 LLSidepanelInventory::getSelectedCount()  {  	int count = 0; -	LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); +	LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");  	std::set<LLUUID> selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList();  	count += selection_list.size(); diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index df29cbceba..9117e3bf27 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -30,6 +30,7 @@  #include "llpanel.h"  class LLFolderViewItem; +class LLInboxOutboxAddedObserver;  class LLInventoryCategoriesObserver;  class LLInventoryItem;  class LLInventoryPanel; @@ -45,8 +46,12 @@ public:  private:  	void handleLoginComplete(); - +	  public: +	void observeInboxOutboxCreation(); +	void observeInboxModifications(const LLUUID& inboxID); +	void observeOutboxModifications(const LLUUID& outboxID); +  	/*virtual*/ BOOL postBuild();  	/*virtual*/ void onOpen(const LLSD& key); @@ -117,6 +122,7 @@ private:  	bool						mOutboxEnabled;  	LLInventoryCategoriesObserver* 			mCategoriesObserver; +	LLInboxOutboxAddedObserver*				mInboxOutboxAddedObserver;  };  #endif //LL_LLSIDEPANELINVENTORY_H diff --git a/indra/newview/llsidepanelinventorysubpanel.cpp b/indra/newview/llsidepanelinventorysubpanel.cpp index 37b10b592f..2918bb388a 100644 --- a/indra/newview/llsidepanelinventorysubpanel.cpp +++ b/indra/newview/llsidepanelinventorysubpanel.cpp @@ -46,8 +46,8 @@  ///----------------------------------------------------------------------------  // Default constructor -LLSidepanelInventorySubpanel::LLSidepanelInventorySubpanel() -  : LLPanel(), +LLSidepanelInventorySubpanel::LLSidepanelInventorySubpanel(const LLPanel::Params& p) +  : LLPanel(p),  	mIsDirty(TRUE),  	mIsEditing(FALSE),  	mCancelBtn(NULL), diff --git a/indra/newview/llsidepanelinventorysubpanel.h b/indra/newview/llsidepanelinventorysubpanel.h index b2de7d3b0b..b5cf3aaf17 100644 --- a/indra/newview/llsidepanelinventorysubpanel.h +++ b/indra/newview/llsidepanelinventorysubpanel.h @@ -40,7 +40,7 @@ class LLInventoryItem;  class LLSidepanelInventorySubpanel : public LLPanel  {  public: -	LLSidepanelInventorySubpanel(); +	LLSidepanelInventorySubpanel(const LLPanel::Params& p = getDefaultParams());  	virtual ~LLSidepanelInventorySubpanel();  	/*virtual*/ void setVisible(BOOL visible); diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index fbd2f7ca83..1ce05da849 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -130,9 +130,10 @@ void LLObjectInventoryObserver::inventoryChanged(LLViewerObject* object,  static LLRegisterPanelClassWrapper<LLSidepanelItemInfo> t_item_info("sidepanel_item_info");  // Default constructor -LLSidepanelItemInfo::LLSidepanelItemInfo() -  : mItemID(LLUUID::null) -  , mObjectInventoryObserver(NULL) +LLSidepanelItemInfo::LLSidepanelItemInfo(const LLPanel::Params& p) +	: LLSidepanelInventorySubpanel(p) +	, mItemID(LLUUID::null) +	, mObjectInventoryObserver(NULL)  {  	mPropertiesObserver = new LLItemPropertiesObserver(this);  } diff --git a/indra/newview/llsidepaneliteminfo.h b/indra/newview/llsidepaneliteminfo.h index 25be145f64..12aaca923e 100644 --- a/indra/newview/llsidepaneliteminfo.h +++ b/indra/newview/llsidepaneliteminfo.h @@ -44,7 +44,7 @@ class LLPermissions;  class LLSidepanelItemInfo : public LLSidepanelInventorySubpanel  {  public: -	LLSidepanelItemInfo(); +	LLSidepanelItemInfo(const LLPanel::Params& p = getDefaultParams());  	virtual ~LLSidepanelItemInfo();  	/*virtual*/ BOOL postBuild(); diff --git a/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml b/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml new file mode 100644 index 0000000000..49abbcde71 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<inventory_panel +    name="inventory_inbox" +    start_folder="Inbox" +    follows="all" layout="topleft" +    top="0" left="0" height="165" width="308" +	top_pad="0" +    bg_opaque_color="DkGray2" +    bg_alpha_color="DkGray2" +    background_visible="true" +    background_opaque="true" +    border="false" +    bevel_style="none" +    show_item_link_overlays="true" +    > +    <scroll reserve_scroll_corner="false" /> +</inventory_panel> diff --git a/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml b/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml new file mode 100644 index 0000000000..af32056428 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<inventory_panel +    name="inventory_outbox" +    start_folder="Outbox" +    follows="all" layout="topleft" +    top="0" left="0" height="165" width="308" +	top_pad="0" +    bg_opaque_color="DkGray2" +    bg_alpha_color="DkGray2" +    background_visible="true" +    background_opaque="true" +    border="false" +    bevel_style="none" +    show_item_link_overlays="true" +    > +    <scroll reserve_scroll_corner="false" /> +</inventory_panel> diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index 778daac83b..baf37ae0b4 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -69,7 +69,6 @@                        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" @@ -112,26 +111,19 @@                          background_opaque="true"                          tool_tip="Drag and drop items to your inventory to manage and use them"                          > -                        <inventory_panel -                            bg_opaque_color="DkGray2" -                            bg_alpha_color="DkGray2" -                            background_visible="true" -                            background_opaque="true" -                            border="false" -                            bevel_style="none" -                            follows="all" -                            top="0" -                            height="165" -                            start_folder="Inbox" -                            layout="topleft" -                            left="0" -                            name="inventory_inbox" -                            sort_order_setting="InventorySortOrder" -                            show_item_link_overlays="true" -                            top_pad="0" -                            width="308"> -                            <scroll reserve_scroll_corner="false" /> -                        </inventory_panel> +                        <text +							name="inbox_inventory_placeholder" +							type="string" +							follows="all" +							layout="topleft" +							top="0" +							left="0" +							width="308" +							height="165" +							wrap="true" +							halign="center"> +							Purchases from the marketplace will be delivered here. +						</text>                      </panel>                   </panel>               </layout_panel> @@ -211,33 +203,30 @@                           </images>                       </loading_indicator>                       <panel -                         follows="all" -                         left="0" -                         bottom="200" -                         width="330" -                         top="35" -                           > -                         <inventory_panel -                              bg_opaque_color="DkGray2" -                              bg_alpha_color="DkGray2" -                              background_visible="true" -                              background_opaque="true" -                              border="false" -                              bevel_style="none" -                              follows="all" -                              height="165" -                              start_folder="Outbox" -                              layout="topleft" -                              left="0" -                              name="inventory_outbox" -                              sort_order_setting="InventorySortOrder" -                              show_item_link_overlays="true" -                              top="0" -                              width="308"> -                             <scroll reserve_scroll_corner="false" /> -                         </inventory_panel> -                     </panel> - +                        follows="all" +                        left="10" +                        bottom="200" +                        width="308" +                        top="35" +                        bg_opaque_color="InventoryBackgroundColor" +                        background_visible="true" +                        background_opaque="true" +                        tool_tip="Drag and drop items here to prepare them for sale on your storefront" +                        > +                        <text +							name="outbox_inventory_placeholder" +							type="string" +							follows="all" +							layout="topleft" +							top="0" +							left="0" +							width="308" +							height="165" +							wrap="true" +							halign="center"> +							Set up your merchant account to use this feature. +						</text> +                    </panel>                   </panel>               </layout_panel>           </layout_stack> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 71f48c833d..2fa7b9f796 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2021,6 +2021,8 @@ Returns a string with the requested data about the region  	<string name="PlacesNoMatchingItems">Didn't find what you're looking for? Try [secondlife:///app/search/places/[SEARCH_TERM] Search].</string>  	<string name="FavoritesNoMatchingItems">Drag a landmark here to add it to your favorites.</string>  	<string name="InventoryNoTexture">You do not have a copy of this texture in your inventory</string> +	<string name="InventoryInboxNoItems">Items purchased through the marketplace will be delivered here.</string> +	<string name="InventoryOutboxNoItems">Drag items here in preparation for listing on your marketplace storefront.</string>      <!-- use value="" because they have preceding spaces -->  	<string name="no_transfer" value=" (no transfer)" />  	<string name="no_modify"   value=" (no modify)" /> | 
