D18698: [baloo/KInotify] Notify if folder was moved from unwatched place

Stefan BrĂ¼ns noreply at phabricator.kde.org
Mon Feb 4 19:18:30 GMT 2019


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190204/e68fb53a/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list