20#ifndef AKONADI_RESOURCESCHEDULER_P_H
21#define AKONADI_RESOURCESCHEDULER_P_H
23#include <akonadi/agentbase.h>
24#include <akonadi/collection.h>
25#include <akonadi/item.h>
26#include <akonadi/resourcebase.h>
28#include <QtCore/QObject>
29#include <QtCore/QStringList>
30#include <QtDBus/QDBusMessage>
45class ResourceScheduler :
public QObject
56 SyncCollectionAttributes,
60 DeleteResourceCollection,
61 InvalideCacheForCollection,
63 SyncCollectionTreeDone,
68 static qint64 latestSerial;
72 : serial(++latestSerial)
79 Collection collection;
81 QSet<QByteArray> itemParts;
82 QList<QDBusMessage> dbusMsgs;
84 QByteArray methodName;
87 void sendDBusReplies(
const QString &errorMsg);
89 bool operator==(
const Task &other)
const
91 return type == other.type
92 && (collection == other.collection || (!collection.isValid() && !other.collection.isValid()))
93 && (item == other.item || (!item.isValid() && !other.item.isValid()))
94 && itemParts == other.itemParts
95 && receiver == other.receiver
96 && methodName == other.methodName
97 && argument == other.argument;
101 explicit ResourceScheduler(QObject *parent = 0);
106 void scheduleFullSync();
111 void scheduleCollectionTreeSync();
117 void scheduleSync(
const Collection &col);
123 void scheduleAttributesSync(
const Collection &collection);
131 void scheduleItemFetch(
const Item &item,
const QSet<QByteArray> &parts,
const QDBusMessage &msg);
137 void scheduleResourceCollectionDeletion();
143 void scheduleCacheInvalidation(
const Collection &collection);
148 void scheduleFullSyncCompletion();
153 void scheduleCollectionTreeSyncCompletion();
159 void scheduleCustomTask(QObject *receiver,
const char *methodName,
const QVariant &argument, ResourceBase::SchedulePriority priority = ResourceBase::Append);
164 void scheduleMoveReplay(
const Collection &movedCollection, RecursiveMover *mover);
174 Task currentTask()
const;
179 void setOnline(
bool state);
188 QString dumpToString()
const;
208 void scheduleChangeReplay();
226 void executeFullSync();
229 void executeCollectionTreeSync();
230 void executeItemFetch(
const Akonadi::Item &item,
const QSet<QByteArray> &parts);
231 void executeResourceCollectionDeletion();
233 void executeChangeReplay();
234 void executeRecursiveMoveReplay(RecursiveMover *mover);
235 void collectionTreeSyncComplete();
236 void fullSyncComplete();
237 void status(
int status,
const QString &message = QString());
244 void signalTaskToTracker(
const Task &task,
const QByteArray &taskType,
const QString &debugString = QString());
260 AfterChangeReplayQueue,
265 typedef QList<Task> TaskList;
267 static QueueType queueTypeForTaskType(TaskType type);
268 TaskList &queueForTaskType(TaskType type);
270 TaskList mTaskList[NQueueCount];
273 int mCurrentTasksQueue;
277QDebug operator<<(QDebug,
const ResourceScheduler::Task &task);
278QTextStream &operator<<(QTextStream &,
const ResourceScheduler::Task &task);
Represents a collection of PIM items.
FreeBusyManager::Singleton.