File indexing completed on 2024-06-23 05:07:02
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2006 Tobias Koenig <tokoe@kde.org> * 0003 * SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org> * 0004 * * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later * 0006 ***************************************************************************/ 0007 0008 #pragma once 0009 0010 #include "entities.h" 0011 #include "handler.h" 0012 0013 namespace Akonadi 0014 { 0015 namespace Server 0016 { 0017 /** 0018 @ingroup akonadi_server_handler 0019 0020 Handler for the item modification command. 0021 0022 <h4>Semantics</h4> 0023 Modifies the selected items. Item selection can happen within the usual three scopes: 0024 - based on a uid set relative to the currently selected collection 0025 - based on a uid set (UID) 0026 - based on a list of remote identifiers within the currently selected collection (RID) 0027 0028 The following item properties can be modified: 0029 - the remote identifier (@c REMOTEID) 0030 - the remote revision (@c REMOTEREVISION) 0031 - the global identifier (@c GID) 0032 - resetting the dirty flag indication local changes not yet replicated to the backend (@c DIRTY) 0033 - adding/deleting/setting item flags (@c FLAGS) 0034 - setting the item size hint (@c SIZE) 0035 - changing item attributes 0036 - changing item payload parts 0037 0038 If multiple items are selected only the following operations are valid: 0039 - adding flags 0040 - removing flags 0041 - settings flags 0042 0043 The following operations are only allowed by resources: 0044 - resetting the dirty flag 0045 - invalidating the cache 0046 - modifying the remote identifier 0047 - modifying the remote revision 0048 0049 Conflict detection: 0050 - only available when modifying a single item 0051 - requires the previous item revision to be provided (@c REV) 0052 */ 0053 0054 class ItemModifyHandler : public Handler 0055 { 0056 public: 0057 ItemModifyHandler(AkonadiServer &akonadi); 0058 ~ItemModifyHandler() override = default; 0059 0060 bool parseStream() override; 0061 0062 private: 0063 bool replaceFlags(const PimItem::List &items, const QSet<QByteArray> &flags, bool &flagsChanged); 0064 bool addFlags(const PimItem::List &items, const QSet<QByteArray> &flags, bool &flagsChanged); 0065 bool deleteFlags(const PimItem::List &items, const QSet<QByteArray> &flags, bool &flagsChanged); 0066 bool replaceTags(const PimItem::List &items, const Scope &tags, bool &tagsChanged); 0067 bool addTags(const PimItem::List &items, const Scope &tags, bool &tagsChanged); 0068 bool deleteTags(const PimItem::List &items, const Scope &tags, bool &tagsChanged); 0069 }; 0070 0071 } // namespace Server 0072 } // namespace Akonadi