Commit 951a092a authored by Laurent Montel's avatar Laurent Montel
Browse files

Port away from deprecated KIO code

parent 8f11cb94
Pipeline #220524 passed with stage
in 5 minutes and 32 seconds
......@@ -9,7 +9,12 @@
#include "archivemailagentutil.h"
#include "archivemailkernel.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 "kmail-version.h"
......@@ -309,7 +314,11 @@ void ArchiveMailWidget::slotOpenFolder()
if (archiveItemInfo) {
const QUrl url = archiveItemInfo->url();
auto job = new KIO::OpenUrlJob(url);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, parentWidget()));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, parentWidget()));
#endif
job->setRunExecutables(false);
job->start();
}
......
......@@ -25,7 +25,12 @@
#include <KEditToolBar>
#include <KFileItemActions>
#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 <KIO/OpenUrlJob>
#include <KLocalizedString>
#include <KMessageBox>
......@@ -237,7 +242,11 @@ void KTNEFMain::viewFile()
qCDebug(KTNEFAPPS_LOG) << "Mime type from attachment object: " << mimename;
}
auto job = new KIO::OpenUrlJob(url, mimename);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#endif
job->setDeleteTemporaryFile(true);
job->start();
} else {
......@@ -268,7 +277,11 @@ void KTNEFMain::viewFileAs()
// Creating ApplicationLauncherJob without any args will invoke the open-with dialog
auto job = new KIO::ApplicationLauncherJob();
job->setUrls(list);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#endif
job->start();
}
} else {
......@@ -478,7 +491,11 @@ void KTNEFMain::slotShowMessageText()
tmpFile->write(rtf.toLocal8Bit());
tmpFile->close();
auto job = new KIO::OpenUrlJob(QUrl::fromLocalFile(tmpFile->fileName()), QStringLiteral("text/rtf"));
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#endif
job->setDeleteTemporaryFile(true);
job->start();
delete tmpFile;
......@@ -514,7 +531,11 @@ void KTNEFMain::openWith(const KService::Ptr &offer)
const QList<QUrl> lst{url};
auto job = new KIO::ApplicationLauncherJob(offer);
job->setUrls(lst);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#endif
job->start();
}
}
......
......@@ -36,7 +36,12 @@
#include <Akonadi/ItemFetchJob>
#include <KActionCollection>
#include <KActionMenu>
#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 <KLocalizedString>
#include <KStringHandler>
......@@ -570,7 +575,11 @@ void MessageActions::slotRunUrl(QAction *urlAction)
const QVariant q = urlAction->data();
if (q.type() == QVariant::Url) {
auto job = new KIO::OpenUrlJob(q.toUrl());
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, mParent));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, mParent));
#endif
job->start();
}
}
......
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