00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef AKONADI_ITEMSYNC_H
00021 #define AKONADI_ITEMSYNC_H
00022
00023 #include "akonadi_export.h"
00024
00025 #include <akonadi/item.h>
00026 #include <akonadi/job.h>
00027
00028 namespace Akonadi {
00029
00030 class Collection;
00031 class ItemFetchScope;
00032
00053 class AKONADI_EXPORT ItemSync : public Job
00054 {
00055 Q_OBJECT
00056
00057 public:
00064 explicit ItemSync( const Collection &collection, QObject *parent = 0 );
00065
00069 ~ItemSync();
00070
00081 void setFullSyncItems( const Item::List &items );
00082
00089 void setTotalItems( int amount );
00090
00097 void setStreamingEnabled( bool enable );
00098
00103 void deliveryDone();
00104
00116 void setIncrementalSyncItems( const Item::List &changedItems,
00117 const Item::List &removedItems );
00118
00130 void setFetchScope( ItemFetchScope &fetchScope );
00131
00144 ItemFetchScope &fetchScope();
00145
00152 void rollback();
00153
00158 enum TransactionMode {
00159 SingleTransaction,
00160 MultipleTransactions,
00161 NoTransaction
00162 };
00163
00169 void setTransactionMode( TransactionMode mode );
00170
00171 protected:
00172 void doStart();
00173 void slotResult( KJob* job );
00174
00181 virtual bool updateItem( const Item &storedItem, Item &newItem );
00182
00183 private:
00184
00185 class Private;
00186 Private* const d;
00187
00188 Q_PRIVATE_SLOT( d, void slotLocalListDone( KJob* ) )
00189 Q_PRIVATE_SLOT( d, void slotLocalDeleteDone( KJob* ) )
00190 Q_PRIVATE_SLOT( d, void slotLocalChangeDone( KJob* ) )
00191 Q_PRIVATE_SLOT( d, void slotTransactionResult( KJob* ) )
00192
00193 };
00194
00195 }
00196
00197 #endif