diff options
Diffstat (limited to 'common/query.h')
-rw-r--r-- | common/query.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/common/query.h b/common/query.h index 8e9050d..5b37cdd 100644 --- a/common/query.h +++ b/common/query.h | |||
@@ -300,7 +300,9 @@ public: | |||
300 | /** Leave the query running and continuously update the result set. */ | 300 | /** Leave the query running and continuously update the result set. */ |
301 | LiveQuery = 1, | 301 | LiveQuery = 1, |
302 | /** Run the query synchronously. */ | 302 | /** Run the query synchronously. */ |
303 | SynchronousQuery = 2 | 303 | SynchronousQuery = 2, |
304 | /** Include status updates via notifications */ | ||
305 | UpdateStatus = 4 | ||
304 | }; | 306 | }; |
305 | Q_DECLARE_FLAGS(Flags, Flag) | 307 | Q_DECLARE_FLAGS(Flags, Flag) |
306 | 308 | ||
@@ -410,6 +412,11 @@ public: | |||
410 | mFlags = flags; | 412 | mFlags = flags; |
411 | } | 413 | } |
412 | 414 | ||
415 | Flags flags() const | ||
416 | { | ||
417 | return mFlags; | ||
418 | } | ||
419 | |||
413 | bool liveQuery() const | 420 | bool liveQuery() const |
414 | { | 421 | { |
415 | return mFlags.testFlag(LiveQuery); | 422 | return mFlags.testFlag(LiveQuery); |
@@ -509,6 +516,31 @@ public: | |||
509 | } | 516 | } |
510 | 517 | ||
511 | template <typename T> | 518 | template <typename T> |
519 | SyncScope &resourceFilter(const ApplicationDomain::ApplicationDomainType &entity) | ||
520 | { | ||
521 | mResourceFilter.propertyFilter.insert(T::name, Comparator(entity.identifier())); | ||
522 | return *this; | ||
523 | } | ||
524 | |||
525 | SyncScope &resourceFilter(const QByteArray &name, const Comparator &comparator) | ||
526 | { | ||
527 | mResourceFilter.propertyFilter.insert(name, comparator); | ||
528 | return *this; | ||
529 | } | ||
530 | |||
531 | template <typename T> | ||
532 | SyncScope &resourceContainsFilter(const QVariant &value) | ||
533 | { | ||
534 | return resourceFilter(T::name, Comparator(value, Comparator::Contains)); | ||
535 | } | ||
536 | |||
537 | template <typename T> | ||
538 | SyncScope &resourceFilter(const QVariant &value) | ||
539 | { | ||
540 | return resourceFilter(T::name, value); | ||
541 | } | ||
542 | |||
543 | template <typename T> | ||
512 | SyncScope &filter(const Query::Comparator &comparator) | 544 | SyncScope &filter(const Query::Comparator &comparator) |
513 | { | 545 | { |
514 | return filter(T::name, comparator); | 546 | return filter(T::name, comparator); |