Commit c9a57d30 authored by David Faure's avatar David Faure
Browse files

Port from KToolInvocation::invokeTerminal to KTerminalLauncherJob

parent adf29180
...@@ -46,6 +46,9 @@ ...@@ -46,6 +46,9 @@
#include <KIO/CommandLauncherJob> #include <KIO/CommandLauncherJob>
#include <kio_version.h> #include <kio_version.h>
#include <KIO/OpenUrlJob> #include <KIO/OpenUrlJob>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 84, 0)
#include <KTerminalLauncherJob>
#endif
#include <KFileCopyToMenu> #include <KFileCopyToMenu>
#include <KJobWidgets> #include <KJobWidgets>
#include <KJobUiDelegate> #include <KJobUiDelegate>
...@@ -405,7 +408,15 @@ void KonqPopupMenuPrivate::populate() ...@@ -405,7 +408,15 @@ void KonqPopupMenuPrivate::populate()
if (isDirectory && m_popupItemProperties.items().count() == 1) { if (isDirectory && m_popupItemProperties.items().count() == 1) {
QAction *openTerminalHere = new QAction(QIcon::fromTheme("utilities-terminal"), i18n("Open Terminal Here"), m_parentWidget); QAction *openTerminalHere = new QAction(QIcon::fromTheme("utilities-terminal"), i18n("Open Terminal Here"), m_parentWidget);
QObject::connect(openTerminalHere, &QAction::triggered, q, [this]() { QObject::connect(openTerminalHere, &QAction::triggered, q, [this]() {
KToolInvocation::invokeTerminal(QString(), m_popupItemProperties.urlList().constFirst().toLocalFile()); const QString localPath = m_popupItemProperties.urlList().constFirst().toLocalFile();
// 5.84 because the header wasn't usable in 5.83
#if KIO_VERSION >= QT_VERSION_CHECK(5, 84, 0)
auto *job = new KTerminalLauncherJob(QString{});
job->setWorkingDirectory(localPath);
job->start();
#else
KToolInvocation::invokeTerminal(QString(), localPath);
#endif
}); });
additionalActions << openTerminalHere; additionalActions << openTerminalHere;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment