Akonadi

monitor.h
1 /*
2  Copyright (c) 2006 - 2007 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef AKONADI_MONITOR_H
8 #define AKONADI_MONITOR_H
9 
10 #include "akonadicore_export.h"
11 #include "tag.h"
12 #include "collection.h"
13 #include "item.h"
14 #include "relation.h"
15 
16 #include <QObject>
17 
18 namespace Akonadi
19 {
20 
21 class CollectionFetchScope;
22 class CollectionStatistics;
23 class Item;
24 class ItemFetchScope;
25 class MonitorPrivate;
26 class Session;
27 class TagFetchScope;
28 class NotificationSubscriber;
29 class ChangeNotification;
30 
31 namespace Protocol
32 {
33 class Command;
34 }
35 
71 class AKONADICORE_EXPORT Monitor : public QObject
72 {
73  Q_OBJECT
74 
75 public:
76  enum Type {
80  Collections = 1,
81  Items,
82  Tags,
83  Relations,
101  Notifications
102  };
103 
109  explicit Monitor(QObject *parent = nullptr);
110 
114  ~Monitor() override;
115 
131  void setCollectionMonitored(const Collection &collection, bool monitored = true);
132 
142  void setItemMonitored(const Item &item, bool monitored = true);
143 
155  void setResourceMonitored(const QByteArray &resource, bool monitored = true);
156 
170  void setMimeTypeMonitored(const QString &mimetype, bool monitored = true);
171 
181  void setTagMonitored(const Tag &tag, bool monitored = true);
182 
193  void setTypeMonitored(Type type, bool monitored = true);
194 
201  void setAllMonitored(bool monitored = true);
202 
203  void setExclusive(bool exclusive = true);
204  Q_REQUIRED_RESULT bool exclusive() const;
205 
212  void ignoreSession(Session *session);
213 
219  void fetchCollection(bool enable);
220 
227  void fetchCollectionStatistics(bool enable);
228 
239  void setItemFetchScope(const ItemFetchScope &fetchScope);
240 
264  void fetchChangedOnly(bool enable);
265 
278  ItemFetchScope &itemFetchScope();
279 
291  void setCollectionFetchScope(const CollectionFetchScope &fetchScope);
292 
306  CollectionFetchScope &collectionFetchScope();
307 
317  void setTagFetchScope(const TagFetchScope &fetchScope);
318 
330  TagFetchScope &tagFetchScope();
331 
337  Q_REQUIRED_RESULT Collection::List collectionsMonitored() const;
338 
346  Q_REQUIRED_RESULT QVector<Item::Id> itemsMonitoredEx() const;
347 
353  Q_REQUIRED_RESULT int numItemsMonitored() const;
354 
360  Q_REQUIRED_RESULT QStringList mimeTypesMonitored() const;
361 
367  Q_REQUIRED_RESULT int numMimeTypesMonitored() const;
368 
374  Q_REQUIRED_RESULT QVector<Tag::Id> tagsMonitored() const;
375 
381  Q_REQUIRED_RESULT QVector<Type> typesMonitored() const;
382 
388  Q_REQUIRED_RESULT QList<QByteArray> resourcesMonitored() const;
389 
395  Q_REQUIRED_RESULT int numResourcesMonitored() const;
396 
402  Q_REQUIRED_RESULT bool isAllMonitored() const;
403 
410  void setSession(Akonadi::Session *session);
411 
417  Q_REQUIRED_RESULT Session *session() const;
418 
426  void setCollectionMoveTranslationEnabled(bool enabled);
427 
428 Q_SIGNALS:
435  void itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &partIdentifiers);
436 
445  void itemsFlagsChanged(const Akonadi::Item::List &items, const QSet<QByteArray> &addedFlags,
446  const QSet<QByteArray> &removedFlags);
447 
456  void itemsTagsChanged(const Akonadi::Item::List &items, const QSet<Akonadi::Tag> &addedTags,
457  const QSet<Akonadi::Tag> &removedTags);
458 
467  void itemsRelationsChanged(const Akonadi::Item::List &items, const Akonadi::Relation::List &addedRelations,
468  const Akonadi::Relation::List &removedRelations);
469 
477  void itemMoved(const Akonadi::Item &item, const Akonadi::Collection &collectionSource,
478  const Akonadi::Collection &collectionDestination);
479 
489  void itemsMoved(const Akonadi::Item::List &items, const Akonadi::Collection &collectionSource,
490  const Akonadi::Collection &collectionDestination);
491 
498  void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection);
499 
508  void itemRemoved(const Akonadi::Item &item);
509 
518  void itemsRemoved(const Akonadi::Item::List &items);
519 
527  void itemLinked(const Akonadi::Item &item, const Akonadi::Collection &collection);
528 
537  void itemsLinked(const Akonadi::Item::List &items, const Akonadi::Collection &collection);
538 
546  void itemUnlinked(const Akonadi::Item &item, const Akonadi::Collection &collection);
547 
556  void itemsUnlinked(const Akonadi::Item::List &items, const Akonadi::Collection &collection);
557 
564  void collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent);
565 
571  void collectionChanged(const Akonadi::Collection &collection);
572 
581  void collectionChanged(const Akonadi::Collection &collection, const QSet<QByteArray> &attributeNames);
582 
592  void collectionMoved(const Akonadi::Collection &collection, const Akonadi::Collection &source, const Akonadi::Collection &destination);
593 
599  void collectionRemoved(const Akonadi::Collection &collection);
600 
611  void collectionSubscribed(const Akonadi::Collection &collection, const Akonadi::Collection &parent);
612 
620  void collectionUnsubscribed(const Akonadi::Collection &collection);
621 
630  void collectionStatisticsChanged(Akonadi::Collection::Id id,
631  const Akonadi::CollectionStatistics &statistics);
632 
639  void tagAdded(const Akonadi::Tag &tag);
640 
647  void tagChanged(const Akonadi::Tag &tag);
648 
658  void tagRemoved(const Akonadi::Tag &tag);
659 
669  void relationAdded(const Akonadi::Relation &relation);
670 
680  void relationRemoved(const Akonadi::Relation &relation);
681 
693  void notificationSubscriberAdded(const Akonadi::NotificationSubscriber &subscriber);
694 
706  void notificationSubscriberChanged(const Akonadi::NotificationSubscriber &subscriber);
707 
719  void notificationSubscriberRemoved(const Akonadi::NotificationSubscriber &subscriber);
720 
731  void debugNotification(const Akonadi::ChangeNotification &notification);
732 
740  void collectionMonitored(const Akonadi::Collection &collection, bool monitored);
741 
749  void itemMonitored(const Akonadi::Item &item, bool monitored);
750 
758  void resourceMonitored(const QByteArray &identifier, bool monitored);
759 
767  void mimeTypeMonitored(const QString &mimeType, bool monitored);
768 
775  void allMonitored(bool monitored);
776 
783  void tagMonitored(const Akonadi::Tag &tag, bool monitored);
784 
791  void typeMonitored(const Akonadi::Monitor::Type type, bool monitored);
792 
793  void monitorReady();
794 
795 protected:
796  //@cond PRIVATE
797  void connectNotify(const QMetaMethod &signal) override;
798  void disconnectNotify(const QMetaMethod &signal) override;
799 
800  friend class EntityTreeModel;
801  friend class EntityTreeModelPrivate;
802  MonitorPrivate *d_ptr;
803  explicit Monitor(MonitorPrivate *d, QObject *parent = nullptr);
804  //@endcond
805 
806 private:
807  Q_DECLARE_PRIVATE(Monitor)
808 
809  //@cond PRIVATE
810  Q_PRIVATE_SLOT(d_ptr, void handleCommands())
811  Q_PRIVATE_SLOT(d_ptr, void invalidateCollectionCache(qint64))
812  Q_PRIVATE_SLOT(d_ptr, void invalidateItemCache(qint64))
813  Q_PRIVATE_SLOT(d_ptr, void invalidateTagCache(qint64))
814 
815  friend class ResourceBasePrivate;
816  //@endcond
817 };
818 
819 }
820 
821 #endif
An Akonadi Relation.
Definition: relation.h:39
Provides statistics information of a Collection.
Specifies which parts of a collection should be fetched from the Akonadi storage. ...
Specifies which parts of a tag should be fetched from the Akonadi storage.
Definition: tagfetchscope.h:22
Represents a collection of PIM items.
Definition: collection.h:63
qint64 Id
Describes the unique id type.
Definition: collection.h:69
A communication session with the Akonadi storage.
Definition: core/session.h:54
Specifies which parts of an item should be fetched from the Akonadi storage.
Monitors an item or collection for changes.
Definition: monitor.h:71
ASAP CLI session.
Listen to subscription changes of other Monitors connected to Akonadi.
Definition: monitor.h:90
Helper integration between Akonadi and Qt.
A model for collections and items together.
An Akonadi Tag.
Definition: tag.h:26
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jul 8 2020 23:15:03 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.