summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/ofilenotify.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/ofilenotify.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/ofilenotify.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie2/opiecore/ofilenotify.cpp b/libopie2/opiecore/ofilenotify.cpp
index b576c4f..2a9bb8c 100644
--- a/libopie2/opiecore/ofilenotify.cpp
+++ b/libopie2/opiecore/ofilenotify.cpp
@@ -228,48 +228,50 @@ bool OFileNotification::hasChanged()
228 { 228 {
229 qDebug( "OFileNotification::hasChanged(): mtime changed" ); 229 qDebug( "OFileNotification::hasChanged(): mtime changed" );
230 c = true; 230 c = true;
231 } 231 }
232 if ( !c && (_type & Attrib) && (long)_stat.st_ctime < (long)newstat.st_ctime ) 232 if ( !c && (_type & Attrib) && (long)_stat.st_ctime < (long)newstat.st_ctime )
233 { 233 {
234 qDebug( "OFileNotification::hasChanged(): ctime changed" ); 234 qDebug( "OFileNotification::hasChanged(): ctime changed" );
235 c = true; 235 c = true;
236 } 236 }
237 237
238 return c; 238 return c;
239} 239}
240 240
241 241
242void OFileNotification::singleShot( const QString& path, QObject* receiver, const char* member, OFileNotificationType type ) 242void OFileNotification::singleShot( const QString& path, QObject* receiver, const char* member, OFileNotificationType type )
243{ 243{
244 OFileNotification* ofn = new OFileNotification(); 244 OFileNotification* ofn = new OFileNotification();
245 ofn->_signal.connect( receiver, member ); 245 ofn->_signal.connect( receiver, member );
246 ofn->start( path, true, type ); 246 ofn->start( path, true, type );
247} 247}
248 248
249 249
250void OFileNotification::__signalHandler( int sig, siginfo_t *si, void *data ) 250void OFileNotification::__signalHandler( int sig, siginfo_t *si, void *data )
251{ 251{
252 Q_UNUSED( sig )
253 Q_UNUSED( data )
252 qWarning( "OFileNotification::__signalHandler(): reached." ); 254 qWarning( "OFileNotification::__signalHandler(): reached." );
253 int fd = si->si_fd; 255 int fd = si->si_fd;
254 OFileNotification* fn = notification_list[fd]; 256 OFileNotification* fn = notification_list[fd];
255 if ( fn ) 257 if ( fn )
256 { 258 {
257 // check if it really was the file (dnotify triggers on directory granularity, not file granularity) 259 // check if it really was the file (dnotify triggers on directory granularity, not file granularity)
258 if ( !fn->activate() ) 260 if ( !fn->activate() )
259 { 261 {
260 qDebug( "OFileNotification::__signalHandler(): false alarm ;) Restarting the trigger (if it was single)..." ); 262 qDebug( "OFileNotification::__signalHandler(): false alarm ;) Restarting the trigger (if it was single)..." );
261 if ( !(fn->type() & Multi ) ) 263 if ( !(fn->type() & Multi ) )
262 { 264 {
263 int result = ::fcntl( fn->fileno(), F_NOTIFY, fn->type() ); 265 int result = ::fcntl( fn->fileno(), F_NOTIFY, fn->type() );
264 if ( result == -1 ) 266 if ( result == -1 )
265 { 267 {
266 qWarning( "OFileNotification::__signalHandler(): Can't restart the trigger: %s.", strerror( errno ) ); 268 qWarning( "OFileNotification::__signalHandler(): Can't restart the trigger: %s.", strerror( errno ) );
267 } 269 }
268 } 270 }
269 return; 271 return;
270 } 272 }
271 #if 1 273 #if 1
272 if ( !(fn->type() & Multi) ) 274 if ( !(fn->type() & Multi) )
273 { 275 {
274 qDebug( "OFileNotification::__signalHandler(): '%d' was singleShot. Removing from list.", fd ); 276 qDebug( "OFileNotification::__signalHandler(): '%d' was singleShot. Removing from list.", fd );
275 notification_list.remove( fd ); 277 notification_list.remove( fd );