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

0001 /*
0002     SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
0003     SPDX-FileContributor: Kevin Ottens <kevin@kdab.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include <QSharedPointer>
0011 #include <QStringList>
0012 
0013 #include <Akonadi/Collection>
0014 #include <Akonadi/Item>
0015 #include <Akonadi/ItemSync>
0016 
0017 #include <KIMAP/ListJob>
0018 
0019 #include "messagehelper.h"
0020 
0021 class ResourceStateInterface
0022 {
0023 public:
0024     using Ptr = QSharedPointer<ResourceStateInterface>;
0025 
0026     virtual ~ResourceStateInterface();
0027 
0028     virtual QString userName() const = 0;
0029     virtual QString resourceName() const = 0;
0030     virtual QString resourceIdentifier() const = 0;
0031     virtual QStringList serverCapabilities() const = 0;
0032     virtual QList<KIMAP::MailBoxDescriptor> serverNamespaces() const = 0;
0033     virtual QList<KIMAP::MailBoxDescriptor> personalNamespaces() const = 0;
0034     virtual QList<KIMAP::MailBoxDescriptor> userNamespaces() const = 0;
0035     virtual QList<KIMAP::MailBoxDescriptor> sharedNamespaces() const = 0;
0036 
0037     virtual bool isAutomaticExpungeEnabled() const = 0;
0038     virtual bool isSubscriptionEnabled() const = 0;
0039     virtual bool isDisconnectedModeEnabled() const = 0;
0040     virtual int intervalCheckTime() const = 0;
0041 
0042     virtual Akonadi::Collection collection() const = 0;
0043     virtual Akonadi::Item item() const = 0;
0044     virtual Akonadi::Item::List items() const = 0;
0045 
0046     virtual Akonadi::Collection parentCollection() const = 0;
0047 
0048     virtual Akonadi::Collection sourceCollection() const = 0;
0049     virtual Akonadi::Collection targetCollection() const = 0;
0050 
0051     virtual QSet<QByteArray> parts() const = 0;
0052     virtual QSet<QByteArray> addedFlags() const = 0;
0053     virtual QSet<QByteArray> removedFlags() const = 0;
0054 
0055     virtual Akonadi::Tag tag() const = 0;
0056     virtual QSet<Akonadi::Tag> addedTags() const = 0;
0057     virtual QSet<Akonadi::Tag> removedTags() const = 0;
0058 
0059     virtual QString rootRemoteId() const = 0;
0060     static QString mailBoxForCollection(const Akonadi::Collection &collection, bool showWarnings = true);
0061 
0062     virtual void setIdleCollection(const Akonadi::Collection &collection) = 0;
0063     virtual void applyCollectionChanges(const Akonadi::Collection &collection) = 0;
0064 
0065     virtual void itemRetrieved(const Akonadi::Item &item) = 0;
0066 
0067     virtual void itemsRetrieved(const Akonadi::Item::List &items) = 0;
0068     virtual void itemsRetrievedIncremental(const Akonadi::Item::List &changed, const Akonadi::Item::List &removed) = 0;
0069     virtual void itemsRetrievalDone() = 0;
0070 
0071     virtual void setTotalItems(int) = 0;
0072 
0073     virtual void itemChangeCommitted(const Akonadi::Item &item) = 0;
0074     virtual void itemsChangesCommitted(const Akonadi::Item::List &items) = 0;
0075 
0076     virtual void collectionsRetrieved(const Akonadi::Collection::List &collections) = 0;
0077     virtual void collectionAttributesRetrieved(const Akonadi::Collection &collection) = 0;
0078 
0079     virtual void collectionChangeCommitted(const Akonadi::Collection &collection) = 0;
0080 
0081     virtual void tagChangeCommitted(const Akonadi::Tag &tag) = 0;
0082 
0083     virtual void changeProcessed() = 0;
0084 
0085     virtual void searchFinished(const QList<qint64> &result, bool isRid = true) = 0;
0086 
0087     virtual void cancelTask(const QString &errorString) = 0;
0088     virtual void deferTask() = 0;
0089     virtual void restartItemRetrieval(Akonadi::Collection::Id col) = 0;
0090     virtual void taskDone() = 0;
0091 
0092     virtual void emitError(const QString &message) = 0;
0093     virtual void emitWarning(const QString &message) = 0;
0094     virtual void emitPercent(int percent) = 0;
0095 
0096     virtual void synchronizeCollectionTree() = 0;
0097     virtual void scheduleConnectionAttempt() = 0;
0098 
0099     virtual QChar separatorCharacter() const = 0;
0100     virtual void setSeparatorCharacter(QChar separator) = 0;
0101 
0102     virtual void showInformationDialog(const QString &message, const QString &title, const QString &dontShowAgainName) = 0;
0103 
0104     virtual int batchSize() const = 0;
0105 
0106     virtual MessageHelper::Ptr messageHelper() const = 0;
0107 
0108     virtual void tagsRetrieved(const Akonadi::Tag::List &tags, const QHash<QString, Akonadi::Item::List> &) = 0;
0109     virtual void relationsRetrieved(const Akonadi::Relation::List &tags) = 0;
0110 
0111     virtual Akonadi::Relation::List addedRelations() const = 0;
0112     virtual Akonadi::Relation::List removedRelations() const = 0;
0113 
0114     virtual void setItemMergingMode(Akonadi::ItemSync::MergeMode mergeMode) = 0;
0115 };