.TH "KDirWatch" 3 "28 Jan 2004" "kio Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KDirWatch \- Watch directories and files for changes. Class for watching directory and file changes.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kdirwatch.h>\fP
.PP
Inherits \fBQObject\fP.
.PP
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBdirty\fP (const  \fBQString\fP &)"
.br
.RI "\fIEmitted when a watched object is changed. \fP"
.ti -1c
.RI "void \fBcreated\fP (const  \fBQString\fP &)"
.br
.RI "\fIEmitted when a file or directory is created. \fP"
.ti -1c
.RI "void \fBdeleted\fP (const  \fBQString\fP &)"
.br
.RI "\fIEmitted when a file or directory is deleted. \fP"
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKDirWatch\fP (\fBQObject\fP *\fBparent\fP=0, const  char *\fBname\fP=0)"
.br
.RI "\fIConstructor. \fP"
.ti -1c
.RI "\fB~KDirWatch\fP ()"
.br
.RI "\fIDestructor. \fP"
.ti -1c
.RI "void \fBaddDir\fP (const  \fBQString\fP &path, bool watchFiles=false, bool recursive=false)"
.br
.RI "\fIAdds a directory to be watched. \fP"
.ti -1c
.RI "void \fBaddFile\fP (const  \fBQString\fP &file)"
.br
.RI "\fIAdds a file to be watched. \fP"
.ti -1c
.RI "\fBQDateTime\fP \fBctime\fP (const  \fBQString\fP &path)"
.br
.RI "\fIReturns the time the directory/file was last changed. \fP"
.ti -1c
.RI "void \fBremoveDir\fP (const  \fBQString\fP &path)"
.br
.RI "\fIRemoves a directory from the list of scanned directories. \fP"
.ti -1c
.RI "void \fBremoveFile\fP (const  \fBQString\fP &file)"
.br
.RI "\fIRemoves a file from the list of watched files. \fP"
.ti -1c
.RI "bool \fBstopDirScan\fP (const  \fBQString\fP &path)"
.br
.RI "\fIStops scanning the specified path. \fP"
.ti -1c
.RI "bool \fBrestartDirScan\fP (const  \fBQString\fP &path)"
.br
.RI "\fIRestarts scanning for specified path. \fP"
.ti -1c
.RI "void \fBstartScan\fP (bool notify=false, bool skippedToo=false)"
.br
.RI "\fIStarts scanning of all dirs in list. \fP"
.ti -1c
.RI "void \fBstopScan\fP ()"
.br
.RI "\fIStops scanning of all directories in internal list. \fP"
.ti -1c
.RI "bool \fBisStopped\fP ()"
.br
.RI "\fIIs scanning stopped? After creation of a KDirWatch instance, this is false. \fP"
.ti -1c
.RI "bool \fBcontains\fP (const  \fBQString\fP &path) const "
.br
.RI "\fICheck if a directory is being watched by this KDirWatch instance. \fP"
.ti -1c
.RI "void \fBsetCreated\fP (const  \fBQString\fP &)"
.br
.RI "\fI\fBcreated\fP() \fP"
.ti -1c
.RI "void \fBsetDirty\fP (const  \fBQString\fP &)"
.br
.RI "\fI\fBdirty\fP() \fP"
.ti -1c
.RI "void \fBsetDeleted\fP (const  \fBQString\fP &)"
.br
.RI "\fI\fBdeleted\fP() \fP"
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "void \fBstatistics\fP ()"
.br
.RI "\fIDump statistic information about all KDirWatch instances. \fP"
.ti -1c
.RI "\fBKDirWatch\fP * \fBself\fP ()"
.br
.RI "\fIThe KDirWatch instance usually globally used in an application. \fP"
.ti -1c
.RI "bool \fBexists\fP ()"
.br
.RI "\fIReturn true if \fBKDirWatch::self()\fP exists 
.PP
\fBSince:\fP
.RS 4
3.1. 
.RE
.PP
\fP"
.in -1c
.SH "Detailed Description"
.PP 
Watch directories and files for changes. Class for watching directory and file changes. 

The watched directories or files doesn't have to exist yet.
.PP
When a watched directory is changed, i.e. when files therein are created or deleted, KDirWatch will emit the signal \fBdirty\fP().
.PP
When a watched, but previously not existing directory gets created, KDirWatch will emit the signal \fBcreated\fP().
.PP
When a watched directory gets deleted, KDirWatch will emit the signal \fBdeleted\fP(). The directory is still watched for new creation.
.PP
When a watched file is changed, i.e. attributes changed or written to, KDirWatch will emit the signal \fBdirty\fP().
.PP
Scanning of particular directories or files can be stopped temporarily and restarted. The whole class can be stopped and restarted. Directories and files can be added/removed from list in any state.
.PP
The implementation uses the FAM service when available; if FAM is not available, the DNOTIFY functionality is used on LINUX. As a last resort, a regular polling for change of modification times is done; the polling interval is a global config option: DirWatch/PollInterval and DirWatch/NFSPollInterval for NFS mounted directories.
.PP
\fBAuthor:\fP
.RS 4
Sven Radej <sven@lisa.exp.univie.ac.at> 
.RE
.PP

.PP
Definition at line 60 of file kdirwatch.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KDirWatch::KDirWatch (\fBQObject\fP * parent = 0, const char * name = 0)"
.PP
Constructor. Scanning begins immediatly when a dir/file watch is added. Definition at line 1264 of file kdirwatch.cpp.
.PP
References QObject::name(), KStdAccel::name(), and QObject::setName().
.SS "KDirWatch::~\fBKDirWatch\fP ()"
.PP
Destructor. Stops scanning and cleans up. Definition at line 1282 of file kdirwatch.cpp.
.SH "Member Function Documentation"
.PP 
.SS "void KDirWatch::addDir (const \fBQString\fP & path, bool watchFiles = false, bool recursive = false)"
.PP
Adds a directory to be watched. The directory does not have to exist. When \fCwatchFiles\fP is false (the default), the signals \fBdirty()\fP, \fBcreated()\fP, \fBdeleted()\fP can be emitted, all for the watched directory. When \fCwatchFiles\fP is true, all files in the watched directory are looked for changes, too. Thus, the signals fileDirty(), fileCreated(), fileDeleted() can be emitted. are looked for changes, too. Thus, the signals \fBdirty()\fP, \fBcreated()\fP, \fBdeleted()\fP can be emitted.
.PP
When \fCrecursive\fP is true, also all sub directories are watched. Definition at line 1295 of file kdirwatch.cpp.
.SS "void KDirWatch::addFile (const \fBQString\fP & file)"
.PP
Adds a file to be watched. Definition at line 1305 of file kdirwatch.cpp.
.SS "\fBQDateTime\fP KDirWatch::ctime (const \fBQString\fP & path)"
.PP
Returns the time the directory/file was last changed. Definition at line 1310 of file kdirwatch.cpp.
.SS "void KDirWatch::removeDir (const \fBQString\fP & path)"
.PP
Removes a directory from the list of scanned directories. If specified path is not in the list this does nothing. Definition at line 1320 of file kdirwatch.cpp.
.SS "void KDirWatch::removeFile (const \fBQString\fP & file)"
.PP
Removes a file from the list of watched files. If specified path is not in the list this does nothing. Definition at line 1325 of file kdirwatch.cpp.
.SS "bool KDirWatch::stopDirScan (const \fBQString\fP & path)"
.PP
Stops scanning the specified path. The \fCpath\fP is not deleted from the interal just, it is just skipped. Call this function when you perform an huge operation on this directory (copy/move big files or many files). When finished, call \fBrestartDirScan\fP (path). Returns \fCfalse\fP if specified path is not in list, \fCtrue\fP otherwise. Definition at line 1330 of file kdirwatch.cpp.
.SS "bool KDirWatch::restartDirScan (const \fBQString\fP & path)"
.PP
Restarts scanning for specified path. Resets ctime. It doesn't notify the change (by emitted a signal), since the ctime value is reset.
.PP
Call it when you are finished with big operations on that path, \fIand\fP when \fIyou\fP have refreshed that path. Returns \fCfalse\fP if specified path is not in list, \fCtrue\fP otherwise. Definition at line 1339 of file kdirwatch.cpp.
.SS "void KDirWatch::startScan (bool notify = false, bool skippedToo = false)"
.PP
Starts scanning of all dirs in list. If notify is \fCtrue\fP, all changed directories (since \fBstopScan\fP() call) will be notified for refresh. If notify is \fCfalse\fP, all ctimes will be reset (except those who are stopped, but only if \fCskippedToo\fP is \fCfalse\fP) and changed dirs won't be notified. You can start scanning even if the list is empty. First call should be called with \fCfalse\fP or else all directories in list will be notified. If \fCskippedToo\fP is true, the skipped directoris (scanning of which was stopped with \fBstopDirScan\fP() ) will be reset and notified for change. Otherwise, stopped directories will continue to be unnotified. Definition at line 1356 of file kdirwatch.cpp.
.SS "void KDirWatch::stopScan ()"
.PP
Stops scanning of all directories in internal list. The timer is stopped, but the list is not cleared. Definition at line 1350 of file kdirwatch.cpp.
.SS "bool KDirWatch::isStopped ()\fC [inline]\fP"
.PP
Is scanning stopped? After creation of a KDirWatch instance, this is false. Definition at line 174 of file kdirwatch.h.
.SS "bool KDirWatch::contains (const \fBQString\fP & path) const"
.PP
Check if a directory is being watched by this KDirWatch instance. Definition at line 1363 of file kdirwatch.cpp.
.SS "void KDirWatch::statistics ()\fC [static]\fP"
.PP
Dump statistic information about all KDirWatch instances. This checks for consistency, too. Definition at line 1376 of file kdirwatch.cpp.
.SS "void KDirWatch::setCreated (const \fBQString\fP &)"
.PP
\fBcreated\fP() Definition at line 1386 of file kdirwatch.cpp.
.PP
References created(), and QObject::name().
.SS "void KDirWatch::setDirty (const \fBQString\fP &)"
.PP
\fBdirty\fP() Definition at line 1392 of file kdirwatch.cpp.
.PP
References dirty(), and QObject::name().
.SS "void KDirWatch::setDeleted (const \fBQString\fP &)"
.PP
\fBdeleted\fP() Definition at line 1398 of file kdirwatch.cpp.
.PP
References deleted(), and QObject::name().
.SS "\fBKDirWatch\fP * KDirWatch::self ()\fC [static]\fP"
.PP
The KDirWatch instance usually globally used in an application. It is automatically deleted when the application exits.
.PP
However, you can create an arbitrary number of KDirWatch instances aside from this one - for those you have to take care of memory management. Definition at line 1250 of file kdirwatch.cpp.
.SS "bool KDirWatch::exists ()\fC [static]\fP"
.PP
Return true if \fBKDirWatch::self()\fP exists 
.PP
\fBSince:\fP
.RS 4
3.1. 
.RE
.PP
Definition at line 1259 of file kdirwatch.cpp.
.SS "void KDirWatch::dirty (const \fBQString\fP &)\fC [signal]\fP"
.PP
Emitted when a watched object is changed. For a directory this signal is emitted when files therein are created or deleted. For a file this signal is emitted when its size or attributes change.
.PP
When you watch a directory, changes in the size or attributes of contained files may or may not trigger this signal to be emitted depending on which backend is used by KDirWatch.
.PP
The new ctime is set before the signal is emitted. Referenced by setDirty().
.SS "void KDirWatch::created (const \fBQString\fP &)\fC [signal]\fP"
.PP
Emitted when a file or directory is created. Referenced by setCreated().
.SS "void KDirWatch::deleted (const \fBQString\fP &)\fC [signal]\fP"
.PP
Emitted when a file or directory is deleted. The object is still watched for new creation. Referenced by setDeleted().

.SH "Author"
.PP 
Generated automatically by Doxygen for kio Library from the source code.
