diff options
author | Lynx Linden <lynx@lindenlab.com> | 2009-12-15 16:00:28 +0000 |
---|---|---|
committer | Lynx Linden <lynx@lindenlab.com> | 2009-12-15 16:00:28 +0000 |
commit | 870d4449f5eec1c2a7e5e4627a0433846ab256aa (patch) | |
tree | 978b060155de581f627fd52c74eba63643829aad /indra/newview/llweb.cpp | |
parent | d82f82d7965ec9360cb49ec7e6c1c2f984d4539b (diff) |
EXT-3441: Support various substitutions for Search URL.
The search URL is now specified in app_settings/settings.xml (instead
of in floater_search.xml), and it is now defined more flexibly with
support for various substitution strings, such as [QUERY], [AUTH_KEY],
[MATURITY], [GODLIKE], etc.
I pulled the common substitution code out into a new static method,
LLWeb::expandURLSubstitutions(). This provides support for common
strings like [VERSION], [CHANNEL], [LANGUAGE], [OS], etc. The Help and
Home sidetray code has been updated to use this new function, to avoid
replicating this behavior 3 times.
I also cleaned up the app_settings/settings.xml file and removed the
old search keys of: SearchURLDefault, SearchURLQuery, and
SearchURLSuffix2.
Diffstat (limited to 'indra/newview/llweb.cpp')
-rw-r--r-- | indra/newview/llweb.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 72431bd22f..045bef294e 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -38,12 +38,19 @@ // Library includes #include "llwindow.h" // spawnWebBrowser() -#include "llviewerwindow.h" -#include "llviewercontrol.h" +#include "llalertdialog.h" +#include "llappviewer.h" #include "llfloatermediabrowser.h" #include "llfloaterreg.h" -#include "llalertdialog.h" +#include "lllogininstance.h" +#include "llsd.h" #include "lltoastalertpanel.h" +#include "llui.h" +#include "lluri.h" +#include "llversioninfo.h" +#include "llviewercontrol.h" +#include "llviewernetwork.h" +#include "llviewerwindow.h" class URLLoader : public LLAlertURLLoader { @@ -124,3 +131,24 @@ std::string LLWeb::escapeURL(const std::string& url) } return escaped_url; } + +//static +std::string LLWeb::expandURLSubstitutions(const std::string &url, + const LLSD &default_subs) +{ + LLSD substitution = default_subs; + substitution["VERSION"] = LLVersionInfo::getVersion(); + substitution["VERSION_MAJOR"] = LLVersionInfo::getMajor(); + substitution["VERSION_MINOR"] = LLVersionInfo::getMinor(); + substitution["VERSION_PATCH"] = LLVersionInfo::getPatch(); + substitution["VERSION_BUILD"] = LLVersionInfo::getBuild(); + substitution["CHANNEL"] = LLVersionInfo::getChannel(); + substitution["LANGUAGE"] = LLUI::getLanguage(); + substitution["GRID"] = LLViewerLogin::getInstance()->getGridLabel(); + substitution["OS"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple(); + + std::string expanded_url = url; + LLStringUtil::format(expanded_url, substitution); + + return LLWeb::escapeURL(expanded_url); +} |