/usr/include/akonadi/itemmodifyjob.h is in kdepimlibs5-dev 4:4.14.10-1ubuntu7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | /*
Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef AKONADI_ITEMMODIFYJOB_H
#define AKONADI_ITEMMODIFYJOB_H
#include "akonadi_export.h"
#include <akonadi/item.h>
#include <akonadi/job.h>
namespace Akonadi {
class Collection;
class ItemModifyJobPrivate;
/**
* @short Job that modifies an existing item in the Akonadi storage.
*
* This job is used to writing back items to the Akonadi storage, after
* the user has changed them in any way.
* For performance reasons either the full item (including the full payload)
* can written back or only the meta data of the item.
*
* Example:
*
* @code
*
* // Fetch item with unique id 125
* Akonadi::ItemFetchJob *fetchJob = new Akonadi::ItemFetchJob( Akonadi::Item( 125 ) );
* connect( fetchJob, SIGNAL(result(KJob*)), SLOT(fetchFinished(KJob*)) );
*
* ...
*
* MyClass::fetchFinished( KJob *job )
* {
* if ( job->error() )
* return;
*
* Akonadi::ItemFetchJob *fetchJob = qobject_cast<Akonadi::ItemFetchJob*>( job );
*
* Akonadi::Item item = fetchJob->items().first();
*
* // Set a custom flag
* item.setFlag( "\GotIt" );
*
* // Store back modified item
* Akonadi::ItemModifyJob *modifyJob = new Akonadi::ItemModifyJob( item );
* connect( modifyJob, SIGNAL(result(KJob*)), SLOT(modifyFinished(KJob*)) );
* }
*
* MyClass::modifyFinished( KJob *job )
* {
* if ( job->error() )
* qDebug() << "Error occurred";
* else
* qDebug() << "Item modified successfully";
* }
*
* @endcode
*
* <h3>Conflict Resolution</h3>
* When the job is executed, a check is made to ensure that the Item contained
* in the job is not older than the version of the Item already held in the
* Akonadi database. If it is older, a conflict resolution dialog is displayed
* for the user to choose which version of the Item to use, unless
* disableAutomaticConflictHandling() has been called to disable the dialog, or
* disableRevisionCheck() has been called to disable version checking
* altogether.
*
* The item version is checked by comparing the Item::revision() values in the
* job and in the database. To ensure that two successive ItemModifyJobs for
* the same Item work correctly, the revision number of the Item supplied to
* the second ItemModifyJob should be set equal to the Item's revision number
* on completion of the first ItemModifyJob. This can be obtained by, for
* example, calling item().revision() in the job's result slot.
*
* @author Volker Krause <vkrause@kde.org>
*/
class AKONADI_EXPORT ItemModifyJob : public Job
{
friend class ResourceBase;
Q_OBJECT
public:
/**
* Creates a new item modify job.
*
* @param item The modified item object to store.
* @param parent The parent object.
*/
explicit ItemModifyJob(const Item &item, QObject *parent = 0);
/**
* Creates a new item modify job for bulk modifications.
*
* Using this is different from running a modification job per item.
* Use this when applying the same change to a set of items, such as a
* mass-change of item flags, not if you just want to store a bunch of
* randomly modified items.
*
* Currently the following modifications are supported:
* - flag changes
*
* @note Since this does not do payload modifications, it implies
* setIgnorePayload( true ) and disableRevisionCheck().
* @param items The list of items to modify, must not be empty.
* @since 4.6
*/
explicit ItemModifyJob(const Item::List &items, QObject *parent = 0);
/**
* Destroys the item modify job.
*/
virtual ~ItemModifyJob();
/**
* Sets whether the payload of the modified item shall be
* omitted from transmission to the Akonadi storage.
* The default is @c false, however it can be set for
* performance reasons.
* @param ignore ignores payload if set as @c true
*/
void setIgnorePayload(bool ignore);
/**
* Returns whether the payload of the modified item shall be
* omitted from transmission to the Akonadi storage.
*/
bool ignorePayload() const;
/**
* Sets whether the GID shall be updated either from the gid parameter or
* by extracting it from the payload.
* The default is @c false to avoid unecessarily update the GID,
* as it should never change once set, and the ItemCreateJob already sets it.
* @param update update the GID if set as @c true
*
* @note If disabled the GID will not be updated, but still be used for identification of the item.
* @since 4.12
*/
void setUpdateGid(bool update);
/**
* Returns wheter the GID should be updated.
* @since 4.12
*/
bool updateGid() const;
/**
* Disables the check of the revision number.
*
* @note If disabled, no conflict detection is available.
*/
void disableRevisionCheck();
/**
* Returns the modified and stored item including the changed revision number.
*
* @note Use this method only when using the single item constructor.
*/
Item item() const;
/**
* Returns the modified and stored items including the changed revision number.
*
* @since 4.6
*/
Item::List items() const;
/**
* Disables the automatic handling of conflicts.
*
* By default the item modify job will bring up a dialog to resolve
* a conflict that might happen when modifying an item.
* Calling this method will avoid that and the job returns with an
* error in case of a conflict.
*
* @since 4.6
*/
void disableAutomaticConflictHandling();
protected:
virtual void doStart();
virtual void doHandleResponse(const QByteArray &tag, const QByteArray &data);
private:
//@cond PRIVATE
Q_DECLARE_PRIVATE(ItemModifyJob)
Q_PRIVATE_SLOT(d_func(), void conflictResolved())
Q_PRIVATE_SLOT(d_func(), void conflictResolveError(const QString &))
//@endcond
};
}
#endif
|