File indexing completed on 2024-11-10 04:40:28
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 "akonadicore_export.h" 0010 #include "job.h" 0011 0012 namespace Akonadi 0013 { 0014 class Collection; 0015 class CollectionCopyJobPrivate; 0016 0017 /** 0018 * @short Job that copies a collection into another collection in the Akonadi storage. 0019 * 0020 * This job copies a single collection into a specified target collection. 0021 * 0022 * @code 0023 * 0024 * Akonadi::Collection source = ... 0025 * Akonadi::Collection target = ... 0026 * 0027 * Akonadi::CollectionCopyJob *job = new Akonadi::CollectionCopyJob( source, target ); 0028 * connect( job, SIGNAL(result(KJob*)), SLOT(copyFinished(KJob*)) ); 0029 * 0030 * ... 0031 * 0032 * MyClass::copyFinished( KJob *job ) 0033 * { 0034 * if ( job->error() ) 0035 * qDebug() << "Error occurred"; 0036 * else 0037 * qDebug() << "Copied successfully"; 0038 * } 0039 * 0040 * @endcode 0041 * 0042 * @author Volker Krause <vkrause@kde.org> 0043 */ 0044 class AKONADICORE_EXPORT CollectionCopyJob : public Job 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 /** 0050 * Creates a new collection copy job to copy the given @p source collection into @p target. 0051 * 0052 * @param source The collection to copy. 0053 * @param target The target collection. 0054 * @param parent The parent object. 0055 */ 0056 CollectionCopyJob(const Collection &source, const Collection &target, QObject *parent = nullptr); 0057 0058 /** 0059 * Destroys the collection copy job. 0060 */ 0061 ~CollectionCopyJob() override; 0062 0063 protected: 0064 void doStart() override; 0065 bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override; 0066 0067 private: 0068 Q_DECLARE_PRIVATE(CollectionCopyJob) 0069 }; 0070 0071 }