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 "qorganizeritemfetchforexportrequest.h" |
35 | |
36 | #include "qorganizeritemrequests_p.h" |
37 | |
38 | QT_BEGIN_NAMESPACE_ORGANIZER |
39 | |
40 | /*! |
41 | \class QOrganizerItemFetchForExportRequest |
42 | \brief The QOrganizerItemFetchForExportRequest class allows a client to asynchronously fetch |
43 | organizer items for export from a backend. |
44 | \inmodule QtOrganizer |
45 | \ingroup organizer-requests |
46 | |
47 | This request will only fetch parent items and persisted exceptions which match the specified |
48 | criteria, and no generated occurrences will be fetched. |
49 | */ |
50 | |
51 | /*! |
52 | Constructs a new organizer item fetch for export request whose parent is the specified \a parent. |
53 | */ |
54 | QOrganizerItemFetchForExportRequest::QOrganizerItemFetchForExportRequest(QObject *parent) |
55 | : QOrganizerAbstractRequest(new QOrganizerItemFetchForExportRequestPrivate, parent) |
56 | { |
57 | } |
58 | |
59 | /*! |
60 | Frees memory in use by this request. |
61 | */ |
62 | QOrganizerItemFetchForExportRequest::~QOrganizerItemFetchForExportRequest() |
63 | { |
64 | } |
65 | |
66 | /*! |
67 | Sets the organizer item filter used to determine which organizer items will be retrieved to \a filter. |
68 | */ |
69 | void QOrganizerItemFetchForExportRequest::setFilter(const QOrganizerItemFilter &filter) |
70 | { |
71 | Q_D(QOrganizerItemFetchForExportRequest); |
72 | QMutexLocker ml(&d->m_mutex); |
73 | d->m_filter = filter; |
74 | } |
75 | |
76 | /*! |
77 | Sets the sort order of the result to \a sorting. |
78 | */ |
79 | void QOrganizerItemFetchForExportRequest::setSorting(const QList<QOrganizerItemSortOrder> &sorting) |
80 | { |
81 | Q_D(QOrganizerItemFetchForExportRequest); |
82 | QMutexLocker ml(&d->m_mutex); |
83 | d->m_sorting = sorting; |
84 | } |
85 | |
86 | /*! |
87 | Sets the fetch hint which may be used by the backend to optimize item retrieval to \a fetchHint. |
88 | |
89 | A client should not make changes to a item which has been retrieved using a fetch hint other than |
90 | the default fetch hint. Doing so will result in information loss when saving the item back to |
91 | the manager (as the "new" restricted item will replace the previously saved item in the backend). |
92 | */ |
93 | void QOrganizerItemFetchForExportRequest::setFetchHint(const QOrganizerItemFetchHint &fetchHint) |
94 | { |
95 | Q_D(QOrganizerItemFetchForExportRequest); |
96 | QMutexLocker ml(&d->m_mutex); |
97 | d->m_fetchHint = fetchHint; |
98 | } |
99 | |
100 | /*! |
101 | Sets the start period of the request to \a date. |
102 | |
103 | A default-constructed (invalid) start date time specifies an open start date time (matches anything |
104 | which occurs up until the end date time). |
105 | */ |
106 | void QOrganizerItemFetchForExportRequest::setStartDate(const QDateTime &date) |
107 | { |
108 | Q_D(QOrganizerItemFetchForExportRequest); |
109 | QMutexLocker ml(&d->m_mutex); |
110 | d->m_startDate = date; |
111 | } |
112 | |
113 | /*! |
114 | Sets the end period of the request to \a date. |
115 | |
116 | A default-constructed (invalid) end date time specifies an open end date time (matches anything |
117 | which occurs after the start date time). |
118 | */ |
119 | void QOrganizerItemFetchForExportRequest::setEndDate(const QDateTime &date) |
120 | { |
121 | Q_D(QOrganizerItemFetchForExportRequest); |
122 | QMutexLocker ml(&d->m_mutex); |
123 | d->m_endDate = date; |
124 | } |
125 | |
126 | /*! |
127 | Returns the filter that will be used to select organizer items to be returned. |
128 | */ |
129 | QOrganizerItemFilter QOrganizerItemFetchForExportRequest::filter() const |
130 | { |
131 | Q_D(const QOrganizerItemFetchForExportRequest); |
132 | QMutexLocker ml(&d->m_mutex); |
133 | return d->m_filter; |
134 | } |
135 | |
136 | /*! |
137 | Returns the sort ordering that will be used to sort the results of this request. |
138 | */ |
139 | QList<QOrganizerItemSortOrder> QOrganizerItemFetchForExportRequest::sorting() const |
140 | { |
141 | Q_D(const QOrganizerItemFetchForExportRequest); |
142 | QMutexLocker ml(&d->m_mutex); |
143 | return d->m_sorting; |
144 | } |
145 | |
146 | /*! |
147 | Returns the fetch hint which may be used by the backend to optimize item retrieval. |
148 | |
149 | A client should not make changes to a item which has been retrieved using a fetch hint other than |
150 | the default fetch hint. Doing so will result in information loss when saving the item back to |
151 | the manager (as the "new" restricted item will replace the previously saved item in the backend). |
152 | */ |
153 | QOrganizerItemFetchHint QOrganizerItemFetchForExportRequest::fetchHint() const |
154 | { |
155 | Q_D(const QOrganizerItemFetchForExportRequest); |
156 | QMutexLocker ml(&d->m_mutex); |
157 | return d->m_fetchHint; |
158 | } |
159 | |
160 | /*! |
161 | Returns the date-time which is the lower bound for the range in which items will be returned. |
162 | */ |
163 | QDateTime QOrganizerItemFetchForExportRequest::startDate() const |
164 | { |
165 | Q_D(const QOrganizerItemFetchForExportRequest); |
166 | QMutexLocker ml(&d->m_mutex); |
167 | return d->m_startDate; |
168 | } |
169 | |
170 | /*! |
171 | Returns the date-time which is the upper bound for the range in which items will be returned. |
172 | */ |
173 | QDateTime QOrganizerItemFetchForExportRequest::endDate() const |
174 | { |
175 | Q_D(const QOrganizerItemFetchForExportRequest); |
176 | QMutexLocker ml(&d->m_mutex); |
177 | return d->m_endDate; |
178 | } |
179 | |
180 | /*! |
181 | Returns the list of organizer items retrieved by this request. |
182 | */ |
183 | QList<QOrganizerItem> QOrganizerItemFetchForExportRequest::items() const |
184 | { |
185 | Q_D(const QOrganizerItemFetchForExportRequest); |
186 | QMutexLocker ml(&d->m_mutex); |
187 | return d->m_organizeritems; |
188 | } |
189 | |
190 | #include "moc_qorganizeritemfetchforexportrequest.cpp" |
191 | |
192 | QT_END_NAMESPACE_ORGANIZER |
193 |