author | mickeyl <mickeyl> | 2005-05-31 14:34:02 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-31 14:34:02 (UTC) |
commit | 6d2273fb22e10474ae26dd249fa2836e100ffdaf (patch) (side-by-side diff) | |
tree | 52ff0e10b629dab847077a8b3afcd3f8c0d1b830 /libopie2/opiecore/linux/ofilenotify.cpp | |
parent | 930f91069c505082a33e43ce5fdca019531a4b5e (diff) | |
download | opie-6d2273fb22e10474ae26dd249fa2836e100ffdaf.zip opie-6d2273fb22e10474ae26dd249fa2836e100ffdaf.tar.gz opie-6d2273fb22e10474ae26dd249fa2836e100ffdaf.tar.bz2 |
misc. opcmciasystem improvements
start implementing recursve dirlocks in ODirNotification
Diffstat (limited to 'libopie2/opiecore/linux/ofilenotify.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/linux/ofilenotify.cpp | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/libopie2/opiecore/linux/ofilenotify.cpp b/libopie2/opiecore/linux/ofilenotify.cpp index 36ec6bf..3096f7e 100644 --- a/libopie2/opiecore/linux/ofilenotify.cpp +++ b/libopie2/opiecore/linux/ofilenotify.cpp @@ -349,30 +349,41 @@ int ODirNotification::watch( const QString& path, bool sshot, OFileNotificationT - if ( recurse == 0 ) + OFileNotification* fn = new OFileNotification( this, "ODirNotification delegate" ); + int result = fn->startWatching( path, sshot, type ); + if ( result != -1 ) { - OFileNotification* fn = new OFileNotification( this, "ODirNotification delegate" ); - int result = fn->startWatching( path, sshot, type ); - if ( result != -1 ) + connect( fn, SIGNAL( triggered( const QString&, unsigned int, const QString& ) ), this, SIGNAL( triggered( const QString&, unsigned int, const QString& ) ) ); + connect( fn, SIGNAL( accessed( const QString& ) ), this, SIGNAL( accessed( const QString& ) ) ); + connect( fn, SIGNAL( modified( const QString& ) ), this, SIGNAL( modified( const QString& ) ) ); + connect( fn, SIGNAL( attributed( const QString& ) ), this, SIGNAL( attributed( const QString& ) ) ); + connect( fn, SIGNAL( closed( const QString&, bool ) ), this, SIGNAL( closed( const QString&, bool ) ) ); + connect( fn, SIGNAL( opened( const QString& ) ), this, SIGNAL( opened( const QString& ) ) ); + connect( fn, SIGNAL( movedTo( const QString&, const QString& ) ), this, SIGNAL( movedTo( const QString&, const QString& ) ) ); + connect( fn, SIGNAL( movedFrom( const QString&, const QString& ) ), this, SIGNAL( movedFrom( const QString&, const QString& ) ) ); + connect( fn, SIGNAL( deletedSubdir( const QString&, const QString& ) ), this, SIGNAL( deletedSubdir( const QString&, const QString& ) ) ); + connect( fn, SIGNAL( deletedFile( const QString&, const QString& ) ), this, SIGNAL( deletedFile( const QString&, const QString& ) ) );; + connect( fn, SIGNAL( createdSubdir( const QString&, const QString& ) ), this, SIGNAL( createdSubdir( const QString&, const QString& ) ) ); + connect( fn, SIGNAL( createdFile( const QString&, const QString& ) ), this, SIGNAL( createdFile( const QString&, const QString& ) ) ); + connect( fn, SIGNAL( deleted( const QString& ) ), this, SIGNAL( deleted( const QString& ) ) ); + connect( fn, SIGNAL( unmounted( const QString& ) ), this, SIGNAL( unmounted( const QString& ) ) ); + + if ( recurse ) { - connect( fn, SIGNAL( triggered( const QString&, unsigned int, const QString& ) ), this, SIGNAL( triggered( const QString&, unsigned int, const QString& ) ) ); - connect( fn, SIGNAL( accessed( const QString& ) ), this, SIGNAL( accessed( const QString& ) ) ); - connect( fn, SIGNAL( modified( const QString& ) ), this, SIGNAL( modified( const QString& ) ) ); - connect( fn, SIGNAL( attributed( const QString& ) ), this, SIGNAL( attributed( const QString& ) ) ); - connect( fn, SIGNAL( closed( const QString&, bool ) ), this, SIGNAL( closed( const QString&, bool ) ) ); - connect( fn, SIGNAL( opened( const QString& ) ), this, SIGNAL( opened( const QString& ) ) ); - connect( fn, SIGNAL( movedTo( const QString&, const QString& ) ), this, SIGNAL( movedTo( const QString&, const QString& ) ) ); - connect( fn, SIGNAL( movedFrom( const QString&, const QString& ) ), this, SIGNAL( movedFrom( const QString&, const QString& ) ) ); - connect( fn, SIGNAL( deletedSubdir( const QString&, const QString& ) ), this, SIGNAL( deletedSubdir( const QString&, const QString& ) ) ); - connect( fn, SIGNAL( deletedFile( const QString&, const QString& ) ), this, SIGNAL( deletedFile( const QString&, const QString& ) ) );; - connect( fn, SIGNAL( createdSubdir( const QString&, const QString& ) ), this, SIGNAL( createdSubdir( const QString&, const QString& ) ) ); - connect( fn, SIGNAL( createdFile( const QString&, const QString& ) ), this, SIGNAL( createdFile( const QString&, const QString& ) ) ); - connect( fn, SIGNAL( deleted( const QString& ) ), this, SIGNAL( deleted( const QString& ) ) ); - connect( fn, SIGNAL( unmounted( const QString& ) ), this, SIGNAL( unmounted( const QString& ) ) ); + QDir directory( path ); + QStringList subdirs = directory.entryList( QDir::Dirs ); + + for ( QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it ) + { + if ( (*it) == "." || (*it) == ".." ) continue; + QString subpath = QString( "%1/%2" ).arg( path ).arg( *it ); + int subresult = watch( subpath, sshot, type, recurse-1 ); + if ( subresult == -1 ) + { + qDebug( "ODirNotification::watch(): subresult for '%s' was -1. Interrupting", (const char*) (*it) ); + return -1; + } + } } - return result; - } - else - { - - return 1; +//connect( fn, SIGNAL( triggered( const QString&, unsigned int, const QString& ) ), this, SIGNAL( triggered( const QString&, unsigned int, const QString& ) ) ); } + else return -1; } |