Akonadi

collectionqueryhelper.h
1 /*
2  SPDX-FileCopyrightText: 2009 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "entities.h"
10 
11 #include <private/scope_p.h>
12 
13 namespace Akonadi
14 {
15 namespace Server
16 {
17 class CommandContext;
18 class QueryBuilder;
19 
20 /**
21  Helper methods to generate WHERE clauses for collection queries based on a Scope object.
22 */
23 namespace CollectionQueryHelper
24 {
25 /**
26  Add conditions to @p qb for the given remote identifier @p rid.
27  The rid context is taken from @p context.
28 */
29 void remoteIdToQuery(const QStringList &rids, const CommandContext &context, QueryBuilder &qb);
30 
31 /**
32  Add conditions to @p qb for the given collection operation scope @p scope.
33  The rid context is taken from @p context, if none is specified an exception is thrown.
34 */
35 void scopeToQuery(const Scope &scope, const CommandContext &context, QueryBuilder &qb);
36 
37 /**
38  Checks if a collection could exist in the given parent folder with the given name.
39 */
40 bool hasAllowedName(const Collection &collection, const QString &name, Collection::Id parent);
41 
42 /**
43  Checks if a collection could be moved from its current parent into the given one.
44 */
45 bool canBeMovedTo(const Collection &collection, const Collection &parent);
46 
47 /**
48  Retrieve the collection referred to by the given hierarchical RID chain.
49 */
50 Collection resolveHierarchicalRID(const QVector<Scope::HRID> &hridChain, Resource::Id resId);
51 
52 /**
53  Returns an existing collection specified by the given scope. If that does not
54  specify exactly one valid collection, an exception is thrown.
55 */
56 Collection singleCollectionFromScope(const Scope &scope, const CommandContext &context);
57 }
58 
59 } // namespace Server
60 } // namespace Akonadi
61 
Represents a collection of PIM items.
Definition: collection.h:61
Collection resolveHierarchicalRID(const QVector< Scope::HRID > &hridChain, Resource::Id resId)
Retrieve the collection referred to by the given hierarchical RID chain.
Collection singleCollectionFromScope(const Scope &scope, const CommandContext &context)
Returns an existing collection specified by the given scope.
bool hasAllowedName(const Collection &collection, const QString &name, Collection::Id parent)
Checks if a collection could exist in the given parent folder with the given name.
void scopeToQuery(const Scope &scope, const CommandContext &context, QueryBuilder &qb)
Add conditions to qb for the given collection operation scope scope.
bool canBeMovedTo(const Collection &collection, const Collection &parent)
Checks if a collection could be moved from its current parent into the given one.
void remoteIdToQuery(const QStringList &rids, const CommandContext &context, QueryBuilder &qb)
Add conditions to qb for the given remote identifier rid.
qint64 Id
Describes the unique id type.
Definition: collection.h:79
Helper class to construct arbitrary SQL queries.
Definition: querybuilder.h:31
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jun 30 2022 03:51:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.