source: trunk/src/gui/dialogs/qfilesystemmodel.h@ 642

Last change on this file since 642 was 561, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.1 sources.

File size: 6.8 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtGui module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QFILESYSTEMMODEL_H
43#define QFILESYSTEMMODEL_H
44
45#include <QtCore/qabstractitemmodel.h>
46#include <QtCore/qpair.h>
47#include <QtCore/qdir.h>
48#include <QtGui/qicon.h>
49#include <QtCore/qdiriterator.h>
50
51QT_BEGIN_HEADER
52
53QT_BEGIN_NAMESPACE
54
55QT_MODULE(Gui)
56
57#ifndef QT_NO_FILESYSTEMMODEL
58
59class ExtendedInformation;
60class QFileSystemModelPrivate;
61class QFileIconProvider;
62
63class Q_GUI_EXPORT QFileSystemModel : public QAbstractItemModel
64{
65 Q_OBJECT
66 Q_PROPERTY(bool resolveSymlinks READ resolveSymlinks WRITE setResolveSymlinks)
67 Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
68 Q_PROPERTY(bool nameFilterDisables READ nameFilterDisables WRITE setNameFilterDisables)
69
70Q_SIGNALS:
71 void rootPathChanged(const QString &newPath);
72 void fileRenamed(const QString &path, const QString &oldName, const QString &newName);
73
74public:
75 enum Roles {
76 FileIconRole = Qt::DecorationRole,
77 FilePathRole = Qt::UserRole + 1,
78 FileNameRole = Qt::UserRole + 2,
79 FilePermissions = Qt::UserRole + 3
80 };
81
82 explicit QFileSystemModel(QObject *parent = 0);
83 ~QFileSystemModel();
84
85 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
86 QModelIndex index(const QString &path, int column = 0) const;
87 QModelIndex parent(const QModelIndex &child) const;
88 bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
89 bool canFetchMore(const QModelIndex &parent) const;
90 void fetchMore(const QModelIndex &parent);
91
92 int rowCount(const QModelIndex &parent = QModelIndex()) const;
93 int columnCount(const QModelIndex &parent = QModelIndex()) const;
94
95 QVariant myComputer(int role = Qt::DisplayRole) const;
96 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
97 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
98
99 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
100
101 Qt::ItemFlags flags(const QModelIndex &index) const;
102
103 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
104
105 QStringList mimeTypes() const;
106 QMimeData *mimeData(const QModelIndexList &indexes) const;
107 bool dropMimeData(const QMimeData *data, Qt::DropAction action,
108 int row, int column, const QModelIndex &parent);