From 3097da1c42ba7fe3b6a26ccb64df64db9c5588b7 Mon Sep 17 00:00:00 2001
From: Dag Andersen <dag.andersen@kdemail.net>
Date: Mon, 26 Oct 2020 13:46:06 +0100
Subject: [PATCH 1/2] Remove dependency on KHtml

This also removes the introductory pages,
but these should be cver by the documentation.
---
 CMakeLists.txt              | 10 +++----
 src/CMakeLists.txt          |  2 --
 src/kptmaindocument.cpp     |  1 -
 src/kptmaindocument.h       |  5 ----
 src/kptpart.cpp             | 47 --------------------------------
 src/kptpart.h               |  4 ---
 src/kptview.cpp             | 53 -------------------------------------
 src/kptview.h               | 10 -------
 src/libs/ui/CMakeLists.txt  |  5 +---
 src/welcome/WelcomeView.cpp |  9 -------
 src/welcome/WelcomeView.h   |  1 -
 src/welcome/WelcomeView.ui  |  6 +----
 12 files changed, 7 insertions(+), 146 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4348601c..13ac4d24 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -150,11 +150,11 @@ if(KF5Activities_FOUND)
     set(HAVE_KACTIVITIES TRUE)
 endif()
 
-find_package(KF5KHtml)
-set_package_properties(KF5KHtml PROPERTIES
-    PURPOSE "Required for rich text support"
-    TYPE REQUIRED
-)
+#find_package(KF5KHtml)
+#set_package_properties(KF5KHtml PROPERTIES
+    #PURPOSE "Required for rich text support"
+    #TYPE REQUIRED
+#)
 
 find_package(KF5Holidays)
 set_package_properties(KF5Holidays PROPERTIES
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 54f1df57..ee1a6137 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -145,8 +145,6 @@ set(planprivate_LIB_SRCS
     kptinsertfiledlg.cpp
     kptloadsharedprojectsdialog.cpp
 
-    about/aboutpage.cpp
-
     KPlatoXmlLoader.cpp
 )
 
diff --git a/src/kptmaindocument.cpp b/src/kptmaindocument.cpp
index b4fe670f..f65f2eb0 100644
--- a/src/kptmaindocument.cpp
+++ b/src/kptmaindocument.cpp
@@ -257,7 +257,6 @@ void MainDocument::setProject(Project *project)
         connect(m_project, &Project::nodeChanged, this, &MainDocument::slotNodeChanged);
         connect(m_project, &Project::sigCalculationFinished, this, &MainDocument::slotCalculationFinished);
     }
-    m_aboutPage.setProject(project);
 
     QString dir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
     if (!dir.isEmpty()) {
diff --git a/src/kptmaindocument.h b/src/kptmaindocument.h
index 44ab931c..01ad942d 100644
--- a/src/kptmaindocument.h
+++ b/src/kptmaindocument.h
@@ -31,7 +31,6 @@
 #include "kptconfig.h"
 #include "kptwbsdefinition.h"
 #include "kptxmlloaderobject.h"
-#include "about/aboutpage.h"
 
 #include "KoDocument.h"
 
@@ -130,8 +129,6 @@ public:
     bool insertProject(Project &project, Node *parent, Node *after);
     bool mergeResources(Project &project);
 
-    KPlatoAboutPage &aboutPage() { return m_aboutPage; }
-
     bool extractFiles(KoStore *store, Package *package);
     bool extractFile(KoStore *store, Package *package, const Document *doc);
 
@@ -254,8 +251,6 @@ private:
     QList<QUrl> m_skipUrls;
     QMap<QDateTime, Project*> m_mergedPackages;
 
-    KPlatoAboutPage m_aboutPage;
-
     QDomDocument m_reports;
 
     bool m_viewlistModified;
diff --git a/src/kptpart.cpp b/src/kptpart.cpp
index cd31b6ce..d498f5e1 100644
--- a/src/kptpart.cpp
+++ b/src/kptpart.cpp
@@ -25,7 +25,6 @@
 #include "kptmaindocument.h"
 #include "kptfactory.h"
 #include "welcome/WelcomeView.h"
-#include "kpthtmlview.h"
 #include "Help.h"
 #include "calligraplansettings.h"
 #include "kptdebug.h"
@@ -163,7 +162,6 @@ void Part::createStarUpWidget(KoMainWindow *parent)
     startUpWidget = new QStackedWidget(parent);
 
     startUpWidget->addWidget(createWelcomeView(parent));
-    startUpWidget->addWidget(createIntroductionView());
 }
 
 void Part::finish()
@@ -188,7 +186,6 @@ QWidget *Part::createWelcomeView(KoMainWindow *mw)
 
     connect(v, &WelcomeView::loadSharedResources, doc, &MainDocument::insertResourcesFile);
     connect(v, &WelcomeView::recentProject, mw, &KoMainWindow::slotFileOpenRecent);
-    connect(v, &WelcomeView::showIntroduction, this, &Part::slotShowIntroduction);
     connect(v, &WelcomeView::projectCreated, doc, &MainDocument::slotProjectCreated);
     connect(v, &WelcomeView::finished, this, &Part::finish);
 
@@ -197,50 +194,6 @@ QWidget *Part::createWelcomeView(KoMainWindow *mw)
     return v;
 }
 
-void Part::slotShowIntroduction()
-{
-    startUpWidget->setCurrentIndex(1);
-    slotOpenUrlRequest(static_cast<HtmlView*>(startUpWidget->currentWidget()), QUrl("about:plan/main"));
-}
-
-void Part::slotOpenUrlRequest(HtmlView *v, const QUrl &url)
-{
-    debugPlan<<url;
-    if (url.scheme() == QLatin1String("about")) {
-        if (url.url() == QLatin1String("about:close")) {
-            startUpWidget->setCurrentIndex(0);
-            return;
-        }
-        if (url.url().startsWith(QLatin1String("about:plan"))) {
-            MainDocument *doc = static_cast<MainDocument*>(document());
-            doc->aboutPage().generatePage(v->htmlPart(), url);
-            return;
-        }
-    }
-    if (url.scheme() == QLatin1String("help")) {
-        KHelpClient::invokeHelp("", url.fileName());
-        return;
-    }
-    // try to open the url
-    debugPlan<<url<<"is external, discard";
-    new KRun(url,  currentMainwindow());
-}
-
-QWidget *Part::createIntroductionView()
-{
-    HtmlView *v = new HtmlView(this, document(), startUpWidget);
-    v->htmlPart().setJScriptEnabled(false);
-    v->htmlPart().setJavaEnabled(false);
-    v->htmlPart().setMetaRefreshEnabled(false);
-    v->htmlPart().setPluginsEnabled(false);
-
-    slotOpenUrlRequest(v, QUrl("about:plan/main"));
-
-    connect(v, &KPlato::HtmlView::openUrlRequest, this, &KPlato::Part::slotOpenUrlRequest);
-
-    return v;
-}
-
 void Part::configure(KoMainWindow *mw)
 {
     //debugPlan;
diff --git a/src/kptpart.h b/src/kptpart.h
index 90f50257..20429fe2 100644
--- a/src/kptpart.h
+++ b/src/kptpart.h
@@ -33,7 +33,6 @@ class QStackedWidget;
 namespace KPlato
 {
 class MainDocument;
-class HtmlView;
 
 class PLAN_EXPORT Part : public KoPart
 {
@@ -63,8 +62,6 @@ public Q_SLOTS:
     void finish();
 
 protected Q_SLOTS:
-    void slotShowIntroduction();
-    void slotOpenUrlRequest(KPlato::HtmlView *v, const QUrl &url);
     void openTemplate(const QUrl& url) override;
     void slotOpenTemplate(const QUrl& url);
 
@@ -74,7 +71,6 @@ protected Q_SLOTS:
 protected:
     void createStarUpWidget(KoMainWindow *parent);
     QWidget *createWelcomeView(KoMainWindow *parent);
-    QWidget *createIntroductionView();
 
 private:
     KPlato::MainDocument *m_document;
diff --git a/src/kptview.cpp b/src/kptview.cpp
index aa2c3dd7..7af53136 100644
--- a/src/kptview.cpp
+++ b/src/kptview.cpp
@@ -103,7 +103,6 @@
 #include "kptpertresult.h"
 #include "kptinsertfiledlg.h"
 #include "kptloadsharedprojectsdialog.h"
-#include "kpthtmlview.h"
 #include "about/aboutpage.h"
 #include "kptlocaleconfigmoneydialog.h"
 #include "kptflatproxymodel.h"
@@ -196,7 +195,6 @@ View::View(KoPart *part, MainDocument *doc, QWidget *parent)
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
     // Add sub views
-    createIntroductionView();
 
     // The menu items
     // ------ File
@@ -258,11 +256,6 @@ View::View(KoPart *part, MainDocument *doc, QWidget *parent)
     connect(actionOpenReportFile, QAction::triggered, this, &View::slotOpenReportFile);
 #endif
 
-    // ------ Help
-    actionIntroduction  = new QAction(koIcon("dialog-information"), i18n("Introduction to Plan"), this);
-    actionCollection()->addAction("plan_introduction", actionIntroduction);
-    connect(actionIntroduction, &QAction::triggered, this, &View::slotIntroduction);
-
     // ------ Popup
     actionOpenNode  = new QAction(koIcon("document-edit"), i18n("Edit..."), this);
     actionCollection()->addAction("node_properties", actionOpenNode);
@@ -762,46 +755,6 @@ ViewInfo View::defaultCategoryInfo(const QString &type) const
     return vi;
 }
 
-void View::slotOpenUrlRequest(HtmlView *v, const QUrl &url)
-{
-    debugPlan<<url;
-    if (url.scheme() == QLatin1String("about")) {
-        if (url.url() == QLatin1String("about:close")) {
-            int view = m_visitedViews.count() < 2 ? qMin(m_defaultView, m_tab->count()-1) : m_visitedViews.at(m_visitedViews.count() - 2);
-            debugPlan<<"Prev:"<<view<<m_visitedViews;
-            m_tab->setCurrentIndex(view);
-            return;
-        }
-        if (url.url().startsWith(QLatin1String("about:plan"))) {
-            getPart()->aboutPage().generatePage(v->htmlPart(), url);
-            return;
-        }
-    }
-    if (url.scheme() == QLatin1String("help")) {
-        KHelpClient::invokeHelp("", url.fileName());
-        return;
-    }
-    // try to open the url
-    debugPlan<<url<<"is external, try to open";
-    new KRun(url, mainWindow());
-}
-
-ViewBase *View::createIntroductionView()
-{
-    HtmlView *v = new HtmlView(getKoPart(), getPart(), m_tab);
-    v->htmlPart().setJScriptEnabled(false);
-    v->htmlPart().setJavaEnabled(false);
-    v->htmlPart().setMetaRefreshEnabled(false);
-    v->htmlPart().setPluginsEnabled(false);
-
-    slotOpenUrlRequest(v, QUrl("about:plan/main"));
-
-    connect(v, &HtmlView::openUrlRequest, this, &View::slotOpenUrlRequest);
-
-    m_tab->addWidget(v);
-    return v;
-}
-
 ViewBase *View::createResourceAppointmentsGanttView(ViewListItem *cat, const QString &tag, const QString &name, const QString &tip, int index)
 {
     ResourceAppointmentsGanttView *v = new ResourceAppointmentsGanttView(getKoPart(), getPart(), m_tab);
@@ -1966,12 +1919,6 @@ void View::slotDefineWBSFinished(int result)
     dia->deleteLater();
 }
 
-void View::slotIntroduction()
-{
-    m_tab->setCurrentIndex(0);
-}
-
-
 Calendar *View::currentCalendar()
 {
     ViewBase *v = dynamic_cast<ViewBase*>(m_tab->currentWidget());
diff --git a/src/kptview.h b/src/kptview.h
index b9242811..33b9a198 100644
--- a/src/kptview.h
+++ b/src/kptview.h
@@ -84,7 +84,6 @@ class ResourceGroup;
 class Relation;
 class Context;
 class ViewAdaptor;
-class HtmlView;
 class ReportView;
 
 class ReportDesignDialog;
@@ -179,8 +178,6 @@ public Q_SLOTS:
 
     void slotCreateView();
 
-    void slotIntroduction();
-
     void openRelationDialog(KPlato::Node *par, KPlato::Node *child);
     void slotEditRelation(KPlato::Relation *rel);
     void slotAddRelation(KPlato::Node *par, KPlato::Node *child, int linkType);
@@ -258,8 +255,6 @@ protected Q_SLOTS:
     void slotMailWorkpackage(KPlato::Node *node, KPlato::Resource *resource = nullptr);
     void slotPublishWorkpackages(const QList<KPlato::Node*> &nodes, KPlato::Resource *resource, bool mailTo);
 
-    void slotOpenUrlRequest(KPlato::HtmlView *v, const QUrl &url);
-
     void createReportView(const QDomDocument &doc);
 
     void saveTaskModule(const QUrl &url, KPlato::Project *project);
@@ -281,8 +276,6 @@ protected:
 
     ViewBase *currentView() const;
 
-    ViewBase *createIntroductionView();
-
 private Q_SLOTS:
     void slotActionDestroyed(QObject *o);
     void slotViewListItemRemoved(KPlato::ViewListItem *item);
@@ -383,9 +376,6 @@ private:
     // ------ Settings
     QAction *actionConfigure;
 
-    // ------ Help
-    QAction *actionIntroduction;
-
     // ------ Popup
     QAction *actionOpenNode;
     QAction *actionTaskProgress;
diff --git a/src/libs/ui/CMakeLists.txt b/src/libs/ui/CMakeLists.txt
index ca22f77f..15d8087c 100644
--- a/src/libs/ui/CMakeLists.txt
+++ b/src/libs/ui/CMakeLists.txt
@@ -96,8 +96,6 @@ set(planui_LIB_SRCS
     kptworkpackagemergedialog.cpp
     kptrecalculatedialog.cpp
 
-    kpthtmlview.cpp
-
     locale/localemon.cpp
     kptlocaleconfigmoneydialog.cpp
 
@@ -166,13 +164,12 @@ target_link_libraries(planui
     PUBLIC
         planmain
         planmodels
-        KF5::KHtml
+        KF5::TextWidgets
     PRIVATE
         KChart
         KF5::ItemViews
         KF5::IconThemes
         KF5::Archive
-        KF5::TextWidgets
         KF5::KIOCore
         KF5::KIOFileWidgets
         KF5::KIOWidgets
diff --git a/src/welcome/WelcomeView.cpp b/src/welcome/WelcomeView.cpp
index bede7f4f..b6115fd7 100644
--- a/src/welcome/WelcomeView.cpp
+++ b/src/welcome/WelcomeView.cpp
@@ -156,14 +156,6 @@ WelcomeView::WelcomeView(KoPart *part, KoDocument *doc, QWidget *parent)
                           "<nl/>This enables you to quickly open projects you have worked on recently."
                           "</para>"));
 
-    Help::add(ui.introductionBtn,
-                   xi18nc("@info:whatsthis",
-                          "<title>Introduction to <application>Plan</application></title>"
-                          "<para>"
-                          "These introductory pages gives you hints and tips on what"
-                          " you can use <application>Plan</application> for, and how to use it."
-                          "</para>"));
-
     Help::add(ui.contextHelp,
                    xi18nc("@info:whatsthis",
                           "<title>Context help</title>"
@@ -199,7 +191,6 @@ WelcomeView::WelcomeView(KoPart *part, KoDocument *doc, QWidget *parent)
     connect(ui.newProjectBtn, &QAbstractButton::clicked, this, &WelcomeView::slotNewProject);
     connect(ui.createResourceFileBtn, &QAbstractButton::clicked, this, &WelcomeView::slotCreateResourceFile);
     connect(ui.openProjectBtn, &QAbstractButton::clicked, this, &WelcomeView::slotOpenProject);
-    connect(ui.introductionBtn, &QAbstractButton::clicked, this, &WelcomeView::showIntroduction);
 
     connect(ui.recentProjects, &QAbstractItemView::activated, this, &WelcomeView::slotRecentFileSelected);
 
diff --git a/src/welcome/WelcomeView.h b/src/welcome/WelcomeView.h
index a09ebe2d..be604de7 100644
--- a/src/welcome/WelcomeView.h
+++ b/src/welcome/WelcomeView.h
@@ -64,7 +64,6 @@ Q_SIGNALS:
     void newProject();
     void openProject();
     void recentProject(const QUrl &file, KoPart *part);
-    void showIntroduction();
     void selectDefaultView();
     void loadSharedResources(const QUrl &url, const QUrl &projects);
     void openExistingFile(const QUrl &url);
diff --git a/src/welcome/WelcomeView.ui b/src/welcome/WelcomeView.ui
index 7317214b..9b3363db 100644
--- a/src/welcome/WelcomeView.ui
+++ b/src/welcome/WelcomeView.ui
@@ -231,14 +231,10 @@
         </spacer>
        </item>
        <item>
-        <widget class="QPushButton" name="introductionBtn">
+        <widget class="QLabel" name="label_6">
          <property name="text">
           <string>Introduction</string>
          </property>
-         <property name="icon">
-          <iconset theme="help-hint">
-           <normaloff>.</normaloff>.</iconset>
-         </property>
         </widget>
        </item>
        <item>
-- 
2.29.1


From 8aec5de56c525e71ae650abd4abfba756f5e5724 Mon Sep 17 00:00:00 2001
From: Dag Andersen <dag.andersen@kdemail.net>
Date: Mon, 26 Oct 2020 14:17:48 +0100
Subject: [PATCH 2/2] User docs now on docs.kde.org

---
 src/welcome/WelcomeView.ui | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/welcome/WelcomeView.ui b/src/welcome/WelcomeView.ui
index 9b3363db..741913b3 100644
--- a/src/welcome/WelcomeView.ui
+++ b/src/welcome/WelcomeView.ui
@@ -307,7 +307,7 @@
         <string>https://userbase.kde.org/Plan</string>
        </property>
        <property name="text">
-        <string comment="@action:button">&lt;a href=&quot;https://userbase.kde.org/Plan&quot;&gt;Plan user documentation&lt;/a&gt;</string>
+        <string comment="@action:button">&lt;a href=&quot;https://docs.kde.org/index.php?application=calligraplan&quot;&gt;Plan user documentation&lt;/a&gt;</string>
        </property>
        <property name="alignment">
         <set>Qt::AlignCenter</set>
-- 
2.29.1

