diff options
Diffstat (limited to 'indra/newview/llviewerhelp.cpp')
-rw-r--r-- | indra/newview/llviewerhelp.cpp | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/indra/newview/llviewerhelp.cpp b/indra/newview/llviewerhelp.cpp index 5af79b4fd3..b82538dacb 100644 --- a/indra/newview/llviewerhelp.cpp +++ b/indra/newview/llviewerhelp.cpp @@ -33,6 +33,7 @@ #include "llviewerprecompiledheaders.h" +#include "llcommandhandler.h" #include "llfloaterhelpbrowser.h" #include "llfloaterreg.h" #include "llfocusmgr.h" @@ -43,6 +44,33 @@ #include "llviewerhelputil.h" #include "llviewerhelp.h" +// support for secondlife:///app/help/{TOPIC} SLapps +class LLHelpHandler : public LLCommandHandler +{ +public: + // requests will be throttled from a non-trusted browser + LLHelpHandler() : LLCommandHandler("help", UNTRUSTED_THROTTLE) {} + + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) + { + LLViewerHelp* vhelp = LLViewerHelp::getInstance(); + if (! vhelp) + { + return false; + } + + // get the requested help topic name, or use the fallback if none + std::string help_topic = vhelp->defaultTopic(); + if (params.size() >= 1) + { + help_topic = params[0].asString(); + } + + vhelp->showTopic(help_topic); + return true; + } +}; +LLHelpHandler gHelpHandler; ////////////////////////////// // implement LLHelp interface @@ -65,18 +93,16 @@ void LLViewerHelp::showTopic(const std::string &topic) help_topic = defaultTopic(); } - // f1 help topic means: if user not logged in yet, show the - // pre-login topic, otherwise show help for the focused item + // f1 help topic means: if the user is not logged in yet, show + // the pre-login topic instead of the default fallback topic, + // otherwise show help for the focused item if (help_topic == f1HelpTopic()) { - if (! LLLoginInstance::getInstance()->authSuccess()) + help_topic = getTopicFromFocus(); + if (help_topic == defaultTopic() && ! LLLoginInstance::getInstance()->authSuccess()) { help_topic = preLoginTopic(); } - else - { - help_topic = getTopicFromFocus(); - } } // work out the URL for this topic and display it |