File indexing completed on 2024-06-23 05:07:01

0001 /*
0002     SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "entities.h"
0010 #include "handler.h"
0011 
0012 namespace Akonadi
0013 {
0014 namespace Server
0015 {
0016 /**
0017   @ingroup akonadi_server_handler
0018 
0019   Handler for the COPY command.
0020 
0021   This command is used to copy a set of items into the specific collection. It
0022   is syntactically identical to the IMAP COPY command.
0023 
0024   The copied items differ in the following points from the originals:
0025   - new unique id
0026   - empty remote id
0027   - possible located in a different collection (and thus resource)
0028 
0029   There is only the usual status response indicating success or failure of the
0030   COPY command
0031  */
0032 class ItemCopyHandler : public Handler
0033 {
0034 public:
0035     ItemCopyHandler(AkonadiServer &akonadi);
0036     ~ItemCopyHandler() override = default;
0037 
0038     bool parseStream() override;
0039 
0040 protected:
0041     /**
0042       Copy the given item and all its parts into the @p target.
0043       The changes mentioned above are applied.
0044     */
0045     bool copyItem(const PimItem &item, const Collection &target);
0046     void processItems(const QList<qint64> &ids);
0047 
0048 private:
0049     Collection mTargetCollection;
0050 };
0051 
0052 } // namespace Server
0053 } // namespace Akonadi