Filter for directory listing
[owncloud:sebas-mirall.git] / src / plasma / lib / directorylister.h
1 /***************************************************************************
2  *                                                                         *
3  *   Copyright 2012 Sebastian K├╝gler <sebas@kde.org>                       *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
19  ***************************************************************************/
20
21
22 #ifndef DIRECTORYLISTER_H
23 #define DIRECTORYLISTER_H
24
25 #include <QFile>
26 #include <QDir>
27
28 class DirectoryListerPrivate;
29
30 class DirectoryLister : public QObject
31 {
32     Q_OBJECT
33
34     Q_PROPERTY(QStringList directories READ directories NOTIFY directoriesChanged)
35     Q_PROPERTY(QString currentPath READ currentPath NOTIFY currentPathChanged)
36     Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
37
38     public:
39         DirectoryLister(QObject* parent = 0);
40         ~DirectoryLister();
41
42
43     public Q_SLOTS:
44         void init();
45
46         QStringList directories();
47         QString currentPath();
48         QString filter();
49
50         void setFilter(const QString &f);
51
52         Q_INVOKABLE void up();
53         Q_INVOKABLE void enterDirectory(const QString &directory);
54
55     Q_SIGNALS:
56         void directoriesChanged();
57         void currentPathChanged();
58         void filterChanged();
59
60     private:
61         DirectoryListerPrivate* d;
62 };
63
64 #endif // DIRECTORYLISTER_H