This enables search within user manual by pressing Ctrl-F.
Esc key closes search panel.

Signed-off-by: Sergey Starosek <[email protected]>
---
 qt-ui/mainwindow.cpp | 18 +-----------------
 qt-ui/mainwindow.h   |  4 ++--
 2 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index cf97ca1..80da754 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -484,27 +484,11 @@ void MainWindow::on_actionAboutSubsurface_triggered()
 void MainWindow::on_actionUserManual_triggered()
 {
        if(!helpView){
-               helpView = new QWebView();
-               
helpView->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
-               connect(helpView, SIGNAL(linkClicked(QUrl)), this, 
SLOT(linkClickedSlot(QUrl)));
-       }
-       QString searchPath = getSubsurfaceDataPath("Documentation");
-       if (searchPath != "") {
-               QUrl url(searchPath.append("/user-manual.html"));
-               helpView->setWindowTitle(tr("User Manual"));
-               helpView->setWindowIcon(QIcon(":/subsurface-icon"));
-               helpView->setUrl(url);
-       } else {
-               helpView->setHtml(tr("Cannot find the Subsurface manual"));
+               helpView = new UserManual();
        }
        helpView->show();
 }
 
-void MainWindow::linkClickedSlot(QUrl url)
-{
-       QDesktopServices::openUrl(url);
-}
-
 QString MainWindow::filter()
 {
        QString f;
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 83672ea..7d14fc7 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -12,6 +12,7 @@
 #include <QUrl>
 
 #include "ui_mainwindow.h"
+#include "usermanual.h"
 
 struct DiveList;
 class QSortFilterProxyModel;
@@ -102,7 +103,6 @@ private slots:
        void initialUiSetup();
 
        void on_actionImportDiveLog_triggered();
-       void linkClickedSlot(QUrl url);
 
 protected:
        void closeEvent(QCloseEvent *);
@@ -117,7 +117,7 @@ private:
        Ui::MainWindow ui;
        QAction *actionNextDive;
        QAction *actionPreviousDive;
-       QWebView *helpView;
+       UserManual *helpView;
        CurrentState state;
        QString filter();
        bool askSaveChanges();
-- 
1.8.3.2

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to