File indexing completed on 2024-11-24 04:44:17
0001 /* 0002 SPDX-FileCopyrightText: 2014 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> 0003 SPDX-FileContributor: Kevin Krammer <kevin.krammer@kdab.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include "kolabrelationresourcetask.h" 0011 0012 class KolabChangeItemsRelationsTask : public KolabRelationResourceTask 0013 { 0014 Q_OBJECT 0015 public: 0016 explicit KolabChangeItemsRelationsTask(const ResourceStateInterface::Ptr &resource, QObject *parent = nullptr); 0017 0018 protected: 0019 void startRelationTask(KIMAP::Session *session) override; 0020 0021 private Q_SLOTS: 0022 void onRelationFetchDone(KJob *job); 0023 0024 void addRelation(const Akonadi::Relation &relation); 0025 void onItemsFetched(KJob *job); 0026 void removeRelation(const Akonadi::Relation &relation); 0027 void onSelectDone(KJob *job); 0028 void triggerStoreJob(); 0029 void onChangeCommitted(KJob *job); 0030 0031 private: 0032 void processNextRelation(); 0033 0034 KIMAP::Session *mSession = nullptr; 0035 Akonadi::Relation::List mAddedRelations; 0036 Akonadi::Relation::List mRemovedRelations; 0037 Akonadi::Relation mCurrentRelation; 0038 bool mAdding = false; 0039 };