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 "qorganizeritemidfetchrequest.h"
35
36#include "qorganizeritemrequests_p.h"
37
38QT_BEGIN_NAMESPACE_ORGANIZER
39
40/*!
41 \class QOrganizerItemIdFetchRequest
42 \brief The QOrganizerItemIdFetchRequest class allows a client to asynchronously fetch organizer
43 item IDs from a backend.
44 \inmodule QtOrganizer
45 \ingroup organizer-requests
46 */
47
48/*!
49 Constructs a new organizer item ID fetch request whose parent is the specified \a parent.
50*/
51QOrganizerItemIdFetchRequest::QOrganizerItemIdFetchRequest(QObject *parent)
52 : QOrganizerAbstractRequest(new QOrganizerItemIdFetchRequestPrivate, parent)
53{
54}
55
56/*!
57 Frees memory in use by this request.
58*/
59QOrganizerItemIdFetchRequest::~QOrganizerItemIdFetchRequest()
60{
61}
62
63/*!
64 Sets the filter which will be used to select the organizer items whose IDs will be returned to \a filter.
65*/
66void QOrganizerItemIdFetchRequest::setFilter(const QOrganizerItemFilter &filter)
67{
68 Q_D(QOrganizerItemIdFetchRequest);
69 QMutexLocker ml(&d->m_mutex);
70 d->m_filter = filter;
71}
72
73/*!
74 Sets the future sort ordering of the result of the request to \a sorting.
75*/
76void QOrganizerItemIdFetchRequest::setSorting(const QList<QOrganizerItemSortOrder> &sorting)
77{
78 Q_D(QOrganizerItemIdFetchRequest);
79 QMutexLocker ml(&d->m_mutex);
80 d->m_sorting = sorting;
81}
82
83/*!
84 Sets the start period of the request to \a date.
85
86 A default-constructed (invalid) start date time specifies an open start date time (matches anything
87 which occurs up until the end date time).
88*/
89void QOrganizerItemIdFetchRequest::setStartDate(const QDateTime &date)
90{
91 Q_D(QOrganizerItemIdFetchRequest);
92 QMutexLocker ml(&d->m_mutex);
93 d->m_startDate = date;
94}
95
96/*!
97 Sets the end period of the request to \a date.
98
99 A default-constructed (invalid) end date time specifies an open end date time (matches anything
100 which occurs after the start date time).
101*/
102void QOrganizerItemIdFetchRequest::setEndDate(const QDateTime &date)
103{
104 Q_D(QOrganizerItemIdFetchRequest);
105 QMutexLocker ml(&d->m_mutex);
106 d->m_endDate = date;
107}
108
109/*!
110 Returns the filter which will be used to select the organizer items whose IDs will be returned.
111*/
112QOrganizerItemFilter QOrganizerItemIdFetchRequest::filter() const
113{
114 Q_D(const QOrganizerItemIdFetchRequest);
115 QMutexLocker ml(&d->m_mutex);
116 return d->m_filter;
117}
118
119/*!
120 Returns the sort ordering which will be used to sort the result.
121*/
122QList<QOrganizerItemSortOrder> QOrganizerItemIdFetchRequest::sorting() const
123{
124 Q_D(const QOrganizerItemIdFetchRequest);
125 QMutexLocker ml(&d->m_mutex);
126 return d->m_sorting;
127}
128
129/*!
130 Returns the date-time which is the lower bound for the range in which items will be returned.
131 */
132QDateTime QOrganizerItemIdFetchRequest::startDate() const
133{
134 Q_D(const QOrganizerItemIdFetchRequest);
135 QMutexLocker ml(&d->m_mutex);
136 return d->m_startDate;
137}
138
139/*!
140 Returns the date-time which is the upper bound for the range in which items will be returned.
141 */
142QDateTime QOrganizerItemIdFetchRequest::endDate() const
143{
144 Q_D(const QOrganizerItemIdFetchRequest);
145 QMutexLocker ml(&d->m_mutex);
146 return d->m_endDate;
147}
148
149/*!
150 Returns the list of IDs of organizer items retrieved by this request.
151*/
152QList<QOrganizerItemId> QOrganizerItemIdFetchRequest::itemIds() const
153{
154 Q_D(const QOrganizerItemIdFetchRequest);
155 QMutexLocker ml(&d->m_mutex);
156 return d->m_ids;
157}
158
159#include "moc_qorganizeritemidfetchrequest.cpp"
160
161QT_END_NAMESPACE_ORGANIZER
162

source code of qtpim/src/organizer/requests/qorganizeritemidfetchrequest.cpp