]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/terminal/terminalpanel.cpp
DragAndDropHelper::updateDropAction: use StatJob for remote URLs
[dolphin.git] / src / panels / terminal / terminalpanel.cpp
index 72886c2e9f1f00e66b51a2b65889919d27c810b1..e9184e7389a10850ee7b87019fe05e697a4757c4 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <KActionCollection>
 #include <KIO/DesktopExecParser>
-#include <KIO/Job>
+#include <KIO/StatJob>
 #include <KJobWidgets>
 #include <KLocalizedString>
 #include <KMessageWidget>
@@ -47,6 +47,11 @@ TerminalPanel::TerminalPanel(QWidget *parent)
 
 TerminalPanel::~TerminalPanel()
 {
+    if (m_konsolePart) {
+        // Avoid when QObject cleanup, which comes after our destructor, deletes the konsolePart
+        // and subsequently calls back into our slot when the destructor has already run.
+        disconnect(m_konsolePart, &KParts::ReadOnlyPart::destroyed, this, &TerminalPanel::terminalExited);
+    }
 }
 
 void TerminalPanel::goHome()
@@ -65,6 +70,7 @@ bool TerminalPanel::currentWorkingDirectoryIsChildOf(const QString &path) const
 void TerminalPanel::terminalExited()
 {
     m_terminal = nullptr;
+    m_konsolePart = nullptr;
     Q_EMIT hideTerminalPanel();
 }
 
@@ -144,7 +150,7 @@ void TerminalPanel::showEvent(QShowEvent *event)
 
     if (!m_terminal) {
         m_clearTerminal = true;
-        KPluginFactory *factory = KPluginFactory::loadFactory(KPluginMetaData(QStringLiteral("konsolepart"))).plugin;
+        KPluginFactory *factory = KPluginFactory::loadFactory(KPluginMetaData(QStringLiteral("kf6/parts/konsolepart"))).plugin;
         m_konsolePart = factory ? (factory->create<KParts::ReadOnlyPart>(this)) : nullptr;
         if (m_konsolePart) {
             connect(m_konsolePart, &KParts::ReadOnlyPart::destroyed, this, &TerminalPanel::terminalExited);
@@ -179,6 +185,7 @@ void TerminalPanel::showEvent(QShowEvent *event)
                     "Terminal cannot be shown because Konsole is not installed. "
                     "Please install it and then reopen the panel.");
                 m_konsolePartMissingMessage = new KMessageWidget(konsoleNotInstalledText, this);
+                m_konsolePartMissingMessage->setPosition(KMessageWidget::Footer);
                 m_konsolePartMissingMessage->setCloseButtonVisible(false);
                 m_konsolePartMissingMessage->hide();
                 if (KIO::DesktopExecParser::hasSchemeHandler(konsoleInstallUrl)) {