summaryrefslogtreecommitdiffstats
path: root/common/synclistresult.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/synclistresult.h')
-rw-r--r--common/synclistresult.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/synclistresult.h b/common/synclistresult.h
index 5fa0efd..0a86f8c 100644
--- a/common/synclistresult.h
+++ b/common/synclistresult.h
@@ -19,20 +19,21 @@ class SyncListResult : public QList<T> {
19public: 19public:
20 SyncListResult(const QSharedPointer<ResultEmitter<T> > &emitter) 20 SyncListResult(const QSharedPointer<ResultEmitter<T> > &emitter)
21 :QList<T>(), 21 :QList<T>(),
22 mComplete(false),
23 mEmitter(emitter) 22 mEmitter(emitter)
24 { 23 {
25 emitter->onAdded([this](const T &value) { 24 emitter->onAdded([this](const T &value) {
26 this->append(value); 25 this->append(value);
27 }); 26 });
28 emitter->onComplete([this]() { 27 emitter->onInitialResultSetComplete([this]() {
29 mComplete = true;
30 if (eventLoopAborter) { 28 if (eventLoopAborter) {
31 eventLoopAborter(); 29 eventLoopAborter();
32 //Be safe in case of a second invocation of the complete handler 30 //Be safe in case of a second invocation of the complete handler
33 eventLoopAborter = std::function<void()>(); 31 eventLoopAborter = std::function<void()>();
34 } 32 }
35 }); 33 });
34 emitter->onComplete([this]() {
35 mEmitter.clear();
36 });
36 emitter->onClear([this]() { 37 emitter->onClear([this]() {
37 this->clear(); 38 this->clear();
38 }); 39 });
@@ -46,7 +47,6 @@ public:
46 } 47 }
47 48
48private: 49private:
49 bool mComplete;
50 QSharedPointer<ResultEmitter<T> > mEmitter; 50 QSharedPointer<ResultEmitter<T> > mEmitter;
51 std::function<void()> eventLoopAborter; 51 std::function<void()> eventLoopAborter;
52}; 52};