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
****************************************************************************/
41
#include "qdeclarativecontactsortorder_p.h"
44
QT_BEGIN_NAMESPACE_CONTACTS
48
\instantiates QDeclarativeContactSortOrder
49
\brief The SortOrder element defines how a list of contacts should be ordered according to some criteria.
51
\ingroup qml-contacts-main
52
\inqmlmodule QtContacts 5.0
54
This element is part of the \b{QtContacts} module.
60
QDeclarativeContactSortOrder::QDeclarativeContactSortOrder(QObject* parent)
65
\qmlproperty enumeration SortOrder::detail
67
This property holds the detail type of the details which will be inspected to perform sorting.
69
\sa ContactDetail::type
71
void QDeclarativeContactSortOrder::setDetail(const int detailType)
73
if (m_detail != detailType) {
74
m_detail = detailType;
75
emit sortOrderChanged();
80
int QDeclarativeContactSortOrder::detail() const
85
\qmlproperty int SortOrder::field
87
This property holds the detail field type of the details which will be inspected to perform sorting.
88
For each detail elements, there are predefined field types.
90
void QDeclarativeContactSortOrder::setField(const int fieldType)
92
if (m_field != fieldType) {
94
emit sortOrderChanged();
98
int QDeclarativeContactSortOrder::field() const
104
\qmlproperty enumeration SortOrder::blankPolicy
105
This property enumerates the ways in which the sort order interprets blanks when sorting contacts.
107
\li SortOrder.BlanksFirst - Considers blank values to evaluate to less than all other values in comparisons.
108
\li SortOrder.BlanksLast - Considers blank values to evaluate to greater than all other values in comparisons.
111
QDeclarativeContactSortOrder::BlankPolicy QDeclarativeContactSortOrder::blankPolicy() const
113
return static_cast<QDeclarativeContactSortOrder::BlankPolicy>(m_sortOrder.blankPolicy());
116
void QDeclarativeContactSortOrder::setBlankPolicy(QDeclarativeContactSortOrder::BlankPolicy blankPolicy)
118
if (blankPolicy != static_cast<QDeclarativeContactSortOrder::BlankPolicy>(m_sortOrder.blankPolicy())) {
119
m_sortOrder.setBlankPolicy(static_cast<QContactSortOrder::BlankPolicy>(blankPolicy));
120
emit sortOrderChanged();
124
\qmlproperty enumeration SortOrder::direction
126
This property holds the direction of the sort order, the value can be one of:
128
\li Qt.AscendingOrder - (default)
129
\li Qt.DescendingOrder
132
Qt::SortOrder QDeclarativeContactSortOrder::direction() const
134
return m_sortOrder.direction();
136
void QDeclarativeContactSortOrder::setDirection(Qt::SortOrder direction)
138
if (direction != m_sortOrder.direction()) {
139
m_sortOrder.setDirection(direction);
140
emit sortOrderChanged();
144
\qmlproperty enumeration SortOrder::caseSensitivity
146
This property holds the case sensitivity of the sort order, the value can be one of:
148
\li Qt.CaseInsensitive
149
\li Qt.CaseSensitive - (default)
152
Qt::CaseSensitivity QDeclarativeContactSortOrder::caseSensitivity() const
154
return m_sortOrder.caseSensitivity();
156
void QDeclarativeContactSortOrder::setCaseSensitivity(Qt::CaseSensitivity sensitivity)
158
if (sensitivity != m_sortOrder.caseSensitivity()) {
159
m_sortOrder.setCaseSensitivity(sensitivity);
160
emit sortOrderChanged();
164
void QDeclarativeContactSortOrder::componentComplete()
166
setSortOrder(sortOrder());
169
QContactSortOrder QDeclarativeContactSortOrder::sortOrder()
171
m_sortOrder.setDetailType(static_cast<QContactDetail::DetailType>(m_detail), m_field);
175
void QDeclarativeContactSortOrder::setSortOrder(const QContactSortOrder& sortOrder)
177
m_sortOrder = sortOrder;
178
m_field = sortOrder.detailField();
179
m_detail = sortOrder.detailType();
180
emit sortOrderChanged();
183
#include "moc_qdeclarativecontactsortorder_p.cpp"
185
QT_END_NAMESPACE_CONTACTS