mirror of
https://github.com/FirestormViewer/phoenix-firestorm.git
synced 2026-08-14 08:53:53 +00:00
Use the marketplace floater when a SL Marketplace URL is clicked
Merged upstream in SLViewer PR#5211
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user