]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/trash/dolphintrash.cpp
Get rid of ugly static_cast usages in connect() calls
[dolphin.git] / src / trash / dolphintrash.cpp
index 749d0d48111318374a4b35bc703c29876ed7c9b9..957091e548ceef298d821abcbb3513748b572492 100644 (file)
@@ -26,7 +26,7 @@
 #include <KNotification>
 #include <KConfig>
 #include <KConfigGroup>
-
+#include <KLocalizedString>
 
 Trash::Trash()
     : m_trashDirLister(new KDirLister())
@@ -40,7 +40,7 @@ Trash::Trash()
         bool isTrashEmpty = m_trashDirLister->items().isEmpty();
         emit emptinessChanged(isTrashEmpty);
     };
-    connect(m_trashDirLister, static_cast<void(KDirLister::*)()>(&KDirLister::completed), this, trashDirContentChanged);
+    connect(m_trashDirLister, QOverload<>::of(&KCoreDirLister::completed), this, trashDirContentChanged);
     connect(m_trashDirLister, &KDirLister::itemsDeleted, this, trashDirContentChanged);
     m_trashDirLister->openUrl(QUrl(QStringLiteral("trash:/")));
 }
@@ -66,8 +66,10 @@ KIO::Job *Trash::empty(QWidget *window)
         KJobWidgets::setWindow(job, window);
         job->uiDelegate()->setAutoErrorHandlingEnabled(true);
          // as long as KIO doesn't do this, do it ourselves
-        connect(job, &KIO::Job::result, [](){
-            KNotification::event(QStringLiteral("Trash: emptied"), QString(), QPixmap(), nullptr, KNotification::DefaultEvent);
+        connect(job, &KIO::Job::result, []() {
+            KNotification::event(QStringLiteral("Trash: emptied"), i18n("Trash Emptied"),
+                                 i18n("The Trash was emptied."), QStringLiteral("user-trash"),
+                                 nullptr, KNotification::DefaultEvent);
         });
         return job;
     }