From 1fe8664ec74165fc3f250098609ea0e049e3adc8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 22 Dec 2016 13:46:13 +0100 Subject: Better query debug output --- common/query.cpp | 13 ++++++++++++- common/query.h | 11 +++++++++++ common/standardqueries.h | 3 +++ 3 files changed, 26 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/query.cpp b/common/query.cpp index 14acde0..940c596 100644 --- a/common/query.cpp +++ b/common/query.cpp @@ -39,9 +39,19 @@ QDebug operator<<(QDebug dbg, const Sink::QueryBase::Comparator &c) return dbg.space(); } +QDebug operator<<(QDebug dbg, const Sink::QueryBase::Filter &filter) +{ + if (filter.ids.isEmpty()) { + dbg.nospace() << "Filter(" << filter.propertyFilter << ")"; + } else { + dbg.nospace() << "Filter(" << filter.ids << ")"; + } + return dbg.maybeSpace(); +} + QDebug operator<<(QDebug dbg, const Sink::QueryBase &query) { - dbg.nospace() << "Query [" << query.type() << "]\n"; + dbg.nospace() << "Query [" << query.type() << "] << Id: " << query.id() << "\n"; dbg.nospace() << " Filter: " << query.getBaseFilters() << "\n"; dbg.nospace() << " Ids: " << query.ids() << "\n"; dbg.nospace() << " Sorting: " << query.sortProperty() << "\n"; @@ -54,6 +64,7 @@ QDebug operator<<(QDebug dbg, const Sink::Query &query) dbg.nospace() << " Requested: " << query.requestedProperties << "\n"; dbg.nospace() << " Parent: " << query.parentProperty() << "\n"; dbg.nospace() << " IsLive: " << query.liveQuery() << "\n"; + dbg.nospace() << " ResourceFilter: " << query.getResourceFilter() << "\n"; return dbg.maybeSpace(); } diff --git a/common/query.h b/common/query.h index c265f92..e1d5f1c 100644 --- a/common/query.h +++ b/common/query.h @@ -82,6 +82,16 @@ public: return hasFilter(T::name); } + void setId(const QByteArray &id) + { + mId = id; + } + + QByteArray id() const + { + return mId; + } + void setBaseFilters(const QHash &filter) { mBaseFilterStage.propertyFilter = filter; @@ -275,6 +285,7 @@ private: QList> mFilterStages; QByteArray mType; QByteArray mSortProperty; + QByteArray mId; }; /** diff --git a/common/standardqueries.h b/common/standardqueries.h index ccb02a2..70e03cb 100644 --- a/common/standardqueries.h +++ b/common/standardqueries.h @@ -30,6 +30,7 @@ namespace StandardQueries { static Query completeThread(const ApplicationDomain::Mail &mail) { Sink::Query query; + query.setId("completethread"); if (!mail.resourceInstanceIdentifier().isEmpty()) { query.resourceFilter(mail.resourceInstanceIdentifier()); } @@ -45,6 +46,7 @@ namespace StandardQueries { static Query threadLeaders(const ApplicationDomain::Folder &folder) { Sink::Query query; + query.setId("threadleaders"); if (!folder.resourceInstanceIdentifier().isEmpty()) { query.resourceFilter(folder.resourceInstanceIdentifier()); } @@ -63,6 +65,7 @@ namespace StandardQueries { static Query outboxMails() { Sink::Query query; + query.setId("outbox"); query.resourceContainsFilter(ApplicationDomain::ResourceCapabilities::Mail::transport); query.sort(); return query; -- cgit v1.2.3