- // 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, m_signalHandler.data(), &PlacesItemSignalHandler::onTrashEmptinessChanged);