diff options
| author | David Faure <[email protected]> | 2014-08-21 22:01:23 +0200 |
|---|---|---|
| committer | David Faure <[email protected]> | 2014-08-21 22:01:23 +0200 |
| commit | e44ddfa5ab16af7cdcfc1c835e1baa8b32beaa67 (patch) | |
| tree | 8b494febb427d23daba76207599a5ac35ec738ba /src/panels | |
| parent | 5a6ac1b5f765543421924df424cd799d866c5b69 (diff) | |
Remove KonqOperations::emptyTrash() and port to KIO::emptyTrash() instead.
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/places/placespanel.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 487751931..ce6c7b7ab 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -29,6 +29,7 @@ #include <KDirNotify> #include <KIcon> #include <KIO/Job> +#include <KIO/EmptyTrashJob> #include <KIO/JobUiDelegate> #include <KJobWidgets> #include <KLocale> @@ -426,7 +427,8 @@ void PlacesPanel::slotTrashUpdated(KJob* job) if (job->error()) { emit errorMessage(job->errorString()); } - org::kde::KDirNotify::emitFilesAdded(QUrl("trash:/")); + // as long as KIO doesn't do this, do it ourselves + KNotification::event("Trash: emptied", QString(), QPixmap(), 0, KNotification::DefaultEvent); } void PlacesPanel::slotStorageSetupDone(int index, bool success) @@ -450,20 +452,11 @@ void PlacesPanel::slotStorageSetupDone(int index, bool success) void PlacesPanel::emptyTrash() { - const QString text = i18nc("@info", "Do you really want to empty the Trash? All items will be deleted."); - const bool del = KMessageBox::warningContinueCancel(window(), - text, - QString(), - KGuiItem(i18nc("@action:button", "Empty Trash"), - KIcon("user-trash")) - ) == KMessageBox::Continue; - if (del) { - QByteArray packedArgs; - QDataStream stream(&packedArgs, QIODevice::WriteOnly); - stream << int(1); - KIO::Job *job = KIO::special(KUrl("trash:/"), packedArgs); - KNotification::event("Trash: emptied", QString() , QPixmap() , 0, KNotification::DefaultEvent); - KJobWidgets::setWindow(job, parentWidget()); + 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); } } |
