|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: file system proxy model, used to filter system folders |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef FMFILESYSTEMPROXYMODEL_H |
|
19 #define FMFILESYSTEMPROXYMODEL_H |
|
20 |
|
21 #include <QDir> |
|
22 #include <QVariant> |
|
23 #include <QFileInfo> |
|
24 #include <QModelIndex> |
|
25 #include <QSortFilterProxyModel> |
|
26 |
|
27 /*! |
|
28 \class FmFileSystemProxyModel |
|
29 \brief The class FmFileSystemProxyModel provide file system model |
|
30 that can filter system folder and enable folder localization if source model is QFileSystemModel |
|
31 Most functions only can be used when source model is QFileSystemModel |
|
32 */ |
|
33 class FmFileSystemProxyModel : public QSortFilterProxyModel |
|
34 { |
|
35 Q_OBJECT |
|
36 public: |
|
37 |
|
38 explicit FmFileSystemProxyModel( QObject *parent = 0 ); |
|
39 virtual ~FmFileSystemProxyModel(); |
|
40 |
|
41 virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; |
|
42 QFileInfo fileInfo ( const QModelIndex & index ) const; |
|
43 QModelIndex setRootPath ( const QString & newPath ); |
|
44 bool isDir ( const QModelIndex & index ) const; |
|
45 QString filePath ( const QModelIndex & index ) const; |
|
46 void setFilter ( QDir::Filters filters ); |
|
47 void setNameFilters(const QStringList &filters); |
|
48 |
|
49 private: |
|
50 virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; |
|
51 }; |
|
52 |
|
53 |
|
54 |
|
55 #endif |