1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the QtOrganizer module of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:LGPL$
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 Digia. For licensing terms and
14
** conditions see http://qt.digia.com/licensing. For further information
15
** use the contact form at http://qt.digia.com/contact-us.
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 as published by the Free Software
20
** Foundation and appearing in the file LICENSE.LGPL included in the
21
** packaging of this file. Please review the following information to
22
** ensure the GNU Lesser General Public License version 2.1 requirements
23
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25
** In addition, as a special exception, Digia gives you certain additional
26
** rights. These rights are described in the Digia Qt LGPL Exception
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29
** GNU General Public License Usage
30
** Alternatively, this file may be used under the terms of the GNU
31
** General Public License version 3.0 as published by the Free Software
32
** Foundation and appearing in the file LICENSE.GPL included in the
33
** packaging of this file. Please review the following information to
34
** ensure the GNU General Public License version 3.0 requirements will be
35
** met: http://www.gnu.org/copyleft/gpl.html.
40
****************************************************************************/
42
#include <qorganizeritemsaverequest.h>
43
#include <private/qorganizeritemrequests_p.h>
45
QT_BEGIN_NAMESPACE_ORGANIZER
48
\class QOrganizerItemSaveRequest
49
\brief The QOrganizerItemSaveRequest class allows a client to asynchronously request that certain
50
organizer items be saved to a backend.
52
\ingroup organizer-requests
56
Constructs a new organizer item save request whose parent is the specified \a parent.
58
QOrganizerItemSaveRequest::QOrganizerItemSaveRequest(QObject *parent)
59
: QOrganizerAbstractRequest(new QOrganizerItemSaveRequestPrivate, parent)
64
Frees memory in use by this request.
66
QOrganizerItemSaveRequest::~QOrganizerItemSaveRequest()
68
QOrganizerAbstractRequestPrivate::notifyEngine(this);
72
Sets the organizer item to be saved to \a item.
73
Equivalent to calling:
75
setItems(QList<QOrganizerItem>() << item);
78
void QOrganizerItemSaveRequest::setItem(const QOrganizerItem &item)
80
Q_D(QOrganizerItemSaveRequest);
81
QMutexLocker ml(&d->m_mutex);
82
d->m_organizeritems.clear();
83
d->m_organizeritems.append(item);
87
Sets the list of organizer items to be saved to \a items.
89
void QOrganizerItemSaveRequest::setItems(const QList<QOrganizerItem> &items)
91
Q_D(QOrganizerItemSaveRequest);
92
QMutexLocker ml(&d->m_mutex);
93
d->m_organizeritems = items;
97
Returns the list of organizer items which will be saved if called prior to calling start(),
98
otherwise returns the list of organizer items as they were saved in the organizer item store.
100
QList<QOrganizerItem> QOrganizerItemSaveRequest::items() const
102
Q_D(const QOrganizerItemSaveRequest);
103
QMutexLocker ml(&d->m_mutex);
104
return d->m_organizeritems;
108
Returns the map of input definition list indices to errors which occurred.
110
QMap<int, QOrganizerManager::Error> QOrganizerItemSaveRequest::errorMap() const
112
Q_D(const QOrganizerItemSaveRequest);
113
QMutexLocker ml(&d->m_mutex);
118
Set the list of detail types to restrict saving to \a detailMask. This allows you to perform
119
partial save (and remove) operations on existing items.
121
If \a detailMask is empty (the default), no restrictions will apply, and the passed
122
in items will be saved as is. Otherwise, only details whose types are in
123
the list will be saved. If a detail type is present in the list, but there are no
124
corresponding details in the item passed into this request, any existing details in
125
the manager for that item will be removed.
127
This is useful if you've used a fetch hint to fetch a partial item from a manager
128
so that you can save changes to the details you actually fetched without removing
129
the details you didn't.
131
Additionally, when performing synchronization operations with other managers that don't
132
support the full range of details, you can restrict the update operation to only those
133
details so that you don't lose the extra details that are supported in this manager.
135
\note Some managers do not support partial updates natively, in which case the QtOrganizer
136
framework will emulate the functionality (fetching the whole item, applying the
137
new restricted details, and saving the item back).
139
void QOrganizerItemSaveRequest::setDetailMask(const QList<QOrganizerItemDetail::DetailType> &detailMask)
141
Q_D(QOrganizerItemSaveRequest);
142
QMutexLocker ml(&d->m_mutex);
143
d->m_detailMask = detailMask;
147
Returns the list of definitions that this request will operate on.
149
If the list is empty, the request will operate on all details.
151
QList<QOrganizerItemDetail::DetailType> QOrganizerItemSaveRequest::detailMask() const
153
Q_D(const QOrganizerItemSaveRequest);
154
QMutexLocker ml(&d->m_mutex);
155
return d->m_detailMask;
158
#include "moc_qorganizeritemsaverequest.cpp"
160
QT_END_NAMESPACE_ORGANIZER