author | mickeyl <mickeyl> | 2005-06-02 21:44:41 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-02 21:44:41 (UTC) |
commit | d0f6a0721d7ab67a115d08990143944ee71d54ba (patch) (side-by-side diff) | |
tree | ba22ad18027419a6417f3d6439a2faf67917ab74 /libopie2 | |
parent | f55a56f54de1d3fa9084160159a379079a317d96 (diff) | |
download | opie-d0f6a0721d7ab67a115d08990143944ee71d54ba.zip opie-d0f6a0721d7ab67a115d08990143944ee71d54ba.tar.gz opie-d0f6a0721d7ab67a115d08990143944ee71d54ba.tar.bz2 |
- move addLanguage.sh and mkipks to scripts/ directory
- finish recursive directory locks and mention in ChangeLog
beginning with `CVS:' are removed automatically CVS: CVS: Committing in . CVS: CVS: Modified Files: CVS:
ChangeLog libopie2/opiecore/linux/ofilenotify.cpp CVS: libopie2/opiecore/linux/ofilenotify.h CVS:
examples/opiecore/onotifytest/main.cpp CVS: examples/opiecore/onotifytest/main.h CVS: Added Files: CVS:
scripts/addLanguage.sh scripts/mkipks CVS:
----------------------------------------------------------------------
-rw-r--r-- | libopie2/opiecore/linux/ofilenotify.cpp | 40 | ||||
-rw-r--r-- | libopie2/opiecore/linux/ofilenotify.h | 3 |
2 files changed, 25 insertions, 18 deletions
diff --git a/libopie2/opiecore/linux/ofilenotify.cpp b/libopie2/opiecore/linux/ofilenotify.cpp index a7820ee..68c5a96 100644 --- a/libopie2/opiecore/linux/ofilenotify.cpp +++ b/libopie2/opiecore/linux/ofilenotify.cpp @@ -233,38 +233,44 @@ bool OFileNotification::isSingleShot() const bool OFileNotification::activate( const OFileNotificationEvent* e ) { qDebug( "OFileNotification::activate(): e = ( %s, %d, 0x%08x, %d, %s )", (const char*) _path, e->descriptor(), e->mask(), e->cookie(), (const char*) e->name() ); + //FIXME: Should we really deliver QueueOverflow and/or Ignore to user level code? + // dumb signal _signal.activate(); // generic signal emit triggered( _path, e->mask(), e->name() ); // specialized signals switch ( e->mask() ) { - case Access: emit accessed( _path ); break; - case Modify: emit modified( _path ); break; - case Attrib: emit attributed( _path); break; - case CloseWrite: emit closed( _path, true ); break; - case CloseNoWrite: emit closed( _path, false ); break; - case Open: emit opened( _path ); break; - case MovedFrom: emit movedFrom( _path, e->name() ); break; - case MovedTo: emit movedTo( _path, e->name() ); break; - case DeleteSubdir: emit deletedSubdir( _path, e->name() ); break; - case DeleteFile: emit deletedFile( _path, e->name() ); break; - case CreateSubdir: emit createdSubdir( _path, e->name() ); break; - case CreateFile: emit createdFile( _path, e->name() ); break; - case DeleteSelf: emit deleted( _path ); break; - case Unmount: emit unmounted( _path ); break; + case Access: emit accessed( _path ); break; + case Modify: emit modified( _path ); break; + case Attrib: emit attributed( _path); break; + case CloseWrite: emit closed( _path, true ); break; + case CloseNoWrite: emit closed( _path, false ); break; + case Open: emit opened( _path ); break; + case MovedFrom: emit movedFrom( _path, e->name() ); break; + case MovedTo: emit movedTo( _path, e->name() ); break; + case DeleteSubdir: emit deletedSubdir( _path, e->name() ); break; + case DeleteFile: emit deletedFile( _path, e->name() ); break; + case CreateSubdir: emit createdSubdir( _path, e->name() ); break; + case CreateFile: emit createdFile( _path, e->name() ); break; + case DeleteSelf: emit deleted( _path ); break; + case Unmount: emit unmounted( _path ); break; + case _QueueOverflow: qFatal( "OFileNotification::activate() - Inotify Event Queue Overload!" ); break; + case _Ignored: qWarning( "OFileNotification::activate() - Further Events for '%s' will be ignored", (const char*) _path ); break; default: assert( 0 ); } + delete e; + if ( !_multi ) stop(); return true; } @@ -314,13 +320,13 @@ bool OFileNotification::registerEventHandler() if ( OFileNotification::_fd < 0 ) { qWarning( "OFileNotification::registerEventHandler(): couldn't register event handler: %s", strerror( errno ) ); return false; } - OFileNotification::_sn = new QSocketNotifier( _fd, QSocketNotifier::Read, this, "inotify event" ); + OFileNotification::_sn = new QSocketNotifier( _fd, QSocketNotifier::Read ); connect( OFileNotification::_sn, SIGNAL( activated(int) ), this, SLOT( inotifyEventHandler() ) ); qDebug( "OFileNotification::registerEventHandler(): done" ); return true; } @@ -345,13 +351,13 @@ ODirNotification::ODirNotification( QObject* parent, const char* name ) ODirNotification::~ODirNotification() { qDebug( "ODirNotification::~ODirNotification()" ); } -/* +/** Love-Trowbridge recursive directory scanning algorithm: Step 1. Start at initial directory foo. Add watch. Step 2. Setup handlers for watch created in Step 1. Specifically, ensure that a directory created @@ -362,13 +368,13 @@ ODirNotification::~ODirNotification() Step 4. For each subdirectory of foo read in step 3, repeat step 1. Step 5. For any CREATE_SUBDIR event on bar, if a watch is not yet created on bar, repeat step 1 on bar. -*/ +**/ int ODirNotification::watch( const QString& path, bool sshot, OFileNotificationType type, int recurse ) { if ( _type == Nothing ) _type = type; // only set it once - for the top level call OFileNotificationType subtype = ( recurse != 0 ) ? (OFileNotificationType) int( _type | CreateSubdir ) : _type; qDebug( "ODirNotification::watch( %s, %d, 0x%08x, %d )", (const char*) path, sshot, subtype, recurse ); diff --git a/libopie2/opiecore/linux/ofilenotify.h b/libopie2/opiecore/linux/ofilenotify.h index 17e6b5d..c713b30 100644 --- a/libopie2/opiecore/linux/ofilenotify.h +++ b/libopie2/opiecore/linux/ofilenotify.h @@ -254,13 +254,14 @@ class OFileNotification : public QObject *======================================================================================*/ /** * @brief Represents a directory notification * * This class allows to watch for events happening to directories - * It uses the OFileNotification class + * It uses the OFileNotification class and (for recursive watches) + * implements the Love-Trowbridge recursive directory scanning algorithm. * * @see http://www.kernel.org/pub/linux/kernel/people/rml/inotify/ * * @author Michael 'Mickey' Lauer <mickey@vanille.de> * **/ |