]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinmodel.h
Restore the "Edit->Selection" menu from Konqueror 3 for file
[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 <kversioncontrolplugin.h>
26 #include <libdolphin_export.h>
27
28 #include <QHash>
29 #include <QPersistentModelIndex>
30
31 class LIBDOLPHINPRIVATE_EXPORT DolphinModel : public KDirModel
32 {
33 Q_OBJECT
34
35 public:
36 enum AdditionalColumns {
37 Version = KDirModel::ColumnCount,
38 ExtraColumnCount
39 };
40
41 DolphinModel(QObject* parent = 0);
42 virtual ~DolphinModel();
43
44 virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
45 virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
46 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
47 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
48
49 void clearVersionData();
50 bool hasVersionData() const;
51
52 private slots:
53 void slotRowsRemoved(const QModelIndex& parent, int start, int end);
54
55 private:
56 QVariant displayRoleData(const QModelIndex& index) const;
57 QVariant sortRoleData(const QModelIndex& index) const;
58
59 private:
60 bool m_hasVersionData;
61 QHash<QPersistentModelIndex, KVersionControlPlugin::VersionState> m_revisionHash;
62
63 static const char* m_others;
64 };
65
66 #endif // DOLPHINMODEL_H