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 "qorganizeritemremovebyidrequest.h"
35
36#include "qorganizeritemrequests_p.h"
37
38QT_BEGIN_NAMESPACE_ORGANIZER
39
40/*!
41 \class QOrganizerItemRemoveByIdRequest
42 \brief The QOrganizerItemRemoveByIdRequest class allows a client to asynchronously
43 request that certain organizer items be removed from a organizer items store.
44 \inmodule QtOrganizer
45
46 For a QOrganizerItemRemoveByIdRequest, the resultsUpdated() signal will be emitted when
47 the individual item errors (which may be retrieved by calling errorMap()) are updated, or if the overall
48 operation error (which may be retrieved by calling error()) is updated.
49
50 \ingroup organizer-requests
51 */
52
53/*!
54 Constructs a new organizer item remove request whose parent is the specified \a parent
55 */
56QOrganizerItemRemoveByIdRequest::QOrganizerItemRemoveByIdRequest(QObject* parent)
57 : QOrganizerAbstractRequest(new QOrganizerItemRemoveByIdRequestPrivate, parent)
58{
59}
60
61/*!
62 Frees memory in use by this request
63*/
64QOrganizerItemRemoveByIdRequest::~QOrganizerItemRemoveByIdRequest()
65{
66}
67
68/*!
69 Sets the id of the organizer item which will be removed to \a organizeritemId.
70 Equivalent to calling:
71 \code
72 setOrganizerItemIds(QList<QOrganizerItemId>() << organizeritemIds);
73 \endcode
74 */
75void QOrganizerItemRemoveByIdRequest::setItemId(const QOrganizerItemId& organizeritemId)
76{
77 Q_D(QOrganizerItemRemoveByIdRequest);
78 QMutexLocker ml(&d->m_mutex);
79 d->m_organizeritemIds.clear();
80 d->m_organizeritemIds.append(t: organizeritemId);
81}
82
83/*!
84 Sets the list of ids of organizer items which will be removed to \a organizeritemIds
85 */
86void QOrganizerItemRemoveByIdRequest::setItemIds(const QList<QOrganizerItemId>& organizeritemIds)
87{
88 Q_D(QOrganizerItemRemoveByIdRequest);
89 QMutexLocker ml(&d->m_mutex);
90 d->m_organizeritemIds = organizeritemIds;
91}
92
93/*!
94 Returns the list of ids of organizer items which will be removed
95 */
96QList<QOrganizerItemId> QOrganizerItemRemoveByIdRequest::itemIds() const
97{
98 Q_D(const QOrganizerItemRemoveByIdRequest);
99 QMutexLocker ml(&d->m_mutex);
100 return d->m_organizeritemIds;
101}
102
103/*!
104 Returns the map of input organizer item list indices to errors which occurred
105 */
106QMap<int, QOrganizerManager::Error> QOrganizerItemRemoveByIdRequest::errorMap() const
107{
108 Q_D(const QOrganizerItemRemoveByIdRequest);
109 QMutexLocker ml(&d->m_mutex);
110 return d->m_errors;
111}
112
113#include "moc_qorganizeritemremovebyidrequest.cpp"
114
115QT_END_NAMESPACE_ORGANIZER
116

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