From 064c0ba1526c5cb1bfcf353aea4f84d8ca6393d6 Mon Sep 17 00:00:00 2001
From: Nicolas Fella <nicolas.fella@gmx.de>
Date: Sat, 23 Apr 2022 22:10:55 +0200
Subject: [PATCH] Fix includes

Add missing ones

Remove unneeded ones

Convert forward decl to include where needed

Fix syntax where needed

(cherry picked from commit 6a6156db8b0041261ac4361a9231f2a974dde475)
---
 src/backends/R/rbackend.cpp                                   | 2 ++
 src/backends/R/rhighlighter.h                                 | 2 ++
 src/backends/R/rkeywords.cpp                                  | 4 ++--
 src/backends/R/rserver/rserver.cpp                            | 2 +-
 src/backends/julia/juliakeywords.cpp                          | 4 ++--
 src/backends/lua/luabackend.cpp                               | 2 ++
 src/backends/lua/luahelper.h                                  | 3 ++-
 src/backends/lua/luakeywords.cpp                              | 4 ++--
 src/backends/maxima/maximabackend.cpp                         | 2 ++
 src/backends/maxima/maximakeywords.cpp                        | 4 ++--
 src/backends/octave/octavebackend.cpp                         | 2 ++
 src/backends/octave/octavekeywords.cpp                        | 4 ++--
 src/backends/python/pythonbackend.cpp                         | 2 ++
 src/backends/python/pythonkeywords.cpp                        | 4 ++--
 src/backends/qalculate/qalculatebackend.cpp                   | 1 +
 src/backends/sage/sagebackend.cpp                             | 2 ++
 src/backends/sage/sagekeywords.cpp                            | 4 ++--
 src/backends/scilab/scilabbackend.cpp                         | 1 +
 src/backends/scilab/scilabkeywords.cpp                        | 4 ++--
 src/cantor.cpp                                                | 1 +
 src/commandentry.cpp                                          | 2 +-
 src/hierarchyentry.cpp                                        | 1 +
 src/horizontalruleentry.cpp                                   | 1 +
 src/lib/backend.cpp                                           | 2 ++
 src/lib/jupyterutils.h                                        | 2 +-
 src/lib/panelpluginhandler.cpp                                | 1 +
 .../documentationpanel/documentationpanelplugin.cpp           | 2 ++
 src/panelplugins/filebrowserpanel/filebrowserpanelplugin.cpp  | 1 +
 src/panelplugins/filebrowserpanel/filebrowserpanelplugin.h    | 1 +
 src/panelplugins/helppanel/helppanelplugin.cpp                | 1 +
 src/panelplugins/helppanel/helppanelplugin.h                  | 2 ++
 src/panelplugins/tocpanel/tocpanelplugin.cpp                  | 2 ++
 src/panelplugins/tocpanel/tocpanelplugin.h                    | 2 ++
 src/panelplugins/variablemgr/variablemanagerplugin.cpp        | 2 ++
 src/panelplugins/variablemgr/variablemanagerplugin.h          | 2 ++
 src/textentry.cpp                                             | 1 +
 src/worksheet.cpp                                             | 3 +++
 37 files changed, 62 insertions(+), 20 deletions(-)

diff --git a/src/backends/R/rbackend.cpp b/src/backends/R/rbackend.cpp
index 5e700fd8..6bc0fed9 100644
--- a/src/backends/R/rbackend.cpp
+++ b/src/backends/R/rbackend.cpp
@@ -10,6 +10,8 @@
 #include "settings.h"
 #include "rsettingswidget.h"
 
+#include <KPluginFactory>
+
 RBackend::RBackend(QObject* parent,const QList<QVariant>& args) : Cantor::Backend(parent, args)
 {
     new RScriptExtension(this);
diff --git a/src/backends/R/rhighlighter.h b/src/backends/R/rhighlighter.h
index f4bd99ff..4ff6f42e 100644
--- a/src/backends/R/rhighlighter.h
+++ b/src/backends/R/rhighlighter.h
@@ -8,6 +8,8 @@
 
 #include "defaulthighlighter.h"
 
+#include <QRegExp>
+
 class RSession;
 
 class RHighlighter : public Cantor::DefaultHighlighter
diff --git a/src/backends/R/rkeywords.cpp b/src/backends/R/rkeywords.cpp
index 407ca1c8..19ad6cb3 100644
--- a/src/backends/R/rkeywords.cpp
+++ b/src/backends/R/rkeywords.cpp
@@ -5,8 +5,8 @@
 
 #include "rkeywords.h"
 
-#include <repository.h>
-#include <KF5/KSyntaxHighlighting/Definition>
+#include <KSyntaxHighlighting/Repository>
+#include <KSyntaxHighlighting/Definition>
 
 RKeywords::RKeywords()
 {
diff --git a/src/backends/R/rserver/rserver.cpp b/src/backends/R/rserver/rserver.cpp
index f86c2a19..04f6194f 100644
--- a/src/backends/R/rserver/rserver.cpp
+++ b/src/backends/R/rserver/rserver.cpp
@@ -8,7 +8,7 @@
 // on the one hand comme il faut, on another, causes flickering in UI
 
 #include "rserver.h"
-#include <KIOCore/KIO/DeleteJob>
+#include <KIO/DeleteJob>
 #include "radaptor.h"
 #include "rcallbacks.h"
 #include "settings.h"
diff --git a/src/backends/julia/juliakeywords.cpp b/src/backends/julia/juliakeywords.cpp
index 13df83ad..20dbc2b7 100644
--- a/src/backends/julia/juliakeywords.cpp
+++ b/src/backends/julia/juliakeywords.cpp
@@ -4,8 +4,8 @@
 */
 #include "juliakeywords.h"
 
-#include <repository.h>
-#include <KF5/KSyntaxHighlighting/Definition>
+#include <KSyntaxHighlighting/Repository>
+#include <KSyntaxHighlighting/Definition>
 
 JuliaKeywords::JuliaKeywords()
 {
diff --git a/src/backends/lua/luabackend.cpp b/src/backends/lua/luabackend.cpp
index 81f0fb72..db2525cd 100644
--- a/src/backends/lua/luabackend.cpp
+++ b/src/backends/lua/luabackend.cpp
@@ -10,6 +10,8 @@
 #include "luasettingswidget.h"
 #include "settings.h"
 
+#include <KPluginFactory>
+
 LuaBackend::LuaBackend( QObject* parent,const QList<QVariant> args ) : Cantor::Backend( parent,args )
 {
     new LuaScriptExtension(this);
diff --git a/src/backends/lua/luahelper.h b/src/backends/lua/luahelper.h
index 470f4375..77ee9133 100644
--- a/src/backends/lua/luahelper.h
+++ b/src/backends/lua/luahelper.h
@@ -6,9 +6,10 @@
 #ifndef _LUAHELPER_H
 #define _LUAHELPER_H
 
+#include <QStringList>
+
 struct lua_State;
 class  QString;
-class  QStringList;
 
 /* follows lua_funcname convention */
 QString     luahelper_tostring   (lua_State* L, int idx);
diff --git a/src/backends/lua/luakeywords.cpp b/src/backends/lua/luakeywords.cpp
index 2069317d..b572e7e0 100644
--- a/src/backends/lua/luakeywords.cpp
+++ b/src/backends/lua/luakeywords.cpp
@@ -5,8 +5,8 @@
 
 #include "luakeywords.h"
 
-#include <repository.h>
-#include <KF5/KSyntaxHighlighting/Definition>
+#include <KSyntaxHighlighting/Repository>
+#include <KSyntaxHighlighting/Definition>
 
 LuaKeywords::LuaKeywords()
 {
diff --git a/src/backends/maxima/maximabackend.cpp b/src/backends/maxima/maximabackend.cpp
index 9c7c8430..d51f08a0 100644
--- a/src/backends/maxima/maximabackend.cpp
+++ b/src/backends/maxima/maximabackend.cpp
@@ -10,6 +10,8 @@
 #include "maximasettingswidget.h"
 #include "settings.h"
 
+#include <KPluginFactory>
+
 MaximaBackend::MaximaBackend( QObject* parent,const QList<QVariant> args ) : Cantor::Backend( parent,args )
 {
     //initialize the supported extensions
diff --git a/src/backends/maxima/maximakeywords.cpp b/src/backends/maxima/maximakeywords.cpp
index 6e7a9a0a..f80d6af7 100644
--- a/src/backends/maxima/maximakeywords.cpp
+++ b/src/backends/maxima/maximakeywords.cpp
@@ -7,8 +7,8 @@
 
 #include <QDebug>
 
-#include <repository.h>
-#include <KF5/KSyntaxHighlighting/Definition>
+#include <KSyntaxHighlighting/Repository>
+#include <KSyntaxHighlighting/Definition>
 
 MaximaKeywords* MaximaKeywords::instance()
 {
diff --git a/src/backends/octave/octavebackend.cpp b/src/backends/octave/octavebackend.cpp
index 3a33023e..d8894454 100644
--- a/src/backends/octave/octavebackend.cpp
+++ b/src/backends/octave/octavebackend.cpp
@@ -10,6 +10,8 @@
 #include "octavesettingswidget.h"
 #include "settings.h"
 
+#include <KPluginFactory>
+
 OctaveBackend::OctaveBackend(QObject* parent, const QList<QVariant>& args): Backend(parent, args)
 {
     new OctaveHistoryExtension(this);
diff --git a/src/backends/octave/octavekeywords.cpp b/src/backends/octave/octavekeywords.cpp
index c309dc1a..8f4289be 100644
--- a/src/backends/octave/octavekeywords.cpp
+++ b/src/backends/octave/octavekeywords.cpp
@@ -5,8 +5,8 @@
 
 #include "octavekeywords.h"
 
-#include <repository.h>
-#include <KF5/KSyntaxHighlighting/Definition>
+#include <KSyntaxHighlighting/Repository>
+#include <KSyntaxHighlighting/Definition>
 
 OctaveKeywords::OctaveKeywords()
 {
diff --git a/src/backends/python/pythonbackend.cpp b/src/backends/python/pythonbackend.cpp
index 87259089..db6cfea6 100644
--- a/src/backends/python/pythonbackend.cpp
+++ b/src/backends/python/pythonbackend.cpp
@@ -13,6 +13,8 @@
 #include <QDebug>
 #include <QWidget>
 
+#include <KPluginFactory>
+
 PythonBackend::PythonBackend(QObject* parent, const QList<QVariant>& args) : Cantor::Backend(parent, args)
 {
     new PythonLinearAlgebraExtension(this);
diff --git a/src/backends/python/pythonkeywords.cpp b/src/backends/python/pythonkeywords.cpp
index 09271a2e..9b28022f 100644
--- a/src/backends/python/pythonkeywords.cpp
+++ b/src/backends/python/pythonkeywords.cpp
@@ -8,8 +8,8 @@
 #include <QFile>
 #include <QDebug>
 
-#include <repository.h>
-#include <KF5/KSyntaxHighlighting/Definition>
+#include <KSyntaxHighlighting/Repository>
+#include <KSyntaxHighlighting/Definition>
 
 PythonKeywords::PythonKeywords()
 {
diff --git a/src/backends/qalculate/qalculatebackend.cpp b/src/backends/qalculate/qalculatebackend.cpp
index 6c978278..23050688 100644
--- a/src/backends/qalculate/qalculatebackend.cpp
+++ b/src/backends/qalculate/qalculatebackend.cpp
@@ -12,6 +12,7 @@
 #include "qalculatesettingswidget.h"
 
 #include <KLocalizedString>
+#include <KPluginFactory>
 
 QalculateBackend::QalculateBackend(QObject* parent,const QList<QVariant> args)
   : Cantor::Backend(parent, args)
diff --git a/src/backends/sage/sagebackend.cpp b/src/backends/sage/sagebackend.cpp
index d79747d0..6765f516 100644
--- a/src/backends/sage/sagebackend.cpp
+++ b/src/backends/sage/sagebackend.cpp
@@ -10,6 +10,8 @@
 #include "sagesettingswidget.h"
 #include "settings.h"
 
+#include <KPluginFactory>
+
 SageBackend::SageBackend( QObject* parent,const QList<QVariant>& args ) : Cantor::Backend( parent,args )
 {
     //initialize the supported extensions
diff --git a/src/backends/sage/sagekeywords.cpp b/src/backends/sage/sagekeywords.cpp
index 2cc2be0e..f81faa02 100644
--- a/src/backends/sage/sagekeywords.cpp
+++ b/src/backends/sage/sagekeywords.cpp
@@ -4,8 +4,8 @@
 */
 #include "sagekeywords.h"
 
-#include <repository.h>
-#include <KF5/KSyntaxHighlighting/Definition>
+#include <KSyntaxHighlighting/Repository>
+#include <KSyntaxHighlighting/Definition>
 
 #include <QDebug>
 
diff --git a/src/backends/scilab/scilabbackend.cpp b/src/backends/scilab/scilabbackend.cpp
index af2d9195..5dacd686 100644
--- a/src/backends/scilab/scilabbackend.cpp
+++ b/src/backends/scilab/scilabbackend.cpp
@@ -9,6 +9,7 @@
 #include "scilabsettingswidget.h"
 #include "settings.h"
 
+#include <KPluginFactory>
 
 ScilabBackend::ScilabBackend(QObject* parent,const QList<QVariant> args) : Cantor::Backend(parent, args)
 {
diff --git a/src/backends/scilab/scilabkeywords.cpp b/src/backends/scilab/scilabkeywords.cpp
index 04b555b6..aac7a4d9 100644
--- a/src/backends/scilab/scilabkeywords.cpp
+++ b/src/backends/scilab/scilabkeywords.cpp
@@ -10,8 +10,8 @@
 #include <QtAlgorithms>
 #include <QDebug>
 
-#include <repository.h>
-#include <KF5/KSyntaxHighlighting/Definition>
+#include <KSyntaxHighlighting/Repository>
+#include <KSyntaxHighlighting/Definition>
 
 ScilabKeywords::ScilabKeywords()
 {
diff --git a/src/cantor.cpp b/src/cantor.cpp
index a62d0be4..161f05e3 100644
--- a/src/cantor.cpp
+++ b/src/cantor.cpp
@@ -18,6 +18,7 @@
 #include <KNS3/DownloadDialog>
 #include <KParts/ReadWritePart>
 #include <KRecentFilesAction>
+#include <KPluginFactory>
 
 #include <QApplication>
 #include <QCloseEvent>
diff --git a/src/commandentry.cpp b/src/commandentry.cpp
index 3bc9359b..b0f8512e 100644
--- a/src/commandentry.cpp
+++ b/src/commandentry.cpp
@@ -20,7 +20,7 @@
 
 #include <QGuiApplication>
 #include <QDebug>
-#include <QDesktopWidget>
+#include <QActionGroup>
 #include <QFontDialog>
 #include <QScreen>
 #include <QTimer>
diff --git a/src/hierarchyentry.cpp b/src/hierarchyentry.cpp
index 30afba5e..59aa603f 100644
--- a/src/hierarchyentry.cpp
+++ b/src/hierarchyentry.cpp
@@ -16,6 +16,7 @@
 #include <QMimeData>
 #include <QPainter>
 #include <QDebug>
+#include <QActionGroup>
 
 #include <KLocalizedString>
 
diff --git a/src/horizontalruleentry.cpp b/src/horizontalruleentry.cpp
index 8763e109..32895323 100644
--- a/src/horizontalruleentry.cpp
+++ b/src/horizontalruleentry.cpp
@@ -9,6 +9,7 @@
 #include <QPainter>
 #include <QPropertyAnimation>
 #include <QJsonObject>
+#include <QActionGroup>
 
 #include <KLocalizedString>
 
diff --git a/src/lib/backend.cpp b/src/lib/backend.cpp
index cd082503..a5426ed2 100644
--- a/src/lib/backend.cpp
+++ b/src/lib/backend.cpp
@@ -13,8 +13,10 @@
 #include <QUrl>
 #include <QProcess>
 #include <QStandardPaths>
+#include <QPluginLoader>
 
 #include <KPluginMetaData>
+#include <KPluginFactory>
 #include <KLocalizedString>
 
 using namespace Cantor;
diff --git a/src/lib/jupyterutils.h b/src/lib/jupyterutils.h
index b2172884..714be188 100644
--- a/src/lib/jupyterutils.h
+++ b/src/lib/jupyterutils.h
@@ -10,6 +10,7 @@
 
 #include <QString>
 #include <QMimeDatabase>
+#include <QStringList>
 
 #include "cantor_export.h"
 
@@ -19,7 +20,6 @@ class QJsonArray;
 class QJsonDocument;
 class QImage;
 class QUrl;
-class QStringList;
 
 namespace Cantor {
 
diff --git a/src/lib/panelpluginhandler.cpp b/src/lib/panelpluginhandler.cpp
index 418e5cba..2604a2dc 100644
--- a/src/lib/panelpluginhandler.cpp
+++ b/src/lib/panelpluginhandler.cpp
@@ -9,6 +9,7 @@ using namespace Cantor;
 #include <QDebug>
 #include <QDir>
 #include <KPluginMetaData>
+#include <KPluginFactory>
 
 #include "session.h"
 #include "backend.h"
diff --git a/src/panelplugins/documentationpanel/documentationpanelplugin.cpp b/src/panelplugins/documentationpanel/documentationpanelplugin.cpp
index 23589ac3..973b41bb 100644
--- a/src/panelplugins/documentationpanel/documentationpanelplugin.cpp
+++ b/src/panelplugins/documentationpanel/documentationpanelplugin.cpp
@@ -8,6 +8,8 @@
 #include "documentationpanelwidget.h"
 #include "session.h"
 
+#include <KPluginFactory>
+
 DocumentationPanelPlugin::DocumentationPanelPlugin(QObject* parent, QList<QVariant> args) : Cantor::PanelPlugin(parent)
 {
     Q_UNUSED(args);
diff --git a/src/panelplugins/filebrowserpanel/filebrowserpanelplugin.cpp b/src/panelplugins/filebrowserpanel/filebrowserpanelplugin.cpp
index 8f3d832e..f7620e97 100644
--- a/src/panelplugins/filebrowserpanel/filebrowserpanelplugin.cpp
+++ b/src/panelplugins/filebrowserpanel/filebrowserpanelplugin.cpp
@@ -22,6 +22,7 @@
 
 #include <KLocalizedString>
 #include <KParts/ReadOnlyPart>
+#include <KPluginFactory>
 
 FileBrowserPanelPlugin::FileBrowserPanelPlugin(QObject* parent, const QList<QVariant>& args): Cantor::PanelPlugin(parent),
     m_mainWidget(nullptr), m_treeview(nullptr), m_pathEdit(nullptr), m_filterCombobox(nullptr)
diff --git a/src/panelplugins/filebrowserpanel/filebrowserpanelplugin.h b/src/panelplugins/filebrowserpanel/filebrowserpanelplugin.h
index 4fe9e194..4215e145 100644
--- a/src/panelplugins/filebrowserpanel/filebrowserpanelplugin.h
+++ b/src/panelplugins/filebrowserpanel/filebrowserpanelplugin.h
@@ -6,6 +6,7 @@
 #ifndef _FILEBROWSERPANELPLUGIN_H
 #define _FILEBROWSERPANELPLUGIN_H
 
+#include <QPointer>
 #include <QVector>
 
 #include "panelplugin.h"
diff --git a/src/panelplugins/helppanel/helppanelplugin.cpp b/src/panelplugins/helppanel/helppanelplugin.cpp
index 164cc3f2..04d6b618 100644
--- a/src/panelplugins/helppanel/helppanelplugin.cpp
+++ b/src/panelplugins/helppanel/helppanelplugin.cpp
@@ -7,6 +7,7 @@
 
 #include <KLocalizedString>
 #include <KTextEdit>
+#include <KPluginFactory>
 
 HelpPanelPlugin::HelpPanelPlugin(QObject* parent, const QList<QVariant>& args) : Cantor::PanelPlugin(parent), m_edit(nullptr)
 {
diff --git a/src/panelplugins/helppanel/helppanelplugin.h b/src/panelplugins/helppanel/helppanelplugin.h
index 473b1148..b16a1184 100644
--- a/src/panelplugins/helppanel/helppanelplugin.h
+++ b/src/panelplugins/helppanel/helppanelplugin.h
@@ -6,6 +6,8 @@
 #ifndef _HELPPANELPLUGIN_H
 #define _HELPPANELPLUGIN_H
 
+#include <QPointer>
+
 #include "panelplugin.h"
 
 class KTextEdit;
diff --git a/src/panelplugins/tocpanel/tocpanelplugin.cpp b/src/panelplugins/tocpanel/tocpanelplugin.cpp
index 24c13355..6df4c3a9 100644
--- a/src/panelplugins/tocpanel/tocpanelplugin.cpp
+++ b/src/panelplugins/tocpanel/tocpanelplugin.cpp
@@ -10,6 +10,8 @@
 #include <QDebug>
 #include <QWidget>
 
+#include <KPluginFactory>
+
 TableOfContentPanelPlugin::TableOfContentPanelPlugin(QObject* parent, const QList<QVariant>& args): Cantor::PanelPlugin(parent),
     m_mainWidget(nullptr)
 {
diff --git a/src/panelplugins/tocpanel/tocpanelplugin.h b/src/panelplugins/tocpanel/tocpanelplugin.h
index 5ce24b78..fed98b8c 100644
--- a/src/panelplugins/tocpanel/tocpanelplugin.h
+++ b/src/panelplugins/tocpanel/tocpanelplugin.h
@@ -8,6 +8,8 @@
 
 #include <QStringListModel>
 
+#include <QPointer>
+
 #include "panelplugin.h"
 
 class QWidget;
diff --git a/src/panelplugins/variablemgr/variablemanagerplugin.cpp b/src/panelplugins/variablemgr/variablemanagerplugin.cpp
index 3482eed0..8526fc3b 100644
--- a/src/panelplugins/variablemgr/variablemanagerplugin.cpp
+++ b/src/panelplugins/variablemgr/variablemanagerplugin.cpp
@@ -8,6 +8,8 @@
 #include "session.h"
 #include "variablemanagerwidget.h"
 
+#include <KPluginFactory>
+
 VariableManagerPlugin::VariableManagerPlugin(QObject* parent, QList<QVariant> args) : Cantor::PanelPlugin(parent), m_widget(nullptr)
 {
     Q_UNUSED(args);
diff --git a/src/panelplugins/variablemgr/variablemanagerplugin.h b/src/panelplugins/variablemgr/variablemanagerplugin.h
index 75ce6851..2dd98e4d 100644
--- a/src/panelplugins/variablemgr/variablemanagerplugin.h
+++ b/src/panelplugins/variablemgr/variablemanagerplugin.h
@@ -6,6 +6,8 @@
 #ifndef _VARIABLEMANAGERPLUGIN_H
 #define _VARIABLEMANAGERPLUGIN_H
 
+#include <QPointer>
+
 #include "panelplugin.h"
 
 class VariableManagerWidget;
diff --git a/src/textentry.cpp b/src/textentry.cpp
index 4c8d192d..3ba54f5a 100644
--- a/src/textentry.cpp
+++ b/src/textentry.cpp
@@ -25,6 +25,7 @@
 #include <QRegularExpression>
 #include <QStringList>
 #include <QInputDialog>
+#include <QActionGroup>
 
 QStringList standartRawCellTargetNames = {QLatin1String("None"), QLatin1String("LaTeX"), QLatin1String("reST"), QLatin1String("HTML"), QLatin1String("Markdown")};
 QStringList standartRawCellTargetMimes = {QString(), QLatin1String("text/latex"), QLatin1String("text/restructuredtext"), QLatin1String("text/html"), QLatin1String("text/markdown")};
diff --git a/src/worksheet.cpp b/src/worksheet.cpp
index 7697a233..a3d961eb 100644
--- a/src/worksheet.cpp
+++ b/src/worksheet.cpp
@@ -32,9 +32,12 @@
 #include <QGraphicsSceneMouseEvent>
 #include <QJsonArray>
 #include <QJsonDocument>
+#include <QJsonObject>
 #include <QPrinter>
 #include <QRegularExpression>
 #include <QTimer>
+#include <QActionGroup>
+#include <QFile>
 #include <QXmlQuery>
 
 #include <kcoreaddons_version.h>
-- 
GitLab

