summaryrefslogtreecommitdiffstats
path: root/common/modelresult.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-20 09:34:12 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-20 09:34:12 +0100
commit6625bb5a2145008ad47ae963e1546714b7342bf0 (patch)
tree0129dc3c1fb3de7a650b42bd9b7690c62aa20156 /common/modelresult.cpp
parent5f7242abda42a1554dfa381a444979beb4c6d289 (diff)
downloadsink-6625bb5a2145008ad47ae963e1546714b7342bf0.tar.gz
sink-6625bb5a2145008ad47ae963e1546714b7342bf0.zip
Return false once we cannot fetch more
Diffstat (limited to 'common/modelresult.cpp')
-rw-r--r--common/modelresult.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/modelresult.cpp b/common/modelresult.cpp
index ed77ebb..34e6dfc 100644
--- a/common/modelresult.cpp
+++ b/common/modelresult.cpp
@@ -167,7 +167,7 @@ template <class T, class Ptr>
167bool ModelResult<T, Ptr>::canFetchMore(const QModelIndex &parent) const 167bool ModelResult<T, Ptr>::canFetchMore(const QModelIndex &parent) const
168{ 168{
169 const auto id = parent.internalId(); 169 const auto id = parent.internalId();
170 return !mEntityChildrenFetched.contains(id) || mEntityChildrenFetchComplete.contains(id); 170 return !mEntityChildrenFetched.contains(id) || !mEntityChildrenFetchComplete.contains(id);
171} 171}
172 172
173template <class T, class Ptr> 173template <class T, class Ptr>
@@ -187,8 +187,12 @@ void ModelResult<T, Ptr>::add(const Ptr &value)
187 SinkTrace() << "Too early" << id; 187 SinkTrace() << "Too early" << id;
188 return; 188 return;
189 } 189 }
190 if (mEntities.contains(childId)) {
191 SinkWarning() << "Entity already in model: " << value->identifier();
192 return;
193 }
190 auto parent = createIndexFromId(id); 194 auto parent = createIndexFromId(id);
191 SinkTrace() << "Added entity " << childId << value->identifier() << id; 195 SinkTrace() << "Added entity " << childId << "id: " << value->identifier() << "parent: " << id;
192 const auto keys = mTree[id]; 196 const auto keys = mTree[id];
193 int index = 0; 197 int index = 0;
194 for (; index < keys.size(); index++) { 198 for (; index < keys.size(); index++) {
@@ -196,10 +200,6 @@ void ModelResult<T, Ptr>::add(const Ptr &value)
196 break; 200 break;
197 } 201 }
198 } 202 }
199 if (mEntities.contains(childId)) {
200 SinkWarning() << "Entity already in model " << value->identifier();
201 return;
202 }
203 // SinkTrace() << "Inserting rows " << index << parent; 203 // SinkTrace() << "Inserting rows " << index << parent;
204 beginInsertRows(parent, index, index); 204 beginInsertRows(parent, index, index);
205 mEntities.insert(childId, value); 205 mEntities.insert(childId, value);