KDECore
kdirwatch.h
Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 #ifndef _KDIRWATCH_H 00019 #define _KDIRWATCH_H 00020 00021 #include <QtCore/QDateTime> 00022 #include <QtCore/QObject> 00023 #include <QtCore/QString> 00024 00025 #include <kdecore_export.h> 00026 00027 class KDirWatchPrivate; 00028 00064 class KDECORE_EXPORT KDirWatch : public QObject 00065 { 00066 Q_OBJECT 00067 00068 public: 00069 00073 enum WatchMode { 00074 WatchDirOnly = 0, 00075 WatchFiles = 0x01, 00076 WatchSubDirs = 0x02 00077 }; 00078 Q_DECLARE_FLAGS(WatchModes, WatchMode) 00079 00080 00087 KDirWatch(QObject* parent = 0); 00088 00094 ~KDirWatch(); 00095 00115 void addDir(const QString& path, WatchModes watchModes = WatchDirOnly); 00116 00122 void addFile(const QString& file); 00123 00129 QDateTime ctime(const QString& path) const; 00130 00137 void removeDir(const QString& path); 00138 00145 void removeFile(const QString& file); 00146 00159 bool stopDirScan(const QString& path); 00160 00174 bool restartDirScan(const QString& path); 00175 00192 void startScan( bool notify=false, bool skippedToo=false ); 00193 00199 void stopScan(); 00200 00206 bool isStopped(); 00207 00213 bool contains( const QString& path ) const; 00214 00219 static void statistics(); // TODO implement a QDebug operator for KDirWatch instead. 00220 00221 enum Method { FAM, INotify, DNotify /*now unused*/, Stat, QFSWatch }; 00226 Method internalMethod(); // TODO KDE5: make const 00227 00240 static KDirWatch* self(); 00246 static bool exists(); 00247 00248 public Q_SLOTS: 00249 00254 void setCreated( const QString &path ); 00255 00260 void setDirty( const QString &path ); 00261 00266 void setDeleted( const QString &path ); 00267 00268 Q_SIGNALS: 00269 00283 void dirty(const QString &path); 00284 00289 void created(const QString &path); 00290 00297 void deleted(const QString &path); 00298 00299 private: 00300 KDirWatchPrivate *const d; 00301 }; 00302 00303 Q_DECLARE_OPERATORS_FOR_FLAGS(KDirWatch::WatchModes) 00304 00305 #endif 00306 00307 // vim: sw=3 et
KDE 4.6 API Reference