diff options
Diffstat (limited to 'common/modelresult.cpp')
-rw-r--r-- | common/modelresult.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/common/modelresult.cpp b/common/modelresult.cpp index 935e2e8..65eaba9 100644 --- a/common/modelresult.cpp +++ b/common/modelresult.cpp | |||
@@ -183,6 +183,28 @@ void ModelResult<T, Ptr>::setFetcher(const std::function<void(const Ptr &parent) | |||
183 | } | 183 | } |
184 | 184 | ||
185 | template<class T, class Ptr> | 185 | template<class T, class Ptr> |
186 | void ModelResult<T, Ptr>::setEmitter(const typename Akonadi2::ResultEmitter<Ptr>::Ptr &emitter) | ||
187 | { | ||
188 | setFetcher(emitter->mFetcher); | ||
189 | emitter->onAdded([this](const Ptr &value) { | ||
190 | this->add(value); | ||
191 | }); | ||
192 | emitter->onModified([this](const Ptr &value) { | ||
193 | this->modify(value); | ||
194 | }); | ||
195 | emitter->onRemoved([this](const Ptr &value) { | ||
196 | this->remove(value); | ||
197 | }); | ||
198 | emitter->onInitialResultSetComplete([this]() { | ||
199 | }); | ||
200 | emitter->onComplete([this]() { | ||
201 | }); | ||
202 | emitter->onClear([this]() { | ||
203 | }); | ||
204 | mEmitter = emitter; | ||
205 | } | ||
206 | |||
207 | template<class T, class Ptr> | ||
186 | void ModelResult<T, Ptr>::modify(const Ptr &value) | 208 | void ModelResult<T, Ptr>::modify(const Ptr &value) |
187 | { | 209 | { |
188 | auto childId = qHash(value->identifier()); | 210 | auto childId = qHash(value->identifier()); |