|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: caquery.h |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CAQUERY_H |
|
19 #define CAQUERY_H |
|
20 |
|
21 #include <QStringList> |
|
22 #include <QString> |
|
23 #include <QDebug> |
|
24 #include <QMap> |
|
25 #include "caclient_global.h" |
|
26 #include "cadefs.h" |
|
27 |
|
28 // mocks Content Storage CaQuery |
|
29 class CaQuery |
|
30 { |
|
31 |
|
32 public: |
|
33 CaQuery(): |
|
34 mSetParentId(0), |
|
35 mSetSortAttribute(NameSortAttribute), |
|
36 mSetSortOrder(Qt::AscendingOrder) |
|
37 {} |
|
38 |
|
39 void setEntryRoles(EntryRoles entryRoles); |
|
40 |
|
41 void setParentId(int id); |
|
42 |
|
43 |
|
44 void addEntryTypeName(const QString &entryTypeName); |
|
45 |
|
46 void setFlagsOn(const EntryFlags &onFlags); |
|
47 |
|
48 void setFlagsOff(const EntryFlags &offFlags); |
|
49 |
|
50 void setSort(SortAttribute sortAttribute, |
|
51 Qt::SortOrder sortOrder = Qt::AscendingOrder); |
|
52 |
|
53 QMap<QString, QString> attributes() const { return QMap<QString, QString>(); } |
|
54 QString attribute(const QString &name) const { |
|
55 Q_UNUSED(name); |
|
56 return QString(); } |
|
57 void setAttribute(const QString &name, const QString &value) { |
|
58 Q_UNUSED(name); |
|
59 Q_UNUSED(value); |
|
60 } |
|
61 |
|
62 void removeAttribute(const QString &name) { Q_UNUSED(name); } |
|
63 |
|
64 |
|
65 // test supporting members |
|
66 mutable int mSetParentId; |
|
67 mutable EntryRoles mSetEntryRoles; |
|
68 mutable QList<QString> mAddEntryTypeNames; |
|
69 mutable EntryFlags mSetFlagsOn; |
|
70 mutable EntryFlags mSetFlagsOff; |
|
71 mutable SortAttribute mSetSortAttribute; |
|
72 mutable Qt::SortOrder mSetSortOrder; |
|
73 mutable QString mQueryId; |
|
74 |
|
75 // test helper, not belonging to Content Storage CaQuery |
|
76 void clear() |
|
77 { |
|
78 mSetParentId = 0; |
|
79 mSetEntryRoles = 0; |
|
80 mAddEntryTypeNames.clear(); |
|
81 mSetFlagsOn = 0; |
|
82 mSetFlagsOff = 0; |
|
83 mSetSortAttribute = NameSortAttribute; |
|
84 mSetSortOrder = Qt::AscendingOrder; |
|
85 } |
|
86 |
|
87 }; |
|
88 |
|
89 inline void CaQuery::setEntryRoles(EntryRoles entryRoles) |
|
90 { |
|
91 mSetEntryRoles = entryRoles; |
|
92 } |
|
93 |
|
94 inline void CaQuery::setParentId(int id) |
|
95 { |
|
96 mSetParentId = id; |
|
97 } |
|
98 |
|
99 |
|
100 inline void CaQuery::addEntryTypeName(const QString &entryTypeName) |
|
101 { |
|
102 mAddEntryTypeNames.append(entryTypeName); |
|
103 } |
|
104 |
|
105 inline void CaQuery::setFlagsOn(const EntryFlags &onFlags) |
|
106 { |
|
107 mSetFlagsOn = onFlags; |
|
108 } |
|
109 |
|
110 inline void CaQuery::setFlagsOff(const EntryFlags &offFlags) |
|
111 { |
|
112 mSetFlagsOff = offFlags; |
|
113 } |
|
114 |
|
115 inline void CaQuery::setSort(SortAttribute sortAttribute, |
|
116 Qt::SortOrder sortOrder) |
|
117 { |
|
118 mSetSortAttribute = sortAttribute; |
|
119 mSetSortOrder = sortOrder; |
|
120 } |
|
121 #endif // CAQUERY_H |