kdirwatch.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1998 Sven Radej <sven@lisa.exp.univie.ac.at> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 #ifndef _KDIRWATCH_H 00019 #define _KDIRWATCH_H 00020 00021 #include <qtimer.h> 00022 #include <qdatetime.h> 00023 #include <qmap.h> 00024 00025 #define kdirwatch KDirWatch::self() 00026 00027 class KDirWatchPrivate; 00028 00060 class KDirWatch : public QObject 00061 { 00062 Q_OBJECT 00063 00064 public: 00071 KDirWatch (QObject* parent = 0, const char* name = 0); 00072 00078 ~KDirWatch(); 00079 00094 void addDir(const QString& path, 00095 bool watchFiles = false, bool recursive = false); 00096 00101 void addFile(const QString& file); 00102 00106 QDateTime ctime(const QString& path); 00107 00113 void removeDir(const QString& path); 00114 00120 void removeFile(const QString& file); 00121 00131 bool stopDirScan(const QString& path); 00132 00143 bool restartDirScan(const QString& path); 00144 00161 void startScan( bool notify=false, bool skippedToo=false ); 00162 00168 void stopScan(); 00169 00174 bool isStopped() { return _isStopped; } 00175 00179 bool contains( const QString& path ) const; 00180 00185 static void statistics(); 00186 00188 void setCreated( const QString& ); 00190 void setDirty( const QString& ); 00192 void setDeleted( const QString& ); 00193 00201 static KDirWatch* self(); 00206 static bool exists(); 00207 00208 signals: 00209 00223 void dirty (const QString&); 00224 00228 void created (const QString&); 00229 00235 void deleted (const QString&); 00236 00237 private: 00238 bool _isStopped; 00239 00240 KDirWatchPrivate *d; 00241 static KDirWatch* s_pSelf; 00242 }; 00243 00244 #endif 00245 00246 // vim: sw=3 et