Changeset View
Changeset View
Standalone View
Standalone View
src/dirmodel.h
- This file was added.
1 | #ifndef DIRMODEL_H | ||||
---|---|---|---|---|---|
2 | #define DIRMODEL_H | ||||
3 | | ||||
4 | #include <QSize> | ||||
5 | #include <kdirmodel.h> | ||||
6 | #include <QVariant> | ||||
7 | | ||||
8 | class DirModel : public KDirModel | ||||
9 | { | ||||
10 | Q_OBJECT | ||||
11 | Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) | ||||
12 | Q_PROPERTY(int count READ count NOTIFY countChanged) | ||||
13 | | ||||
14 | public: | ||||
15 | enum Roles { | ||||
16 | UrlRole = Qt::UserRole + 1, | ||||
17 | MimeTypeRole = Qt::UserRole + 2, | ||||
18 | }; | ||||
19 | | ||||
20 | DirModel(QObject* parent=0); | ||||
21 | virtual ~DirModel(); | ||||
22 | | ||||
23 | QHash<int, QByteArray> roleNames() const override; | ||||
24 | | ||||
25 | void setUrl(const QString& url); | ||||
26 | QString url() const; | ||||
27 | | ||||
28 | QVariant data(const QModelIndex &index, int role) const; | ||||
29 | int count() const {return rowCount();} | ||||
30 | | ||||
31 | Q_INVOKABLE int indexForUrl(const QString &url) const; | ||||
32 | Q_INVOKABLE QVariantMap get(int index) const; | ||||
33 | Q_INVOKABLE QUrl checkType(const QString& type, const QString& url); | ||||
34 | | ||||
35 | Q_SIGNALS: | ||||
36 | void countChanged(); | ||||
37 | void urlChanged(); | ||||
38 | | ||||
39 | private: | ||||
40 | QStringList m_mimeTypes; | ||||
41 | }; | ||||
42 | | ||||
43 | #endif // DIRMODEL_H |