File indexing completed on 2024-11-24 04:44:31
0001 /* 0002 SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <Akonadi/ResourceBase> 0010 0011 class OpenXchangeResource : public Akonadi::ResourceBase, public Akonadi::AgentBase::ObserverV2 0012 { 0013 Q_OBJECT 0014 0015 public: 0016 explicit OpenXchangeResource(const QString &id); 0017 ~OpenXchangeResource() override; 0018 0019 void cleanup() override; 0020 0021 public Q_SLOTS: 0022 void aboutToQuit() override; 0023 0024 protected: 0025 using ResourceBase::retrieveItems; // Suppress -Woverload-virtual 0026 0027 protected Q_SLOTS: 0028 void retrieveCollections() override; 0029 void retrieveItems(const Akonadi::Collection &collection) override; 0030 bool retrieveItem(const Akonadi::Item &item, const QSet<QByteArray> &parts) override; 0031 0032 protected: 0033 void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection) override; 0034 void itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &parts) override; 0035 void itemRemoved(const Akonadi::Item &item) override; 0036 void itemMoved(const Akonadi::Item &item, const Akonadi::Collection &collectionSource, const Akonadi::Collection &collectionDestination) override; 0037 0038 void collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent) override; 0039 void collectionChanged(const Akonadi::Collection &collection) override; 0040 // do not hide the other variant, use implementation from base class 0041 // which just forwards to the one above 0042 using Akonadi::AgentBase::ObserverV2::collectionChanged; 0043 void collectionRemoved(const Akonadi::Collection &collection) override; 0044 void collectionMoved(const Akonadi::Collection &collection, 0045 const Akonadi::Collection &collectionSource, 0046 const Akonadi::Collection &collectionDestination) override; 0047 0048 private: 0049 void onReloadConfiguration(); 0050 void onUpdateUsersJobFinished(KJob *); 0051 void onFoldersRequestJobFinished(KJob *); 0052 void onFoldersRequestDeltaJobFinished(KJob *); 0053 void onFolderCreateJobFinished(KJob *); 0054 void onFolderModifyJobFinished(KJob *); 0055 void onFolderMoveJobFinished(KJob *); 0056 void onFolderDeleteJobFinished(KJob *); 0057 void onObjectsRequestJobFinished(KJob *); 0058 void onObjectsRequestDeltaJobFinished(KJob *); 0059 void onObjectRequestJobFinished(KJob *); 0060 void onObjectCreateJobFinished(KJob *); 0061 void onObjectModifyJobFinished(KJob *); 0062 void onObjectMoveJobFinished(KJob *); 0063 void onObjectDeleteJobFinished(KJob *); 0064 void onFetchResourceCollectionsFinished(KJob *); 0065 0066 private: 0067 void syncCollectionsRemoteIdCache(); 0068 QMap<qlonglong, Akonadi::Collection> mCollectionsMap; 0069 0070 Akonadi::Collection mResourceCollection; 0071 QMap<qlonglong, Akonadi::Collection> mStandardCollectionsMap; 0072 0073 bool mUseIncrementalUpdates = false; 0074 };