File indexing completed on 2024-11-10 04:40:29

0001 /*
0002     SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "akonadicore_export.h"
0010 #include "job.h"
0011 
0012 namespace Akonadi
0013 {
0014 class Collection;
0015 class CollectionMoveJobPrivate;
0016 
0017 /**
0018  * @short Job that moves a collection in the Akonadi storage to a new parent collection.
0019  *
0020  * This job moves an existing collection to a new parent collection.
0021  *
0022  * @code
0023  *
0024  * const Akonadi::Collection collection = ...
0025  * const Akonadi::Collection newParent = ...
0026  *
0027  * Akonadi::CollectionMoveJob *job = new Akonadi::CollectionMoveJob( collection, newParent );
0028  * connect( job, SIGNAL(result(KJob*)), this, SLOT(moveResult(KJob*)) );
0029  *
0030  * @endcode
0031  *
0032  * @since 4.4
0033  * @author Volker Krause <vkrause@kde.org>
0034  */
0035 class AKONADICORE_EXPORT CollectionMoveJob : public Job
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040     /**
0041      * Creates a new collection move job for the given collection and destination
0042      *
0043      * @param collection The collection to move.
0044      * @param destination The destination collection where @p collection should be moved to.
0045      * @param parent The parent object.
0046      */
0047     CollectionMoveJob(const Collection &collection, const Collection &destination, QObject *parent = nullptr);
0048 
0049 protected:
0050     void doStart() override;
0051     bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
0052 
0053 private:
0054     Q_DECLARE_PRIVATE(CollectionMoveJob)
0055 };
0056 
0057 }