diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-10-09 18:51:04 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-10-10 10:40:01 +0200 |
commit | 6f1d3437b3bdd3ccde1243ceddf19f0c0fb5afda (patch) | |
tree | 0c90df67eac827d5166158c1f7055d00cf39425d /common/synclistresult.h | |
parent | 4f1ec5deaf3205e4d71dcb0ff35a29cfbb2c8ec1 (diff) | |
download | sink-6f1d3437b3bdd3ccde1243ceddf19f0c0fb5afda.tar.gz sink-6f1d3437b3bdd3ccde1243ceddf19f0c0fb5afda.zip |
Modification and removal in results
Now we just need to ensure that equality is tested using the
ApplicationDomainType::identifier
Diffstat (limited to 'common/synclistresult.h')
-rw-r--r-- | common/synclistresult.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/synclistresult.h b/common/synclistresult.h index 865d3e0..3ae2bed 100644 --- a/common/synclistresult.h +++ b/common/synclistresult.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <functional> | 4 | #include <functional> |
5 | #include <QSharedPointer> | 5 | #include <QSharedPointer> |
6 | #include <QEventLoop> | 6 | #include <QEventLoop> |
7 | #include <QDebug> | ||
7 | #include "resultprovider.h" | 8 | #include "resultprovider.h" |
8 | 9 | ||
9 | namespace async { | 10 | namespace async { |
@@ -25,6 +26,23 @@ public: | |||
25 | emitter->onAdded([this](const T &value) { | 26 | emitter->onAdded([this](const T &value) { |
26 | this->append(value); | 27 | this->append(value); |
27 | }); | 28 | }); |
29 | emitter->onModified([this](const T &value) { | ||
30 | for (auto it = this->begin(); it != this->end(); it++) { | ||
31 | if (**it == *value) { | ||
32 | it = this->erase(it); | ||
33 | this->insert(it, value); | ||
34 | break; | ||
35 | } | ||
36 | } | ||
37 | }); | ||
38 | emitter->onRemoved([this](const T &value) { | ||
39 | for (auto it = this->begin(); it != this->end(); it++) { | ||
40 | if (**it == *value) { | ||
41 | this->erase(it); | ||
42 | break; | ||
43 | } | ||
44 | } | ||
45 | }); | ||
28 | emitter->onInitialResultSetComplete([this]() { | 46 | emitter->onInitialResultSetComplete([this]() { |
29 | if (eventLoopAborter) { | 47 | if (eventLoopAborter) { |
30 | eventLoopAborter(); | 48 | eventLoopAborter(); |