From 0c0f7558782edccda375609777967184b8440441 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Mon, 6 Jun 2011 16:30:22 -0700 Subject: fixing drag and drop for inbox, adding inbox text and cleaning up context menus --- indra/newview/llinventorybridge.cpp | 15 ++++++--- indra/newview/llinventorybridge.h | 1 + indra/newview/llpanelmarketplaceinbox.cpp | 38 ++++++++++++++++++++++ indra/newview/llpanelmarketplaceinbox.h | 9 +++++ .../skins/default/xui/en/sidepanel_inventory.xml | 25 +++++++++++--- 5 files changed, 79 insertions(+), 9 deletions(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index bdb9f6167a..20a187c302 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -572,7 +572,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, } // Don't allow items to be pasted directly into the COF. - if (!isCOFFolder()) + if (!isCOFFolder() && !isInboxFolder()) { items.push_back(std::string("Paste")); } @@ -781,6 +781,11 @@ BOOL LLInvFVBridge::isCOFFolder() const return LLAppearanceMgr::instance().getIsInCOF(mUUID); } +BOOL LLInvFVBridge::isInboxFolder() const +{ + return gInventory.isObjectDescendentOf(mUUID, gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX)); +} + BOOL LLInvFVBridge::isItemPermissive() const { return FALSE; @@ -2601,7 +2606,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLViewerInventoryCategory *cat = getCategory(); // BAP removed protected check to re-enable standard ops in untyped folders. // Not sure what the right thing is to do here. - if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT)) + if (!isCOFFolder() && !isInboxFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT)) { // Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694. if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat)) @@ -2627,7 +2632,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else { // Want some but not all of the items from getClipboardEntries for outfits. - if (cat && (cat->getPreferredType() == LLFolderType::FT_OUTFIT)) + if (cat && (cat->getPreferredType() == LLFolderType::FT_OUTFIT) || (cat->getPreferredType() == LLFolderType::FT_INBOX)) { mItems.push_back(std::string("Rename")); @@ -4298,7 +4303,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Wearable And Object Separator")); items.push_back(std::string("Detach From Yourself")); } - else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder()) + else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder() && !isInboxFolder()) { items.push_back(std::string("Wearable And Object Separator")); items.push_back(std::string("Wearable And Object Wear")); @@ -4650,7 +4655,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) disabled_items.push_back(std::string("Wearable Edit")); } // Don't allow items to be worn if their baseobj is in the trash. - if (isLinkedObjectInTrash() || isLinkedObjectMissing() || isCOFFolder()) + if (isLinkedObjectInTrash() || isLinkedObjectMissing() || isCOFFolder() || isInboxFolder()) { disabled_items.push_back(std::string("Wearable And Object Wear")); disabled_items.push_back(std::string("Wearable Add")); diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 5ac328dcef..f268f36f3b 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -138,6 +138,7 @@ protected: BOOL isAgentInventory() const; // false if lost or in the inventory library BOOL isCOFFolder() const; // true if COF or descendent of + BOOL isInboxFolder() const; // true if COF or descendent of marketplace inbox virtual BOOL isItemPermissive() const; static void changeItemParent(LLInventoryModel* model, LLViewerInventoryItem* item, diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index b3afaea20e..b401087345 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -28,6 +28,9 @@ #include "llpanelmarketplaceinbox.h" +#include "llbutton.h" +#include "llinventorypanel.h" + static LLRegisterPanelClassWrapper t_panel_marketplace_inbox("panel_marketplace_inbox"); // protected @@ -43,5 +46,40 @@ LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() // virtual BOOL LLPanelMarketplaceInbox::postBuild() { + mInventoryPanel = getChild("inventory_inbox"); + + mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE); + + return TRUE; +} + +BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) +{ + *accept = ACCEPT_NO; return TRUE; } + +void LLPanelMarketplaceInbox::draw() +{ + LLInventoryModel* model = mInventoryPanel->getModel(); + + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + + model->getDirectDescendentsOf(model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false), cats, items); + + S32 item_count = cats->size() + items->size(); + + if (item_count) + { + LLStringUtil::format_map_t args; + args["[NUM]"] = llformat ("%d", item_count); + getChild("inbox_btn")->setLabel(getString("InboxLabelWithArg", args)); + } + else + { + getChild("inbox_btn")->setLabel(getString("InboxLabelNoArg")); + } + + LLPanel::draw(); +} diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h index 519b213081..504659b1ef 100644 --- a/indra/newview/llpanelmarketplaceinbox.h +++ b/indra/newview/llpanelmarketplaceinbox.h @@ -29,6 +29,8 @@ #include "llpanel.h" +class LLInventoryPanel; + class LLPanelMarketplaceInbox : public LLPanel { public: @@ -39,6 +41,13 @@ public: ~LLPanelMarketplaceInbox(); /*virtual*/ BOOL postBuild(); + + /*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(); + +private: + LLInventoryPanel* mInventoryPanel; }; diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index 49c45233d8..91de3047e6 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -9,7 +9,7 @@ min_width="240" name="objects panel" width="333"> - + MARKETPLACE INBOX ([NUM]) + MARKETPLACE INBOX