Hey Sebastian

> I've tested it out. If a directory and its parent are being watched, and
> > the directory is moved the moveSelf event does *not* occur. The normal
> > move does occur. :-)
>
> OK, if that is the case then I suppose your patch is correct. But better
> add a lengthy comment to the code explaining why we treat moveself as a
> delete.
>
>
I refrained from committing as I thought I hadn't tested it out properly. It
turns out that I hadn't. Long story shot. The EventMoveSelf event is called
in both the cases.

1. If a folder A is being watched and A is moved.
2. If a folder B/A is being watched and so is its parent B.

Here "being watched" means explicitly adding a watch. It does NOT apply to
sub folders of the watched folder, even though they are also being watched.
(watches are recursive)

I've tested it out properly this time. And it works perfectly. (Try it out
if you have the time)

- Vishesh Handa
Index: nepomukfilewatch.cpp
===================================================================
--- nepomukfilewatch.cpp	(revision 1124640)
+++ nepomukfilewatch.cpp	(working copy)
@@ -137,7 +137,7 @@ void Nepomuk::FileWatch::watchFolder( co
 #ifdef BUILD_KINOTIFY
     if ( m_dirWatch && !m_dirWatch->watchingPath( path ) )
         m_dirWatch->addWatch( path,
-                              KInotify::WatchEvents( KInotify::EventMove|KInotify::EventDelete|KInotify::EventDeleteSelf|KInotify::EventCreate ),
+                              KInotify::WatchEvents( KInotify::EventMove|KInotify::EventDelete|KInotify::EventDeleteSelf|KInotify::EventCreate|KInotify::EventMoveSelf ),
                               KInotify::WatchFlags() );
 #endif
 }
Index: kinotify.cpp
===================================================================
--- kinotify.cpp	(revision 1124561)
+++ kinotify.cpp	(working copy)
@@ -355,6 +355,8 @@ void KInotify::slotEvent( int socket )
         }
         if ( event->mask & EventMoveSelf ) {
             kDebug() << path << "EventMoveSelf";
+            d->removeWatch( event->wd );
+            emit deleted( path );
         }
         if ( event->mask & EventMoveFrom ) {
             kDebug() << path << "EventMoveFrom";
_______________________________________________
Nepomuk mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/nepomuk

Reply via email to