1/****************************************************************************
2**
3** Copyright (C) 2015 The Qt Company Ltd.
4** Contact: http://www.qt.io/licensing/
5**
6** This file is part of the plugins of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL21$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see http://www.qt.io/terms-conditions. For further
15** information use the contact form at http://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 or version 3 as published by the Free
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22** following information to ensure the GNU Lesser General Public License
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25**
26** As a special exception, The Qt Company gives you certain additional
27** rights. These rights are described in The Qt Company LGPL Exception
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29**
30** $QT_END_LICENSE$
31**
32****************************************************************************/
33
34#ifndef QDECLARATIVEORGANIZERITEMFILTER_P_H
35#define QDECLARATIVEORGANIZERITEMFILTER_P_H
36
37#include <QtQml/qqml.h>
38
39#include <QtOrganizer/qorganizeritemfilters.h>
40
41#include "qdeclarativeorganizeritemdetail_p.h"
42
43QTORGANIZER_USE_NAMESPACE
44
45QT_BEGIN_NAMESPACE
46
47class QDeclarativeOrganizerItemFilter : public QObject
48{
49 Q_OBJECT
50
51 Q_ENUMS(FilterType)
52 Q_FLAGS(MatchFlags)
53 Q_PROPERTY(FilterType type READ type NOTIFY filterChanged)
54
55public:
56 QDeclarativeOrganizerItemFilter(QObject *parent = Q_NULLPTR);
57
58 enum FilterType {
59 DefaultFilter = QOrganizerItemFilter::DefaultFilter,
60 InvalidFilter = QOrganizerItemFilter::InvalidFilter,
61 IntersectionFilter = QOrganizerItemFilter::IntersectionFilter,
62 UnionFilter = QOrganizerItemFilter::UnionFilter,
63 CollectionFilter = QOrganizerItemFilter::CollectionFilter,
64 DetailFilter = QOrganizerItemFilter::DetailFilter,
65 DetailFieldFilter = QOrganizerItemFilter::DetailFieldFilter,
66 DetailRangeFilter = QOrganizerItemFilter::DetailRangeFilter,
67 IdFilter = QOrganizerItemFilter::IdFilter
68 };
69
70 FilterType type() const;
71
72 enum MatchFlag {
73 MatchExactly = QOrganizerItemFilter::MatchExactly,
74 MatchContains = QOrganizerItemFilter::MatchContains,
75 MatchStartsWith = QOrganizerItemFilter::MatchStartsWith,
76 MatchEndsWith = QOrganizerItemFilter::MatchEndsWith,
77 MatchFixedString = QOrganizerItemFilter::MatchFixedString,
78 MatchCaseSensitive = QOrganizerItemFilter::MatchCaseSensitive
79 };
80 Q_DECLARE_FLAGS(MatchFlags, MatchFlag)
81
82 // used by model
83 virtual QOrganizerItemFilter filter() const;
84
85Q_SIGNALS:
86 void filterChanged();
87};
88
89
90class QDeclarativeOrganizerItemInvalidFilter : public QDeclarativeOrganizerItemFilter
91{
92 Q_OBJECT
93
94public:
95 QDeclarativeOrganizerItemInvalidFilter(QObject *parent = Q_NULLPTR);
96
97 // used by model
98 QOrganizerItemFilter filter() const;
99};
100
101
102class QDeclarativeOrganizerItemCompoundFilter : public QDeclarativeOrganizerItemFilter
103{
104 Q_OBJECT
105 Q_PROPERTY(QQmlListProperty<QDeclarativeOrganizerItemFilter> filters READ filters NOTIFY valueChanged)
106 Q_CLASSINFO("DefaultProperty", "filters")
107
108public:
109 explicit QDeclarativeOrganizerItemCompoundFilter(QObject *parent = Q_NULLPTR);
110 virtual ~QDeclarativeOrganizerItemCompoundFilter();
111
112 QQmlListProperty<QDeclarativeOrganizerItemFilter> filters();
113
114 static void filters_append(QQmlListProperty<QDeclarativeOrganizerItemFilter> *prop, QDeclarativeOrganizerItemFilter *filter);
115 static int filters_count(QQmlListProperty<QDeclarativeOrganizerItemFilter> *prop);
116 static QDeclarativeOrganizerItemFilter *filters_at(QQmlListProperty<QDeclarativeOrganizerItemFilter> *prop, int index);
117 static void filters_clear(QQmlListProperty<QDeclarativeOrganizerItemFilter> *prop);
118
119Q_SIGNALS:
120 void valueChanged();
121
122protected:
123 QList<QDeclarativeOrganizerItemFilter *> m_filters;
124};
125
126
127class QDeclarativeOrganizerItemIntersectionFilter : public QDeclarativeOrganizerItemCompoundFilter
128{
129 Q_OBJECT
130
131public:
132 QDeclarativeOrganizerItemIntersectionFilter(QObject *parent = Q_NULLPTR);
133
134 // used by model
135 QOrganizerItemFilter filter() const;
136};
137
138
139class QDeclarativeOrganizerItemUnionFilter : public QDeclarativeOrganizerItemCompoundFilter
140{
141 Q_OBJECT
142public:
143 QDeclarativeOrganizerItemUnionFilter(QObject *parent = Q_NULLPTR);
144
145 // used by model
146 QOrganizerItemFilter filter() const;
147};
148
149
150class QDeclarativeOrganizerItemCollectionFilter : public QDeclarativeOrganizerItemFilter
151{
152 Q_OBJECT
153 Q_PROPERTY(QStringList ids READ ids WRITE setIds NOTIFY valueChanged)
154
155public:
156 QDeclarativeOrganizerItemCollectionFilter(QObject *parent = Q_NULLPTR);
157
158 QStringList ids() const;
159 void setIds(const QStringList &ids);
160
161 // used by model
162 QOrganizerItemFilter filter() const;
163
164Q_SIGNALS:
165 void valueChanged();
166
167private:
168 QStringList m_ids;
169};
170
171
172class QDeclarativeOrganizerItemDetailFilter : public QDeclarativeOrganizerItemFilter
173{
174 Q_OBJECT
175 Q_PROPERTY(QDeclarativeOrganizerItemDetail *detail READ detail WRITE setDetail NOTIFY valueChanged)
176
177public:
178 QDeclarativeOrganizerItemDetailFilter(QObject *parent = Q_NULLPTR);
179
180 QDeclarativeOrganizerItemDetail *detail() const;
181 void setDetail(QDeclarativeOrganizerItemDetail *detail);
182
183 // used by model
184 QOrganizerItemFilter filter() const;
185
186signals:
187 void valueChanged();
188
189private:
190 QDeclarativeOrganizerItemDetail *m_detail;
191 QOrganizerItemDetailFilter d;
192};
193
194
195class QDeclarativeOrganizerItemDetailFieldFilter : public QDeclarativeOrganizerItemFilter
196{
197 Q_OBJECT
198 Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
199 Q_PROPERTY(MatchFlags matchFlags READ matchFlags WRITE setMatchFlags NOTIFY valueChanged)
200 Q_PROPERTY(int field READ field WRITE setField NOTIFY valueChanged)
201 Q_PROPERTY(QDeclarativeOrganizerItemDetail::DetailType detail READ detail WRITE setDetail NOTIFY valueChanged)
202
203public:
204 QDeclarativeOrganizerItemDetailFieldFilter(QObject *parent = Q_NULLPTR);
205
206 QDeclarativeOrganizerItemDetail::DetailType detail() const;
207 void setDetail(QDeclarativeOrganizerItemDetail::DetailType detail);
208
209 int field() const;
210 void setField(int field);
211
212 void setValue(const QVariant &value);
213 QVariant value() const;
214
215 QDeclarativeOrganizerItemFilter::MatchFlags matchFlags() const;
216 void setMatchFlags(QDeclarativeOrganizerItemFilter::MatchFlags flags);
217
218 // used by model
219 QOrganizerItemFilter filter() const;
220
221signals:
222 void valueChanged();
223
224private:
225 QOrganizerItemDetailFieldFilter d;
226};
227
228
229class QDeclarativeOrganizerItemDetailRangeFilter : public QDeclarativeOrganizerItemFilter
230{
231 Q_OBJECT
232 Q_FLAGS(RangeFlags)
233 Q_PROPERTY(QVariant min READ minValue WRITE setMinValue NOTIFY valueChanged)
234 Q_PROPERTY(QVariant max READ maxValue WRITE setMaxValue NOTIFY valueChanged)
235 Q_PROPERTY(MatchFlags matchFlags READ matchFlags WRITE setMatchFlags NOTIFY valueChanged)
236 Q_PROPERTY(RangeFlags rangeFlags READ rangeFlags WRITE setRangeFlags NOTIFY valueChanged)
237 Q_PROPERTY(QDeclarativeOrganizerItemDetail::DetailType detail READ detail WRITE setDetail NOTIFY valueChanged)
238 Q_PROPERTY(int field READ field WRITE setField NOTIFY valueChanged)
239
240public:
241 enum RangeFlag {
242 IncludeLower = QOrganizerItemDetailRangeFilter::IncludeLower,
243 IncludeUpper = QOrganizerItemDetailRangeFilter::IncludeUpper,
244 ExcludeLower = QOrganizerItemDetailRangeFilter::ExcludeLower,
245 ExcludeUpper = QOrganizerItemDetailRangeFilter::ExcludeUpper
246 };
247 Q_DECLARE_FLAGS(RangeFlags, RangeFlag)
248
249 QDeclarativeOrganizerItemDetailRangeFilter(QObject *parent = Q_NULLPTR);
250
251 QDeclarativeOrganizerItemDetail::DetailType detail() const;
252 void setDetail(QDeclarativeOrganizerItemDetail::DetailType detail);
253
254 int field() const;
255 void setField(int field);
256
257 QDeclarativeOrganizerItemFilter::MatchFlags matchFlags() const;
258 void setMatchFlags(QDeclarativeOrganizerItemFilter::MatchFlags flags);
259
260 RangeFlags rangeFlags() const;
261 void setRangeFlags(RangeFlags flags);
262
263 QVariant minValue() const;
264 void setMinValue(const QVariant &value);
265
266 QVariant maxValue() const;
267 void setMaxValue(const QVariant &value);
268
269 // used by model
270 QOrganizerItemFilter filter() const;
271
272signals:
273 void valueChanged();
274
275private:
276 QOrganizerItemDetailRangeFilter d;
277
278};
279
280
281class QDeclarativeOrganizerItemIdFilter : public QDeclarativeOrganizerItemFilter
282{
283 Q_OBJECT
284 Q_PROPERTY(QStringList ids READ ids WRITE setIds NOTIFY valueChanged)
285
286public:
287 QDeclarativeOrganizerItemIdFilter(QObject *parent = Q_NULLPTR);
288
289 QStringList ids() const;
290 void setIds(const QStringList &ids);
291
292 // used by model
293 QOrganizerItemFilter filter() const;
294
295Q_SIGNALS:
296 void valueChanged();
297
298private:
299 QStringList m_ids;
300};
301
302QT_END_NAMESPACE
303
304QML_DECLARE_TYPE(QDeclarativeOrganizerItemFilter)
305QML_DECLARE_TYPE(QDeclarativeOrganizerItemInvalidFilter)
306QML_DECLARE_TYPE(QDeclarativeOrganizerItemCompoundFilter)
307QML_DECLARE_TYPE(QDeclarativeOrganizerItemIntersectionFilter)
308QML_DECLARE_TYPE(QDeclarativeOrganizerItemUnionFilter)
309QML_DECLARE_TYPE(QDeclarativeOrganizerItemCollectionFilter)
310QML_DECLARE_TYPE(QDeclarativeOrganizerItemDetailFilter)
311QML_DECLARE_TYPE(QDeclarativeOrganizerItemDetailFieldFilter)
312QML_DECLARE_TYPE(QDeclarativeOrganizerItemDetailRangeFilter)
313QML_DECLARE_TYPE(QDeclarativeOrganizerItemIdFilter)
314
315#endif // QDECLARATIVEORGANIZERITEMFILTER_P_H
316

source code of qtpim/src/imports/organizer/qdeclarativeorganizeritemfilter_p.h