Commit 4164910d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compile without deprecated 5.71 methods

parent 34b59c06
Pipeline #21440 passed with stage
in 49 minutes and 44 seconds
......@@ -144,7 +144,7 @@ find_package(Gpgmepp 1.11.1 CONFIG)
set_package_properties(Gpgmepp PROPERTIES DESCRIPTION "GpgME library" URL "https://www.gnupg.org" TYPE REQUIRED)
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054600)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054700)
endif()
add_definitions(-DQT_NO_FOREACH)
......
......@@ -69,7 +69,13 @@ using namespace KCalendarCore;
#include "text_calendar_debug.h"
#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 <KIO/FileCopyJob>
#include <KIO/StatJob>
#include <KLocalizedString>
......@@ -1022,11 +1028,11 @@ public:
return ok;
}
bool openAttachment(const QString &name, const QString &iCal) const
void openAttachment(const QString &name, const QString &iCal) const
{
Attachment attachment(findAttachment(name, iCal));
if (attachment.isEmpty()) {
return false;
return;
}
if (attachment.isUri()) {
......@@ -1048,13 +1054,17 @@ public:
file->write(QByteArray::fromBase64(attachment.data()));
file->close();
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(file->fileName()), attachment.mimeType());
job->setDeleteTemporaryFile(true);
job->start();
#else
KRun::RunFlags flags;
flags |= KRun::DeleteTemporaryFiles;
bool stat = KRun::runUrl(QUrl::fromLocalFile(file->fileName()), attachment.mimeType(), nullptr, flags);
KRun::runUrl(QUrl::fromLocalFile(file->fileName()), attachment.mimeType(), nullptr, flags);
#endif
delete file;
return stat;
}
return true;
}
bool saveAsAttachment(const QString &name, const QString &iCal) const
......@@ -1301,7 +1311,7 @@ public:
if (path.startsWith(QLatin1String("ATTACH:"))) {
const QString name = QString::fromUtf8(QByteArray::fromBase64(path.mid(7).toUtf8()));
result = openAttachment(name, iCal);
openAttachment(name, iCal);
}
if (result) {
......
......@@ -23,7 +23,13 @@
#include "adblockutil.h"
#include "adblockmanager.h"
#include <WebEngineViewer/WebEngineScript>
#include <KIOWidgets/KRun>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#else
#include <KRun>
#endif
#include <QVBoxLayout>
#include <KLocalizedString>
#include <CustomTreeView>
......@@ -157,8 +163,15 @@ void AdBlockBlockableItemsWidget::slotOpenItem()
return;
}
const QUrl url(item->text(Url));
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(url);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->setRunExecutables(false);
job->start();
#else
KRun *runner = new KRun(url, this); // will delete itself
runner->setRunExecutables(false);
#endif
}
void AdBlockBlockableItemsWidget::slotBlockItem()
......
......@@ -54,7 +54,13 @@ using namespace PimCommon::ConfigureImmutableWidgetUtils;
#include <QListWidgetItem>
#include <QPointer>
#include <QStandardPaths>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#else
#include <KRun>
#endif
#include <adblocksubscription.h>
using namespace AdBlock;
......@@ -168,7 +174,13 @@ bool AdBlockSettingWidget::event(QEvent *event)
{
if (event->type() == QEvent::WhatsThisClicked) {
QWhatsThisClickedEvent *clicked = static_cast<QWhatsThisClickedEvent *>(event);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(QUrl(clicked->href()));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
#else
new KRun(QUrl(clicked->href()), this);
#endif
return true;
}
return QWidget::event(event);
......
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