47
|
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 |
|
49
|
27 |
class HbDirectoryNameLocalizer;
|
|
28 |
|
47
|
29 |
/*!
|
|
30 |
\class FmFileSystemProxyModel
|
|
31 |
\brief The class FmFileSystemProxyModel provide file system model
|
|
32 |
that can filter system folder and enable folder localization if source model is QFileSystemModel
|
|
33 |
Most functions only can be used when source model is QFileSystemModel
|
|
34 |
*/
|
|
35 |
class FmFileSystemProxyModel : public QSortFilterProxyModel
|
|
36 |
{
|
|
37 |
Q_OBJECT
|
|
38 |
public:
|
|
39 |
|
|
40 |
explicit FmFileSystemProxyModel( QObject *parent = 0 );
|
|
41 |
virtual ~FmFileSystemProxyModel();
|
|
42 |
|
|
43 |
virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
|
|
44 |
QFileInfo fileInfo ( const QModelIndex & index ) const;
|
|
45 |
QModelIndex setRootPath ( const QString & newPath );
|
|
46 |
bool isDir ( const QModelIndex & index ) const;
|
|
47 |
QString filePath ( const QModelIndex & index ) const;
|
|
48 |
void setFilter ( QDir::Filters filters );
|
|
49 |
void setNameFilters(const QStringList &filters);
|
|
50 |
|
|
51 |
private:
|
|
52 |
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
|
49
|
53 |
|
|
54 |
private:
|
|
55 |
// used to get localized directory name
|
|
56 |
HbDirectoryNameLocalizer *localizer;
|
47
|
57 |
};
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
#endif
|