KDirWatch Class Reference

[KDirWatch Index] [KDirWatch Hierarchy] [Headers]


Class for watching directory changes. More...

#include <kdirwatch.h>

Inherits: QObject (qt)

Public Members

Protected Members

Protected Slots


Detailed Description

Class for watching directory changes. It uses stat (2) and compares stored and actual changed time of directories. If there is a difference notifies KFM for change. Directories can be aded, removed from the list and scanning of particular directories can be stoped and restarted. The whole class can be stoped and restarted. Directories can be added/removed from list in any state. There may be only one KDirWatch object in application. There is a static function that returns a pointer that object.


KDirWatch(int freq = 500)

Constructor. Does not begin with scanning until startScan is called. Default frequency is 500 ms. The created list of directories has deep copies.

~KDirWatch()

Destructor. Stops scanning and cleans up.

void addDirListEntry(const char *_url)

Adds directory to list of directories to be watched. (The list makes deep copies).

void removeDirListEntry(const char *_url)

Removes directory from list of scanned directories. If specified url is not in the list, does nothing.

bool stopDirScan(const char *_url)

Stops scanning for specified url. Does not delete dir from list, just skips it. Call this function when you make an huge operation on this directory (copy/move big files or lot of files). When finished, call restartDirScan (url). Returns 'false' if specified url is not in list, 'true' otherwise.

bool restartDirScan(const char *_url)

Restarts scanning for specified url. Resets ctime. It doesn't notify the change, since ctime value is reset. Call it when you are finished with big operations on that url, *and* when *you* have refreshed that url. Returns 'false' if specified url is not in list, 'true' otherwise.

void startScan(bool notify=false, bool skippedToo=false)

Starts scanning of all dirs in list. If notify is true, all changed dirs (since stopScan call) will be notified for refresh. If notify is false, all ctimes will be reset (except those who are stopped, but only if skippedToo is false) and changed dirs won't be notified. You can start scanning even if the list is empty. First call should be called with 'false' or else all dirs in list will be notified. Note that direcories that were. If 'skippedToo' is true, the skipped dirs, (scanning of which was stopped with stopDirScan ) will be reset and notified for change. Otherwise, stopped dirs will continue to be unnotified.

void stopScan()

Stops scanning of all dirs in list. List is not cleared, just the timer is stopped.

QStrList *getDirlist()

Returns list of directories.

static KDirWatch *getKDirWatch()

Static function that returns a pointer to dirwatcher.


  • Author: Sven Radej <sven@lisa.exp.univie.ac.at>
  • Documentation generated by sven@beta on Sun Mar 29 03:00:43 CEST 1998
Kdoc