1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the QtQml module of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:LGPL$
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 Digia. For licensing terms and
14
** conditions see http://qt.digia.com/licensing. For further information
15
** use the contact form at http://qt.digia.com/contact-us.
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 as published by the Free Software
20
** Foundation and appearing in the file LICENSE.LGPL included in the
21
** packaging of this file. Please review the following information to
22
** ensure the GNU Lesser General Public License version 2.1 requirements
23
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25
** In addition, as a special exception, Digia gives you certain additional
26
** rights. These rights are described in the Digia Qt LGPL Exception
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29
** GNU General Public License Usage
30
** Alternatively, this file may be used under the terms of the GNU
31
** General Public License version 3.0 as published by the Free Software
32
** Foundation and appearing in the file LICENSE.GPL included in the
33
** packaging of this file. Please review the following information to
34
** ensure the GNU General Public License version 3.0 requirements will be
35
** met: http://www.gnu.org/copyleft/gpl.html.
40
****************************************************************************/
42
#include "qdeclarativecontactfilter_p.h"
44
QT_BEGIN_NAMESPACE_CONTACTS
48
\instantiates QDeclarativeContactFilter
49
\brief The Filter element is used as a property of ContactModel, to allow
50
selection of contacts which have certain details or properties.
52
\ingroup qml-contacts-main
53
\inqmlmodule QtContacts 5.0
55
This element is part of the \b{QtContacts} module.
62
\qmlproperty enumeration Filter::type
64
This property holds the type value of this filter. It can be one of:
67
\li Filter.DefaultFilter - A filter which matches everything (default).
68
\li Filter.InvalidFilter - An invalid filter which matches nothing.
69
\li Filter.DetailFilter - A filter which matches contacts containing one or more details of a particular definition with a particular value.
70
\li Filter.DetailRangeFilter - A filter which matches contacts containing one or more details of a particular definition whose values are within a particular range.
71
\li Filter.ChangeLogFilter - A filter which matches contacts whose timestamps have been updated since some particular date and time.
72
\li Filter.ActionFilter - A filter which matches contacts for which a particular action is available, or which contain a detail with a particular value for which a particular action is available.
73
\li Filter.RelationshipFilter - A filter which matches contacts which participate in a particular type of relationship, or relationship with a specified contact.
74
\li Filter.IntersectionFilter - A filter which matches all contacts that are matched by all filters it includes.
75
\li Filter.UnionFilter - A filter which matches any contact that is matched by any of the filters it includes.
76
\li Filter.IdFilter - A filter which matches any contact whose local id is contained in a particular list of contact local ids.
82
\instantiates QDeclarativeContactActionFilter
83
\brief The ActionFilter element provides a filter based around an action availability criterion.
85
\ingroup qml-contacts-filters
86
\inqmlmodule QtContacts 5.0
88
This element is part of the \b{QtContacts} module.
90
\sa QContactActionFilter
94
\qmlproperty string ActionFilter::actionName
96
This property holds the action name criterion of the filter.
100
\qmltype ChangeLogFilter
101
\instantiates QDeclarativeContactChangeLogFilter
102
\brief The ChangeLogFilter element provides a filter based around a contact timestamp criterion.
104
\ingroup qml-contacts-filters
105
\inqmlmodule QtContacts 5.0
107
This element is part of the \b{QtContacts} module.
109
\sa QContactChangeLogFilter
113
\qmlproperty date ChangeLogFilter::since
115
This property holds the date and time lower-bound criterion of the filter.The value can be one of:
117
\li ChangeLogFilter.EventAdded
118
\li ChangeLogFilter.EventChanged
119
\li ChangeLogFilter.EventRemoved
124
\qmlproperty enumeration ChangeLogFilter::eventType
126
This property holds the type of change that this filter will match against.
130
\qmltype DetailFilter
131
\instantiates QDeclarativeContactDetailFilter
132
\brief The DetailFilter element provides a filter based around a detail value criterion.
134
\ingroup qml-contacts-filters
135
\inqmlmodule QtContacts 5.0
137
This element is part of the \b{QtContacts} module.
139
\sa QContactDetailFilter
143
\qmlproperty enumeration DetailFilter::detail
145
This property holds the detail type of which details will be matched to.
147
\sa ContactDetail::type
151
\qmlproperty int DetailFilter::field
153
This property holds the detail field type of which detail fields will be matched to.
154
Detail field types are enumeration values defined in each detail elements.
184
\qmlproperty variant DetailFilter::value
186
This property holds the value criterion of the detail filter.
190
\qmlproperty enumeration DetailFilter::matchFlags
192
This property holds the semantics of the value matching criterion. The valid match flags include:
194
\li MatchExactly - Performs QVariant-based matching (default).
195
\li MatchContains - The search term is contained in the item.
196
\li MatchStartsWith - The search term matches the start of the item.
197
\li MatchEndsWith - The search term matches the end of the item.
198
\li MatchFixedString - Performs string-based matching. String-based comparisons are case-insensitive unless the \c MatchCaseSensitive flag is also specified.
199
\li MatchCaseSensitive - The search is case sensitive.
204
\qmltype DetailRangeFilter
205
\instantiates QDeclarativeContactDetailRangeFilter
206
\brief The DetailRangeFilter element provides a filter based around a detail value range criterion.
209
\ingroup qml-contacts-filters
210
\inqmlmodule QtContacts 5.0
212
This element is part of the \b{QtContacts} module.
214
\sa QContactDetailRangeFilter
218
\qmlproperty enumeration DetailRangeFilter::detail
220
This property holds the detail type of which details will be matched to.
222
\sa ContactDetail::type
223
\sa DetailFilter::detail
227
\qmlproperty int DetailRangeFilter::field
229
This property holds the detail field type of which detail fields will be matched to.
230
Detail field types are enumeration values defined in each detail elements.
232
\sa DetailFilter::field
235
\qmlproperty variant DetailRangeFilter::min
237
This property holds the lower bound of the value range criterion. By default, there is no lower bound.
240
\qmlproperty variant DetailRangeFilter::max
242
This property holds the upper bound of the value range criterion. By default, there is no upper bound.
246
\qmlproperty enumeration DetailRangeFilter::matchFlags
248
This property holds the match flags of the criterion, which define semantics such as case sensitivity, and exact matching.
250
\sa DetailFilter::matchFlags
254
\qmlproperty enumeration DetailRangeFilter::rangeFlags
256
This property holds a set of flags which defines the boundary condition semantics of the value range criterion.The valid range flags include:
258
\li DetailRangeFilter.IncludeLower
259
\li DetailRangeFilter.IncludeUpper
260
\li DetailRangeFilter.ExcludeLower
261
\li DetailRangeFilter.ExcludeUpper
265
\qmltype IntersectionFilter
266
\instantiates QDeclarativeContactIntersectionFilter
267
\brief The IntersectionFilter element provides a filter which intersects the results of other filters.
269
\ingroup qml-contacts-filters
270
\inqmlmodule QtContacts 5.0
272
This element is part of the \b{QtContacts} module.
274
\sa QContactIntersectionFilter
278
\qmlproperty list<Filter> IntersectionFilter::filters
280
This property holds the list of filters which form the intersection filter.
286
\instantiates QDeclarativeContactUnionFilter
287
\brief The UnionFilter element provides a filter which unions the results of other filters.
289
\ingroup qml-contacts-filters
290
\inqmlmodule QtContacts 5.0
292
This element is part of the \b{QtContacts} module.
294
\sa QContactUnionFilter
298
\qmlproperty list<Filter> UnionFilter::filters
300
This property holds the list of filters which form the union filter.
305
\instantiates QDeclarativeContactIdFilter
306
\brief The IdFilter element provides a filter based around a list of contact ids.
308
\ingroup qml-contacts-filters
309
\inqmlmodule QtContacts 5.0
311
This element is part of the \b{QtContacts} module.
317
\qmlproperty list<string> IdFilter::ids
319
This property holds the list of ids of contacts which match this filter.
324
\qmltype RelationshipFilter
325
\instantiates QDeclarativeContactRelationshipFilter
326
\brief The RelationshipFilter element provides a filter based around relationship criteria.
328
\ingroup qml-contacts-filters
329
\inqmlmodule QtContacts 5.0
332
This element is part of the \b{QtContacts} module.
335
\sa RelationshipModel
336
\sa QContactRelationshipFilter
337
\sa QContactRelationship
342
\qmlproperty variant RelationshipFilter::relationshipType
344
This property holds the type of relationship that a contact must have in order to match the filter.
346
\sa Relationship::type
350
\qmlproperty int RelationshipFilter::relatedContactId
352
This property holds the id of the contact with whom the tested contact must have a relationship in order for the tested contact to match this filter
355
\qmlproperty enumeration RelationshipFilter::relatedContactRole
357
This property holds the role in the relationship with the tested contact that the related contact must play in order for the tested contact to match this filter.
358
The role can be one of:
360
\li Relationship.First - The contact is the first contact in the relationship.
361
\li Relationship.Second - The contact is the second contact in the relationship.
362
\li Relationship.Either - The contact is either the first or second contact in the relationship (default).
367
\qmltype InvalidFilter
368
\instantiates QDeclarativeContactInvalidFilter
369
\brief the InvalidFilter element provides a filter which will never match any contacts.
371
\ingroup qml-contacts-filters
372
\inqmlmodule QtContacts 5.0
374
This element is part of the \b{QtContacts} module.
376
\sa QContactInvalidFilter
379
QQmlListProperty<QDeclarativeContactFilter> QDeclarativeContactCompoundFilter::filters()
381
return QQmlListProperty<QDeclarativeContactFilter>(this,
382
0, // opaque data parameter
389
void QDeclarativeContactCompoundFilter::filters_append(QQmlListProperty<QDeclarativeContactFilter>* prop, QDeclarativeContactFilter* filter)
391
QDeclarativeContactCompoundFilter* compoundFilter = static_cast<QDeclarativeContactCompoundFilter*>(prop->object);
392
compoundFilter->m_filters.append(filter);
393
QObject::connect(filter, SIGNAL(filterChanged()), compoundFilter, SIGNAL(filterChanged()), Qt::UniqueConnection);
394
emit compoundFilter->filterChanged();
397
int QDeclarativeContactCompoundFilter::filters_count(QQmlListProperty<QDeclarativeContactFilter>* prop)
399
// The 'prop' is in a sense 'this' for this static function (as given in filters() function)
400
return static_cast<QDeclarativeContactCompoundFilter*>(prop->object)->m_filters.count();
403
QDeclarativeContactFilter* QDeclarativeContactCompoundFilter::filters_at(QQmlListProperty<QDeclarativeContactFilter>* prop, int index)
405
return static_cast<QDeclarativeContactCompoundFilter*>(prop->object)->m_filters.at(index);
408
void QDeclarativeContactCompoundFilter::filters_clear(QQmlListProperty<QDeclarativeContactFilter>* prop)
410
QDeclarativeContactCompoundFilter* compoundFilter = static_cast<QDeclarativeContactCompoundFilter*>(prop->object);
411
if (!compoundFilter->m_filters.isEmpty()) {
412
foreach (QDeclarativeContactFilter* filter, compoundFilter->m_filters) {
413
QObject::disconnect(filter, SIGNAL(filterChanged()), compoundFilter, SIGNAL(filterChanged()));
415
compoundFilter->m_filters.clear();
416
emit compoundFilter->filterChanged();
420
#include "moc_qdeclarativecontactfilter_p.cpp"
422
QT_END_NAMESPACE_CONTACTS