File indexing completed on 2024-11-17 04:45:03
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 <QPair> 0011 #include <QVariant> 0012 0013 #include "resourcestateinterface.h" 0014 0015 using TagListAndMembers = QPair<Akonadi::Tag::List, QHash<QString, Akonadi::Item::List>>; 0016 0017 class DummyResourceState : public ResourceStateInterface 0018 { 0019 public: 0020 using Ptr = QSharedPointer<DummyResourceState>; 0021 0022 explicit DummyResourceState(); 0023 ~DummyResourceState() override; 0024 0025 void setUserName(const QString &name); 0026 QString userName() const override; 0027 0028 void setResourceName(const QString &name); 0029 QString resourceName() const override; 0030 0031 void setResourceIdentifier(const QString &identifier); 0032 QString resourceIdentifier() const override; 0033 0034 void setServerCapabilities(const QStringList &capabilities); 0035 QStringList serverCapabilities() const override; 0036 0037 void setServerNamespaces(const QList<KIMAP::MailBoxDescriptor> &namespaces); 0038 QList<KIMAP::MailBoxDescriptor> serverNamespaces() const override; 0039 QList<KIMAP::MailBoxDescriptor> personalNamespaces() const override; 0040 QList<KIMAP::MailBoxDescriptor> userNamespaces() const override; 0041 QList<KIMAP::MailBoxDescriptor> sharedNamespaces() const override; 0042 0043 void setAutomaticExpungeEnagled(bool enabled); 0044 bool isAutomaticExpungeEnabled() const override; 0045 0046 void setSubscriptionEnabled(bool enabled); 0047 bool isSubscriptionEnabled() const override; 0048 void setDisconnectedModeEnabled(bool enabled); 0049 bool isDisconnectedModeEnabled() const override; 0050 void setIntervalCheckTime(int interval); 0051 int intervalCheckTime() const override; 0052 0053 void setCollection(const Akonadi::Collection &collection); 0054 Akonadi::Collection collection() const override; 0055 void setItem(const Akonadi::Item &item); 0056 Akonadi::Item item() const override; 0057 Akonadi::Item::List items() const override; 0058 0059 void setParentCollection(const Akonadi::Collection &collection); 0060 Akonadi::Collection parentCollection() const override; 0061 0062 void setSourceCollection(const Akonadi::Collection &collection); 0063 Akonadi::Collection sourceCollection() const override; 0064 void setTargetCollection(const Akonadi::Collection &collection); 0065 Akonadi::Collection targetCollection() const override; 0066 0067 void setParts(const QSet<QByteArray> &parts); 0068 QSet<QByteArray> parts() const override; 0069 0070 void setTag(const Akonadi::Tag &tag); 0071 Akonadi::Tag tag() const override; 0072 void setAddedTags(const QSet<Akonadi::Tag> &addedTags); 0073 QSet<Akonadi::Tag> addedTags() const override; 0074 void setRemovedTags(const QSet<Akonadi::Tag> &removedTags); 0075 QSet<Akonadi::Tag> removedTags() const override; 0076 0077 Akonadi::Relation::List addedRelations() const override; 0078 Akonadi::Relation::List removedRelations() const override; 0079 0080 QString rootRemoteId() const override; 0081 0082 void setIdleCollection(const Akonadi::Collection &collection) override; 0083 void applyCollectionChanges(const Akonadi::Collection &collection) override; 0084 0085 void collectionAttributesRetrieved(const Akonadi::Collection &collection) override; 0086 0087 void itemRetrieved(const Akonadi::Item &item) override; 0088 0089 void itemsRetrieved(const Akonadi::Item::List &items) override; 0090 void itemsRetrievedIncremental(const Akonadi::Item::List &changed, const Akonadi::Item::List &removed) override; 0091 void itemsRetrievalDone() override; 0092 0093 void setTotalItems(int) override; 0094 0095 QSet<QByteArray> addedFlags() const override; 0096 QSet<QByteArray> removedFlags() const override; 0097 0098 void itemChangeCommitted(const Akonadi::Item &item) override; 0099 void itemsChangesCommitted(const Akonadi::Item::List &items) override; 0100 0101 void collectionsRetrieved(const Akonadi::Collection::List &collections) override; 0102 0103 void collectionChangeCommitted(const Akonadi::Collection &collection) override; 0104 0105 void tagsRetrieved(const Akonadi::Tag::List &tags, const QHash<QString, Akonadi::Item::List> &) override; 0106 void relationsRetrieved(const Akonadi::Relation::List &tags) override; 0107 void tagChangeCommitted(const Akonadi::Tag &tag) override; 0108 0109 void searchFinished(const QList<qint64> &result, bool isRid = true) override; 0110 0111 void changeProcessed() override; 0112 0113 void cancelTask(const QString &errorString) override; 0114 void deferTask() override; 0115 void restartItemRetrieval(Akonadi::Collection::Id col) override; 0116 void taskDone() override; 0117 0118 void emitError(const QString &message) override; 0119 void emitWarning(const QString &message) override; 0120 void emitPercent(int percent) override; 0121 0122 void synchronizeCollectionTree() override; 0123 void scheduleConnectionAttempt() override; 0124 0125 QChar separatorCharacter() const override; 0126 void setSeparatorCharacter(QChar separator) override; 0127 0128 void showInformationDialog(const QString &message, const QString &title, const QString &dontShowAgainName) override; 0129 0130 int batchSize() const override; 0131 void setItemMergingMode(Akonadi::ItemSync::MergeMode mergeMode) override; 0132 0133 MessageHelper::Ptr messageHelper() const override; 0134 0135 QList<QPair<QByteArray, QVariant>> calls() const; 0136 0137 private: 0138 void recordCall(const QByteArray &callName, const QVariant ¶meter = QVariant()); 0139 0140 QString m_userName; 0141 QString m_resourceName; 0142 QString m_resourceIdentifier; 0143 QStringList m_capabilities; 0144 QList<KIMAP::MailBoxDescriptor> m_namespaces; 0145 0146 bool m_automaticExpunge; 0147 bool m_subscriptionEnabled; 0148 bool m_disconnectedMode; 0149 int m_intervalCheckTime; 0150 QChar m_separator; 0151 0152 Akonadi::ItemSync::MergeMode m_mergeMode; 0153 0154 Akonadi::Collection m_collection; 0155 Akonadi::Item::List m_items; 0156 0157 Akonadi::Collection m_parentCollection; 0158 0159 Akonadi::Collection m_sourceCollection; 0160 Akonadi::Collection m_targetCollection; 0161 0162 QSet<QByteArray> m_parts; 0163 0164 Akonadi::Tag m_tag; 0165 QSet<Akonadi::Tag> m_addedTags; 0166 QSet<Akonadi::Tag> m_removedTags; 0167 0168 QList<QPair<QByteArray, QVariant>> m_calls; 0169 };