Use the marketplace floater when a SL Marketplace URL is clicked

Signed-off-by: Hecklezz <tj8@live.com.au>
This commit is contained in:
Hecklezz
2026-01-05 21:59:46 +02:00
committed by Andrey Kleshchev
parent 23bfecf0b1
commit edb294a8fe
3 changed files with 49 additions and 2 deletions
+35
View File
@@ -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<std::string> marketplace_url(gSavedSettings, "MarketplaceURL", "https://marketplace.secondlife.com/");
return url.starts_with(marketplace_url());
}
+3
View File
@@ -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;
};
+11 -2
View File
@@ -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