diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-14 18:52:04 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-14 18:52:04 +0100 |
commit | 78284e0963d93e3e0f85e2165013412580a3b8c1 (patch) | |
tree | b4f0b5750c3f27ad107cc66358bd7b930b8399bc | |
parent | 7de95983b30ca414c04bb3f877b67c1b7e9d6fa0 (diff) | |
download | sink-78284e0963d93e3e0f85e2165013412580a3b8c1.tar.gz sink-78284e0963d93e3e0f85e2165013412580a3b8c1.zip |
Got rid of all uses of Query::syncOnDemand and Query::processAll
-rw-r--r-- | akonadish/akonadish_utils.cpp | 2 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_count.cpp | 2 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_list.cpp | 2 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_stat.cpp | 2 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_sync.cpp | 2 | ||||
-rw-r--r-- | common/clientapi.cpp | 2 | ||||
-rw-r--r-- | examples/client/main.cpp | 3 | ||||
-rw-r--r-- | tests/dummyresourcebenchmark.cpp | 6 | ||||
-rw-r--r-- | tests/dummyresourcetest.cpp | 28 | ||||
-rw-r--r-- | tests/maildirresourcetest.cpp | 47 | ||||
-rw-r--r-- | tests/modelinteractivitytest.cpp | 4 | ||||
-rw-r--r-- | tests/querytest.cpp | 31 |
12 files changed, 35 insertions, 96 deletions
diff --git a/akonadish/akonadish_utils.cpp b/akonadish/akonadish_utils.cpp index 140c741..27a863d 100644 --- a/akonadish/akonadish_utils.cpp +++ b/akonadish/akonadish_utils.cpp | |||
@@ -77,8 +77,6 @@ QStringList resourceIds(State &state) | |||
77 | { | 77 | { |
78 | QStringList resources; | 78 | QStringList resources; |
79 | Akonadi2::Query query; | 79 | Akonadi2::Query query; |
80 | query.syncOnDemand = false; | ||
81 | query.processAll = false; | ||
82 | query.liveQuery = false; | 80 | query.liveQuery = false; |
83 | auto model = AkonadishUtils::loadModel("resource", query); | 81 | auto model = AkonadishUtils::loadModel("resource", query); |
84 | 82 | ||
diff --git a/akonadish/syntax_modules/akonadi_count.cpp b/akonadish/syntax_modules/akonadi_count.cpp index 5acdcdd..bb1cd19 100644 --- a/akonadish/syntax_modules/akonadi_count.cpp +++ b/akonadish/syntax_modules/akonadi_count.cpp | |||
@@ -53,8 +53,6 @@ bool count(const QStringList &args, State &state) | |||
53 | for (const auto &res : resources) { | 53 | for (const auto &res : resources) { |
54 | query.resources << res.toLatin1(); | 54 | query.resources << res.toLatin1(); |
55 | } | 55 | } |
56 | query.syncOnDemand = false; | ||
57 | query.processAll = false; | ||
58 | query.liveQuery = false; | 56 | query.liveQuery = false; |
59 | 57 | ||
60 | auto model = AkonadishUtils::loadModel(type, query); | 58 | auto model = AkonadishUtils::loadModel(type, query); |
diff --git a/akonadish/syntax_modules/akonadi_list.cpp b/akonadish/syntax_modules/akonadi_list.cpp index 82f13b5..7709d3b 100644 --- a/akonadish/syntax_modules/akonadi_list.cpp +++ b/akonadish/syntax_modules/akonadi_list.cpp | |||
@@ -58,8 +58,6 @@ bool list(const QStringList &args, State &state) | |||
58 | for (const auto &res : resources) { | 58 | for (const auto &res : resources) { |
59 | query.resources << res.toLatin1(); | 59 | query.resources << res.toLatin1(); |
60 | } | 60 | } |
61 | query.syncOnDemand = false; | ||
62 | query.processAll = false; | ||
63 | query.liveQuery = false; | 61 | query.liveQuery = false; |
64 | 62 | ||
65 | QTime time; | 63 | QTime time; |
diff --git a/akonadish/syntax_modules/akonadi_stat.cpp b/akonadish/syntax_modules/akonadi_stat.cpp index 9270f9d..d10556f 100644 --- a/akonadish/syntax_modules/akonadi_stat.cpp +++ b/akonadish/syntax_modules/akonadi_stat.cpp | |||
@@ -69,8 +69,6 @@ void statResources(const QStringList &resources, const State &state) | |||
69 | bool statAllResources(State &state) | 69 | bool statAllResources(State &state) |
70 | { | 70 | { |
71 | Akonadi2::Query query; | 71 | Akonadi2::Query query; |
72 | query.syncOnDemand = false; | ||
73 | query.processAll = false; | ||
74 | query.liveQuery = false; | 72 | query.liveQuery = false; |
75 | auto model = AkonadishUtils::loadModel("resource", query); | 73 | auto model = AkonadishUtils::loadModel("resource", query); |
76 | 74 | ||
diff --git a/akonadish/syntax_modules/akonadi_sync.cpp b/akonadish/syntax_modules/akonadi_sync.cpp index 03abbb4..0c994d0 100644 --- a/akonadish/syntax_modules/akonadi_sync.cpp +++ b/akonadish/syntax_modules/akonadi_sync.cpp | |||
@@ -43,8 +43,6 @@ bool sync(const QStringList &args, State &state) | |||
43 | for (const auto &res : args) { | 43 | for (const auto &res : args) { |
44 | query.resources << res.toLatin1(); | 44 | query.resources << res.toLatin1(); |
45 | } | 45 | } |
46 | query.syncOnDemand = true; | ||
47 | query.processAll = true; | ||
48 | 46 | ||
49 | QTimer::singleShot(0, [query, state]() { | 47 | QTimer::singleShot(0, [query, state]() { |
50 | Akonadi2::Store::synchronize(query).then<void>([state]() { | 48 | Akonadi2::Store::synchronize(query).then<void>([state]() { |
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index ffaa57b..5c0bcb8 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -204,7 +204,7 @@ KAsync::Job<void> Store::synchronize(const Akonadi2::Query &query) | |||
204 | Trace() << "Synchronizing " << resource; | 204 | Trace() << "Synchronizing " << resource; |
205 | auto resourceAccess = QSharedPointer<Akonadi2::ResourceAccess>::create(resource); | 205 | auto resourceAccess = QSharedPointer<Akonadi2::ResourceAccess>::create(resource); |
206 | resourceAccess->open(); | 206 | resourceAccess->open(); |
207 | resourceAccess->synchronizeResource(query.syncOnDemand, query.processAll).then<void>([&future, resourceAccess]() { | 207 | resourceAccess->synchronizeResource(true, false).then<void>([&future, resourceAccess]() { |
208 | future.setFinished(); | 208 | future.setFinished(); |
209 | }).exec(); | 209 | }).exec(); |
210 | }) | 210 | }) |
diff --git a/examples/client/main.cpp b/examples/client/main.cpp index 127fd2f..6660f86 100644 --- a/examples/client/main.cpp +++ b/examples/client/main.cpp | |||
@@ -120,7 +120,6 @@ public: | |||
120 | QObject::connect(syncButton, &QPushButton::pressed, []() { | 120 | QObject::connect(syncButton, &QPushButton::pressed, []() { |
121 | Akonadi2::Query query; | 121 | Akonadi2::Query query; |
122 | query.resources << "org.kde.dummy.instance1"; | 122 | query.resources << "org.kde.dummy.instance1"; |
123 | query.syncOnDemand = true; | ||
124 | Akonadi2::Store::synchronize(query).exec(); | 123 | Akonadi2::Store::synchronize(query).exec(); |
125 | }); | 124 | }); |
126 | 125 | ||
@@ -198,8 +197,6 @@ int main(int argc, char *argv[]) | |||
198 | for (const auto &res : resources) { | 197 | for (const auto &res : resources) { |
199 | query.resources << res.toLatin1(); | 198 | query.resources << res.toLatin1(); |
200 | } | 199 | } |
201 | query.syncOnDemand = false; | ||
202 | query.processAll = false; | ||
203 | query.liveQuery = true; | 200 | query.liveQuery = true; |
204 | if (type == "folder") { | 201 | if (type == "folder") { |
205 | query.parentProperty = "parent"; | 202 | query.parentProperty = "parent"; |
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index aad86c0..c52eee3 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp | |||
@@ -92,9 +92,7 @@ private Q_SLOTS: | |||
92 | { | 92 | { |
93 | Akonadi2::Query query; | 93 | Akonadi2::Query query; |
94 | query.resources << "org.kde.dummy.instance1"; | 94 | query.resources << "org.kde.dummy.instance1"; |
95 | query.syncOnDemand = false; | 95 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
96 | query.processAll = true; | ||
97 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
98 | } | 96 | } |
99 | auto allProcessedTime = time.elapsed(); | 97 | auto allProcessedTime = time.elapsed(); |
100 | 98 | ||
@@ -123,8 +121,6 @@ private Q_SLOTS: | |||
123 | time.start(); | 121 | time.start(); |
124 | Akonadi2::Query query; | 122 | Akonadi2::Query query; |
125 | query.resources << "org.kde.dummy.instance1"; | 123 | query.resources << "org.kde.dummy.instance1"; |
126 | query.syncOnDemand = false; | ||
127 | query.processAll = false; | ||
128 | 124 | ||
129 | query.propertyFilter.insert("uid", "testuid"); | 125 | query.propertyFilter.insert("uid", "testuid"); |
130 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 126 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index 0e1f382..72a24b6 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -62,11 +62,9 @@ private Q_SLOTS: | |||
62 | 62 | ||
63 | Akonadi2::Query query; | 63 | Akonadi2::Query query; |
64 | query.resources << "org.kde.dummy.instance1"; | 64 | query.resources << "org.kde.dummy.instance1"; |
65 | query.syncOnDemand = false; | ||
66 | query.processAll = true; | ||
67 | 65 | ||
68 | //Ensure all local data is processed | 66 | //Ensure all local data is processed |
69 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 67 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
70 | 68 | ||
71 | query.propertyFilter.insert("uid", "testuid"); | 69 | query.propertyFilter.insert("uid", "testuid"); |
72 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 70 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
@@ -88,11 +86,9 @@ private Q_SLOTS: | |||
88 | 86 | ||
89 | Akonadi2::Query query; | 87 | Akonadi2::Query query; |
90 | query.resources << "org.kde.dummy.instance1"; | 88 | query.resources << "org.kde.dummy.instance1"; |
91 | query.syncOnDemand = false; | ||
92 | query.processAll = true; | ||
93 | 89 | ||
94 | //Ensure all local data is processed | 90 | //Ensure all local data is processed |
95 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 91 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
96 | 92 | ||
97 | query.propertyFilter.insert("uid", "testuid"); | 93 | query.propertyFilter.insert("uid", "testuid"); |
98 | 94 | ||
@@ -118,11 +114,9 @@ private Q_SLOTS: | |||
118 | 114 | ||
119 | Akonadi2::Query query; | 115 | Akonadi2::Query query; |
120 | query.resources << "org.kde.dummy.instance1"; | 116 | query.resources << "org.kde.dummy.instance1"; |
121 | query.syncOnDemand = false; | ||
122 | query.processAll = true; | ||
123 | 117 | ||
124 | //Ensure all local data is processed | 118 | //Ensure all local data is processed |
125 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 119 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
126 | 120 | ||
127 | query.propertyFilter.insert("summary", "summaryValue2"); | 121 | query.propertyFilter.insert("summary", "summaryValue2"); |
128 | 122 | ||
@@ -153,11 +147,10 @@ private Q_SLOTS: | |||
153 | { | 147 | { |
154 | Akonadi2::Query query; | 148 | Akonadi2::Query query; |
155 | query.resources << "org.kde.dummy.instance1"; | 149 | query.resources << "org.kde.dummy.instance1"; |
156 | query.syncOnDemand = true; | ||
157 | query.processAll = true; | ||
158 | 150 | ||
159 | //Ensure all local data is processed | 151 | //Ensure all local data is processed |
160 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 152 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
153 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
161 | 154 | ||
162 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 155 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
163 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); | 156 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); |
@@ -171,11 +164,10 @@ private Q_SLOTS: | |||
171 | { | 164 | { |
172 | Akonadi2::Query query; | 165 | Akonadi2::Query query; |
173 | query.resources << "org.kde.dummy.instance1"; | 166 | query.resources << "org.kde.dummy.instance1"; |
174 | query.syncOnDemand = true; | ||
175 | query.processAll = true; | ||
176 | 167 | ||
177 | //Ensure all local data is processed | 168 | //Ensure all local data is processed |
178 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 169 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
170 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
179 | 171 | ||
180 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 172 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); |
181 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); | 173 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); |
@@ -195,12 +187,10 @@ private Q_SLOTS: | |||
195 | 187 | ||
196 | Akonadi2::Query query; | 188 | Akonadi2::Query query; |
197 | query.resources << "org.kde.dummy.instance1"; | 189 | query.resources << "org.kde.dummy.instance1"; |
198 | query.syncOnDemand = false; | ||
199 | query.processAll = true; | ||
200 | query.propertyFilter.insert("uid", "testuid"); | 190 | query.propertyFilter.insert("uid", "testuid"); |
201 | 191 | ||
202 | //Ensure all local data is processed | 192 | //Ensure all local data is processed |
203 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 193 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
204 | 194 | ||
205 | //Test create | 195 | //Test create |
206 | Akonadi2::ApplicationDomain::Event event2; | 196 | Akonadi2::ApplicationDomain::Event event2; |
@@ -219,7 +209,7 @@ private Q_SLOTS: | |||
219 | Akonadi2::Store::modify<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 209 | Akonadi2::Store::modify<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
220 | 210 | ||
221 | //Ensure all local data is processed | 211 | //Ensure all local data is processed |
222 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 212 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
223 | 213 | ||
224 | //Test modify | 214 | //Test modify |
225 | { | 215 | { |
@@ -234,7 +224,7 @@ private Q_SLOTS: | |||
234 | Akonadi2::Store::remove<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 224 | Akonadi2::Store::remove<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
235 | 225 | ||
236 | //Ensure all local data is processed | 226 | //Ensure all local data is processed |
237 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 227 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
238 | 228 | ||
239 | //Test remove | 229 | //Test remove |
240 | { | 230 | { |
@@ -249,8 +239,6 @@ private Q_SLOTS: | |||
249 | 239 | ||
250 | Akonadi2::Query query; | 240 | Akonadi2::Query query; |
251 | query.resources << "org.kde.dummy.instance1"; | 241 | query.resources << "org.kde.dummy.instance1"; |
252 | query.syncOnDemand = false; | ||
253 | query.processAll = true; | ||
254 | query.liveQuery = true; | 242 | query.liveQuery = true; |
255 | query.propertyFilter.insert("uid", "testuid"); | 243 | query.propertyFilter.insert("uid", "testuid"); |
256 | 244 | ||
diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp index b61190d..3e07d93 100644 --- a/tests/maildirresourcetest.cpp +++ b/tests/maildirresourcetest.cpp | |||
@@ -87,11 +87,10 @@ private Q_SLOTS: | |||
87 | { | 87 | { |
88 | Akonadi2::Query query; | 88 | Akonadi2::Query query; |
89 | query.resources << "org.kde.maildir.instance1"; | 89 | query.resources << "org.kde.maildir.instance1"; |
90 | query.syncOnDemand = true; | ||
91 | query.processAll = true; | ||
92 | 90 | ||
93 | //Ensure all local data is processed | 91 | //Ensure all local data is processed |
94 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 92 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
93 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
95 | 94 | ||
96 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 95 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); |
97 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 96 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
@@ -102,12 +101,11 @@ private Q_SLOTS: | |||
102 | { | 101 | { |
103 | Akonadi2::Query query; | 102 | Akonadi2::Query query; |
104 | query.resources << "org.kde.maildir.instance1"; | 103 | query.resources << "org.kde.maildir.instance1"; |
105 | query.syncOnDemand = true; | ||
106 | query.processAll = true; | ||
107 | query.parentProperty = "parent"; | 104 | query.parentProperty = "parent"; |
108 | 105 | ||
109 | //Ensure all local data is processed | 106 | //Ensure all local data is processed |
110 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 107 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
108 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
111 | 109 | ||
112 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 110 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); |
113 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 111 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
@@ -124,10 +122,8 @@ private Q_SLOTS: | |||
124 | using namespace Akonadi2::ApplicationDomain; | 122 | using namespace Akonadi2::ApplicationDomain; |
125 | //Ensure all local data is processed | 123 | //Ensure all local data is processed |
126 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); | 124 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); |
127 | query.processAll = true; | ||
128 | query.syncOnDemand = true; | ||
129 | Store::synchronize(query).exec().waitForFinished(); | 125 | Store::synchronize(query).exec().waitForFinished(); |
130 | // Store::flushMessageQueues(Query::ResourceFilter("org.kde.maildir.instance1")).exec().waitForFinished(); | 126 | Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
131 | auto result = Store::fetchOne<Folder>( | 127 | auto result = Store::fetchOne<Folder>( |
132 | Query::ResourceFilter("org.kde.maildir.instance1") + Query::RequestedProperties(QByteArrayList() << "name") | 128 | Query::ResourceFilter("org.kde.maildir.instance1") + Query::RequestedProperties(QByteArrayList() << "name") |
133 | ) | 129 | ) |
@@ -150,11 +146,10 @@ private Q_SLOTS: | |||
150 | Akonadi2::Query query; | 146 | Akonadi2::Query query; |
151 | query.resources << "org.kde.maildir.instance1"; | 147 | query.resources << "org.kde.maildir.instance1"; |
152 | query.requestedProperties << "folder" << "subject" << "mimeMessage" << "date"; | 148 | query.requestedProperties << "folder" << "subject" << "mimeMessage" << "date"; |
153 | query.syncOnDemand = true; | ||
154 | query.processAll = true; | ||
155 | 149 | ||
156 | //Ensure all local data is processed | 150 | //Ensure all local data is processed |
157 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 151 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
152 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
158 | 153 | ||
159 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 154 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); |
160 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 155 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
@@ -170,12 +165,11 @@ private Q_SLOTS: | |||
170 | { | 165 | { |
171 | Akonadi2::Query query; | 166 | Akonadi2::Query query; |
172 | query.resources << "org.kde.maildir.instance1"; | 167 | query.resources << "org.kde.maildir.instance1"; |
173 | query.syncOnDemand = true; | ||
174 | query.processAll = true; | ||
175 | query.requestedProperties << "name"; | 168 | query.requestedProperties << "name"; |
176 | 169 | ||
177 | //Ensure all local data is processed | 170 | //Ensure all local data is processed |
178 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 171 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
172 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
179 | 173 | ||
180 | auto targetPath = tempDir.path() + "/maildir1/"; | 174 | auto targetPath = tempDir.path() + "/maildir1/"; |
181 | QDir dir(targetPath); | 175 | QDir dir(targetPath); |
@@ -183,6 +177,7 @@ private Q_SLOTS: | |||
183 | 177 | ||
184 | //Ensure all local data is processed | 178 | //Ensure all local data is processed |
185 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 179 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
180 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
186 | 181 | ||
187 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 182 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); |
188 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 183 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
@@ -194,15 +189,15 @@ private Q_SLOTS: | |||
194 | { | 189 | { |
195 | Akonadi2::Query query; | 190 | Akonadi2::Query query; |
196 | query.resources << "org.kde.maildir.instance1"; | 191 | query.resources << "org.kde.maildir.instance1"; |
197 | query.syncOnDemand = true; | ||
198 | query.processAll = true; | ||
199 | query.requestedProperties << "folder" << "subject"; | 192 | query.requestedProperties << "folder" << "subject"; |
200 | 193 | ||
201 | //Ensure all local data is processed | 194 | //Ensure all local data is processed |
202 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 195 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
196 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
203 | 197 | ||
204 | //Ensure all local data is processed | 198 | //Ensure all local data is processed |
205 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 199 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
200 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
206 | 201 | ||
207 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 202 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); |
208 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 203 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
@@ -213,12 +208,11 @@ private Q_SLOTS: | |||
213 | { | 208 | { |
214 | Akonadi2::Query query; | 209 | Akonadi2::Query query; |
215 | query.resources << "org.kde.maildir.instance1"; | 210 | query.resources << "org.kde.maildir.instance1"; |
216 | query.syncOnDemand = true; | ||
217 | query.processAll = true; | ||
218 | query.requestedProperties << "folder" << "subject"; | 211 | query.requestedProperties << "folder" << "subject"; |
219 | 212 | ||
220 | //Ensure all local data is processed | 213 | //Ensure all local data is processed |
221 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 214 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
215 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
222 | 216 | ||
223 | auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; | 217 | auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; |
224 | QFile file(targetPath); | 218 | QFile file(targetPath); |
@@ -226,6 +220,7 @@ private Q_SLOTS: | |||
226 | 220 | ||
227 | //Ensure all local data is processed | 221 | //Ensure all local data is processed |
228 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 222 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
223 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
229 | 224 | ||
230 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 225 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); |
231 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 226 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
@@ -236,11 +231,9 @@ private Q_SLOTS: | |||
236 | { | 231 | { |
237 | Akonadi2::Query query; | 232 | Akonadi2::Query query; |
238 | query.resources << "org.kde.maildir.instance1"; | 233 | query.resources << "org.kde.maildir.instance1"; |
239 | query.syncOnDemand = false; | ||
240 | query.processAll = true; | ||
241 | 234 | ||
242 | //Ensure all local data is processed | 235 | //Ensure all local data is processed |
243 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 236 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
244 | 237 | ||
245 | Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); | 238 | Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); |
246 | folder.setProperty("name", "testCreateFolder"); | 239 | folder.setProperty("name", "testCreateFolder"); |
@@ -248,7 +241,7 @@ private Q_SLOTS: | |||
248 | Akonadi2::Store::create(folder).exec().waitForFinished(); | 241 | Akonadi2::Store::create(folder).exec().waitForFinished(); |
249 | 242 | ||
250 | //Ensure all local data is processed | 243 | //Ensure all local data is processed |
251 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 244 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
252 | 245 | ||
253 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; | 246 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; |
254 | QFileInfo file(targetPath); | 247 | QFileInfo file(targetPath); |
@@ -260,15 +253,13 @@ private Q_SLOTS: | |||
260 | { | 253 | { |
261 | Akonadi2::Query query; | 254 | Akonadi2::Query query; |
262 | query.resources << "org.kde.maildir.instance1"; | 255 | query.resources << "org.kde.maildir.instance1"; |
263 | query.syncOnDemand = false; | ||
264 | query.processAll = true; | ||
265 | 256 | ||
266 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; | 257 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; |
267 | 258 | ||
268 | Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); | 259 | Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); |
269 | folder.setProperty("name", "testCreateFolder"); | 260 | folder.setProperty("name", "testCreateFolder"); |
270 | Akonadi2::Store::create(folder).exec().waitForFinished(); | 261 | Akonadi2::Store::create(folder).exec().waitForFinished(); |
271 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 262 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
272 | QTRY_VERIFY(QFileInfo(targetPath).exists()); | 263 | QTRY_VERIFY(QFileInfo(targetPath).exists()); |
273 | 264 | ||
274 | Akonadi2::Query folderQuery; | 265 | Akonadi2::Query folderQuery; |
@@ -280,7 +271,7 @@ private Q_SLOTS: | |||
280 | auto createdFolder = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>(); | 271 | auto createdFolder = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>(); |
281 | 272 | ||
282 | Akonadi2::Store::remove(*createdFolder).exec().waitForFinished(); | 273 | Akonadi2::Store::remove(*createdFolder).exec().waitForFinished(); |
283 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 274 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
284 | QTRY_VERIFY(!QFileInfo(targetPath).exists()); | 275 | QTRY_VERIFY(!QFileInfo(targetPath).exists()); |
285 | } | 276 | } |
286 | 277 | ||
@@ -288,11 +279,9 @@ private Q_SLOTS: | |||
288 | { | 279 | { |
289 | Akonadi2::Query query; | 280 | Akonadi2::Query query; |
290 | query.resources << "org.kde.maildir.instance1"; | 281 | query.resources << "org.kde.maildir.instance1"; |
291 | query.syncOnDemand = false; | ||
292 | query.processAll = true; | ||
293 | 282 | ||
294 | //Ensure all local data is processed | 283 | //Ensure all local data is processed |
295 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 284 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
296 | 285 | ||
297 | Akonadi2::ApplicationDomain::Mail mail("org.kde.maildir.instance1"); | 286 | Akonadi2::ApplicationDomain::Mail mail("org.kde.maildir.instance1"); |
298 | mail.setProperty("name", "testCreateMail"); | 287 | mail.setProperty("name", "testCreateMail"); |
@@ -300,7 +289,7 @@ private Q_SLOTS: | |||
300 | Akonadi2::Store::create(mail).exec().waitForFinished(); | 289 | Akonadi2::Store::create(mail).exec().waitForFinished(); |
301 | 290 | ||
302 | //Ensure all local data is processed | 291 | //Ensure all local data is processed |
303 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 292 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
304 | 293 | ||
305 | auto targetPath = tempDir.path() + "/maildir1/new"; | 294 | auto targetPath = tempDir.path() + "/maildir1/new"; |
306 | QDir dir(targetPath); | 295 | QDir dir(targetPath); |
@@ -312,9 +301,8 @@ private Q_SLOTS: | |||
312 | { | 301 | { |
313 | Akonadi2::Query query; | 302 | Akonadi2::Query query; |
314 | query.resources << "org.kde.maildir.instance1"; | 303 | query.resources << "org.kde.maildir.instance1"; |
315 | query.syncOnDemand = true; | ||
316 | query.processAll = true; | ||
317 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 304 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
305 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
318 | 306 | ||
319 | Akonadi2::Query folderQuery; | 307 | Akonadi2::Query folderQuery; |
320 | folderQuery.resources << "org.kde.maildir.instance1"; | 308 | folderQuery.resources << "org.kde.maildir.instance1"; |
@@ -334,6 +322,7 @@ private Q_SLOTS: | |||
334 | 322 | ||
335 | Akonadi2::Store::remove(*mail).exec().waitForFinished(); | 323 | Akonadi2::Store::remove(*mail).exec().waitForFinished(); |
336 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 324 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
325 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
337 | 326 | ||
338 | QTRY_COMPARE(QDir(tempDir.path() + "/maildir1/cur", QString(), QDir::NoSort, QDir::Files).count(), static_cast<unsigned int>(0)); | 327 | QTRY_COMPARE(QDir(tempDir.path() + "/maildir1/cur", QString(), QDir::NoSort, QDir::Files).count(), static_cast<unsigned int>(0)); |
339 | } | 328 | } |
diff --git a/tests/modelinteractivitytest.cpp b/tests/modelinteractivitytest.cpp index 52db932..59c2c6f 100644 --- a/tests/modelinteractivitytest.cpp +++ b/tests/modelinteractivitytest.cpp | |||
@@ -73,11 +73,9 @@ private Q_SLOTS: | |||
73 | 73 | ||
74 | Akonadi2::Query query; | 74 | Akonadi2::Query query; |
75 | query.resources << "org.kde.dummy.instance1"; | 75 | query.resources << "org.kde.dummy.instance1"; |
76 | query.syncOnDemand = false; | ||
77 | query.processAll = true; | ||
78 | query.liveQuery = true; | 76 | query.liveQuery = true; |
79 | 77 | ||
80 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 78 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
81 | 79 | ||
82 | //Test | 80 | //Test |
83 | QTime time; | 81 | QTime time; |
diff --git a/tests/querytest.cpp b/tests/querytest.cpp index e09f7a4..f9344cd 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp | |||
@@ -48,8 +48,6 @@ private Q_SLOTS: | |||
48 | //Test | 48 | //Test |
49 | Akonadi2::Query query; | 49 | Akonadi2::Query query; |
50 | query.resources << "foobar"; | 50 | query.resources << "foobar"; |
51 | query.syncOnDemand = false; | ||
52 | query.processAll = false; | ||
53 | query.liveQuery = true; | 51 | query.liveQuery = true; |
54 | 52 | ||
55 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 53 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
@@ -70,8 +68,6 @@ private Q_SLOTS: | |||
70 | //Test | 68 | //Test |
71 | Akonadi2::Query query; | 69 | Akonadi2::Query query; |
72 | query.resources << "org.kde.dummy.instance1"; | 70 | query.resources << "org.kde.dummy.instance1"; |
73 | query.syncOnDemand = false; | ||
74 | query.processAll = false; | ||
75 | query.liveQuery = true; | 71 | query.liveQuery = true; |
76 | 72 | ||
77 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 73 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
@@ -91,12 +87,10 @@ private Q_SLOTS: | |||
91 | //Test | 87 | //Test |
92 | Akonadi2::Query query; | 88 | Akonadi2::Query query; |
93 | query.resources << "org.kde.dummy.instance1"; | 89 | query.resources << "org.kde.dummy.instance1"; |
94 | query.syncOnDemand = false; | ||
95 | query.processAll = true; | ||
96 | query.liveQuery = false; | 90 | query.liveQuery = false; |
97 | 91 | ||
98 | //Ensure all local data is processed | 92 | //Ensure all local data is processed |
99 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 93 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
100 | 94 | ||
101 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data | 95 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data |
102 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 96 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); |
@@ -150,8 +144,6 @@ private Q_SLOTS: | |||
150 | //Test | 144 | //Test |
151 | Akonadi2::Query query; | 145 | Akonadi2::Query query; |
152 | query.resources << "org.kde.dummy.instance1"; | 146 | query.resources << "org.kde.dummy.instance1"; |
153 | query.syncOnDemand = false; | ||
154 | query.processAll = false; | ||
155 | query.liveQuery = true; | 147 | query.liveQuery = true; |
156 | 148 | ||
157 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 149 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
@@ -171,11 +163,9 @@ private Q_SLOTS: | |||
171 | 163 | ||
172 | Akonadi2::Query query; | 164 | Akonadi2::Query query; |
173 | query.resources << "org.kde.dummy.instance1"; | 165 | query.resources << "org.kde.dummy.instance1"; |
174 | query.syncOnDemand = false; | ||
175 | query.processAll = true; | ||
176 | 166 | ||
177 | //Ensure all local data is processed | 167 | //Ensure all local data is processed |
178 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 168 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
179 | 169 | ||
180 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 170 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); |
181 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 171 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
@@ -192,12 +182,10 @@ private Q_SLOTS: | |||
192 | //Test | 182 | //Test |
193 | Akonadi2::Query query; | 183 | Akonadi2::Query query; |
194 | query.resources << "org.kde.dummy.instance1"; | 184 | query.resources << "org.kde.dummy.instance1"; |
195 | query.syncOnDemand = false; | ||
196 | query.processAll = true; | ||
197 | query.parentProperty = "parent"; | 185 | query.parentProperty = "parent"; |
198 | 186 | ||
199 | //Ensure all local data is processed | 187 | //Ensure all local data is processed |
200 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 188 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
201 | 189 | ||
202 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data | 190 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data |
203 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 191 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); |
@@ -222,13 +210,11 @@ private Q_SLOTS: | |||
222 | //Test | 210 | //Test |
223 | Akonadi2::Query query; | 211 | Akonadi2::Query query; |
224 | query.resources << "org.kde.dummy.instance1"; | 212 | query.resources << "org.kde.dummy.instance1"; |
225 | query.syncOnDemand = false; | ||
226 | query.processAll = true; | ||
227 | query.liveQuery = false; | 213 | query.liveQuery = false; |
228 | query.propertyFilter.insert("uid", "test1"); | 214 | query.propertyFilter.insert("uid", "test1"); |
229 | 215 | ||
230 | //Ensure all local data is processed | 216 | //Ensure all local data is processed |
231 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 217 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
232 | 218 | ||
233 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 219 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
234 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 220 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); |
@@ -246,11 +232,9 @@ private Q_SLOTS: | |||
246 | 232 | ||
247 | Akonadi2::Query query; | 233 | Akonadi2::Query query; |
248 | query.resources << "org.kde.dummy.instance1"; | 234 | query.resources << "org.kde.dummy.instance1"; |
249 | query.syncOnDemand = false; | ||
250 | query.processAll = true; | ||
251 | 235 | ||
252 | //Ensure all local data is processed | 236 | //Ensure all local data is processed |
253 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 237 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
254 | 238 | ||
255 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 239 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); |
256 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 240 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
@@ -268,13 +252,10 @@ private Q_SLOTS: | |||
268 | //Test | 252 | //Test |
269 | Akonadi2::Query query; | 253 | Akonadi2::Query query; |
270 | query.resources << "org.kde.dummy.instance1"; | 254 | query.resources << "org.kde.dummy.instance1"; |
271 | query.syncOnDemand = false; | ||
272 | query.processAll = true; | ||
273 | query.liveQuery = false; | ||
274 | query.propertyFilter.insert("folder", folderEntity->identifier()); | 255 | query.propertyFilter.insert("folder", folderEntity->identifier()); |
275 | 256 | ||
276 | //Ensure all local data is processed | 257 | //Ensure all local data is processed |
277 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 258 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
278 | 259 | ||
279 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 260 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
280 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 261 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); |