From a22d8242022bdb4b295f2b64cf854c3f7a5811e6 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Sun, 18 Apr 2021 10:23:01 +0200
Subject: [PATCH] Add to main menu > Help > Visit web docs

This resolves #41
---
 GUI/coregui/Views/WelcomeView.cpp                 |  2 +-
 GUI/coregui/mainwindow/aboutapplicationdialog.cpp |  4 ++--
 GUI/coregui/mainwindow/actionmanager.cpp          | 11 ++++++++++-
 GUI/coregui/mainwindow/actionmanager.h            |  1 +
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/GUI/coregui/Views/WelcomeView.cpp b/GUI/coregui/Views/WelcomeView.cpp
index ebab66b38d9..0999fd9bff7 100644
--- a/GUI/coregui/Views/WelcomeView.cpp
+++ b/GUI/coregui/Views/WelcomeView.cpp
@@ -135,7 +135,7 @@ void WelcomeView::onWebLinkClicked(const QUrl& url)
 
 void WelcomeView::onNewUser()
 {
-    QDesktopServices::openUrl(QUrl("http://www.bornagainproject.org"));
+    QDesktopServices::openUrl(QUrl("https://www.bornagainproject.org"));
 }
 
 void WelcomeView::updateRecentProjectPanel()
diff --git a/GUI/coregui/mainwindow/aboutapplicationdialog.cpp b/GUI/coregui/mainwindow/aboutapplicationdialog.cpp
index 5e564a432dc..eb0b744b1c5 100644
--- a/GUI/coregui/mainwindow/aboutapplicationdialog.cpp
+++ b/GUI/coregui/mainwindow/aboutapplicationdialog.cpp
@@ -111,8 +111,8 @@ QBoxLayout* AboutApplicationDialog::createTextLayout()
 
     // home page
     auto homepageLabel = createLinkLabel(
-        "Documentation at"
-        " <a href=\"http://www.bornagainproject.org\">www.bornagainproject.org</a>.");
+        "Homepage: "
+        " <a href=\"https://www.bornagainproject.org\">www.bornagainproject.org</a>.");
     homepageLabel->setFont(normalFont);
 
     // mailing list
diff --git a/GUI/coregui/mainwindow/actionmanager.cpp b/GUI/coregui/mainwindow/actionmanager.cpp
index c8105febb7f..9f64a598402 100644
--- a/GUI/coregui/mainwindow/actionmanager.cpp
+++ b/GUI/coregui/mainwindow/actionmanager.cpp
@@ -25,10 +25,12 @@
 #include "GUI/coregui/utils/qstringutils.h"
 #include "Views/JobView.h"
 #include "Views/SampleView.h"
+#include <QDesktopServices>
 #include <QDir>
 #include <QMenuBar>
 #include <QSettings>
 #include <QShortcut>
+#include <QUrl>
 
 ActionManager::ActionManager(MainWindow* parent)
     : QObject(parent)
@@ -94,8 +96,14 @@ void ActionManager::createActions()
     m_exitAction->setStatusTip("Exit the application");
     connect(m_exitAction, &QAction::triggered, m_mainWindow, &MainWindow::close);
 
+    // visit web doc action
+    m_webdocAction = new QAction("&Visit web docs", this);
+    m_webdocAction->setStatusTip("Open BornAgain documentation in default browser");
+    connect(m_webdocAction, &QAction::triggered, this,
+            []() { QDesktopServices::openUrl(QUrl("https://www.bornagainproject.org/m")); });
+
     // about application action
-    m_aboutAction = new QAction("About &BornAgain", this);
+    m_aboutAction = new QAction("&About BornAgain", this);
     m_aboutAction->setStatusTip("About the application");
     connect(m_aboutAction, &QAction::triggered, this, &ActionManager::onAboutApplication);
 }
@@ -153,6 +161,7 @@ void ActionManager::createMenus()
 
     // Help Menu
     m_helpMenu = m_menuBar->addMenu("&Help");
+    m_helpMenu->addAction(m_webdocAction);
     m_helpMenu->addAction(m_aboutAction);
 
     onCurrentViewChanged();
diff --git a/GUI/coregui/mainwindow/actionmanager.h b/GUI/coregui/mainwindow/actionmanager.h
index 0e066835795..73904a0683f 100644
--- a/GUI/coregui/mainwindow/actionmanager.h
+++ b/GUI/coregui/mainwindow/actionmanager.h
@@ -49,6 +49,7 @@ private:
     QAction* m_saveAction;
     QAction* m_saveAsAction;
     QAction* m_exitAction;
+    QAction* m_webdocAction;
     QAction* m_aboutAction;
 
     QMenuBar* m_menuBar;
-- 
GitLab