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 "qorganizeritemremoverequest.h"
35
36#include "qorganizeritemrequests_p.h"
37
38QT_BEGIN_NAMESPACE_ORGANIZER
39
40/*!
41 \class QOrganizerItemRemoveRequest
42 \brief The QOrganizerItemRemoveRequest class allows a client to asynchronously request that certain
43 organizer items be removed from a backend.
44 \inmodule QtOrganizer
45 \ingroup organizer-requests
46
47 This request will remove the items and all the occurrences (both generated and persisted) of the
48 given items.
49 */
50
51/*!
52 Constructs a new organizer item remove request whose parent is the specified \a parent.
53*/
54QOrganizerItemRemoveRequest::QOrganizerItemRemoveRequest(QObject *parent)
55 : QOrganizerAbstractRequest(new QOrganizerItemRemoveRequestPrivate, parent)
56{
57}
58
59/*!
60 Frees memory in use by this request.
61*/
62QOrganizerItemRemoveRequest::~QOrganizerItemRemoveRequest()
63{
64}
65
66/*!
67 Sets the organizer item which will be removed to \a item.
68 Equivalent to calling:
69 \code
70 setOrganizerItems(QList<QOrganizerItem>() << item);
71 \endcode
72 */
73void QOrganizerItemRemoveRequest::setItem(const QOrganizerItem &item)
74{
75 Q_D(QOrganizerItemRemoveRequest);
76 QMutexLocker ml(&d->m_mutex);
77 d->m_organizeritems.clear();
78 d->m_organizeritems.append(t: item);
79}
80
81/*! Sets the organizer items which will be removed to \a items
82*/
83void QOrganizerItemRemoveRequest::setItems(const QList<QOrganizerItem> &items)
84{
85 Q_D(QOrganizerItemRemoveRequest);
86 QMutexLocker ml(&d->m_mutex);
87 d->m_organizeritems = items;
88}
89
90/*!
91 Returns the list of IDs of organizer items which will be removed.
92*/
93QList<QOrganizerItem> QOrganizerItemRemoveRequest::items() const
94{
95 Q_D(const QOrganizerItemRemoveRequest);
96 QMutexLocker ml(&d->m_mutex);
97 return d->m_organizeritems;
98}
99
100/*!
101 Returns the map of input organizer item list indices to errors which occurred.
102*/
103QMap<int, QOrganizerManager::Error> QOrganizerItemRemoveRequest::errorMap() const
104{
105 Q_D(const QOrganizerItemRemoveRequest);
106 QMutexLocker ml(&d->m_mutex);
107 return d->m_errors;
108}
109
110#include "moc_qorganizeritemremoverequest.cpp"
111
112QT_END_NAMESPACE_ORGANIZER
113

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