]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinmodel.h
When pressing a key after entering a directory, QAbstractItemView::scrollTo() must...
[dolphin.git] / src / dolphinmodel.h
1 /*
2 * This file is part of the KDE project
3 * Copyright (C) 2007 Rafael Fernández López <ereslibre@kde.org>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #ifndef DOLPHINMODEL_H
22 #define DOLPHINMODEL_H
23
24 #include <kdirmodel.h>
25 #include <libdolphin_export.h>
26
27 #include <QHash>
28 #include <QPersistentModelIndex>
29
30 class LIBDOLPHINPRIVATE_EXPORT DolphinModel : public KDirModel
31 {
32 Q_OBJECT
33
34 public:
35 enum AdditionalColumns {
36 Revision = KDirModel::ColumnCount,
37 ExtraColumnCount
38 };
39
40 enum RevisionState {
41 LocalRevision,
42 LatestRevision,
43 ConflictingRevision
44 // TODO...
45 };
46
47 DolphinModel(QObject* parent = 0);
48 virtual ~DolphinModel();
49
50 virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
51 virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
52 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
53 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
54
55 bool hasRevisionData() const;
56
57 private:
58 QVariant displayRoleData(const QModelIndex& index) const;
59 QVariant sortRoleData(const QModelIndex& index) const;
60
61 private:
62 bool m_hasRevisionData;
63 QHash<QPersistentModelIndex, RevisionState> m_revisionHash;
64
65 static const char* m_others;
66 };
67
68 #endif // DOLPHINMODEL_H