summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/linux/ofilenotify.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/linux/ofilenotify.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/linux/ofilenotify.cpp25
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
@@ -347,8 +347,6 @@ int ODirNotification::watch( const QString& path, bool sshot, OFileNotificationT
347{ 347{
348 qDebug( "ODirNotification::watch( %s, %d, 0x%08x, %d )", (const char*) path, sshot, type, recurse ); 348 qDebug( "ODirNotification::watch( %s, %d, 0x%08x, %d )", (const char*) path, sshot, type, recurse );
349 349
350 if ( recurse == 0 )
351 {
352 OFileNotification* fn = new OFileNotification( this, "ODirNotification delegate" ); 350 OFileNotification* fn = new OFileNotification( this, "ODirNotification delegate" );
353 int result = fn->startWatching( path, sshot, type ); 351 int result = fn->startWatching( path, sshot, type );
354 if ( result != -1 ) 352 if ( result != -1 )
@@ -367,14 +365,27 @@ int ODirNotification::watch( const QString& path, bool sshot, OFileNotificationT
367 connect( fn, SIGNAL( createdFile( const QString&, const QString& ) ), this, SIGNAL( createdFile( const QString&, const QString& ) ) ); 365 connect( fn, SIGNAL( createdFile( const QString&, const QString& ) ), this, SIGNAL( createdFile( const QString&, const QString& ) ) );
368 connect( fn, SIGNAL( deleted( const QString& ) ), this, SIGNAL( deleted( const QString& ) ) ); 366 connect( fn, SIGNAL( deleted( const QString& ) ), this, SIGNAL( deleted( const QString& ) ) );
369 connect( fn, SIGNAL( unmounted( const QString& ) ), this, SIGNAL( unmounted( const QString& ) ) ); 367 connect( fn, SIGNAL( unmounted( const QString& ) ), this, SIGNAL( unmounted( const QString& ) ) );
370 } 368
371 return result; 369 if ( recurse )
372 }
373 else
374 { 370 {
371 QDir directory( path );
372 QStringList subdirs = directory.entryList( QDir::Dirs );
375 373
376 return 1; 374 for ( QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it )
375 {
376 if ( (*it) == "." || (*it) == ".." ) continue;
377 QString subpath = QString( "%1/%2" ).arg( path ).arg( *it );
378 int subresult = watch( subpath, sshot, type, recurse-1 );
379 if ( subresult == -1 )
380 {
381 qDebug( "ODirNotification::watch(): subresult for '%s' was -1. Interrupting", (const char*) (*it) );
382 return -1;
383 }
384 }
385 }
386//connect( fn, SIGNAL( triggered( const QString&, unsigned int, const QString& ) ), this, SIGNAL( triggered( const QString&, unsigned int, const QString& ) ) );
377 } 387 }
388 else return -1;
378} 389}
379 390
380 391