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 QtContacts 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 "qcontactdetailfilter.h"
43
#include "qcontactdetailfilter_p.h"
44
#include "qcontactfilter_p.h"
45
#include "qcontactmanager.h"
47
QT_BEGIN_NAMESPACE_CONTACTS
50
\class QContactDetailFilter
51
\brief The QContactDetailFilter class provides a filter based around a detail value criterion
56
\ingroup contacts-filters
58
It may be used to select contacts which contain a detail of a particular type with a particular value
61
Q_IMPLEMENT_CONTACTFILTER_PRIVATE(QContactDetailFilter)
64
* \fn QContactDetailFilter::QContactDetailFilter(const QContactFilter& other)
65
* Constructs a copy of \a other if possible, otherwise constructs a new detail filter
69
* Constructs a new detail filter
71
QContactDetailFilter::QContactDetailFilter()
72
: QContactFilter(new QContactDetailFilterPrivate)
77
* Sets the type of the detail type of which details will be matched to \a type, and the name of the field in
78
* details of that type which will contain the value criterion to \a field.
79
* If \a type is QContactDetail::TypeUndefined, the detail filter will match no contacts. If \a field
80
* is not specified, or equal to -1, the detail filter acts like a "detail exists" filter; if any
81
* detail of the specified type is present in a contact, that contact will match the filter, regardless
82
* of what values might be stored in that detail.
85
void QContactDetailFilter::setDetailType(QContactDetail::DetailType type, int field)
87
Q_D(QContactDetailFilter);
93
* Sets the value criterion of the filter to \a value.
94
* If the field criterion (set via setDetailType())
95
* of the filter is not specified or equal to -1, this value will be ignored.
96
* Note that certain backends might perform backend specific sanitization of
97
* \a value for those detail types that are supported by them.
98
* If the provided value cannot be sanitized, the filter is considered
100
* \sa value(), setDetailType()
102
void QContactDetailFilter::setValue(const QVariant& value)
104
Q_D(QContactDetailFilter);
105
d->m_exactValue = value;
109
* Sets the semantics of the value matching criterion to those defined in \a flags
112
void QContactDetailFilter::setMatchFlags(QContactFilter::MatchFlags flags)
114
Q_D(QContactDetailFilter);
119
* Returns the semantics of the value matching criterion
120
* \sa setMatchFlags()
122
QContactFilter::MatchFlags QContactDetailFilter::matchFlags() const
124
Q_D(const QContactDetailFilter);
129
* Returns the type of the details which will be inspected for matching values
130
* \sa setDetailType()
132
QContactDetail::DetailType QContactDetailFilter::detailType() const
134
Q_D(const QContactDetailFilter);
139
* Returns the detail field containing the value which will be matched against the value criterion
140
* \sa setDetailType()
142
int QContactDetailFilter::detailField() const
144
Q_D(const QContactDetailFilter);
149
* Returns the value criterion of the detail filter
152
QVariant QContactDetailFilter::value() const
154
Q_D(const QContactDetailFilter);
155
return d->m_exactValue;
158
QT_END_NAMESPACE_CONTACTS