Commit 4767063e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compile against 5.71 without deprecated method

parent 95f4b7b6
Pipeline #21436 passed with stage
in 5 minutes and 16 seconds
......@@ -49,7 +49,7 @@ add_definitions(-DTRANSLATION_DOMAIN=\"libkpimidentities5\")
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054600)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054700)
endif()
add_definitions(-DQT_NO_FOREACH)
......
......@@ -28,7 +28,13 @@
#include <KShellCompletion>
#include <KToolBar>
#include <KMessageBox>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#else
#include <KRun>
#endif
#include <QUrl>
#include <KPIMTextEdit/RichTextComposer>
......@@ -439,13 +445,20 @@ void SignatureConfigurator::slotUrlChanged()
void SignatureConfigurator::slotEdit()
{
QString url = filePath();
const QString url = filePath();
// slotEnableEditButton should prevent this assert from being hit:
assert(!url.isEmpty());
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(url), QStringLiteral("text/plain"));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->setDeleteTemporaryFile(true);
job->start();
#else
KRun::RunFlags flags;
flags |= KRun::DeleteTemporaryFiles;
KRun::runUrl(QUrl::fromLocalFile(url), QStringLiteral("text/plain"), this, flags);
#endif
}
// "use HTML"-checkbox (un)checked
......
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