Commit ae0790dd authored by Laurent Montel's avatar Laurent Montel
Browse files

Port away from deprecated KIO code

parent 8c6e07dc
Pipeline #220955 passed with stage
in 3 minutes and 42 seconds
......@@ -30,7 +30,12 @@
#include "konversation_log.h"
#include "konversation_state.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 <KConfig>
#include <KShell>
......@@ -1249,7 +1254,11 @@ void Application::openUrl(const QString& url)
#else
auto *job = new KIO::OpenUrlJob(QUrl(url));
job->setFollowRedirections(false);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, Application::instance()->getMainWindow()));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, Application::instance()->getMainWindow()));
#endif
job->start();
#endif
return;
......
......@@ -17,7 +17,13 @@
#include <config-konversation.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 <QFileInfo>
......@@ -102,7 +108,11 @@ namespace Konversation
if (getType() == Transfer::Send || getStatus() == Transfer::Done)
{
auto *job = new KIO::OpenUrlJob(getFileURL());
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, nullptr));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, nullptr));
#endif
job->setRunExecutables(false);
job->start();
}
......
......@@ -19,7 +19,12 @@
#include <QFileDialog>
#include <KIO/CopyJob>
#include <KIO/ApplicationLauncherJob>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
#include <KIO/JobUiDelegateFactory>
#else
#include <KIO/JobUiDelegate>
#endif
#include <QMenu>
#include <KMessageBox>
#include <KStandardAction>
......@@ -750,7 +755,11 @@ void IrcContextMenus::processLinkAction(int actionId, const QString& link)
{
// ApplicationLauncherJob ctor without args will invoke the open-with dialog
auto *job = new KIO::ApplicationLauncherJob();
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, Application::instance()->getMainWindow()));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, Application::instance()->getMainWindow()));
#endif
job->setUrls({ QUrl(link) });
job->start();
......
......@@ -38,7 +38,12 @@
#include <KMessageBox>
#include <KIO/OpenUrlJob>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
#include <KIO/JobUiDelegateFactory>
#else
#include <KIO/JobUiDelegate>
#endif
#include <QUrl>
#include <KXMLGUIFactory>
#include <KActionCollection>
......@@ -2589,7 +2594,11 @@ void ViewContainer::openLogFile(const QString& caption, const QString& file)
if(Preferences::self()->useExternalLogViewer())
{
auto *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(file), QStringLiteral("text/plain"));
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, m_window));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, m_window));
#endif
job->start();
return;
}
......
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