]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmodel.h
Enable Dolphin to show the revision states of files that are under revision control...
[dolphin.git] / src / dolphinmodel.h
index 44067f5a56f3034982b04ce795e4509abc87b861..b03507dc5790471903fb52711edf5308f03830c7 100644 (file)
 #define DOLPHINMODEL_H
 
 #include <kdirmodel.h>
-
 #include <libdolphin_export.h>
 
-class LIBDOLPHINPRIVATE_EXPORT DolphinModel
-    : public KDirModel
+#include <QHash>
+#include <QPersistentModelIndex>
+
+class LIBDOLPHINPRIVATE_EXPORT DolphinModel : public KDirModel
 {
+    Q_OBJECT
+
 public:
     enum AdditionalColumns {
-        Rating = ColumnCount, // ColumnCount defined at KDirModel
-        Tags,
+        Revision = KDirModel::ColumnCount,
         ExtraColumnCount
     };
 
+    enum RevisionState {
+        LocalRevision,
+        LatestRevision
+        // TODO...
+    };
+
     DolphinModel(QObject* parent = 0);
     virtual ~DolphinModel();
 
-    virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
-
+    virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
+    virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;    
+    virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
     virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
 
-    /**
-     * Returns the rating for the item with the index \a index. 0 is
-     * returned if no item could be found.
-     */
-    static quint32 ratingForIndex(const QModelIndex& index);
-
-    /**
-     * Returns the tags for the item with the index \a index. If no
-     * tag is applied, a predefined string will be returned.
-     */
-    static QString tagsForIndex(const QModelIndex& index);
+    bool hasRevisionData() const;
 
 private:
     QVariant displayRoleData(const QModelIndex& index) const;
     QVariant sortRoleData(const QModelIndex& index) const;
 
 private:
+    bool m_hasRevisionData;
+    QHash<QPersistentModelIndex, RevisionState> m_revisionHash;
+
     static const char* m_others;
 };