aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/term
diff options
context:
space:
mode:
authorGravatar ctrlaltca2023-07-08 01:38:33 +0200
committerGravatar GitHub2023-07-08 01:38:33 +0200
commit28292170d8c02743cabfabba3a1623b8d71b9aa2 (patch)
tree03c7269f527a40a5b86863db7c111f2552afe46c /src/modules/term
parentMerge branch 'bugfix/script-editor-out-of-range-exception' (diff)
downloadKVIrc-28292170d8c02743cabfabba3a1623b8d71b9aa2.tar.gz
KVIrc-28292170d8c02743cabfabba3a1623b8d71b9aa2.tar.bz2
KVIrc-28292170d8c02743cabfabba3a1623b8d71b9aa2.zip
Port to (and require) Qt 5.15. Drop KDE4 support, fix KDE5 (#2541)
* Port to (and require) Qt 5.15. Drop KDE4 support, implement KDE5 support where needed. --------- Co-authored-by: Fabio Bas <fabio.bas@officineinformatiche.net>
Diffstat (limited to 'src/modules/term')
-rw-r--r--src/modules/term/TermWidget.cpp36
-rw-r--r--src/modules/term/TermWidget.h4
-rw-r--r--src/modules/term/TermWindow.cpp2
-rw-r--r--src/modules/term/TermWindow.h2
-rw-r--r--src/modules/term/libkviterm.cpp10
5 files changed, 22 insertions, 32 deletions
diff --git a/src/modules/term/TermWidget.cpp b/src/modules/term/TermWidget.cpp
index 304daea00..14ea1e518 100644
--- a/src/modules/term/TermWidget.cpp
+++ b/src/modules/term/TermWidget.cpp
@@ -34,11 +34,10 @@
#include <QToolTip>
#include <QTimer>
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
-#include "klibloader.h"
-#include "kparts/part.h"
-#include "kparts/factory.h"
+#include <KPluginFactory>
+#include <KParts/ReadOnlyPart>
#include <kde_terminal_interface.h>
#include <unordered_set>
@@ -78,32 +77,23 @@ TermWidget::TermWidget(QWidget * par, bool bIsStandalone)
setFrameStyle(QFrame::Sunken | QFrame::Panel);
- KPluginFactory * pKonsoleFactory = KPluginLoader("libkonsolepart").factory();
+ m_pKonsolePart = KPluginFactory::instantiatePlugin<KParts::ReadOnlyPart>(KPluginMetaData(QStringLiteral("konsolepart")), this).plugin;
- if(pKonsoleFactory)
+ if(m_pKonsolePart)
{
- m_pKonsolePart = static_cast<KParts::ReadOnlyPart *>(pKonsoleFactory->create<QObject>(this, this));
+ // start the terminal
+ qobject_cast<TerminalInterface *>(m_pKonsolePart)->showShellInDir(QString());
- if(m_pKonsolePart)
- {
- // start the terminal
- qobject_cast<TerminalInterface *>(m_pKonsolePart)->showShellInDir(QString());
+ m_pKonsoleWidget = m_pKonsolePart->widget();
- m_pKonsoleWidget = m_pKonsolePart->widget();
+ setFocusProxy(m_pKonsoleWidget);
+ m_pKonsoleWidget->show();
- setFocusProxy(m_pKonsoleWidget);
- m_pKonsoleWidget->show();
-
- connect(m_pKonsolePart, SIGNAL(destroyed()), this, SLOT(konsoleDestroyed()));
- }
- else
- {
- m_pKonsoleWidget = new QLabel(__tr2qs("Can't create the terminal emulation part"), this);
- }
+ connect(m_pKonsolePart, SIGNAL(destroyed()), this, SLOT(konsoleDestroyed()));
}
else
{
- m_pKonsoleWidget = new QLabel(__tr2qs("Can't retrieve the terminal emulation factory"), this);
+ m_pKonsoleWidget = new QLabel(__tr2qs("Can't create the terminal emulation part"), this);
}
}
@@ -183,4 +173,4 @@ QSize TermWidget::sizeHint() const
return QSize(wdth + 2, hght + 2);
}
-#endif //COMPILE_KDE4_SUPPORT
+#endif //COMPILE_KDE_SUPPORT
diff --git a/src/modules/term/TermWidget.h b/src/modules/term/TermWidget.h
index d9e41fae0..4c5794443 100644
--- a/src/modules/term/TermWidget.h
+++ b/src/modules/term/TermWidget.h
@@ -26,13 +26,13 @@
#include "kvi_settings.h"
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
#include <QFrame>
#include <QLabel>
#include <QPushButton>
#include "KviTalHBox.h"
-#include "kparts/part.h"
+#include <KParts/Part>
class KviMainWindow;
diff --git a/src/modules/term/TermWindow.cpp b/src/modules/term/TermWindow.cpp
index 9ee745226..76f6bbb5a 100644
--- a/src/modules/term/TermWindow.cpp
+++ b/src/modules/term/TermWindow.cpp
@@ -25,7 +25,7 @@
#include "TermWindow.h"
#include "TermWidget.h"
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
#include "KviIconManager.h"
#include "KviOptions.h"
#include "KviLocale.h"
diff --git a/src/modules/term/TermWindow.h b/src/modules/term/TermWindow.h
index 2fc4a87ec..25e4365a6 100644
--- a/src/modules/term/TermWindow.h
+++ b/src/modules/term/TermWindow.h
@@ -26,7 +26,7 @@
#include "kvi_settings.h"
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
#include "KviWindow.h"
#include "KviCString.h"
diff --git a/src/modules/term/libkviterm.cpp b/src/modules/term/libkviterm.cpp
index 4c56d5f1d..b4bc32b8a 100644
--- a/src/modules/term/libkviterm.cpp
+++ b/src/modules/term/libkviterm.cpp
@@ -29,7 +29,7 @@
#include <QSplitter>
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
#include "TermWidget.h"
#include "TermWindow.h"
@@ -66,7 +66,7 @@ KviModule * g_pTermModule = nullptr;
static bool term_kvs_cmd_open(KviKvsModuleCommandCall * c)
{
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
c->module()->lock(); // multiple locks are allowed
if(
c->hasSwitch('m', "mdi") || // compat only
@@ -81,7 +81,7 @@ static bool term_kvs_cmd_open(KviKvsModuleCommandCall * c)
w->show();
}
#else
- c->warning("Terminal emulation service not supported (non-KDE4 compilation)");
+ c->warning("Terminal emulation service not supported (non-KDE compilation)");
#endif
return true;
}
@@ -96,9 +96,9 @@ static bool term_module_init(KviModule * m)
static bool term_module_cleanup(KviModule *)
{
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
while(!g_pTermWidgetList.empty())
- delete *g_pSocketSpyWindowList.begin();
+ delete *g_pTermWidgetList.begin();
while(!g_pTermWindowList.empty())
(*g_pTermWindowList.begin())->close();