diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 19 | ||||
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 55 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 18 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 5 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/menu_inventory.xml | 14 |
5 files changed, 67 insertions, 44 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 7ff0a445e8..3af734ba27 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -65,6 +65,7 @@ #include "llsidepanelappearance.h" #include "lltooldraganddrop.h" #include "lltrans.h" +#include "llurlaction.h" #include "llviewerassettype.h" #include "llviewerfoldertype.h" #include "llviewermenu.h" @@ -853,13 +854,14 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, if (depth == 1) { // Options available at the Listing Folder level - items.push_back(std::string("Marketplace Add Listing")); + items.push_back(std::string("Marketplace Associate Listing")); items.push_back(std::string("Marketplace Attach Listing")); + items.push_back(std::string("Marketplace Disassociate Listing")); items.push_back(std::string("Marketplace Activate")); items.push_back(std::string("Marketplace Deactivate")); if (LLMarketplaceData::instance().isListed(mUUID)) { - disabled_items.push_back(std::string("Marketplace Add Listing")); + disabled_items.push_back(std::string("Marketplace Associate Listing")); disabled_items.push_back(std::string("Marketplace Attach Listing")); if (LLMarketplaceData::instance().getActivationState(mUUID)) { @@ -872,6 +874,7 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, } else { + disabled_items.push_back(std::string("Marketplace Disassociate Listing")); disabled_items.push_back(std::string("Marketplace Activate")); disabled_items.push_back(std::string("Marketplace Deactivate")); } @@ -3147,11 +3150,16 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) LLMarketplaceData::instance().setActivation(mUUID,false); return; } - else if ("marketplace_add_listing" == action) + else if ("marketplace_associate_listing" == action) { LLMarketplaceData::instance().addListing(mUUID); return; } + else if ("marketplace_disassociate_listing" == action) + { + LLMarketplaceData::instance().deleteListing(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 @@ -3163,6 +3171,11 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string 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 + // https://marketplace.secondlife.com/p/Nounours/4438852 + // https://marketplace.secondlife.com/p/Un-autre-nounours/4447997?preview=true + // https://marketplace.secondlife.com/p/<listing_name>/<listing_id>?preview=true + std::string url("https://marketplace.secondlife.com/p/Un-autre-nounours/4447997?preview=true"); + LLUrlAction::openURL(url); return; } #ifndef LL_RELEASE_FOR_DOWNLOAD diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index ad9326965b..ff38017d6f 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -120,33 +120,58 @@ void append_path(const LLUUID& id, std::string& path) path.append(temp); } -void update_marketplace_category(const LLUUID& cat_id) +void update_marketplace_folder_hierarchy(const LLUUID cat_id) { // When changing the marketplace status of a folder, the only thing that needs to happen is // for all observers of the folder to, possibly, change the display label of the folder - // as well as, potentially, change the display label of all parent folders up to the marketplace root. + // so that's the only thing we change on the update mask. + gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); + gInventory.notifyObservers(); + + // Update all descendent folders down + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array); + + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; + for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) + { + LLInventoryCategory* category = *iter; + update_marketplace_folder_hierarchy(category->getUUID()); + } + return; +} + +void update_marketplace_category(const LLUUID& cat_id) +{ + // When changing the marketplace status of a folder, we usually have to change the status of all + // folders in the same listing. This is because the display of each folder is affected by the + // overall status of the whole listing. + // Consequently, the only way to correctly update a folder anywhere in the marketplace is to + // update the whole listing from its listing root. + // This is not as bad as it seems as we only update folders, not items, and the folder nesting depth + // is limited to 4. + // We also take care of degenerated cases so we don't update all folders in the inventory by mistake. const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); - // No marketplace, likely called in error then... - // Or not a descendent of the marketplace listings root, then just do the regular category update + // No marketplace -> likely called too early... or + // Not a descendent of the marketplace listings root -> likely called in error then... if (marketplace_listings_uuid.isNull() || !gInventory.isObjectDescendentOf(cat_id, marketplace_listings_uuid)) { + // In those cases, just do the regular category update LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); gInventory.updateCategory(cat); gInventory.notifyObservers(); return; } - // Explore all the hierarchy of folders up to the root to get them to update - // Note: this is not supposed to be deeper than 4 - LLUUID cur_id = cat_id; - LLInventoryCategory* cur_cat = gInventory.getCategory(cur_id); - while (cur_id != marketplace_listings_uuid) - { - gInventory.addChangedMask(LLInventoryObserver::LABEL, cur_id); - gInventory.notifyObservers(); - cur_id = cur_cat->getParentUUID(); - cur_cat = gInventory.getCategory(cur_id); - } + + // Grab marketplace listing data for this folder + S32 depth = depth_nesting_in_marketplace(cat_id); + LLUUID listing_uuid = nested_parent_id(cat_id, depth); + + // Update all descendents starting from the listing root + update_marketplace_folder_hierarchy(listing_uuid); + return; } diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 29ce5361f0..b7c84dc714 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -687,7 +687,6 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); (it->second).mIsActive = activate; update_marketplace_category((it->second).mListingFolderId); - update_marketplace_category((it->second).mVersionFolderId); return true; } // We need to iterate through the list to check it's not a version folder @@ -698,7 +697,6 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) { (it->second).mIsActive = activate; update_marketplace_category((it->second).mListingFolderId); - update_marketplace_category((it->second).mVersionFolderId); return true; } it++; @@ -706,20 +704,4 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) return false; } -// Test methods -void LLMarketplaceData::addTestItem(const LLUUID& folder_id) -{ - llinfos << "Merov : addTestItem, id = " << folder_id << llendl; - mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); - update_marketplace_category(folder_id); -} -void LLMarketplaceData::addTestItem(const LLUUID& folder_id, const LLUUID& version_id) -{ - llinfos << "Merov : addTestItem, id = " << folder_id << ", version = " << version_id << llendl; - mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); - setVersionFolderID(folder_id, version_id); - update_marketplace_category(folder_id); - update_marketplace_category(version_id); -} - diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index d76072da1f..0b1066a558 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -165,11 +165,6 @@ public: bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id); bool setActivation(const LLUUID& folder_id, bool activate); - // Merov : DD Development : methods to populate the items list with something usefull using - // inventory IDs and some pseudo random code so we can play with the UI... - void addTestItem(const LLUUID& folder_id); - void addTestItem(const LLUUID& folder_id, const LLUUID& version_id); - private: marketplace_items_list_t mMarketplaceItems; }; diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index cde14e72f0..0be5509333 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -5,12 +5,12 @@ name="Popup" visible="false"> <menu_item_call - label="Add Listing" + label="Associate Listing" layout="topleft" - name="Marketplace Add Listing"> + name="Marketplace Associate Listing"> <menu_item_call.on_click function="Inventory.DoToSelected" - parameter="marketplace_add_listing" /> + parameter="marketplace_associate_listing" /> </menu_item_call> <menu_item_call label="Attach Listing" @@ -21,6 +21,14 @@ parameter="marketplace_attach_listing" /> </menu_item_call> <menu_item_call + label="Disassociate Listing" + layout="topleft" + name="Marketplace Disassociate Listing"> + <menu_item_call.on_click + function="Inventory.DoToSelected" + parameter="marketplace_disassociate_listing" /> + </menu_item_call> + <menu_item_call label="Show Listing" layout="topleft" name="Marketplace Show Listing"> |