From edb294a8fef8d8b157fa6bdcf04fdd6fcd9af862 Mon Sep 17 00:00:00 2001 From: Hecklezz Date: Tue, 6 Jan 2026 02:34:42 +1000 Subject: Use the marketplace floater when a SL Marketplace URL is clicked Signed-off-by: Hecklezz --- indra/newview/llfloatermarketplace.cpp | 35 ++++++++++++++++++++++++++++++++++ indra/newview/llfloatermarketplace.h | 3 +++ indra/newview/llweb.cpp | 13 +++++++++++-- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloatermarketplace.cpp b/indra/newview/llfloatermarketplace.cpp index 7316d7617d..2a67e75fec 100644 --- a/indra/newview/llfloatermarketplace.cpp +++ b/indra/newview/llfloatermarketplace.cpp @@ -39,6 +39,26 @@ LLFloaterMarketplace::~LLFloaterMarketplace() { } +void LLFloaterMarketplace::onOpen(const LLSD& key) +{ + Params params(key); + + if (!params.validateBlock()) + { + closeFloater(); + return; + } + + if (params.url().empty()) + { + openMarketplace(); + } + else + { + openMarketplaceURL(params.url); + } +} + // just to override LLFloaterWebContent void LLFloaterMarketplace::onClose(bool app_quitting) { @@ -68,3 +88,18 @@ void LLFloaterMarketplace::openMarketplace() mWebBrowser->navigateTo(url, HTTP_CONTENT_TEXT_HTML); } } + +void LLFloaterMarketplace::openMarketplaceURL(const std::string& url) +{ + if (mCurrentURL != url) + { + mWebBrowser->navigateTo(url, HTTP_CONTENT_TEXT_HTML); + } +} + +// static +bool LLFloaterMarketplace::isMarketplaceURL(const std::string& url) +{ + static LLCachedControl marketplace_url(gSavedSettings, "MarketplaceURL", "https://marketplace.secondlife.com/"); + return url.starts_with(marketplace_url()); +} diff --git a/indra/newview/llfloatermarketplace.h b/indra/newview/llfloatermarketplace.h index 9524c94eee..17979dae90 100644 --- a/indra/newview/llfloatermarketplace.h +++ b/indra/newview/llfloatermarketplace.h @@ -36,11 +36,14 @@ class LLFloaterMarketplace: public: void openMarketplace(); + void openMarketplaceURL(const std::string& url); + bool static isMarketplaceURL(const std::string& url); private: LLFloaterMarketplace(const LLSD& key); ~LLFloaterMarketplace(); bool postBuild() override; + void onOpen(const LLSD& key) override; void onClose(bool app_quitting) override; }; diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index a319aa00bc..f603274335 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -34,6 +34,7 @@ #include "llagent.h" #include "llappviewer.h" +#include "llfloatermarketplace.h" #include "llfloaterwebcontent.h" #include "llfloaterreg.h" #include "lllogininstance.h" @@ -74,12 +75,20 @@ void LLWeb::loadURL(const std::string& url, const std::string& target, const std } // static -// Explicitly open a Web URL using the Web content floater +// Explicitly open a Web URL using the Web content floater or Marketplace floater void LLWeb::loadURLInternal(const std::string &url, const std::string& target, const std::string& uuid, bool dev_mode) { LLFloaterWebContent::Params p; p.url(url).target(target).id(uuid).dev_mode(dev_mode); - LLFloaterReg::showInstance("web_content", p); + + if (LLFloaterMarketplace::isMarketplaceURL(url)) + { + LLFloaterReg::showInstance("marketplace", p); + } + else + { + LLFloaterReg::showInstance("web_content", p); + } } // static -- cgit v1.3