bruns requested changes to this revision.
bruns added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> kinotify.cpp:430
> +                        // HACK: For some reason, it.fileInfo() returns an 
> empty QFileInfo for `path` here
> +                        // Creating new QFileInfo works fine though
> +                        QFileInfo fi(it.filePath());

FilteredDirIterator  is somewhat odd, as it returns the traversed folder itself 
as the first element (if not filtered/excluded by the config).

The folder itself has no fileInfo, as it is not backed by a QDirIterator item. 
Unfortunately, this is not really trivial to fix.

Instead of creating another QFileInfo for each item, you can just do the 
following:

  if (event->mask & IN_ISDIR) {
      Baloo::FilteredDirIterator it(d->config, QFile::decodeName(path));
      if (!it.next().isEmpty()) {
              // add folder itself, it not excluded
              d->addWatch(it.filePath());
      }
      while (!it.next().isEmpty()) {
          Q_EMIT created(it.filePath(), it.fileInfo().isDir());
          if (it.fileInfo().isDir()) {
              d->addWatch(it.filePath());
          }
      }
  }
  Q_EMIT created(QFile::decodeName(path), event->mask & IN_ISDIR);

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D18698

To: poboiko, #baloo, #frameworks, ngraham, bruns
Cc: bruns, ngraham, kde-frameworks-devel, #baloo, ashaposhnikov, michaelh, 
astippich, spoorun, abrahams

Reply via email to