┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphincontextmenu.cpp
diff options
context:
space:
mode:
authorRoman Inflianskas <[email protected]>2018-03-03 19:44:56 +0300
committerRoman Inflianskas <[email protected]>2018-03-11 17:32:33 +0300
commitf16fbcba4e9ed3cd48cb2c1a40c01daf1d511f4b (patch)
tree2dd71c3a19bb24ff82fc7d655f42c5040294a520 /src/dolphincontextmenu.cpp
parent0c9343d614872b88da59a7c1a18d19c8df83739f (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/dolphincontextmenu.cpp')
-rw-r--r--src/dolphincontextmenu.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index c35f442cb..c4a66c19a 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -27,6 +27,7 @@
#include "dolphinviewcontainer.h"
#include "panels/places/placesitem.h"
#include "panels/places/placesitemmodel.h"
+#include "trash/dolphintrash.h"
#include "views/dolphinview.h"
#include "views/viewmodecontroller.h"
@@ -139,8 +140,7 @@ void DolphinContextMenu::openTrashContextMenu()
Q_ASSERT(m_context & TrashContext);
QAction* emptyTrashAction = new QAction(QIcon::fromTheme(QStringLiteral("trash-empty")), i18nc("@action:inmenu", "Empty Trash"), this);
- KConfig trashConfig(QStringLiteral("trashrc"), KConfig::SimpleConfig);
- emptyTrashAction->setEnabled(!trashConfig.group("Status").readEntry("Empty", true));
+ emptyTrashAction->setEnabled(!Trash::isEmpty());
addAction(emptyTrashAction);
addCustomActions();
@@ -151,13 +151,7 @@ void DolphinContextMenu::openTrashContextMenu()
addShowMenuBarAction();
if (exec(m_pos) == emptyTrashAction) {
- KIO::JobUiDelegate uiDelegate;
- uiDelegate.setWindow(m_mainWindow);
- if (uiDelegate.askDeleteConfirmation(QList<QUrl>(), KIO::JobUiDelegate::EmptyTrash, KIO::JobUiDelegate::DefaultConfirmation)) {
- KIO::Job* job = KIO::emptyTrash();
- KJobWidgets::setWindow(job, m_mainWindow);
- job->uiDelegate()->setAutoErrorHandlingEnabled(true);
- }
+ Trash::empty(m_mainWindow);
}
}