summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerhelp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerhelp.cpp')
-rw-r--r--indra/newview/llviewerhelp.cpp73
1 files changed, 66 insertions, 7 deletions
diff --git a/indra/newview/llviewerhelp.cpp b/indra/newview/llviewerhelp.cpp
index 0e0727e382..b82538dacb 100644
--- a/indra/newview/llviewerhelp.cpp
+++ b/indra/newview/llviewerhelp.cpp
@@ -33,35 +33,82 @@
#include "llviewerprecompiledheaders.h"
+#include "llcommandhandler.h"
#include "llfloaterhelpbrowser.h"
#include "llfloaterreg.h"
#include "llfocusmgr.h"
#include "llviewercontrol.h"
-#include "llversionviewer.h"
#include "llappviewer.h"
+#include "lllogininstance.h"
#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
void LLViewerHelp::showTopic(const std::string &topic)
{
- showHelp();
-
+ // allow overriding the help server with a local help file
if( gSavedSettings.getBOOL("HelpUseLocal") )
{
+ showHelp();
LLFloaterHelpBrowser* helpbrowser = dynamic_cast<LLFloaterHelpBrowser*>(LLFloaterReg::getInstance("help_browser"));
helpbrowser->navigateToLocalPage( "help-offline" , "index.html" );
+ return;
}
- else
+
+ // if the help topic is empty, use the default topic
+ std::string help_topic = topic;
+ if (help_topic.empty())
{
- const LLOSInfo& osinfo = LLAppViewer::instance()->getOSInfo();
- std::string helpURL = LLViewerHelpUtil::buildHelpURL( topic, gSavedSettings, osinfo );
- setRawURL( helpURL );
+ help_topic = defaultTopic();
}
+
+ // 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())
+ {
+ help_topic = getTopicFromFocus();
+ if (help_topic == defaultTopic() && ! LLLoginInstance::getInstance()->authSuccess())
+ {
+ help_topic = preLoginTopic();
+ }
+ }
+
+ // work out the URL for this topic and display it
+ showHelp();
+ std::string helpURL = LLViewerHelpUtil::buildHelpURL( help_topic );
+ setRawURL( helpURL );
}
std::string LLViewerHelp::defaultTopic()
@@ -70,6 +117,18 @@ std::string LLViewerHelp::defaultTopic()
return "this_is_fallbacktopic";
}
+std::string LLViewerHelp::preLoginTopic()
+{
+ // *hack: to be done properly
+ return "pre_login_help";
+}
+
+std::string LLViewerHelp::f1HelpTopic()
+{
+ // *hack: to be done properly
+ return "f1_help";
+}
+
//////////////////////////////
// our own interfaces