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 QtOrganizer module 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#include "qdeclarativeorganizeritemsortorder_p.h"
35
36QTORGANIZER_USE_NAMESPACE
37
38QT_BEGIN_NAMESPACE
39
40/*!
41 \qmltype SortOrder
42 \instantiates QDeclarativeOrganizerItemSortOrder
43 \brief The SortOrder element defines how a list of organizer item should be ordered according to some criteria.
44 \inqmlmodule QtOrganizer
45 \ingroup qml-organizer-filters
46 */
47QDeclarativeOrganizerItemSortOrder::QDeclarativeOrganizerItemSortOrder(QObject *parent)
48 : QObject(parent)
49{
50}
51
52/*!
53 \qmlsignal SortOrder::onSortOrderChanged()
54
55 This signal is emitted, when any of the SortOrder's properties have been changed.
56 */
57
58/*!
59 \qmlproperty string SortOrder::detail
60
61 This property holds the detail type of which the sorting will be performed to. The value should
62 be the enumeration value of Detail::type.
63 */
64void QDeclarativeOrganizerItemSortOrder::setDetail(QDeclarativeOrganizerItemDetail::DetailType detail)
65{
66 if (detail != static_cast<QDeclarativeOrganizerItemDetail::DetailType>(d.detailType())) {
67 d.setDetail(detailType: static_cast<QOrganizerItemDetail::DetailType>(detail), field: d.detailField());
68 emit sortOrderChanged();
69 }
70}
71
72QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemSortOrder::detail() const
73{
74 return static_cast<QDeclarativeOrganizerItemDetail::DetailType>(d.detailType());
75}
76
77/*!
78 \qmlproperty string SortOrder::field
79
80 This property holds the detail field type of which the sorting will be performed to. The value
81 should be the filld enumeration value defined in each detail element.
82
83 \sa EventTime, JournalTime, TodoTime, TodoProgress, Reminder, AudibleReminder, VisualReminder,
84 EmailReminder, Comment, Description, DisplayLabel, Guid, Location, Parent, Priority, Recurrence,
85 Timestamp, ItemType, Tag
86 */
87void QDeclarativeOrganizerItemSortOrder::setField(int field)
88{
89 if (field != d.detailField()) {
90 d.setDetail(detailType: d.detailType(), field);
91 emit sortOrderChanged();
92 }
93}
94
95int QDeclarativeOrganizerItemSortOrder::field() const
96{
97 return d.detailField();
98}
99
100/*!
101 \qmlproperty enumeration SortOrder::blankPolicy
102
103 This property enumerates the ways in which the sort order interprets blanks when sorting organizer.
104 \list
105 \li SortOrder.BlanksFirst Considers blank values to evaluate to less than all other values in comparisons.
106 \li SortOrder.BlanksLast Considers blank values to evaluate to greater than all other values in comparisons.
107 \endlist
108 */
109void QDeclarativeOrganizerItemSortOrder::setBlankPolicy(BlankPolicy policy)
110{
111 if (policy != blankPolicy()) {
112 d.setBlankPolicy(static_cast<QOrganizerItemSortOrder::BlankPolicy>(policy));
113 emit sortOrderChanged();
114 }
115}
116
117QDeclarativeOrganizerItemSortOrder::BlankPolicy QDeclarativeOrganizerItemSortOrder::blankPolicy() const
118{
119 return static_cast<QDeclarativeOrganizerItemSortOrder::BlankPolicy>(d.blankPolicy());
120}
121
122/*!
123 \qmlproperty enumeration SortOrder::direction
124
125 This property holds the direction of the sort order, the value can be one of:
126 \list
127 \li Qt.AscendingOrder The items will be sorted by the ascending order (default).
128 \li Qt.DescendingOrder The items will be sorted by the descending order.
129 \endlist
130 */
131void QDeclarativeOrganizerItemSortOrder::setDirection(Qt::SortOrder newDirection)
132{
133 if (newDirection != direction()) {
134 d.setDirection(newDirection);
135 emit sortOrderChanged();
136 }
137}
138
139Qt::SortOrder QDeclarativeOrganizerItemSortOrder::direction() const
140{
141 return d.direction();
142}
143
144/*!
145 \qmlproperty enumeration SortOrder::caseSensitivity
146
147 This property holds the case sensitivity of the sort order, the value can be one of:
148 \list
149 \li Qt.CaseInsensitive Sets the case sensitivity of the sort order to insensitivity.
150 \li Qt.CaseSensitive Sets the case sensitivity of the sort order to sensitivity (default).
151 \endlist
152 */
153void QDeclarativeOrganizerItemSortOrder::setCaseSensitivity(Qt::CaseSensitivity newSensitivity)
154{
155 if (newSensitivity != caseSensitivity()) {
156 d.setCaseSensitivity(newSensitivity);
157 emit sortOrderChanged();
158 }
159}
160
161Qt::CaseSensitivity QDeclarativeOrganizerItemSortOrder::caseSensitivity() const
162{
163 return d.caseSensitivity();
164}
165
166/*!
167 \internal
168 */
169QOrganizerItemSortOrder QDeclarativeOrganizerItemSortOrder::sortOrder()
170{
171 return d;
172}
173
174#include "moc_qdeclarativeorganizeritemsortorder_p.cpp"
175
176QT_END_NAMESPACE
177

source code of qtpim/src/imports/organizer/qdeclarativeorganizeritemsortorder.cpp