summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/client/main.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/examples/client/main.cpp b/examples/client/main.cpp
index 8e1cc80..e0d9078 100644
--- a/examples/client/main.cpp
+++ b/examples/client/main.cpp
@@ -209,7 +209,7 @@ int main(int argc, char *argv[])
209 auto model = loadModel(type, query); 209 auto model = loadModel(type, query);
210 QObject::connect(model.data(), &QAbstractItemModel::dataChanged, [model, &app](const QModelIndex &, const QModelIndex &, const QVector<int> &roles) { 210 QObject::connect(model.data(), &QAbstractItemModel::dataChanged, [model, &app](const QModelIndex &, const QModelIndex &, const QVector<int> &roles) {
211 if (roles.contains(Akonadi2::Store::ChildrenFetchedRole)) { 211 if (roles.contains(Akonadi2::Store::ChildrenFetchedRole)) {
212 std::cout << "\tCounted results " << model->rowCount(QModelIndex()); 212 std::cout << "\tCounted results " << model->rowCount(QModelIndex()) << std::endl;
213 app.quit(); 213 app.quit();
214 } 214 }
215 }); 215 });
@@ -222,15 +222,17 @@ int main(int argc, char *argv[])
222 }).exec(); 222 }).exec();
223 app.exec(); 223 app.exec();
224 } else { 224 } else {
225 query.parentProperty = "parent";
226 query.liveQuery = true; 225 query.liveQuery = true;
226 if (type == "folder") {
227 query.parentProperty = "parent";
228 }
227 auto model = loadModel(type, query); 229 auto model = loadModel(type, query);
228 QObject::connect(model.data(), &QAbstractItemModel::rowsInserted, [model](const QModelIndex &index, int start, int end) {
229 for (int i = start; i <= end; i++) {
230 model->fetchMore(model->index(i, 0, index));
231 }
232 });
233 if (type == "folder") { 230 if (type == "folder") {
231 QObject::connect(model.data(), &QAbstractItemModel::rowsInserted, [model](const QModelIndex &index, int start, int end) {
232 for (int i = start; i <= end; i++) {
233 model->fetchMore(model->index(i, 0, index));
234 }
235 });
234 auto view = QSharedPointer<View<Akonadi2::ApplicationDomain::Folder> >::create(model.data()); 236 auto view = QSharedPointer<View<Akonadi2::ApplicationDomain::Folder> >::create(model.data());
235 app.exec(); 237 app.exec();
236 } else if (type == "mail") { 238 } else if (type == "mail") {