aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/term/TermWidget.cpp
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/TermWidget.cpp
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/TermWidget.cpp')
-rw-r--r--src/modules/term/TermWidget.cpp36
1 files changed, 13 insertions, 23 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