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

0001 /*
0002     SPDX-FileCopyrightText: 2014 Christian Mollekopf <mollekopf@kolabsys.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include "akonadicore_export.h"
0009 
0010 #include "jobs/job.h"
0011 #include "relation.h"
0012 
0013 namespace Akonadi
0014 {
0015 class AKONADICORE_EXPORT RelationSync : public Akonadi::Job
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit RelationSync(QObject *parent = nullptr);
0020     ~RelationSync() override;
0021 
0022     void setRemoteRelations(const Akonadi::Relation::List &relations);
0023 
0024 protected:
0025     void doStart() override;
0026 
0027 private Q_SLOTS:
0028     void onLocalFetchDone(KJob *job);
0029     void slotResult(KJob *job) override;
0030 
0031 private:
0032     void diffRelations();
0033     void checkDone();
0034 
0035 private:
0036     Akonadi::Relation::List mRemoteRelations;
0037     Akonadi::Relation::List mLocalRelations;
0038     bool mRemoteRelationsSet = false;
0039     bool mLocalRelationsFetched = false;
0040 };
0041 
0042 }