20 #ifndef AKONADI_MONITOR_P_H
21 #define AKONADI_MONITOR_P_H
23 #include "akonadiprivate_export.h"
25 #include "collection.h"
26 #include "collectionstatisticsjob.h"
27 #include "collectionfetchscope.h"
29 #include "itemfetchscope.h"
30 #include "tagfetchscope.h"
32 #include "entitycache_p.h"
33 #include "servermanager.h"
34 #include "changenotificationdependenciesfactory_p.h"
35 #include "notificationsource_p.h"
37 #include <akonadi/private/notificationmessagev3_p.h>
39 #include <kmimetype.h>
41 #include <QtCore/QObject>
42 #include <QtCore/QTimer>
56 delete dependenciesFactory;
57 delete collectionCache;
65 NotificationSource *notificationSource;
77 bool mFetchChangedOnly;
80 ItemListCache *itemCache;
81 TagListCache *tagCache;
94 bool fetchCollectionStatistics;
95 bool collectionMoveTranslationEnabled;
98 virtual void notificationsEnqueued(
int)
101 virtual void notificationsErased()
106 virtual bool connectToNotificationManager();
107 bool acceptNotification(
const NotificationMessageV3 &msg)
const;
108 void dispatchNotifications();
109 void flushPipeline();
113 void cleanOldNotifications();
115 bool ensureDataAvailable(
const NotificationMessageV3 &msg);
121 virtual bool emitNotification(
const NotificationMessageV3 &msg);
122 void updatePendingStatistics(
const NotificationMessageV3 &msg);
123 void invalidateCaches(
const NotificationMessageV3 &msg);
131 virtual int pipelineSize()
const;
134 void dataAvailable();
135 void slotSessionDestroyed(
QObject *
object);
136 void slotStatisticsChangedFinished(KJob *job);
137 void slotFlushRecentlyChangedCollections();
144 virtual void slotNotify(
const NotificationMessageV3::List &msgs);
150 bool emitItemsNotification(
const NotificationMessageV3 &msg,
const Item::List &items = Item::List(),
156 bool emitCollectionNotification(
const NotificationMessageV3 &msg,
const Collection &col =
Collection(),
159 bool emitTagsNotification(
const NotificationMessageV3 &msg,
const Tag::List &tags);
166 void invalidateCollectionCache(qint64 collectionId);
171 void invalidateItemCache(qint64 itemId);
176 void invalidateTagCache(qint64 tagId);
193 static const int MAXBUFFERSIZE = 10;
213 return m_buffer.contains(
id);
216 static int buffersize();
241 QTimer statisticsCompressionTimer;
246 bool isLazilyIgnored(
const NotificationMessageV3 &msg,
bool allowModifyFlagsConversion =
false)
const;
253 void checkBatchSupport(
const NotificationMessageV3 &msg,
bool &needsSplit,
bool &batchSupported)
const;
255 NotificationMessageV3::List splitMessage(
const NotificationMessageV3 &msg,
bool legacy)
const;
259 if (collection < 0) {
262 if (collections.contains(
Collection(collection))) {
271 bool isMimeTypeMonitored(
const QString &mimetype)
const
273 if (mimetypes.contains(mimetype)) {
277 KMimeType::Ptr mimeType = KMimeType::mimeType(mimetype, KMimeType::ResolveAliases);
278 if (mimeType.isNull()) {
282 foreach (
const QString &mt, mimetypes) {
283 if (mimeType->is(mt)) {
291 bool isMoveDestinationResourceMonitored(
const NotificationMessageV3 &msg)
const
293 if (msg.operation() != NotificationMessageV2::Move) {
296 return resources.contains(msg.destinationResource());
301 CollectionStatisticsJob *job =
new CollectionStatisticsJob(Collection(colId), session);
302 QObject::connect(job, SIGNAL(result(KJob*)), q_ptr, SLOT(slotStatisticsChangedFinished(KJob*)));
This class exists so that we can create a fake notification source in unit tests. ...
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.
Represents a collection of PIM items.
qint64 Id
Describes the unique id type.
static Collection root()
Returns the root collection.
A communication session with the Akonadi storage.
Specifies which parts of an item should be fetched from the Akonadi storage.
Monitors an item or collection for changes.
Class used to determine when to purge items in a Collection.
State
Enum for the various states the server can be in.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)