DD-14 : Add all right click menu items for marketplace. Make Add, Activate and Deactivate work. Right click fails on non folder items though in marketplace

master
Merov Linden 2014-04-04 16:56:17 -07:00
parent 6263a4fe6f
commit e1d2f71d34
5 changed files with 174 additions and 41 deletions

View File

@ -246,29 +246,6 @@ void LLFloaterMarketplaceListings::onOpen(const LLSD& key)
setup();
}
// Merov : Debug : Create fake Marketplace data if none is present
if (LLMarketplaceData::instance().isEmpty() && (getFolderCount() > 0))
{
LLInventoryModel::cat_array_t* cats;
LLInventoryModel::item_array_t* items;
gInventory.getDirectDescendentsOf(mRootFolderId, cats, items);
int index = 0;
for (LLInventoryModel::cat_array_t::iterator iter = cats->begin(); iter != cats->end(); iter++, index++)
{
LLViewerInventoryCategory* category = *iter;
if (index%3)
{
LLMarketplaceData::instance().addTestItem(category->getUUID());
if (index%3 == 1)
{
LLMarketplaceData::instance().setListingID(category->getUUID(),"TestingID1234");
}
LLMarketplaceData::instance().setActivation(category->getUUID(),(index%2));
}
}
}
//
// Update the floater view
//

View File

@ -744,10 +744,6 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
addOutboxContextMenuOptions(flags, items, disabled_items);
}
else if (isMarketplaceListingsFolder())
{
addMarketplaceContextMenuOptions(flags, items, disabled_items);
}
else
{
items.push_back(std::string("Share"));
@ -853,8 +849,49 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags,
menuentry_vec_t &items,
menuentry_vec_t &disabled_items)
{
items.push_back(std::string("Marketplace Separator"));
items.push_back(std::string("Marketplace Activate"));
S32 depth = depth_nesting_in_marketplace(mUUID);
llinfos << "Merov : adding marketplace menu at depth = " << depth << llendl;
if (depth <= 1)
{
// Options available at the Listing Folder level only
items.push_back(std::string("Marketplace Add Listing"));
items.push_back(std::string("Marketplace Attach Listing"));
if (LLMarketplaceData::instance().isListed(mUUID))
{
disabled_items.push_back(std::string("Marketplace Add Listing"));
disabled_items.push_back(std::string("Marketplace Attach Listing"));
}
}
if (depth <= 2)
{
// Options available at the Listing Folder and Version Folder levels
items.push_back(std::string("Marketplace Activate"));
items.push_back(std::string("Marketplace Deactivate"));
if (LLMarketplaceData::instance().isListed(mUUID))
{
if (LLMarketplaceData::instance().getActivationState(mUUID))
{
disabled_items.push_back(std::string("Marketplace Activate"));
}
else
{
disabled_items.push_back(std::string("Marketplace Deactivate"));
}
}
else
{
disabled_items.push_back(std::string("Marketplace Activate"));
disabled_items.push_back(std::string("Marketplace Deactivate"));
}
}
// Options available at all levels on all items
items.push_back(std::string("Marketplace Show Listing"));
if (!LLMarketplaceData::instance().isListed(mUUID))
{
disabled_items.push_back(std::string("Marketplace Show Listing"));
}
// Separator
items.push_back(std::string("Marketplace Listings Separator"));
}
@ -3084,13 +3121,33 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
}
else if ("marketplace_activate" == action)
{
if (!LLMarketplaceData::instance().isListed(mUUID))
{
LLMarketplaceData::instance().addTestItem(mUUID);
}
LLMarketplaceData::instance().setActivation(mUUID,true);
return;
}
else if ("marketplace_deactivate" == action)
{
LLMarketplaceData::instance().setActivation(mUUID,false);
return;
}
else if ("marketplace_add_listing" == action)
{
// *TODO : Do something a bit smarter...
LLMarketplaceData::instance().addTestItem(mUUID);
return;
}
else if ("marketplace_attach_listing" == action)
{
// *TODO : Get a list of listing IDs and let the user choose one, delist the old one and relist the new one
LLMarketplaceData::instance().addTestItem(mUUID);
return;
}
else if ("marketplace_show_listing" == action)
{
// *TODO : Need to show a browser window with the info for the listing
// Get the listing id (i.e. go up the hierarchy to find the listing folder
// Show the listing folder in a browser window
return;
}
#ifndef LL_RELEASE_FOR_DOWNLOAD
else if ("delete_system_folder" == action)
{
@ -4644,6 +4701,10 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
addOutboxContextMenuOptions(flags, items, disabled_items);
}
else if (isMarketplaceListingsFolder())
{
addMarketplaceContextMenuOptions(flags, items, disabled_items);
}
else
{
items.push_back(std::string("Share"));
@ -4711,6 +4772,10 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
addOutboxContextMenuOptions(flags, items, disabled_items);
}
else if (isMarketplaceListingsFolder())
{
addMarketplaceContextMenuOptions(flags, items, disabled_items);
}
else
{
if (isItemInTrash())
@ -4769,6 +4834,10 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
addOutboxContextMenuOptions(flags, items, disabled_items);
}
else if (isMarketplaceListingsFolder())
{
addMarketplaceContextMenuOptions(flags, items, disabled_items);
}
else
{
if(isItemInTrash())
@ -5019,6 +5088,10 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
items.push_back(std::string("Delete"));
}
else if (isMarketplaceListingsFolder())
{
addMarketplaceContextMenuOptions(flags, items, disabled_items);
}
else
{
items.push_back(std::string("Share"));
@ -5286,6 +5359,10 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
items.push_back(std::string("Delete"));
}
else if (isMarketplaceListingsFolder())
{
addMarketplaceContextMenuOptions(flags, items, disabled_items);
}
else
{
items.push_back(std::string("Share"));
@ -5340,6 +5417,10 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
items.push_back(std::string("Delete"));
}
else if (isMarketplaceListingsFolder())
{
addMarketplaceContextMenuOptions(flags, items, disabled_items);
}
else
{
if(isItemInTrash())
@ -5619,6 +5700,10 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
items.push_back(std::string("Delete"));
}
else if (isMarketplaceListingsFolder())
{
addMarketplaceContextMenuOptions(flags, items, disabled_items);
}
else
{
items.push_back(std::string("Share"));
@ -5841,6 +5926,10 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
items.push_back(std::string("Delete"));
}
else if (isMarketplaceListingsFolder())
{
addMarketplaceContextMenuOptions(flags, items, disabled_items);
}
else
{ // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere
BOOL can_open = ((flags & SUPPRESS_OPEN_ITEM) != SUPPRESS_OPEN_ITEM);
@ -6141,6 +6230,10 @@ void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
addOutboxContextMenuOptions(flags, items, disabled_items);
}
else if (isMarketplaceListingsFolder())
{
addMarketplaceContextMenuOptions(flags, items, disabled_items);
}
else
{
items.push_back(std::string("Properties"));

View File

@ -705,6 +705,33 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold
// permission checking and listings validation.
///----------------------------------------------------------------------------
S32 depth_nesting_in_marketplace(LLUUID cur_uuid)
{
// Get the marketplace listings root, exit with -1 (i.e. not under the marketplace listings root) if none
const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
if (marketplace_listings_uuid.isNull())
{
return -1;
}
// If not a descendent of the marketplace listings root, then the nesting depth is -1 by definition
if (!gInventory.isObjectDescendentOf(cur_uuid, marketplace_listings_uuid))
{
return -1;
}
// Iterate through the parents till we hit the marketplace listings root
// Note that the marketplace listings root itself will return 0
S32 depth = 0;
LLInventoryObject* cur_object = gInventory.getObject(cur_uuid);
while (cur_uuid != marketplace_listings_uuid)
{
depth++;
cur_uuid = cur_object->getParentUUID();
cur_object = gInventory.getCategory(cur_uuid);
}
return depth;
}
void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy)
{
// Get the marketplace listings, exit with error if none

View File

@ -76,6 +76,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol
void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false);
bool has_correct_permissions_for_sale(LLInventoryCategory* cat);
void validate_marketplacelistings(LLInventoryCategory* inv_cat);
S32 depth_nesting_in_marketplace(LLUUID cur_uuid);
/** Miscellaneous global functions
** **

View File

@ -4,6 +4,49 @@
layout="topleft"
name="Popup"
visible="false">
<menu_item_call
label="Add Listing"
layout="topleft"
name="Marketplace Add Listing">
<menu_item_call.on_click
function="Inventory.DoToSelected"
parameter="marketplace_add_listing" />
</menu_item_call>
<menu_item_call
label="Attach Listing"
layout="topleft"
name="Marketplace Attach Listing">
<menu_item_call.on_click
function="Inventory.DoToSelected"
parameter="marketplace_attach_listing" />
</menu_item_call>
<menu_item_call
label="Show Listing"
layout="topleft"
name="Marketplace Show Listing">
<menu_item_call.on_click
function="Inventory.DoToSelected"
parameter="marketplace_show_listing" />
</menu_item_call>
<menu_item_call
label="Activate"
layout="topleft"
name="Marketplace Activate">
<menu_item_call.on_click
function="Inventory.DoToSelected"
parameter="marketplace_activate" />
</menu_item_call>
<menu_item_call
label="Deactivate"
layout="topleft"
name="Marketplace Deactivate">
<menu_item_call.on_click
function="Inventory.DoToSelected"
parameter="marketplace_deactivate" />
</menu_item_call>
<menu_item_separator
layout="topleft"
name="Marketplace Listings Separator" />
<menu_item_call
label="Share"
layout="topleft"
@ -726,14 +769,6 @@
parameter="send_to_marketplace" />
</menu_item_call>
<menu_item_call
label="Activate"
layout="topleft"
name="Marketplace Activate">
<menu_item_call.on_click
function="Inventory.DoToSelected"
parameter="marketplace_activate" />
</menu_item_call>
<menu_item_call
label="--no options--"
layout="topleft"
name="--no options--" />