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>
45 class ResourceScheduler :
public QObject
56 SyncCollectionAttributes,
60 DeleteResourceCollection,
61 InvalideCacheForCollection,
63 SyncCollectionTreeDone,
68 static qint64 latestSerial;
71 Task() : serial( ++latestSerial ), type( Invalid ), receiver( 0 ) {}
74 Collection collection;
76 QSet<QByteArray> itemParts;
77 QList<QDBusMessage> dbusMsgs;
79 QByteArray methodName;
82 void sendDBusReplies(
const QString &errorMsg );
84 bool operator==(
const Task &other )
const
86 return type == other.type
87 && (collection == other.collection || (!collection.isValid() && !other.collection.isValid()))
88 && (item == other.item || (!item.isValid() && !other.item.isValid()))
89 && itemParts == other.itemParts
90 && receiver == other.receiver
91 && methodName == other.methodName
92 && argument == other.argument;
96 explicit ResourceScheduler( QObject *parent = 0 );
101 void scheduleFullSync();
106 void scheduleCollectionTreeSync();
112 void scheduleSync(
const Collection &col );
118 void scheduleAttributesSync(
const Collection &collection );
126 void scheduleItemFetch(
const Item &item,
const QSet<QByteArray> &parts,
const QDBusMessage &msg );
132 void scheduleResourceCollectionDeletion();
138 void scheduleCacheInvalidation(
const Collection &collection );
143 void scheduleFullSyncCompletion();
148 void scheduleCollectionTreeSyncCompletion();
159 void scheduleMoveReplay(
const Collection &movedCollection, RecursiveMover *mover );
169 Task currentTask()
const;
174 void setOnline(
bool state );
183 QString dumpToString()
const;
203 void scheduleChangeReplay();
221 void executeFullSync();
224 void executeCollectionTreeSync();
225 void executeItemFetch(
const Akonadi::Item &item,
const QSet<QByteArray> &parts );
226 void executeResourceCollectionDeletion();
228 void executeChangeReplay();
229 void executeRecursiveMoveReplay( RecursiveMover *mover );
230 void collectionTreeSyncComplete();
231 void fullSyncComplete();
232 void status(
int status,
const QString &message = QString() );
239 void signalTaskToTracker(
const Task &task,
const QByteArray &taskType,
const QString &debugString = QString() );
253 AfterChangeReplayQueue,
258 typedef QList<Task> TaskList;
260 static QueueType queueTypeForTaskType( TaskType type );
261 TaskList& queueForTaskType( TaskType type );
263 TaskList mTaskList[ NQueueCount ];
266 int mCurrentTasksQueue;
270 QDebug operator<<( QDebug,
const ResourceScheduler::Task& task );
271 QTextStream& operator<<( QTextStream&,
const ResourceScheduler::Task& task );
Represents a collection of PIM items.
The task will be executed after all tasks currently in the queue are finished.
SchedulePriority
Describes the scheduling priority of a task that has been queued for execution.