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>
34 class Akonadi__ResourceAdaptor;
39 class ResourceBasePrivate;
179 template <
typename T>
180 static int init(
int argc,
char **argv )
182 const QString
id = parseArguments( argc, argv );
190 r->registerObserver( observer );
198 void setName(
const QString &name );
203 QString name()
const;
217 void setAutomaticProgressReporting(
bool enabled );
225 void nameChanged(
const QString &name );
238 void attributesSynchronized( qlonglong collectionId );
245 void collectionTreeSynchronized();
253 virtual void retrieveCollections() = 0;
293 virtual bool retrieveItem(
const Akonadi::Item &item,
const QSet<QByteArray> &parts ) = 0;
302 void abortActivity();
333 void itemRetrieved(
const Item &item );
341 void collectionAttributesRetrieved(
const Collection &collection );
350 void changeCommitted(
const Item &item );
361 void changesCommitted(
const Item::List &items );
372 void changeCommitted(
const Tag &tag );
383 void changeCommitted(
const Collection &collection );
400 void collectionsRetrievedIncremental(
const Collection::List &changedCollections,
410 void setCollectionStreamingEnabled(
bool enable );
420 void collectionsRetrievalDone();
431 void itemsRetrieved(
const Item::List &items );
441 void setTotalItems(
int amount );
448 void setItemStreamingEnabled(
bool enable );
469 void setItemSynchronizationFetchScope(
const ItemFetchScope &fetchScope );
477 void itemsRetrievedIncremental(
const Item::List &changedItems,
478 const Item::List &removedItems );
489 void itemsRetrievalDone();
511 void invalidateCache(
const Collection &collection );
525 Item currentItem()
const;
536 void synchronizeCollection( qint64
id );
543 void synchronizeCollection( qint64
id,
bool recursive );
552 void synchronizeCollectionAttributes( qint64
id );
557 void synchronizeCollectionTree();
569 void cancelTask(
const QString &error );
588 void doSetOnline(
bool online );
601 void setHierarchicalRemoteIdentifiersEnabled(
bool enable );
603 friend class ResourceScheduler;
604 friend class ::ResourceState;
634 void scheduleCustomTask( QObject* receiver,
const char* method,
const QVariant &argument, SchedulePriority priority = Append );
648 QString dumpNotificationListToString()
const;
658 void dumpMemoryInfo()
const;
666 QString dumpMemoryInfoToString()
const;
672 QString dumpSchedulerToString()
const;
675 static QString parseArguments(
int,
char** );
679 friend class ::Akonadi__ResourceAdaptor;
681 bool requestItemDelivery( qint64 uid,
const QString &remoteId,
const QString &mimeType,
const QStringList &parts );
683 QString requestItemDeliveryV2( qint64 uid,
const QString &remoteId,
const QString &mimeType,
const QStringList &parts );
688 Q_PRIVATE_SLOT( d_func(),
void slotAbortRequested() )
689 Q_PRIVATE_SLOT( d_func(),
void slotDeliveryDone( KJob* ) )
690 Q_PRIVATE_SLOT( d_func(),
void slotCollectionSyncDone( KJob* ) )
691 Q_PRIVATE_SLOT( d_func(),
void slotDeleteResourceCollection() )
692 Q_PRIVATE_SLOT( d_func(),
void slotDeleteResourceCollectionDone( KJob* ) )
693 Q_PRIVATE_SLOT( d_func(),
void slotCollectionDeletionDone( KJob* ) )
694 Q_PRIVATE_SLOT( d_func(),
void slotInvalidateCache( const Akonadi::
Collection& ) )
695 Q_PRIVATE_SLOT( d_func(),
void slotLocalListDone( KJob* ) )
696 Q_PRIVATE_SLOT( d_func(),
void slotSynchronizeCollection( const Akonadi::
Collection& ) )
697 Q_PRIVATE_SLOT( d_func(),
void slotCollectionListDone( KJob* ) )
698 Q_PRIVATE_SLOT( d_func(),
void slotSynchronizeCollectionAttributes( const Akonadi::
Collection& ) )
699 Q_PRIVATE_SLOT( d_func(),
void slotCollectionListForAttributesDone( KJob* ) )
700 Q_PRIVATE_SLOT( d_func(),
void slotCollectionAttributesSyncDone( KJob* ) )
701 Q_PRIVATE_SLOT( d_func(),
void slotItemSyncDone( KJob* ) )
702 Q_PRIVATE_SLOT( d_func(),
void slotPercent( KJob*,
unsigned long ) )
703 Q_PRIVATE_SLOT( d_func(),
void slotDelayedEmitProgress() )
704 Q_PRIVATE_SLOT( d_func(),
void slotPrepareItemRetrieval( const Akonadi::Item& item ) )
705 Q_PRIVATE_SLOT( d_func(),
void slotPrepareItemRetrievalResult( KJob* ) )
706 Q_PRIVATE_SLOT( d_func(),
void changeCommittedResult( KJob* ) )
707 Q_PRIVATE_SLOT( d_func(),
void slotSessionReconnected() )
708 Q_PRIVATE_SLOT( d_func(),
void slotRecursiveMoveReplay(
RecursiveMover* ) )
709 Q_PRIVATE_SLOT( d_func(),
void slotRecursiveMoveReplayResult( KJob* ) )
714 #ifndef AKONADI_RESOURCE_MAIN
718 #define AKONADI_RESOURCE_MAIN( resourceClass ) \
719 int main( int argc, char **argv ) \
721 return Akonadi::ResourceBase::init<resourceClass>( argc, argv ); \
Helper class for expanding inter-resource collection moves inside ResourceBase.
Represents a collection of PIM items.
The interface for reacting on monitored or replayed changes.
The base class for all Akonadi agents and resources.
SchedulePriority
Describes the scheduling priority of a task that has been queued for execution.
The task is scheduled after the last ChangeReplay task in the queue.
Specifies which parts of an item should be fetched from the Akonadi storage.
TransactionMode
Transaction mode used by ItemSync.
QString dumpResourceToString() const
Dump resource internals, for debugging.
static int init(int argc, char **argv)
Use this method in the main function of your resource application to initialize your resource subclas...
The task will be executed as soon as the current task has finished.
QList< Collection > List
Describes a list of collections.
The base class for all Akonadi resources.