Akonadi

monitor.h
1 /*
2  SPDX-FileCopyrightText: 2006-2007 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "akonadicore_export.h"
10 #include "collection.h"
11 #include "item.h"
12 #include "relation.h"
13 #include "tag.h"
14 
15 #include <QObject>
16 
17 #include <memory>
18 
19 namespace Akonadi
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 
36 /**
37  * @short Monitors an item or collection for changes.
38  *
39  * The Monitor emits signals if some of these objects are changed or
40  * removed or new ones are added to the Akonadi storage.
41  *
42  * There are various ways to filter these notifications. There are three types of filter
43  * evaluation:
44  * - (-) removal-only filter, ie. if the filter matches the notification is dropped,
45  * if not filter evaluation continues with the next one
46  * - (+) pass-exit filter, ie. if the filter matches the notification is delivered,
47  * if not evaluation is continued
48  * - (f) final filter, ie. evaluation ends here if the corresponding filter criteria is set,
49  * the notification is delivered depending on the result, evaluation is only continued
50  * if no filter criteria is defined
51  *
52  * The following filter are available, listed in evaluation order:
53  * (1) ignored sessions (-)
54  * (2) monitor everything (+)
55  * (3a) resource and mimetype filters (f) (items only)
56  * (3b) resource filters (f) (collections only)
57  * (4) item is monitored (+)
58  * (5) collection is monitored (+)
59  *
60  * Optionally, the changed objects can be fetched automatically from the server.
61  * To enable this, see itemFetchScope() and collectionFetchScope().
62  *
63  * Note that as a consequence of rule 3a, it is not possible to monitor (more than zero resources
64  * OR more than zero mimetypes) AND more than zero collections.
65  *
66  * @todo Distinguish between monitoring collection properties and collection content.
67  * @todo Special case for collection content counts changed
68  *
69  * @author Volker Krause <[email protected]>
70  */
71 class AKONADICORE_EXPORT Monitor : public QObject
72 {
73  Q_OBJECT
74 
75 public:
76  enum Type {
77  /**
78  * @internal This must be kept in sync with Akonadi::NotificationMessageV2::Type
79  */
80  Collections = 1,
81  Items,
82  Tags,
83  Relations,
84  /**
85  * Listen to subscription changes of other Monitors connected to Akonadi.
86  * This is only for debugging purposes and should not be used in real
87  * applications.
88  * @since 5.4
89  */
91  /**
92  * Listens to all notifications being emitted by the server and provides
93  * additional information about them. This is only for debugging purposes
94  * and should not be used in real applications.
95  *
96  * @note Enabling monitoring this type has performance impact on the
97  * Akonadi Server.
98  *
99  * @since 5.4
100  */
101  Notifications
102  };
103 
104  /**
105  * Creates a new monitor.
106  *
107  * @param parent The parent object.
108  */
109  explicit Monitor(QObject *parent = nullptr);
110 
111  /**
112  * Destroys the monitor.
113  */
114  ~Monitor() override;
115 
116  /**
117  * Sets whether the specified collection shall be monitored for changes. If
118  * monitoring is turned on for the collection, all notifications for items
119  * in that collection will be emitted, and its child collections will also
120  * be monitored. Note that move notifications will be emitted if either one
121  * of the collections involved is being monitored.
122  *
123  * Note that if a session is being ignored, this takes precedence over
124  * setCollectionMonitored() on that session.
125  *
126  * @param collection The collection to monitor.
127  * If this collection is Collection::root(), all collections
128  * in the Akonadi storage will be monitored.
129  * @param monitored Whether to monitor the collection.
130  */
131  void setCollectionMonitored(const Collection &collection, bool monitored = true);
132 
133  /**
134  * Sets whether the specified item shall be monitored for changes.
135  *
136  * Note that if a session is being ignored, this takes precedence over
137  * setItemMonitored() on that session.
138  *
139  * @param item The item to monitor.
140  * @param monitored Whether to monitor the item.
141  */
142  void setItemMonitored(const Item &item, bool monitored = true);
143 
144  /**
145  * Sets whether the specified resource shall be monitored for changes. If
146  * monitoring is turned on for the resource, all notifications for
147  * collections and items in that resource will be emitted.
148  *
149  * Note that if a session is being ignored, this takes precedence over
150  * setResourceMonitored() on that session.
151  *
152  * @param resource The resource identifier.
153  * @param monitored Whether to monitor the resource.
154  */
155  void setResourceMonitored(const QByteArray &resource, bool monitored = true);
156 
157  /**
158  * Sets whether items of the specified mime type shall be monitored for changes.
159  * If monitoring is turned on for the mime type, all notifications for items
160  * matching that mime type will be emitted, but notifications for collections
161  * matching that mime type will only be emitted if this is otherwise specified,
162  * for example by setCollectionMonitored().
163  *
164  * Note that if a session is being ignored, this takes precedence over
165  * setMimeTypeMonitored() on that session.
166  *
167  * @param mimetype The mime type to monitor.
168  * @param monitored Whether to monitor the mime type.
169  */
170  void setMimeTypeMonitored(const QString &mimetype, bool monitored = true);
171 
172  /**
173  * Sets whether the specified tag shall be monitored for changes.
174  *
175  * Same rules as for item monitoring apply.
176  *
177  * @param tag Tag to monitor.
178  * @param monitored Whether to monitor the tag.
179  * @since 4.13
180  */
181  void setTagMonitored(const Tag &tag, bool monitored = true);
182 
183  /**
184  * Sets whether given type (Collection, Item, Tag should be monitored).
185  *
186  * By default all types are monitored, but once you change one, you have
187  * to explicitly enable all other types you want to monitor.
188  *
189  * @param type Type to monitor.
190  * @param monitored Whether to monitor the type
191  * @since 4.13
192  */
193  void setTypeMonitored(Type type, bool monitored = true);
194 
195  /**
196  * Sets whether all items shall be monitored.
197  * @param monitored sets all items as monitored if set as @c true
198  * Note that if a session is being ignored, this takes precedence over
199  * setAllMonitored() on that session.
200  */
201  void setAllMonitored(bool monitored = true);
202 
203  void setExclusive(bool exclusive = true);
204  Q_REQUIRED_RESULT bool exclusive() const;
205 
206  /**
207  * Ignores all change notifications caused by the given session. This
208  * overrides all other settings on this session.
209  *
210  * @param session The session you want to ignore.
211  */
212  void ignoreSession(Session *session);
213 
214  /**
215  * Enables automatic fetching of changed collections from the Akonadi storage.
216  *
217  * @param enable @c true enables automatic fetching, @c false disables automatic fetching.
218  */
219  void fetchCollection(bool enable);
220 
221  /**
222  * Enables automatic fetching of changed collection statistics information from
223  * the Akonadi storage.
224  *
225  * @param enable @c true to enables automatic fetching, @c false disables automatic fetching.
226  */
227  void fetchCollectionStatistics(bool enable);
228 
229  /**
230  * Sets the item fetch scope.
231  *
232  * Controls how much of an item's data is fetched from the server, e.g.
233  * whether to fetch the full item payload or only meta data.
234  *
235  * @param fetchScope The new scope for item fetch operations.
236  *
237  * @see itemFetchScope()
238  */
239  void setItemFetchScope(const ItemFetchScope &fetchScope);
240 
241  /**
242  * Instructs the monitor to fetch only those parts that were changed and
243  * were requested in the fetch scope.
244  *
245  * This is taken in account only for item modifications.
246  * Example usage:
247  * @code
248  * monitor->itemFetchScope().fetchFullPayload( true );
249  * monitor->fetchChangedOnly(true);
250  * @endcode
251  *
252  * In the example if an item was changed, but its payload was not, the full
253  * payload will not be retrieved.
254  * If the item's payload was changed, the monitor retrieves the changed
255  * payload as well.
256  *
257  * The default is to fetch everything requested.
258  *
259  * @since 4.8
260  *
261  * @param enable @c true to enable the feature, @c false means everything
262  * that was requested will be fetched.
263  */
264  void fetchChangedOnly(bool enable);
265 
266  /**
267  * Returns the item fetch scope.
268  *
269  * Since this returns a reference it can be used to conveniently modify the
270  * current scope in-place, i.e. by calling a method on the returned reference
271  * without storing it in a local variable. See the ItemFetchScope documentation
272  * for an example.
273  *
274  * @return a reference to the current item fetch scope
275  *
276  * @see setItemFetchScope() for replacing the current item fetch scope
277  */
278  ItemFetchScope &itemFetchScope();
279 
280  /**
281  * Sets the collection fetch scope.
282  *
283  * Controls which collections are monitored and how much of a collection's data
284  * is fetched from the server.
285  *
286  * @param fetchScope The new scope for collection fetch operations.
287  *
288  * @see collectionFetchScope()
289  * @since 4.4
290  */
291  void setCollectionFetchScope(const CollectionFetchScope &fetchScope);
292 
293  /**
294  * Returns the collection fetch scope.
295  *
296  * Since this returns a reference it can be used to conveniently modify the
297  * current scope in-place, i.e. by calling a method on the returned reference
298  * without storing it in a local variable. See the CollectionFetchScope documentation
299  * for an example.
300  *
301  * @return a reference to the current collection fetch scope
302  *
303  * @see setCollectionFetchScope() for replacing the current collection fetch scope
304  * @since 4.4
305  */
306  CollectionFetchScope &collectionFetchScope();
307 
308  /**
309  * Sets the tag fetch scope.
310  *
311  * Controls how much of an tag's data is fetched from the server.
312  *
313  * @param fetchScope The new scope for tag fetch operations.
314  *
315  * @see tagFetchScope()
316  */
317  void setTagFetchScope(const TagFetchScope &fetchScope);
318 
319  /**
320  * Returns the tag fetch scope.
321  *
322  * Since this returns a reference it can be used to conveniently modify the
323  * current scope in-place, i.e. by calling a method on the returned reference
324  * without storing it in a local variable.
325  *
326  * @return a reference to the current tag fetch scope
327  *
328  * @see setTagFetchScope() for replacing the current tag fetch scope
329  */
330  TagFetchScope &tagFetchScope();
331 
332  /**
333  * Returns the list of collections being monitored.
334  *
335  * @since 4.3
336  */
337  Q_REQUIRED_RESULT Collection::List collectionsMonitored() const;
338 
339  /**
340  * Returns the set of items being monitored.
341  *
342  * Faster version (at least on 32-bit systems) of itemsMonitored().
343  *
344  * @since 4.6
345  */
346  Q_REQUIRED_RESULT QVector<Item::Id> itemsMonitoredEx() const;
347 
348  /**
349  * Returns the number of items being monitored.
350  * Optimization.
351  * @since 4.14.3
352  */
353  Q_REQUIRED_RESULT int numItemsMonitored() const;
354 
355  /**
356  * Returns the set of mimetypes being monitored.
357  *
358  * @since 4.3
359  */
360  Q_REQUIRED_RESULT QStringList mimeTypesMonitored() const;
361 
362  /**
363  * Returns the number of mimetypes being monitored.
364  * Optimization.
365  * @since 4.14.3
366  */
367  Q_REQUIRED_RESULT int numMimeTypesMonitored() const;
368 
369  /**
370  * Returns the set of tags being monitored.
371  *
372  * @since 4.13
373  */
374  Q_REQUIRED_RESULT QVector<Tag::Id> tagsMonitored() const;
375 
376  /**
377  * Returns the set of types being monitored.
378  *
379  * @since 4.13
380  */
381  Q_REQUIRED_RESULT QVector<Type> typesMonitored() const;
382 
383  /**
384  * Returns the set of identifiers for resources being monitored.
385  *
386  * @since 4.3
387  */
388  Q_REQUIRED_RESULT QList<QByteArray> resourcesMonitored() const;
389 
390  /**
391  * Returns the number of resources being monitored.
392  * Optimization.
393  * @since 4.14.3
394  */
395  Q_REQUIRED_RESULT int numResourcesMonitored() const;
396 
397  /**
398  * Returns true if everything is being monitored.
399  *
400  * @since 4.3
401  */
402  Q_REQUIRED_RESULT bool isAllMonitored() const;
403 
404  /**
405  * Sets the session used by the Monitor to communicate with the %Akonadi server.
406  * If not set, the Akonadi::Session::defaultSession is used.
407  * @param session the session to be set
408  * @since 4.4
409  */
410  void setSession(Akonadi::Session *session);
411 
412  /**
413  * Returns the Session used by the monitor to communicate with Akonadi.
414  *
415  * @since 4.4
416  */
417  Q_REQUIRED_RESULT Session *session() const;
418 
419  /**
420  * Allows to enable/disable collection move translation. If enabled (the default), move
421  * notifications are automatically translated into add/remove notifications if the source/destination
422  * is outside of the monitored collection hierarchy.
423  * @param enabled enables collection move translation if set as @c true
424  * @since 4.9
425  */
426  void setCollectionMoveTranslationEnabled(bool enabled);
427 
428 Q_SIGNALS:
429  /**
430  * This signal is emitted if a monitored item has changed, e.g. item parts have been modified.
431  *
432  * @param item The changed item.
433  * @param partIdentifiers The identifiers of the item parts that has been changed.
434  */
435  void itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &partIdentifiers);
436 
437  /**
438  * This signal is emitted if flags of monitored items have changed.
439  *
440  * @param items Items that were changed
441  * @param addedFlags Flags that have been added to each item in @p items
442  * @param removedFlags Flags that have been removed from each item in @p items
443  * @since 4.11
444  */
445  void itemsFlagsChanged(const Akonadi::Item::List &items, const QSet<QByteArray> &addedFlags, const QSet<QByteArray> &removedFlags);
446 
447  /**
448  * This signal is emitted if tags of monitored items have changed.
449  *
450  * @param items Items that were changed
451  * @param addedTags Tags that have been added to each item in @p items.
452  * @param removedTags Tags that have been removed from each item in @p items
453  * @since 4.13
454  */
455  void itemsTagsChanged(const Akonadi::Item::List &items, const QSet<Akonadi::Tag> &addedTags, const QSet<Akonadi::Tag> &removedTags);
456 
457  /**
458  * This signal is emitted if relations of monitored items have changed.
459  *
460  * @param items Items that were changed
461  * @param addedRelations Relations that have been added to each item in @p items.
462  * @param removedRelations Relations that have been removed from each item in @p items
463  * @since 4.15
464  */
465  void
466  itemsRelationsChanged(const Akonadi::Item::List &items, const Akonadi::Relation::List &addedRelations, const Akonadi::Relation::List &removedRelations);
467 
468  /**
469  * This signal is emitted if a monitored item has been moved between two collections
470  *
471  * @param item The moved item.
472  * @param collectionSource The collection the item has been moved from.
473  * @param collectionDestination The collection the item has been moved to.
474  */
475  void itemMoved(const Akonadi::Item &item, const Akonadi::Collection &collectionSource, const Akonadi::Collection &collectionDestination);
476 
477  /**
478  * This is signal is emitted when multiple monitored items have been moved between two collections
479  *
480  * @param items Moved items
481  * @param collectionSource The collection the items have been moved from.
482  * @param collectionDestination The collection the items have been moved to.
483  *
484  * @since 4.11
485  */
486  void itemsMoved(const Akonadi::Item::List &items, const Akonadi::Collection &collectionSource, const Akonadi::Collection &collectionDestination);
487 
488  /**
489  * This signal is emitted if an item has been added to a monitored collection in the Akonadi storage.
490  *
491  * @param item The new item.
492  * @param collection The collection the item has been added to.
493  */
494  void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection);
495 
496  /**
497  * This signal is emitted if
498  * - a monitored item has been removed from the Akonadi storage
499  * or
500  * - a item has been removed from a monitored collection.
501  *
502  * @param item The removed item.
503  */
504  void itemRemoved(const Akonadi::Item &item);
505 
506  /**
507  * This signal is emitted if monitored items have been removed from Akonadi
508  * storage of items have been removed from a monitored collection.
509  *
510  * @param items Removed items
511  *
512  * @since 4.11
513  */
514  void itemsRemoved(const Akonadi::Item::List &items);
515 
516  /**
517  * This signal is emitted if a reference to an item is added to a virtual collection.
518  * @param item The linked item.
519  * @param collection The collection the item is linked to.
520  *
521  * @since 4.2
522  */
523  void itemLinked(const Akonadi::Item &item, const Akonadi::Collection &collection);
524 
525  /**
526  * This signal is emitted if a reference to multiple items is added to a virtual collection
527  *
528  * @param items The linked items
529  * @param collection The collections the items are linked to
530  *
531  * @since 4.11
532  */
533  void itemsLinked(const Akonadi::Item::List &items, const Akonadi::Collection &collection);
534 
535  /**
536  * This signal is emitted if a reference to an item is removed from a virtual collection.
537  * @param item The unlinked item.
538  * @param collection The collection the item is unlinked from.
539  *
540  * @since 4.2
541  */
542  void itemUnlinked(const Akonadi::Item &item, const Akonadi::Collection &collection);
543 
544  /**
545  * This signal is emitted if a reference to items is removed from a virtual collection
546  *
547  * @param items The unlinked items
548  * @param collection The collections the items are unlinked from
549  *
550  * @since 4.11
551  */
552  void itemsUnlinked(const Akonadi::Item::List &items, const Akonadi::Collection &collection);
553 
554  /**
555  * This signal is emitted if a new collection has been added to a monitored collection in the Akonadi storage.
556  *
557  * @param collection The new collection.
558  * @param parent The parent collection.
559  */
560  void collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent);
561 
562  /**
563  * This signal is emitted if a monitored collection has been changed (properties or content).
564  *
565  * @param collection The changed collection.
566  */
567  void collectionChanged(const Akonadi::Collection &collection);
568 
569  /**
570  * This signal is emitted if a monitored collection has been changed (properties or attributes).
571  *
572  * @param collection The changed collection.
573  * @param attributeNames The names of the collection attributes that have been changed.
574  *
575  * @since 4.4
576  */
577  void collectionChanged(const Akonadi::Collection &collection, const QSet<QByteArray> &attributeNames);
578 
579  /**
580  * This signals is emitted if a monitored collection has been moved.
581  *
582  * @param collection The moved collection.
583  * @param source The previous parent collection.
584  * @param destination The new parent collection.
585  *
586  * @since 4.4
587  */
588  void collectionMoved(const Akonadi::Collection &collection, const Akonadi::Collection &source, const Akonadi::Collection &destination);
589 
590  /**
591  * This signal is emitted if a monitored collection has been removed from the Akonadi storage.
592  *
593  * @param collection The removed collection.
594  */
595  void collectionRemoved(const Akonadi::Collection &collection);
596 
597  /**
598  * This signal is emitted if a collection has been subscribed to by the user.
599  * It will be emitted even for unmonitored collections as the check for whether to
600  * monitor it has not been applied yet.
601  *
602  * @param collection The subscribed collection
603  * @param parent The parent collection of the subscribed collection.
604  *
605  * @since 4.6
606  */
607  void collectionSubscribed(const Akonadi::Collection &collection, const Akonadi::Collection &parent);
608 
609  /**
610  * This signal is emitted if a user unsubscribes from a collection.
611  *
612  * @param collection The unsubscribed collection
613  *
614  * @since 4.6
615  */
616  void collectionUnsubscribed(const Akonadi::Collection &collection);
617 
618  /**
619  * This signal is emitted if the statistics information of a monitored collection
620  * has changed.
621  *
622  * @param id The collection identifier of the changed collection.
623  * @param statistics The updated collection statistics, invalid if automatic
624  * fetching of statistics changes is disabled.
625  */
626  void collectionStatisticsChanged(Akonadi::Collection::Id id, const Akonadi::CollectionStatistics &statistics);
627 
628  /**
629  * This signal is emitted if a tag has been added to Akonadi storage.
630  *
631  * @param tag The added tag
632  * @since 4.13
633  */
634  void tagAdded(const Akonadi::Tag &tag);
635 
636  /**
637  * This signal is emitted if a monitored tag is changed on the server.
638  *
639  * @param tag The changed tag.
640  * @since 4.13
641  */
642  void tagChanged(const Akonadi::Tag &tag);
643 
644  /**
645  * This signal is emitted if a monitored tag is removed from the server storage.
646  *
647  * The monitor will also emit itemTagsChanged() signal for all monitored items
648  * (if any) that were tagged by @p tag.
649  *
650  * @param tag The removed tag.
651  * @since 4.13
652  */
653  void tagRemoved(const Akonadi::Tag &tag);
654 
655  /**
656  * This signal is emitted if a relation has been added to Akonadi storage.
657  *
658  * The monitor will also emit itemRelationsChanged() signal for all monitored items
659  * hat are affected by @p relation.
660  *
661  * @param relation The added relation
662  * @since 4.13
663  */
664  void relationAdded(const Akonadi::Relation &relation);
665 
666  /**
667  * This signal is emitted if a monitored relation is removed from the server storage.
668  *
669  * The monitor will also emit itemRelationsChanged() signal for all monitored items
670  * that were affected by @p relation.
671  *
672  * @param relation The removed relation.
673  * @since 4.13
674  */
675  void relationRemoved(const Akonadi::Relation &relation);
676 
677  /**
678  * This signal is emitted when Subscribers are monitored and a new subscriber
679  * subscribers to the server.
680  *
681  * @param subscriber The new subscriber
682  * @since 5.4
683  *
684  * @note Monitoring for subscribers and listening to this signal only makes
685  * sense if you want to globally debug Monitors. There is no reason to use
686  * this in regular applications.
687  */
688  void notificationSubscriberAdded(const Akonadi::NotificationSubscriber &subscriber);
689 
690  /**
691  * This signal is emitted when Subscribers are monitored and an existing
692  * subscriber changes its subscription.
693  *
694  * @param subscriber The changed subscriber
695  * @since 5.4
696  *
697  * @note Monitoring for subscribers and listening to this signal only makes
698  * sense if you want to globally debug Monitors. There is no reason to use
699  * this in regular applications.
700  */
701  void notificationSubscriberChanged(const Akonadi::NotificationSubscriber &subscriber);
702 
703  /**
704  * This signal is emitted when Subscribers are monitored and an existing
705  * subscriber unsubscribes from the server.
706  *
707  * @param subscriber The removed subscriber
708  * @since 5.4
709  *
710  * @note Monitoring for subscribers and listening to this signal only makes
711  * sense if you want to globally debug Monitors. There is no reason to use
712  * this in regular applications.
713  */
714  void notificationSubscriberRemoved(const Akonadi::NotificationSubscriber &subscriber);
715 
716  /**
717  * This signal is emitted when Notifications are monitored and the server emits
718  * any change notification.
719  *
720  * @since 5.4
721  *
722  * @note Getting introspection into all change notifications only makes sense
723  * if you want to globally debug Notifications. There is no reason to use
724  * this in regular applications.
725  */
726  void debugNotification(const Akonadi::ChangeNotification &notification);
727 
728  /**
729  * This signal is emitted if the Monitor starts or stops monitoring @p collection explicitly.
730  * @param collection The collection
731  * @param monitored Whether the collection is now being monitored or not.
732  *
733  * @since 4.3
734  */
735  void collectionMonitored(const Akonadi::Collection &collection, bool monitored);
736 
737  /**
738  * This signal is emitted if the Monitor starts or stops monitoring @p item explicitly.
739  * @param item The item
740  * @param monitored Whether the item is now being monitored or not.
741  *
742  * @since 4.3
743  */
744  void itemMonitored(const Akonadi::Item &item, bool monitored);
745 
746  /**
747  * This signal is emitted if the Monitor starts or stops monitoring the resource with the identifier @p identifier explicitly.
748  * @param identifier The identifier of the resource.
749  * @param monitored Whether the resource is now being monitored or not.
750  *
751  * @since 4.3
752  */
753  void resourceMonitored(const QByteArray &identifier, bool monitored);
754 
755  /**
756  * This signal is emitted if the Monitor starts or stops monitoring @p mimeType explicitly.
757  * @param mimeType The mimeType.
758  * @param monitored Whether the mimeType is now being monitored or not.
759  *
760  * @since 4.3
761  */
762  void mimeTypeMonitored(const QString &mimeType, bool monitored);
763 
764  /**
765  * This signal is emitted if the Monitor starts or stops monitoring everything.
766  * @param monitored Whether everything is now being monitored or not.
767  *
768  * @since 4.3
769  */
770  void allMonitored(bool monitored);
771 
772  /**
773  * This signal is emitted if the Monitor starts or stops monitoring @p tag explicitly.
774  * @param tag The tag.
775  * @param monitored Whether the tag is now being monitored or not.
776  * @since 4.13
777  */
778  void tagMonitored(const Akonadi::Tag &tag, bool monitored);
779 
780  /**
781  * This signal is emitted if the Monitor starts or stops monitoring @p type explicitly
782  * @param type The type.
783  * @param monitored Whether the type is now being monitored or not.
784  * @since 4.13
785  */
786  void typeMonitored(const Akonadi::Monitor::Type type, bool monitored);
787 
788  void monitorReady();
789 
790 protected:
791  /// @cond PRIVATE
792  void connectNotify(const QMetaMethod &signal) override;
793  void disconnectNotify(const QMetaMethod &signal) override;
794 
795  friend class EntityTreeModel;
796  friend class EntityTreeModelPrivate;
797  std::unique_ptr<MonitorPrivate> const d_ptr;
798  explicit Monitor(MonitorPrivate *d, QObject *parent = nullptr);
799  /// @endcond
800 
801 private:
802  Q_DECLARE_PRIVATE(Monitor)
803 
804  /// @cond PRIVATE
805  Q_PRIVATE_SLOT(d_ptr, void handleCommands())
806  Q_PRIVATE_SLOT(d_ptr, void invalidateCollectionCache(qint64))
807  Q_PRIVATE_SLOT(d_ptr, void invalidateItemCache(qint64))
808  Q_PRIVATE_SLOT(d_ptr, void invalidateTagCache(qint64))
809 
810  friend class ResourceBasePrivate;
811  /// @endcond
812 };
813 
814 }
815 
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:61
qint64 Id
Describes the unique id type.
Definition: collection.h:67
A communication session with the Akonadi storage.
Definition: core/session.h:55
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:25
Emitted by Monitor::debugNotification() signal.
Represents a PIM item stored in Akonadi storage.
Definition: item.h:100
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 23:07:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.