9#include "commandcontext.h"
10#include "storage/countquerybuilder.h"
11#include "storage/datastore.h"
12#include "storage/itemretriever.h"
14#include "private/protocol_p.h"
15#include "private/scope_p.h"
19class ItemFetchHelperTest;
31 ItemFetchHelper(Connection *connection,
33 const Protocol::ItemFetchScope &itemFetchScope,
34 const Protocol::TagFetchScope &tagFagScope,
35 AkonadiServer &akonadi,
36 const Protocol::FetchLimit &itemsLimit = Protocol::FetchLimit());
37 ItemFetchHelper(Connection *connection,
38 const CommandContext &context,
40 const Protocol::ItemFetchScope &itemFetchScope,
41 const Protocol::TagFetchScope &tagFetchScope,
42 AkonadiServer &akonadi,
43 const Protocol::FetchLimit &itemsLimit = Protocol::FetchLimit());
45 bool fetchItems(std::function<
void(Protocol::FetchItemsResponse &&)> &&callback = {});
47 void disableATimeUpdates();
50 enum ItemQueryColumns {
51 ItemQueryPimItemIdColumn,
52 ItemQueryPimItemRidColumn,
53 ItemQueryMimeTypeIdColumn,
55 ItemQueryRemoteRevisionColumn,
57 ItemQueryDatetimeColumn,
58 ItemQueryCollectionIdColumn,
59 ItemQueryPimItemGidColumn,
63 void updateItemAccessTime();
64 void triggerOnDemandFetch();
65 QueryBuilder buildItemQuery();
67 QueryBuilder buildFlagQuery(
QSqlQuery &itemQuery);
68 QueryBuilder buildTagQuery(
QSqlQuery &itemQuery);
69 QueryBuilder buildVRefQuery(
QSqlQuery &itemQuery);
73 QVariant extractQueryResult(
const QSqlQuery &query, ItemQueryColumns column)
const;
74 bool isScopeLocal(
const Scope &scope);
75 DataStore *storageBackend()
const;
78 Connection *mConnection =
nullptr;
79 const CommandContext &mContext;
82 Protocol::ItemFetchScope mItemFetchScope;
83 Protocol::TagFetchScope mTagFetchScope;
84 int mItemQueryColumnMap[ItemQueryColumnCount];
85 bool mUpdateATimeEnabled =
true;
86 AkonadiServer &mAkonadi;
87 Protocol::FetchLimit mItemsLimit;
90 friend class ::ItemFetchHelperTest;
qint64 Id
Describes the unique id type.
Helper integration between Akonadi and Qt.