┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/places/placesitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/panels/places/placesitem.cpp')
-rw-r--r--src/panels/places/placesitem.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp
index 20c19e152..ff81e8e63 100644
--- a/src/panels/places/placesitem.cpp
+++ b/src/panels/places/placesitem.cpp
@@ -21,6 +21,7 @@
***************************************************************************/
#include "placesitem.h"
+#include "trash/dolphintrash.h"
#include "dolphindebug.h"
#include "placesitemsignalhandler.h"
@@ -60,16 +61,9 @@ void PlacesItem::setUrl(const QUrl &url)
if (dataValue("url").toUrl() != url) {
delete m_trashDirLister;
if (url.scheme() == QLatin1String("trash")) {
- // The trash icon must always be updated dependent on whether
- // the trash is empty or not. We use a KDirLister that automatically
- // watches for changes if the number of items has been changed.
- // The update of the icon is handled in onTrashDirListerCompleted().
- m_trashDirLister = new KDirLister();
- m_trashDirLister->setAutoErrorHandlingEnabled(false, nullptr);
- m_trashDirLister->setDelayedMimeTypes(true);
- QObject::connect(m_trashDirLister.data(), static_cast<void(KDirLister::*)()>(&KDirLister::completed),
- m_signalHandler.data(), &PlacesItemSignalHandler::onTrashDirListerCompleted);
- m_trashDirLister->openUrl(url);
+ QObject::connect(&Trash::instance(), &Trash::emptinessChanged, [this](bool isTrashEmpty){
+ setIcon(isTrashEmpty ? QStringLiteral("user-trash") : QStringLiteral("user-trash-full"));
+ });
}
setDataValue("url", url);
@@ -239,14 +233,6 @@ void PlacesItem::onAccessibilityChanged()
setUrl(QUrl::fromLocalFile(m_access->filePath()));
}
-void PlacesItem::onTrashDirListerCompleted()
-{
- Q_ASSERT(url().scheme() == QLatin1String("trash"));
-
- const bool isTrashEmpty = m_trashDirLister->items().isEmpty();
- setIcon(isTrashEmpty ? QStringLiteral("user-trash") : QStringLiteral("user-trash-full"));
-}
-
void PlacesItem::updateBookmarkForRole(const QByteArray& role)
{
Q_ASSERT(!m_bookmark.isNull());