From 0e21b478636fac986a5e2276662da6a6e1692f9e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 18 Feb 2013 15:34:03 +0300 Subject: Add support for help seach links. To add link to search text: /url ?text Also add support for links in format: help://topic --- src/gui/helpwindow.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/gui/helpwindow.cpp') diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index c035b2a24..712d9fa6a 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -36,6 +36,7 @@ #include "utils/gettext.h" #include "utils/langs.h" +#include "utils/paths.h" #include "utils/process.h" #include "utils/translation/podict.h" @@ -101,18 +102,19 @@ void HelpWindow::handleLink(const std::string &link, void HelpWindow::loadHelp(const std::string &helpFile) { + if (!checkPath(helpFile)) + return; mBrowserBox->clearRows(); - loadFile("header"); loadFile(helpFile); loadFile("footer"); - mScrollArea->setVerticalScrollAmount(0); setVisible(true); } -void HelpWindow::loadFile(const std::string &file) +void HelpWindow::loadFile(std::string file) { + trim(file); std::string helpPath = branding.getStringValue("helpPath"); if (helpPath.empty()) helpPath = paths.getStringValue("help"); @@ -144,6 +146,7 @@ void HelpWindow::loadTags() void HelpWindow::search(const std::string &text0) { std::string text = text0; + trim(text); toLower(text); if (mTagFileMap.find(text) == mTagFileMap.end()) { -- cgit v1.2.3-70-g09d2