diff options
author | Merov Linden <merov@lindenlab.com> | 2014-04-04 16:56:17 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-04-04 16:56:17 -0700 |
commit | e1d2f71d348bafe0be783dcb3dfbeb56bc877c12 (patch) | |
tree | 8727ed160e14873ee2373ab71d796e7e3b8017e3 /indra/newview | |
parent | 6263a4fe6f38bd860e583f3819fb38c5c1d37efd (diff) |
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
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloatermarketplacelistings.cpp | 23 | ||||
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 113 | ||||
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 27 | ||||
-rwxr-xr-x | indra/newview/llinventoryfunctions.h | 1 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/menu_inventory.xml | 51 |
5 files changed, 174 insertions, 41 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 42e49f5d7d..10c6045f87 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -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 // diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ceb54b3dcd..cd3e51a0ea 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -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")); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index d99193067d..e57519d67a 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -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 diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index e6f9ef6d89..aab4db8adf 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -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 ** ** diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index aa115c1ad1..cde14e72f0 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -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--" /> |