add more spacing
[personal-kdebase.git] / runtime / nepomuk / kcm / folderselectionmodel.h
blobdbc1ecf12f209f911f52e08855804d1ed35bc1e5
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
35 Q_OBJECT
37 public:
38 FolderSelectionModel( QObject* parent = 0 );
39 virtual ~FolderSelectionModel();
41 enum IncludeState {
42 StateNone,
43 StateInclude,
44 StateExclude,
45 StateIncludeInherited,
46 StateExcludeInherited
49 enum CustomRoles {
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;
61 /**
62 * Include the specified path. All subdirs will be reset.
64 void includePath( const QString& );
66 /**
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;
76 private:
77 bool isForbiddenPath( const QString& path ) const;
79 QSet<QString> m_included;
80 QSet<QString> m_excluded;
83 #endif