- if (dataValue("url").value<KUrl>() != url) {
- delete m_trashDirLister;
- if (url.protocol() == 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, 0);
- m_trashDirLister->setDelayedMimeTypes(true);
- QObject::connect(m_trashDirLister, SIGNAL(completed()),
- m_signalHandler, SLOT(onTrashDirListerCompleted()));
- m_trashDirLister->openUrl(url);
+ if (dataValue("url").toUrl() != url) {
+ if (url.scheme() == QLatin1String("trash")) {
+ QObject::connect(&Trash::instance(), &Trash::emptinessChanged, m_signalHandler.data(), &PlacesItemSignalHandler::onTrashEmptinessChanged);