filemanager/src/inc/fmfilesystemproxymodel.h
changeset 48 1bebd60c0f00
child 49 81668a704644
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/inc/fmfilesystemproxymodel.h	Mon Oct 04 00:06:46 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: file system proxy model, used to filter system folders
+*
+*/
+
+#ifndef FMFILESYSTEMPROXYMODEL_H
+#define FMFILESYSTEMPROXYMODEL_H
+
+#include <QDir>
+#include <QVariant>
+#include <QFileInfo>
+#include <QModelIndex>
+#include <QSortFilterProxyModel>
+
+/*!
+    \class FmFileSystemProxyModel 
+    \brief The class FmFileSystemProxyModel provide file system model
+    that can filter system folder and enable folder localization if source model is QFileSystemModel
+    Most functions only can be used when source model is QFileSystemModel
+*/
+class FmFileSystemProxyModel : public QSortFilterProxyModel
+{
+Q_OBJECT
+public:
+
+    explicit FmFileSystemProxyModel( QObject *parent = 0 );
+    virtual ~FmFileSystemProxyModel();
+
+    virtual QVariant    data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
+    QFileInfo fileInfo ( const QModelIndex & index ) const;
+    QModelIndex setRootPath ( const QString & newPath );
+    bool isDir ( const QModelIndex & index ) const;
+    QString filePath ( const QModelIndex & index ) const;
+    void setFilter ( QDir::Filters filters );
+    void setNameFilters(const QStringList &filters);
+
+private:
+    virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+};
+
+
+
+#endif