49
49
class SortedDirModel;
50
class GWENVIEWLIB_EXPORT AbstractSortedDirModelFilter : public QObject {
50
class GWENVIEWLIB_EXPORT AbstractSortedDirModelFilter : public QObject
52
AbstractSortedDirModelFilter(SortedDirModel* model);
53
~AbstractSortedDirModelFilter();
54
SortedDirModel* model() const { return mModel; }
53
AbstractSortedDirModelFilter(SortedDirModel* model);
54
~AbstractSortedDirModelFilter();
55
SortedDirModel* model() const {
56
virtual bool needsSemanticInfo() const = 0;
58
* Returns true if index should be accepted.
59
* Warning: index is a source index of SortedDirModel
61
virtual bool acceptsIndex(const QModelIndex& index) const = 0;
59
virtual bool needsSemanticInfo() const = 0;
61
* Returns true if index should be accepted.
62
* Warning: index is a source index of SortedDirModel
64
virtual bool acceptsIndex(const QModelIndex& index) const = 0;
64
QPointer<SortedDirModel> mModel;
67
QPointer<SortedDirModel> mModel;
68
71
* This model makes it possible to show all images in a folder.
69
72
* It can filter images based on name and metadata.
71
class GWENVIEWLIB_EXPORT SortedDirModel : public KDirSortFilterProxyModel {
74
class GWENVIEWLIB_EXPORT SortedDirModel : public KDirSortFilterProxyModel
74
SortedDirModel(QObject* parent=0);
76
KDirLister* dirLister() const;
77
KFileItem itemForIndex(const QModelIndex& index) const;
78
KUrl urlForIndex(const QModelIndex& index) const;
79
KFileItem itemForSourceIndex(const QModelIndex& sourceIndex) const;
80
QModelIndex indexForItem(const KFileItem& item) const;
81
QModelIndex indexForUrl(const KUrl& url) const;
83
void setKindFilter(MimeTypeUtils::Kinds);
84
MimeTypeUtils::Kinds kindFilter() const;
86
void adjustKindFilter(MimeTypeUtils::Kinds, bool set);
89
* A list of file extensions we should skip
91
void setBlackListedExtensions(const QStringList& list);
93
void addFilter(AbstractSortedDirModelFilter*);
95
void removeFilter(AbstractSortedDirModelFilter*);
99
AbstractSemanticInfoBackEnd* semanticInfoBackEnd() const;
78
SortedDirModel(QObject* parent = 0);
80
KDirLister* dirLister() const;
81
KFileItem itemForIndex(const QModelIndex& index) const;
82
KUrl urlForIndex(const QModelIndex& index) const;
83
KFileItem itemForSourceIndex(const QModelIndex& sourceIndex) const;
84
QModelIndex indexForItem(const KFileItem& item) const;
85
QModelIndex indexForUrl(const KUrl& url) const;
87
void setKindFilter(MimeTypeUtils::Kinds);
88
MimeTypeUtils::Kinds kindFilter() const;
90
void adjustKindFilter(MimeTypeUtils::Kinds, bool set);
93
* A list of file extensions we should skip
95
void setBlackListedExtensions(const QStringList& list);
97
void addFilter(AbstractSortedDirModelFilter*);
99
void removeFilter(AbstractSortedDirModelFilter*);
103
AbstractSemanticInfoBackEnd* semanticInfoBackEnd() const;
101
105
#ifndef GWENVIEW_SEMANTICINFO_BACKEND_NONE
102
SemanticInfo semanticInfoForSourceIndex(const QModelIndex& sourceIndex) const;
106
SemanticInfo semanticInfoForSourceIndex(const QModelIndex& sourceIndex) const;
105
bool hasDocuments() const;
109
bool hasDocuments() const;
108
112
void applyFilters();
111
bool filterAcceptsRow(int row, const QModelIndex& parent) const;
112
bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
115
bool filterAcceptsRow(int row, const QModelIndex& parent) const;
116
bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
115
void doApplyFilters();
119
void doApplyFilters();
118
friend struct SortedDirModelPrivate;
119
SortedDirModelPrivate * const d;
122
friend struct SortedDirModelPrivate;
123
SortedDirModelPrivate * const d;