[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/io
From:       David Faure <faure () kde ! org>
Date:       2010-11-05 18:34:24
Message-ID: 20101105183424.E3507AC89B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1193365 by dfaure:

Use the public enum "Method" instead of the internal "WatchMethod" enum, which had \
the same purpose.


 M  +14 -14    kdirwatch.cpp  
 M  +7 -5      kdirwatch.h  
 M  +1 -3      kdirwatch_p.h  


--- trunk/KDE/kdelibs/kdecore/io/kdirwatch.cpp #1193364:1193365
@@ -83,21 +83,21 @@
 }
 
 
-// Convert a string into a WatchMethod
-static KDirWatchPrivate::WatchMethod methodFromString(const QString& method) {
+// Convert a string into a watch Method
+static KDirWatch::Method methodFromString(const QString& method) {
   if (method == QLatin1String("Fam")) {
-    return KDirWatchPrivate::Fam;
+    return KDirWatch::FAM;
   } else if (method == QLatin1String("Stat")) {
-    return KDirWatchPrivate::Stat;
+    return KDirWatch::Stat;
   } else if (method == QLatin1String("QFSWatch")) {
-    return KDirWatchPrivate::QFSWatch;
+    return KDirWatch::QFSWatch;
   } else {
 #ifdef Q_OS_WIN
-    return KDirWatchPrivate::QFSWatch;
+    return KDirWatch::QFSWatch;
 #elif defined(Q_OS_FREEBSD)
-    return KDirWatchPrivate::Stat;
+    return KDirWatch::Stat;
 #else
-    return KDirWatchPrivate::INotify;
+    return KDirWatch::INotify;
 #endif
   }
 }
@@ -845,7 +845,7 @@
     }
 
 #if defined(HAVE_SYS_INOTIFY_H)
-    if (e->m_mode == INotifyMode || (e->m_mode == UnknownMode && m_preferredMethod \
== INotify)  ) +    if (e->m_mode == INotifyMode || (e->m_mode == UnknownMode && \
m_preferredMethod == KDirWatch::INotify)  )  {
         //kDebug(7001) << "Ignoring WatchFiles directive - this is implicit with \
inotify";  // Placing a watch on individual files is redundant with inotify
@@ -877,7 +877,7 @@
   // cannot detect changes made by other machines. However as a default inotify
   // is fine, since the most common case is a NFS-mounted home, where all changes
   // are made locally. #177892.
-  WatchMethod preferredMethod = m_preferredMethod;
+  KDirWatch::Method preferredMethod = m_preferredMethod;
   if (m_nfsPreferredMethod != m_preferredMethod) {
     KMountPoint::Ptr mountPoint = \
KMountPoint::currentMountPoints().findByPath(e->path);  if (mountPoint && \
mountPoint->probablySlow()) { @@ -889,15 +889,15 @@
   bool entryAdded = false;
   switch (preferredMethod) {
 #if defined(HAVE_FAM)
-  case Fam: entryAdded = useFAM(e); break;
+    case KDirWatch::FAM: entryAdded = useFAM(e); break;
 #endif
 #if defined(HAVE_SYS_INOTIFY_H)
-  case INotify: entryAdded = useINotify(e); break;
+    case KDirWatch::INotify: entryAdded = useINotify(e); break;
 #endif
 #if defined(HAVE_QFILESYSTEMWATCHER)
-  case QFSWatch: entryAdded = useQFSWatch(e); break;
+    case KDirWatch::QFSWatch: entryAdded = useQFSWatch(e); break;
 #endif
-  case Stat: entryAdded = useStat(e); break;
+    case KDirWatch::Stat: entryAdded = useStat(e); break;
   default: break;
   }
 
--- trunk/KDE/kdelibs/kdecore/io/kdirwatch.h #1193364:1193365
@@ -49,15 +49,17 @@
   * and restarted. The whole class can be stopped and restarted.
   * Directories and files can be added/removed from the list in any state.
   *
-  * The implementation uses the FAM service when available;
-  * if FAM is not available, the INOTIFY functionality is used on LINUX.
+  * The implementation uses the INOTIFY functionality on LINUX.
+  * Otherwise the FAM service is used, when available.
   * 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.
+  * The choice of implementation can be adjusted by the user, with the key
+  * [DirWatch] PreferredMethod={Fam|Stat|QFSWatch|inotify}
   *
   * @see self()
-  * @author Sven Radej <sven@lisa.exp.univie.ac.at>
+  * @author Sven Radej (in 1998)
   */
 class KDECORE_EXPORT KDirWatch : public QObject
 {
@@ -216,12 +218,12 @@
     */
    static void statistics(); // TODO implement a QDebug operator for KDirWatch \
instead.  
-   enum Method { FAM, INotify, DNotify, Stat };
+   enum Method { FAM, INotify, DNotify /*now unused*/, Stat, QFSWatch };
    /**
     * Returns the preferred internal method to
     * watch for changes.
     */
-   Method internalMethod();
+   Method internalMethod(); // TODO KDE5: make const
 
    /**
     * The KDirWatch instance usually globally used in an application.
--- trunk/KDE/kdelibs/kdecore/io/kdirwatch_p.h #1193364:1193365
@@ -119,8 +119,6 @@
   enum { NoChange=0, Changed=1, Created=2, Deleted=4 };
 
 
-  enum WatchMethod { Stat, Fam, INotify, QFSWatch };
-
   struct Client {
     KDirWatch* instance;
     int count;
@@ -223,7 +221,7 @@
   QTimer timer;
   EntryMap m_mapEntries;
 
-  WatchMethod m_preferredMethod, m_nfsPreferredMethod;
+  KDirWatch::Method m_preferredMethod, m_nfsPreferredMethod;
   int freq;
   int statEntries;
   int m_nfsPollInterval, m_PollInterval;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic