Diffstat (limited to 'libopie2/opiecore/linux/ofilenotify.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/linux/ofilenotify.cpp | 25 |
1 files changed, 18 insertions, 7 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,4 +349,2 @@ int ODirNotification::watch( const QString& path, bool sshot, OFileNotificationT - if ( recurse == 0 ) - { OFileNotification* fn = new OFileNotification( this, "ODirNotification delegate" ); @@ -369,10 +367,23 @@ int ODirNotification::watch( const QString& path, bool sshot, OFileNotificationT connect( fn, SIGNAL( unmounted( const QString& ) ), this, SIGNAL( unmounted( const QString& ) ) ); - } - return result; - } - else + + if ( recurse ) { + QDir directory( path ); + QStringList subdirs = directory.entryList( QDir::Dirs ); - return 1; + 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; + } + } + } +//connect( fn, SIGNAL( triggered( const QString&, unsigned int, const QString& ) ), this, SIGNAL( triggered( const QString&, unsigned int, const QString& ) ) ); } + else return -1; } |