]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kfileitemmodelrolesupdater.h
Fix Exports.
[dolphin.git] / src / kitemviews / kfileitemmodelrolesupdater.h
index 2a5a4041c25cd0a909c8aec41f05fa4a2bde2558..6c82dbe4ae552f9b85055a29711f78b755dfc114 100644 (file)
 #ifndef KFILEITEMMODELROLESUPDATER_H
 #define KFILEITEMMODELROLESUPDATER_H
 
-#include <config-nepomuk.h>
+#include <config-baloo.h>
 
 #include <KFileItem>
 #include <kitemviews/kitemmodelbase.h>
 
-#include <libdolphin_export.h>
+#include "libdolphin_export.h"
 
 #include <QObject>
 #include <QSet>
 #include <QSize>
 #include <QStringList>
 
-class KDirWatch;
+class KDirectoryContentsCounter;
 class KFileItemModel;
-class KJob;
 class QPixmap;
 class QTimer;
 
-#ifdef HAVE_NEPOMUK
-    namespace Nepomuk2
-    {
-        class ResourceWatcher;
-        class Resource;
-    }
-#else
-    // Required for the slot applyChangedNepomukRoles() that
-    // cannot be ifdefined due to moc.
-    namespace Nepomuk2
+namespace KIO {
+    class PreviewJob;
+}
+
+#ifdef HAVE_BALOO
+    namespace Baloo
     {
-        class Resource;
+        class FileMonitor;
     }
 #endif
 
@@ -208,14 +203,9 @@ private slots:
      */
     void resolveRecentlyChangedItems();
 
-    void applyChangedNepomukRoles(const Nepomuk2::Resource& resource);
+    void applyChangedBalooRoles(const QString& file);
 
-    /**
-     * Is invoked if a directory watched by KDirWatch got dirty. Updates
-     * the "isExpandable"- and "size"-roles of the item that matches to
-     * the given path.
-     */
-    void slotDirWatchDirty(const QString& path);
+    void slotDirectoryContentsCountReceived(const QString& path, int count);
 
 private:
     /**
@@ -223,6 +213,15 @@ private:
      */
     void startUpdating();
 
+    /**
+     * Loads the icons for the visible items. After 200 ms, the function
+     * stops determining mime types and only loads preliminary icons.
+     * This is a compromise that prevents that
+     * (a) the GUI is blocked for more than 200 ms, and
+     * (b) "unknown" icons could be shown in the view.
+     */
+    void updateVisibleIcons();
+
     /**
      * Creates previews for the items starting from the first item in
      * m_pendingPreviewItems.
@@ -249,8 +248,8 @@ private:
         ResolveFast,
         ResolveAll
     };
-    bool applyResolvedRoles(const KFileItem& item, ResolveHint hint);
-    QHash<QByteArray, QVariant> rolesData(const KFileItem& item) const;
+    bool applyResolvedRoles(int index, ResolveHint hint);
+    QHash<QByteArray, QVariant> rolesData(const KFileItem& item);
 
     /**
      * @return The number of items of the path \a path.
@@ -311,11 +310,6 @@ private:
     // Items for which the sort role still has to be determined.
     QSet<KFileItem> m_pendingSortRoleItems;
 
-    // While the sort role is being resolved, we also keep the indexes
-    // in a sorted list. The reason is that this enables us to determine
-    // both the sort role and the icon for the visible items first.
-    QList<int> m_pendingSortRoleIndexes;
-
     // Indexes of items which still have to be handled by
     // resolveNextPendingRoles().
     QList<int> m_pendingIndexes;
@@ -324,7 +318,7 @@ private:
     // A new preview job will be started from them once the first one finishes.
     KFileItemList m_pendingPreviewItems;
 
-    KJob* m_previewJob;
+    KIO::PreviewJob* m_previewJob;
 
     // When downloading or copying large files, the slot slotItemsChanged()
     // will be called periodically within a quite short delay. To prevent
@@ -337,12 +331,10 @@ private:
     // Items which have not been changed repeatedly recently.
     QSet<KFileItem> m_changedItems;
 
-    KDirWatch* m_dirWatcher;
-    mutable QSet<QString> m_watchedDirs; // Required as sadly KDirWatch does not offer a getter method
-                                         // to get all watched directories.
-#ifdef HAVE_NEPOMUK
-    Nepomuk2::ResourceWatcher* m_nepomukResourceWatcher;
-    mutable QHash<QUrl, KUrl> m_nepomukUriItems;
+    KDirectoryContentsCounter* m_directoryContentsCounter;
+
+#ifdef HAVE_BALOO
+    Baloo::FileMonitor* m_balooFileMonitor;
 #endif
 };