1 /* This file is part of the KDE Project
2 Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
4 Based on CollectionSetup.h from the Amarok project
5 (C) 2003 Scott Wheeler <wheeler@kde.org>
6 (C) 2004 Max Howell <max.howell@methylblue.com>
7 (C) 2004 Mark Kretschmann <markey@web.de>
8 (C) 2008 Seb Ruiz <ruiz@kde.org>
9 (C) 2008 Sebastian Trueg <trueg@kde.org>
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public
13 License version 2 as published by the Free Software Foundation.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
20 You should have received a copy of the GNU Library General Public License
21 along with this library; see the file COPYING.LIB. If not, write to
22 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 Boston, MA 02110-1301, USA.
26 #ifndef _FOLDER_SELECTION_MODEL_H_
27 #define _FOLDER_SELECTION_MODEL_H_
29 #include <QtGui/QFileSystemModel>
30 #include <QtCore/QSet>
33 class FolderSelectionModel
: public QFileSystemModel
38 FolderSelectionModel( QObject
* parent
= 0 );
39 virtual ~FolderSelectionModel();
45 StateIncludeInherited
,
50 IncludeStateRole
= 7777
53 Qt::ItemFlags
flags( const QModelIndex
&index
) const;
54 QVariant
data( const QModelIndex
& index
, int role
= Qt::DisplayRole
) const;
55 bool setData( const QModelIndex
& index
, const QVariant
& value
, int role
= Qt::EditRole
);
57 void setFolders( const QStringList
& includeDirs
, const QStringList
& exclude
);
58 QStringList
includeFolders() const;
59 QStringList
excludeFolders() const;
62 * Include the specified path. All subdirs will be reset.
64 void includePath( const QString
& );
67 * Exclude the specified path. All subdirs will be reset.
69 void excludePath( const QString
& );
71 int columnCount( const QModelIndex
& ) const { return 1; }
73 IncludeState
includeState( const QModelIndex
& ) const;
74 IncludeState
includeState( const QString
& path
) const;
77 bool isForbiddenPath( const QString
& path
) const;
79 QSet
<QString
> m_included
;
80 QSet
<QString
> m_excluded
;