Port away from deprecated KIO code

wilder
Laurent Montel 4 years ago
parent aa320d81ee
commit fc45802b72
  1. 9
      src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp
  2. 9
      src/filterHotSpots/FileFilterHotspot.cpp
  3. 13
      src/session/SessionController.cpp

@ -7,7 +7,12 @@
#include "EscapeSequenceUrlFilterHotSpot.h"
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
#include <KIO/JobUiDelegateFactory>
#else
#include <KIO/JobUiDelegate>
#endif
#include <KIO/OpenUrlJob>
#include <QApplication>
@ -31,6 +36,10 @@ void EscapeSequenceUrlHotSpot::activate(QObject *obj)
Q_UNUSED(obj)
auto *job = new KIO::OpenUrlJob(QUrl(_url));
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#endif
job->start();
}

@ -25,7 +25,12 @@
#include <KIO/OpenUrlJob>
#include <KFileItemListProperties>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
#include <KIO/JobUiDelegateFactory>
#else
#include <KIO/JobUiDelegate>
#endif
#include <KLocalizedString>
#include <KMessageBox>
#include <KShell>
@ -127,7 +132,11 @@ void FileFilterHotSpot::activate(QObject *)
void FileFilterHotSpot::openWithSysDefaultApp(const QString &filePath) const
{
auto *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(filePath));
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#endif
job->setRunExecutables(false); // Always open scripts, shell/python/perl... etc, as text
job->start();
}

@ -46,7 +46,12 @@
#include <KIO/CommandLauncherJob>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
#include <KIO/JobUiDelegateFactory>
#else
#include <KIO/JobUiDelegate>
#endif
#include <KIO/OpenFileManagerWindowJob>
#include <KIO/OpenUrlJob>
@ -552,7 +557,11 @@ void SessionController::handleWebShortcutAction(QAction *action)
const QUrl url = filterData.uri();
auto *job = new KIO::OpenUrlJob(url);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#endif
job->start();
}
}
@ -1159,7 +1168,11 @@ void SessionController::openBrowser()
} else {
const QUrl currentUrl = url().isLocalFile() ? url() : QUrl::fromLocalFile(QDir::homePath());
auto *job = new KIO::OpenUrlJob(currentUrl);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#endif
job->start();
}
}

Loading…
Cancel
Save