23#ifndef AKONADI_RESOURCEBASE_H
24#define AKONADI_RESOURCEBASE_H
26#include "akonadi_export.h"
28#include <akonadi/agentbase.h>
29#include <akonadi/collection.h>
30#include <akonadi/item.h>
31#include <akonadi/itemsync.h>
34class Akonadi__ResourceAdaptor;
39class ResourceBasePrivate;
179 template <
typename T>
180 static int init(
int argc,
char **argv)
182 const QString
id = parseArguments(argc, argv);
190 r->registerObserver(observer);
199 void setName(
const QString &name);
204 QString name()
const;
218 void setAutomaticProgressReporting(
bool enabled);
310 int itemSyncBatchSize()
const;
319 void setItemSyncBatchSize(
int batchSize);
330 virtual bool retrieveItem(
const Akonadi::Item &item,
const QSet<QByteArray> &parts) = 0;
339 void abortActivity();
370 void itemRetrieved(
const Item &item);
378 void collectionAttributesRetrieved(
const Collection &collection);
387 void changeCommitted(
const Item &item);
398 void changesCommitted(
const Item::List &items);
409 void changeCommitted(
const Tag &tag);
420 void changeCommitted(
const Collection &collection);
437 void collectionsRetrievedIncremental(
const Collection::List &changedCollections,
447 void setCollectionStreamingEnabled(
bool enable);
457 void collectionsRetrievalDone();
472 void setKeepLocalCollectionChanges(
const QSet<QByteArray> &parts);
483 void itemsRetrieved(
const Item::List &items);
500 void setTotalItems(
int amount);
515 void setDisableAutomaticItemDeliveryDone(
bool disable);
522 void setItemStreamingEnabled(
bool enable);
544 void setItemMergingMode(ItemSync::MergeMode mode);
557 void setItemSynchronizationFetchScope(
const ItemFetchScope &fetchScope);
565 void itemsRetrievedIncremental(
const Item::List &changedItems,
566 const Item::List &removedItems);
577 void itemsRetrievalDone();
599 void invalidateCache(
const Collection &collection);
613 Item currentItem()
const;
624 void synchronizeCollection(qint64
id);
631 void synchronizeCollection(qint64
id,
bool recursive);
640 void synchronizeCollectionAttributes(qint64
id);
645 void synchronizeCollectionTree();
657 void cancelTask(
const QString &error);
679 void doSetOnline(
bool online);
692 void setHierarchicalRemoteIdentifiersEnabled(
bool enable);
694 friend class ResourceScheduler;
695 friend class ::ResourceState;
725 void scheduleCustomTask(QObject *receiver,
const char *method,
const QVariant &argument, SchedulePriority priority = Append);
739 QString dumpNotificationListToString()
const;
749 void dumpMemoryInfo()
const;
757 QString dumpMemoryInfoToString()
const;
763 QString dumpSchedulerToString()
const;
766 static QString parseArguments(
int,
char **);
770 friend class ::Akonadi__ResourceAdaptor;
772 bool requestItemDelivery(qint64 uid,
const QString &remoteId,
const QString &mimeType,
const QStringList &parts);
774 QString requestItemDeliveryV2(qint64 uid,
const QString &remoteId,
const QString &mimeType,
const QStringList &parts);
779 Q_PRIVATE_SLOT(d_func(),
void slotAbortRequested())
780 Q_PRIVATE_SLOT(d_func(),
void slotDeliveryDone(KJob *))
781 Q_PRIVATE_SLOT(d_func(),
void slotCollectionSyncDone(KJob *))
782 Q_PRIVATE_SLOT(d_func(),
void slotDeleteResourceCollection())
783 Q_PRIVATE_SLOT(d_func(),
void slotDeleteResourceCollectionDone(KJob *))
784 Q_PRIVATE_SLOT(d_func(),
void slotCollectionDeletionDone(KJob *))
786 Q_PRIVATE_SLOT(d_func(),
void slotLocalListDone(KJob *))
787 Q_PRIVATE_SLOT(d_func(),
void slotSynchronizeCollection(const
Akonadi::
Collection &))
788 Q_PRIVATE_SLOT(d_func(),
void slotCollectionListDone(KJob *))
789 Q_PRIVATE_SLOT(d_func(),
void slotSynchronizeCollectionAttributes(const
Akonadi::
Collection &))
790 Q_PRIVATE_SLOT(d_func(),
void slotCollectionListForAttributesDone(KJob *))
791 Q_PRIVATE_SLOT(d_func(),
void slotCollectionAttributesSyncDone(KJob *))
792 Q_PRIVATE_SLOT(d_func(),
void slotItemSyncDone(KJob *))
793 Q_PRIVATE_SLOT(d_func(),
void slotPercent(KJob *,
unsigned long))
794 Q_PRIVATE_SLOT(d_func(),
void slotDelayedEmitProgress())
795 Q_PRIVATE_SLOT(d_func(),
void slotPrepareItemRetrieval(const
Akonadi::Item &item))
796 Q_PRIVATE_SLOT(d_func(),
void slotPrepareItemRetrievalResult(KJob *))
797 Q_PRIVATE_SLOT(d_func(),
void changeCommittedResult(KJob *))
798 Q_PRIVATE_SLOT(d_func(),
void slotSessionReconnected())
799 Q_PRIVATE_SLOT(d_func(),
void slotRecursiveMoveReplay(
RecursiveMover *))
800 Q_PRIVATE_SLOT(d_func(),
void slotRecursiveMoveReplayResult(KJob *))
801 Q_PRIVATE_SLOT(d_func(),
void slotItemRetrievalCollectionFetchDone(KJob *))
802 Q_PRIVATE_SLOT(d_func(),
void slotAttributeRetrievalCollectionFetchDone(KJob *))
807#ifndef AKONADI_RESOURCE_MAIN
811#define AKONADI_RESOURCE_MAIN( resourceClass ) \
812 int main( int argc, char **argv ) \
814 return Akonadi::ResourceBase::init<resourceClass>( argc, argv ); \
The interface for reacting on monitored or replayed changes.
The base class for all Akonadi agents and resources.
Represents a collection of PIM items.
QList< Collection > List
Describes a list of collections.
Specifies which parts of an item should be fetched from the Akonadi storage.
TransactionMode
Transaction mode used by ItemSync.
Helper class for expanding inter-resource collection moves inside ResourceBase.
The base class for all Akonadi resources.
virtual bool retrieveItem(const Akonadi::Item &item, const QSet< QByteArray > &parts)=0
Retrieve a single item from the backend.
static int init(int argc, char **argv)
Use this method in the main function of your resource application to initialize your resource subclas...
virtual void retrieveCollections()=0
Retrieve the collection tree from the remote server and supply it via collectionsRetrieved() or colle...
SchedulePriority
Describes the scheduling priority of a task that has been queued for execution.
@ Prepend
The task will be executed as soon as the current task has finished.
@ AfterChangeReplay
The task is scheduled after the last ChangeReplay task in the queue.
void retrieveNextItemSyncBatch(int remainingBatchSize)
Emitted when the item synchronization processed the current batch and is ready for a new one.
void attributesSynchronized(qlonglong collectionId)
Emitted when a collection attributes synchronization has been completed.
void nameChanged(const QString &name)
This signal is emitted whenever the name of the resource has changed.
virtual void retrieveItems(const Akonadi::Collection &collection)=0
Retrieve all (new/changed) items in collection collection.
QString dumpResourceToString() const
Dump resource internals, for debugging.
void collectionTreeSynchronized()
Emitted when a collection tree synchronization has been completed.
FreeBusyManager::Singleton.