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

0001 /*
0002  * SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include "akonadicore_export.h"
0010 
0011 #include <KJob>
0012 
0013 #include <memory>
0014 
0015 namespace Akonadi
0016 {
0017 class Collection;
0018 class CollectionAttributesSynchronizationJobPrivate;
0019 
0020 /**
0021  * @short Job that synchronizes the attributes of a collection.
0022  *
0023  * This job will trigger a resource to synchronize the attributes of
0024  * a collection based on what the backend is reporting to store them in the
0025  * Akonadi storage.
0026  *
0027  * Example:
0028  *
0029  * @code
0030  * using namespace Akonadi;
0031  *
0032  * const Collection collection = ...;
0033  *
0034  * CollectionAttributesSynchronizationJob *job = new CollectionAttributesSynchronizationJob( collection );
0035  * connect( job, SIGNAL(result(KJob*)), SLOT(synchronizationFinished(KJob*)) );
0036  *
0037  * @endcode
0038  *
0039  * @note This is a KJob not an Akonadi::Job, so it won't auto-start!
0040  *
0041  * @author Volker Krause <vkrause@kde.org>
0042  * @since 4.6
0043  */
0044 class AKONADICORE_EXPORT CollectionAttributesSynchronizationJob : public KJob
0045 {
0046     Q_OBJECT
0047 
0048 public:
0049     /**
0050      * Creates a new synchronization job for the given collection.
0051      *
0052      * @param collection The collection to synchronize.
0053      */
0054     explicit CollectionAttributesSynchronizationJob(const Collection &collection, QObject *parent = nullptr);
0055 
0056     /**
0057      * Destroys the synchronization job.
0058      */
0059     ~CollectionAttributesSynchronizationJob() override;
0060 
0061     /* reimpl */
0062     void start() override;
0063 
0064 private:
0065     /// @cond PRIVATE
0066     friend class CollectionAttributesSynchronizationJobPrivate;
0067     std::unique_ptr<CollectionAttributesSynchronizationJobPrivate> const d;
0068     /// @endcond
0069 };
0070 
0071 }