diff options
| author | David Faure <[email protected]> | 2014-08-22 10:16:48 +0200 |
|---|---|---|
| committer | David Faure <[email protected]> | 2014-08-22 10:16:48 +0200 |
| commit | ee946d362c64ee35af932b3cad54d23ad786fe55 (patch) | |
| tree | 167edee2c9f91fc6f572a006c9b28551809ec809 /src/views/dolphinview.cpp | |
| parent | e44ddfa5ab16af7cdcfc1c835e1baa8b32beaa67 (diff) | |
Port away from KonqOperations::askDeleteConfirmation and KonqOperations::del
and remove them. Porting docs added to https://community.kde.org/Frameworks/Porting_Notes#libkonq
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 00358a268..e57881c10 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -51,6 +51,7 @@ #include <kitemviews/kitemlistselectionmanager.h> #include <kitemviews/kitemlistview.h> #include <kitemviews/kitemlistcontroller.h> +#include <KIO/CopyJob> #include <KIO/DeleteJob> #include <KIO/JobUiDelegate> #include <KIO/NetAccess> @@ -673,22 +674,26 @@ void DolphinView::renameSelectedItems() void DolphinView::trashSelectedItems() { const KUrl::List list = simplifiedSelectedUrls(); - KonqOperations::del(this, KonqOperations::TRASH, list); + KIO::JobUiDelegate uiDelegate; + uiDelegate.setWindow(window()); + if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) { + KIO::Job* job = KIO::trash(list); + KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, KUrl("trash:/"), job); + KJobWidgets::setWindow(job, this); + connect(job, &KIO::Job::result, + this, &DolphinView::slotTrashFileFinished); + } } void DolphinView::deleteSelectedItems() { const KUrl::List list = simplifiedSelectedUrls(); - const bool del = KonqOperations::askDeleteConfirmation(list, - KonqOperations::DEL, - KonqOperations::DEFAULT_CONFIRMATION, - this); - if (del) { + KIO::JobUiDelegate uiDelegate; + uiDelegate.setWindow(window()); + if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) { KIO::Job* job = KIO::del(list); - if (job->ui()) { - KJobWidgets::setWindow(job, this); - } + KJobWidgets::setWindow(job, this); connect(job, &KIO::Job::result, this, &DolphinView::slotDeleteFileFinished); } @@ -1357,6 +1362,15 @@ void DolphinView::calculateItemCount(int& fileCount, } } +void DolphinView::slotTrashFileFinished(KJob* job) +{ + if (job->error() == 0) { + emit operationCompletedMessage(i18nc("@info:status", "Trash operation completed.")); + } else if (job->error() != KIO::ERR_USER_CANCELED) { + emit errorMessage(job->errorString()); + } +} + void DolphinView::slotDeleteFileFinished(KJob* job) { if (job->error() == 0) { |
