From 9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 24 Mar 2017 22:15:18 +0100 Subject: Implemented notification support in the model. This will allow us to fold things like progress and sync status directly into the model. Usecases are mail download progress and folder sync progress. Ideally we would also solve the resource/account state through this. --- common/modelresult.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'common/modelresult.h') diff --git a/common/modelresult.h b/common/modelresult.h index f30a8e1..cc263cf 100644 --- a/common/modelresult.h +++ b/common/modelresult.h @@ -30,15 +30,23 @@ #include "resultprovider.h" #include "threadboundary.h" +namespace Sink { +class Notifier; +} + template class ModelResult : public QAbstractItemModel { public: + //Update the copy in store.h as well if you modify this enum Roles { DomainObjectRole = Qt::UserRole + 1, ChildrenFetchedRole, - DomainObjectBaseRole + DomainObjectBaseRole, + StatusRole, //ApplicationDomain::SyncStatus + WarningRole, //ApplicationDomain::Warning, only if status == warning || status == error + ProgressRole //ApplicationDomain::Progress }; ModelResult(const Sink::Query &query, const QList &propertyColumns, const Sink::Log::Context &); @@ -77,9 +85,11 @@ private: QSet mEntityChildrenFetched; QSet mEntityChildrenFetchComplete; QSet mEntityAllChildrenFetched; + QMap mEntityStatus; QList mPropertyColumns; Sink::Query mQuery; std::function loadEntities; typename Sink::ResultEmitter::Ptr mEmitter; async::ThreadBoundary threadBoundary; + QScopedPointer mNotifier; }; -- cgit v1.2.3