diff options
| author | Ahmad Samir <[email protected]> | 2022-09-07 22:01:09 +0200 |
|---|---|---|
| committer | Ahmad Samir <[email protected]> | 2022-10-16 13:13:55 +0200 |
| commit | 197a7f690571256c8007b78a8fea30edb176a978 (patch) | |
| tree | 4b9e53897caf9b0c4283e12c46feb688768302b1 /src/views/dolphinview.cpp | |
| parent | a0c0b43b97017280f6290fc720f41307a5b85d22 (diff) | |
Port away from deprecated KIO API
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 4e5f4c786..e8603858f 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -49,6 +49,11 @@ #include <kwidgetsaddons_version.h> +#include <kio_version.h> +#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) +#include <KIO/DeleteOrTrashJob> +#endif + #include <QAbstractItemView> #include <QActionGroup> #include <QApplication> @@ -753,6 +758,13 @@ void DolphinView::renameSelectedItems() void DolphinView::trashSelectedItems() { const QList<QUrl> list = simplifiedSelectedUrls(); + +#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) + using Iface = KIO::AskUserActionInterface; + auto *trashJob = new KIO::DeleteOrTrashJob(list, Iface::Trash, Iface::DefaultConfirmation, this); + connect(trashJob, &KJob::result, this, &DolphinView::slotTrashFileFinished); + trashJob->start(); +#else KIO::JobUiDelegate uiDelegate; uiDelegate.setWindow(window()); if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) { @@ -762,12 +774,19 @@ void DolphinView::trashSelectedItems() connect(job, &KIO::Job::result, this, &DolphinView::slotTrashFileFinished); } +#endif } void DolphinView::deleteSelectedItems() { const QList<QUrl> list = simplifiedSelectedUrls(); +#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) + using Iface = KIO::AskUserActionInterface; + auto *trashJob = new KIO::DeleteOrTrashJob(list, Iface::Delete, Iface::DefaultConfirmation, this); + connect(trashJob, &KJob::result, this, &DolphinView::slotTrashFileFinished); + trashJob->start(); +#else KIO::JobUiDelegate uiDelegate; uiDelegate.setWindow(window()); if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) { @@ -776,6 +795,7 @@ void DolphinView::deleteSelectedItems() connect(job, &KIO::Job::result, this, &DolphinView::slotDeleteFileFinished); } +#endif } void DolphinView::cutSelectedItemsToClipboard() |
