Commit 0de73c4d authored by Volker Krause's avatar Volker Krause Committed by Albert Astals Cid
Browse files

Restore compatibility with KF5 < 5.100

parent e404516c
Pipeline #268462 passed with stage
in 1 minute and 52 seconds
......@@ -27,9 +27,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include <QPushButton>
// KF
#include "kio_version.h"
#include <KIO/CopyJob>
#include <KIO/DeleteJob>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0)
#include <KIO/DeleteOrTrashJob>
#endif
#include <KIO/Job>
#include <KIO/JobUiDelegate>
#include <KJobWidgets>
......@@ -134,6 +137,24 @@ static void delOrTrash(KIO::JobUiDelegate::DeletionType deletionType, const QLis
{
Q_ASSERT(urlList.count() > 0);
#if KIO_VERSION < QT_VERSION_CHECK(5, 100, 0)
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(parent);
if (!uiDelegate.askDeleteConfirmation(urlList, deletionType, KIO::JobUiDelegate::DefaultConfirmation)) {
return;
}
KIO::Job *job = nullptr;
switch (deletionType) {
case KIO::JobUiDelegate::Trash:
job = KIO::trash(urlList);
break;
case KIO::JobUiDelegate::Delete:
job = KIO::del(urlList);
break;
default: // e.g. EmptyTrash
return;
}
#else
KJob *job = nullptr;
switch (deletionType) {
case KIO::JobUiDelegate::Trash:
......@@ -145,6 +166,7 @@ static void delOrTrash(KIO::JobUiDelegate::DeletionType deletionType, const QLis
default: // e.g. EmptyTrash
return;
}
#endif
Q_ASSERT(job);
KJobWidgets::setWindow(job, parent);
......
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