Akonadi

itemsync.h
1 /*
2  SPDX-FileCopyrightText: 2007 Tobias Koenig <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef AKONADI_ITEMSYNC_H
8 #define AKONADI_ITEMSYNC_H
9 
10 #include "akonadicore_export.h"
11 #include "item.h"
12 #include "job.h"
13 
14 namespace Akonadi
15 {
16 
17 class Collection;
18 class ItemFetchScope;
19 class ItemSyncPrivate;
20 
41 class AKONADICORE_EXPORT ItemSync : public Job
42 {
43  Q_OBJECT
44 
45 public:
46  enum MergeMode {
47  RIDMerge,
48  GIDMerge
49  };
50 
57  explicit ItemSync(const Collection &collection, QObject *parent = nullptr);
58 
62  ~ItemSync() override;
63 
74  void setFullSyncItems(const Item::List &items);
75 
87  void setTotalItems(int amount);
88 
95  void setStreamingEnabled(bool enable);
96 
101  void deliveryDone();
102 
114  void setIncrementalSyncItems(const Item::List &changedItems,
115  const Item::List &removedItems);
116 
128  void setFetchScope(ItemFetchScope &fetchScope);
129 
142  ItemFetchScope &fetchScope();
143 
150  void rollback();
151 
159  NoTransaction
160  };
161 
168  void setTransactionMode(TransactionMode mode);
169 
177  Q_REQUIRED_RESULT int batchSize() const;
178 
188  void setBatchSize(int);
189 
202  void setDisableAutomaticDeliveryDone(bool disable);
203 
210  Q_REQUIRED_RESULT MergeMode mergeMode() const;
211 
223  void setMergeMode(MergeMode mergeMode);
224 
225 Q_SIGNALS:
232  void readyForNextBatch(int remainingBatchSize);
233 
240  void transactionCommitted();
241 
242 protected:
243  void doStart() override;
244  void slotResult(KJob *job) override;
245 
246 private:
247  //@cond PRIVATE
248  Q_DECLARE_PRIVATE(ItemSync)
249 
250  Q_PRIVATE_SLOT(d_func(), void slotLocalListDone(KJob *))
251  Q_PRIVATE_SLOT(d_func(), void slotTransactionResult(KJob *))
252  Q_PRIVATE_SLOT(d_func(), void slotItemsReceived(const Akonadi::Item::List &))
253  //@endcond
254 };
255 
256 }
257 
258 #endif
Represents a collection of PIM items.
Definition: collection.h:63
Use a single transaction for the entire sync process (default), provides maximum consistency ("all or...
Definition: itemsync.h:157
Base class for all actions in the Akonadi storage.
Definition: job.h:80
Syncs between items known to a client (usually a resource) and the Akonadi storage.
Definition: itemsync.h:41
Specifies which parts of an item should be fetched from the Akonadi storage.
Use one transaction per chunk of delivered items, good compromise between the other two when using st...
Definition: itemsync.h:158
TransactionMode
Transaction mode used by ItemSync.
Definition: itemsync.h:156
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jul 12 2020 23:16:57 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.