File indexing completed on 2024-11-17 04:45:02

0001 /*
0002     SPDX-FileCopyrightText: 2020 Igor Poboiko <igor.poboiko@gmail.com>
0003     SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
0004     SPDX-FileContributor: Kevin Ottens <kevin@kdab.com>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <Akonadi/Collection>
0012 #include <Akonadi/Item>
0013 #include <Akonadi/ItemSync>
0014 
0015 /**
0016  * This is a generic interface for ResourceBase class
0017  */
0018 class ResourceStateInterface
0019 {
0020 public:
0021     using Ptr = QSharedPointer<ResourceStateInterface>;
0022 
0023     virtual ~ResourceStateInterface() = default;
0024 
0025     // Items handling
0026     virtual void itemRetrieved(const Akonadi::Item &item) = 0;
0027     virtual void itemsRetrieved(const Akonadi::Item::List &items) = 0;
0028     virtual void itemsRetrievedIncremental(const Akonadi::Item::List &changed, const Akonadi::Item::List &removed) = 0;
0029     virtual void itemsRetrievalDone() = 0;
0030     virtual void setTotalItems(int) = 0;
0031     virtual void itemChangeCommitted(const Akonadi::Item &item) = 0;
0032     virtual void itemsChangesCommitted(const Akonadi::Item::List &items) = 0;
0033     virtual Akonadi::Item::List currentItems() = 0;
0034 
0035     // Collections handling
0036     virtual void collectionsRetrieved(const Akonadi::Collection::List &collections) = 0;
0037     virtual void collectionAttributesRetrieved(const Akonadi::Collection &collection) = 0;
0038     virtual void collectionChangeCommitted(const Akonadi::Collection &collection) = 0;
0039     virtual Akonadi::Collection currentCollection() = 0;
0040 
0041     // Tags handling
0042     virtual void tagsRetrieved(const Akonadi::Tag::List &tags, const QHash<QString, Akonadi::Item::List> &) = 0;
0043     virtual void tagChangeCommitted(const Akonadi::Tag &tag) = 0;
0044 
0045     // Relations handling
0046     virtual void relationsRetrieved(const Akonadi::Relation::List &tags) = 0;
0047 
0048     // Result reporting
0049     virtual void changeProcessed() = 0;
0050     virtual void cancelTask(const QString &errorString) = 0;
0051     virtual void deferTask() = 0;
0052     virtual void taskDone() = 0;
0053 
0054     virtual void emitStatus(int status, const QString &message) = 0;
0055     virtual void emitError(const QString &message) = 0;
0056     virtual void emitWarning(const QString &message) = 0;
0057     virtual void emitPercent(int percent) = 0;
0058 };