]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/terminal/terminalpanel.cpp
Switch to C++20
[dolphin.git] / src / panels / terminal / terminalpanel.cpp
index 0e79a475d4a9b8db4058bc1305f3a69b135e5564..92ba18bf513cee88a21b1c959e45f18576b248a5 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <KActionCollection>
 #include <KIO/DesktopExecParser>
-#include <KIO/Job>
+#include <KIO/StatJob>
 #include <KJobWidgets>
 #include <KLocalizedString>
 #include <KMessageWidget>
@@ -70,6 +70,7 @@ bool TerminalPanel::currentWorkingDirectoryIsChildOf(const QString &path) const
 void TerminalPanel::terminalExited()
 {
     m_terminal = nullptr;
+    m_konsolePart = nullptr;
     Q_EMIT hideTerminalPanel();
 }
 
@@ -184,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)) {
@@ -217,6 +219,10 @@ void TerminalPanel::changeDir(const QUrl &url)
     delete m_mostLocalUrlJob;
     m_mostLocalUrlJob = nullptr;
 
+    if (url.isEmpty()) {
+        return;
+    }
+
     if (url.isLocalFile()) {
         sendCdToTerminal(url.toLocalFile());
         return;
@@ -272,7 +278,7 @@ void TerminalPanel::sendCdToTerminalKIOFuse(const QUrl &url)
     // If we can't do that for any reason, silently fail.
     auto reply = m_kiofuseInterface.mountUrl(url.toString());
     QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
-    QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](QDBusPendingCallWatcher *watcher) {
+    QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=, this](QDBusPendingCallWatcher *watcher) {
         watcher->deleteLater();
         if (!reply.isError()) {
             // Successfully mounted, point to the KIOFuse equivalent path.
@@ -320,7 +326,7 @@ void TerminalPanel::slotKonsolePartCurrentDirectoryChanged(const QString &dir)
 
     auto reply = m_kiofuseInterface.remoteUrl(m_konsolePartCurrentDirectory);
     QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
-    QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](QDBusPendingCallWatcher *watcher) {
+    QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=, this](QDBusPendingCallWatcher *watcher) {
         watcher->deleteLater();
         if (reply.isError()) {
             // KIOFuse errored out... just show the normal URL