Commit 46aed66d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Now we depend against 5.71.0

parent 7d6ba2f2
Pipeline #23586 passed with stage
in 85 minutes and 31 seconds
......@@ -72,10 +72,8 @@
#include <settings/messagecomposersettings.h>
#include <KIO/Job>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#endif
#include <Akonadi/Contact/EmailAddressSelectionDialog>
#include <Akonadi/Contact/EmailAddressSelectionWidget>
......@@ -746,30 +744,6 @@ void AttachmentControllerBase::openAttachment(const AttachmentPart::Ptr &part)
return;
}
tempFile->setPermissions(QFile::ReadUser);
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
KRun::RunFlags flags;
flags |= KRun::DeleteTemporaryFiles;
bool success = KRun::runUrl(QUrl::fromLocalFile(tempFile->fileName()),
QString::fromLatin1(part->mimeType()),
d->wParent,
flags);
if (!success) {
if (!KMimeTypeTrader::self()->preferredService(QString::fromLatin1(part->mimeType())).data()) {
// KRun showed an Open-With dialog, and it was canceled.
} else {
// KRun failed.
KMessageBox::sorry(d->wParent,
i18n("KMail was unable to open the attachment."),
i18n("Unable to open attachment"));
}
delete tempFile;
tempFile = nullptr;
} else {
// The file was opened. Delete it only when the composer is closed
// (and this object is destroyed).
tempFile->setParent(this); // Manages lifetime.
}
#else
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(tempFile->fileName()), QString::fromLatin1(part->mimeType()));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, d->wParent));
job->setDeleteTemporaryFile(true);
......@@ -786,7 +760,6 @@ void AttachmentControllerBase::openAttachment(const AttachmentPart::Ptr &part)
}
});
job->start();
#endif
}
void AttachmentControllerBase::viewAttachment(const AttachmentPart::Ptr &part)
......
......@@ -58,10 +58,8 @@
#include <KMimeTypeChooser>
#include <KMimeTypeTrader>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#endif
#include <KRun>
#include <KSelectAction>
#include <KSharedConfig>
......@@ -290,17 +288,10 @@ void ViewerPrivate::openAttachment(KMime::Content *node, const QUrl &url)
}
if (node->contentType()->mimeType() == "message/external-body") {
if (node->contentType()->hasParameter(QStringLiteral("url"))) {
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(url, QStringLiteral("text/html"));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, q));
job->setRunExecutables(true);
job->start();
#else
KRun::RunFlags flags;
flags |= KRun::RunExecutables;
const QString url = node->contentType()->parameter(QStringLiteral("url"));
KRun::runUrl(QUrl(url), QStringLiteral("text/html"), q, flags);
#endif
return;
}
}
......@@ -2028,15 +2019,10 @@ void ViewerPrivate::checkPhishingUrl()
void ViewerPrivate::executeRunner(const QUrl &url)
{
if (!MessageViewer::Util::handleUrlWithQDesktopServices(url)) {
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(url);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, viewer()));
job->setRunExecutables(false);
job->start();
#else
KRun *runner = new KRun(url, viewer()); // will delete itself
runner->setRunExecutables(false);
#endif
}
}
......@@ -2385,17 +2371,10 @@ void ViewerPrivate::slotOpenInBrowser()
void ViewerPrivate::slotExportHtmlPageSuccess(const QString &filename)
{
const QUrl url(QUrl::fromLocalFile(filename));
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
KRun::RunFlags flags;
flags |= KRun::DeleteTemporaryFiles;
KRun::runUrl(url, QStringLiteral("text/html"), q, flags);
#else
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(url, QStringLiteral("text/html"), q);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, q));
job->setDeleteTemporaryFile(true);
job->start();
#endif
Q_EMIT printingFinished();
}
......
Markdown is supported
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