diff options
| author | Roman Inflianskas <[email protected]> | 2018-03-03 19:44:56 +0300 |
|---|---|---|
| committer | Roman Inflianskas <[email protected]> | 2018-03-11 17:32:33 +0300 |
| commit | f16fbcba4e9ed3cd48cb2c1a40c01daf1d511f4b (patch) | |
| tree | 2dd71c3a19bb24ff82fc7d655f42c5040294a520 /src/panels/places/placespanel.cpp | |
| parent | 0c9343d614872b88da59a7c1a18d19c8df83739f (diff) | |
Add Trash (empty, isEmpty, emptinessChanged)
Summary: Add `Trash` class to handle all trash operations.
Reviewers: elvisangelaccio, markg, ngraham
Reviewed By: elvisangelaccio, markg, ngraham
Subscribers: ngraham, markg, rkflx, elvisangelaccio, #dolphin
Differential Revision: https://phabricator.kde.org/D11012
Diffstat (limited to 'src/panels/places/placespanel.cpp')
| -rw-r--r-- | src/panels/places/placespanel.cpp | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 29acd034c..216b76038 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -25,16 +25,17 @@ #include "dolphin_generalsettings.h" #include "global.h" +#include "kitemviews/kitemlistcontainer.h" +#include "kitemviews/kitemlistcontroller.h" +#include "kitemviews/kitemlistselectionmanager.h" +#include "kitemviews/kstandarditem.h" #include "placesitem.h" #include "placesitemeditdialog.h" #include "placesitemlistgroupheader.h" #include "placesitemlistwidget.h" #include "placesitemmodel.h" #include "placesview.h" -#include "kitemviews/kitemlistcontainer.h" -#include "kitemviews/kitemlistcontroller.h" -#include "kitemviews/kitemlistselectionmanager.h" -#include "kitemviews/kstandarditem.h" +#include "trash/dolphintrash.h" #include "views/draganddrophelper.h" #include <KDirNotify> @@ -226,7 +227,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) QAction* action = menu.exec(pos.toPoint()); if (action) { if (action == emptyTrashAction) { - emptyTrash(); + Trash::empty(this); } else { // The index might have changed if devices were added/removed while // the context menu was open. @@ -425,15 +426,6 @@ void PlacesPanel::slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* } } -void PlacesPanel::slotTrashUpdated(KJob* job) -{ - if (job->error()) { - emit errorMessage(job->errorString()); - } - // as long as KIO doesn't do this, do it ourselves - KNotification::event(QStringLiteral("Trash: emptied"), QString(), QPixmap(), nullptr, KNotification::DefaultEvent); -} - void PlacesPanel::slotStorageSetupDone(int index, bool success) { disconnect(m_model, &PlacesItemModel::storageSetupDone, @@ -453,17 +445,6 @@ void PlacesPanel::slotStorageSetupDone(int index, bool success) } } -void PlacesPanel::emptyTrash() -{ - KIO::JobUiDelegate uiDelegate; - uiDelegate.setWindow(window()); - if (uiDelegate.askDeleteConfirmation(QList<QUrl>(), KIO::JobUiDelegate::EmptyTrash, KIO::JobUiDelegate::DefaultConfirmation)) { - KIO::Job* job = KIO::emptyTrash(); - KJobWidgets::setWindow(job, window()); - connect(job, &KIO::Job::result, this, &PlacesPanel::slotTrashUpdated); - } -} - void PlacesPanel::addEntry() { const int index = m_controller->selectionManager()->currentItem(); |
