diff options
-rw-r--r-- | common/domain/applicationdomaintype.h | 4 | ||||
-rw-r--r-- | common/storage.h | 6 | ||||
-rw-r--r-- | common/store.cpp | 2 | ||||
-rw-r--r-- | common/synchronizer.cpp | 5 | ||||
-rw-r--r-- | common/synchronizer.h | 5 | ||||
-rw-r--r-- | examples/imapresource/imapresource.cpp | 2 |
6 files changed, 15 insertions, 9 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index aa6a192..d84bda4 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -321,8 +321,6 @@ struct SINK_EXPORT SinkAccount : public ApplicationDomainType { | |||
321 | SINK_PROPERTY(QString, Icon, icon); | 321 | SINK_PROPERTY(QString, Icon, icon); |
322 | SINK_PROPERTY(QString, AccountType, type); | 322 | SINK_PROPERTY(QString, AccountType, type); |
323 | SINK_STATUS_PROPERTY(int, Status, status); | 323 | SINK_STATUS_PROPERTY(int, Status, status); |
324 | SINK_STATUS_PROPERTY(ApplicationDomain::Error, Error, error); | ||
325 | SINK_STATUS_PROPERTY(ApplicationDomain::Progress, Progress, progress); | ||
326 | }; | 324 | }; |
327 | 325 | ||
328 | 326 | ||
@@ -344,8 +342,6 @@ struct SINK_EXPORT SinkResource : public ApplicationDomainType { | |||
344 | SINK_PROPERTY(QByteArray, ResourceType, type); | 342 | SINK_PROPERTY(QByteArray, ResourceType, type); |
345 | SINK_PROPERTY(QByteArrayList, Capabilities, capabilities); | 343 | SINK_PROPERTY(QByteArrayList, Capabilities, capabilities); |
346 | SINK_STATUS_PROPERTY(int, Status, status); | 344 | SINK_STATUS_PROPERTY(int, Status, status); |
347 | SINK_STATUS_PROPERTY(ApplicationDomain::Error, Error, error); | ||
348 | SINK_STATUS_PROPERTY(ApplicationDomain::Progress, Progress, progress); | ||
349 | }; | 345 | }; |
350 | 346 | ||
351 | struct SINK_EXPORT Entity : public ApplicationDomainType { | 347 | struct SINK_EXPORT Entity : public ApplicationDomainType { |
diff --git a/common/storage.h b/common/storage.h index fd349f3..589c738 100644 --- a/common/storage.h +++ b/common/storage.h | |||
@@ -128,14 +128,14 @@ public: | |||
128 | public: | 128 | public: |
129 | Transaction(); | 129 | Transaction(); |
130 | ~Transaction(); | 130 | ~Transaction(); |
131 | bool commit(const std::function<void(const DataStore::Error &error)> &errorHandler = std::function<void(const DataStore::Error &error)>()); | 131 | bool commit(const std::function<void(const DataStore::Error &error)> &errorHandler = {}); |
132 | void abort(); | 132 | void abort(); |
133 | 133 | ||
134 | QList<QByteArray> getDatabaseNames() const; | 134 | QList<QByteArray> getDatabaseNames() const; |
135 | bool validateNamedDatabases(); | 135 | bool validateNamedDatabases(); |
136 | 136 | ||
137 | NamedDatabase openDatabase(const QByteArray &name = QByteArray("default"), | 137 | NamedDatabase openDatabase(const QByteArray &name = {"default"}, |
138 | const std::function<void(const DataStore::Error &error)> &errorHandler = std::function<void(const DataStore::Error &error)>(), bool allowDuplicates = false) const; | 138 | const std::function<void(const DataStore::Error &error)> &errorHandler = {}, bool allowDuplicates = false) const; |
139 | 139 | ||
140 | Transaction(Transaction &&other); | 140 | Transaction(Transaction &&other); |
141 | Transaction &operator=(Transaction &&other); | 141 | Transaction &operator=(Transaction &&other); |
diff --git a/common/store.cpp b/common/store.cpp index 8c0a985..d266098 100644 --- a/common/store.cpp +++ b/common/store.cpp | |||
@@ -251,7 +251,7 @@ KAsync::Job<void> Store::remove(const Sink::Query &query) | |||
251 | KAsync::Job<void> Store::removeDataFromDisk(const QByteArray &identifier) | 251 | KAsync::Job<void> Store::removeDataFromDisk(const QByteArray &identifier) |
252 | { | 252 | { |
253 | // All databases are going to become invalid, nuke the environments | 253 | // All databases are going to become invalid, nuke the environments |
254 | // TODO: all clients should react to a notification the resource | 254 | // TODO: all clients should react to a notification from the resource |
255 | Sink::Storage::DataStore::clearEnv(); | 255 | Sink::Storage::DataStore::clearEnv(); |
256 | SinkTrace() << "Remove data from disk " << identifier; | 256 | SinkTrace() << "Remove data from disk " << identifier; |
257 | auto time = QSharedPointer<QTime>::create(); | 257 | auto time = QSharedPointer<QTime>::create(); |
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index d3de20b..e004d64 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp | |||
@@ -303,6 +303,11 @@ void Synchronizer::emitNotification(Notification::NoticationType type, int code, | |||
303 | emit notify(n); | 303 | emit notify(n); |
304 | } | 304 | } |
305 | 305 | ||
306 | void Synchronizer::reportProgress(int progress, int total) | ||
307 | { | ||
308 | SinkLogCtx(mLogCtx) << "Progress: " << progress << " out of " << total; | ||
309 | } | ||
310 | |||
306 | KAsync::Job<void> Synchronizer::processRequest(const SyncRequest &request) | 311 | KAsync::Job<void> Synchronizer::processRequest(const SyncRequest &request) |
307 | { | 312 | { |
308 | if (request.options & SyncRequest::RequestFlush) { | 313 | if (request.options & SyncRequest::RequestFlush) { |
diff --git a/common/synchronizer.h b/common/synchronizer.h index 751542d..32e93c4 100644 --- a/common/synchronizer.h +++ b/common/synchronizer.h | |||
@@ -184,6 +184,11 @@ protected: | |||
184 | 184 | ||
185 | void emitNotification(Notification::NoticationType type, int code, const QString &message, const QByteArray &id = QByteArray{}, const QByteArrayList &entiteis = QByteArrayList{}); | 185 | void emitNotification(Notification::NoticationType type, int code, const QString &message, const QByteArray &id = QByteArray{}, const QByteArrayList &entiteis = QByteArrayList{}); |
186 | 186 | ||
187 | /** | ||
188 | * Report progress for current task | ||
189 | */ | ||
190 | void reportProgress(int progress, int total); | ||
191 | |||
187 | protected: | 192 | protected: |
188 | Sink::Log::Context mLogCtx; | 193 | Sink::Log::Context mLogCtx; |
189 | 194 | ||
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index 175f75a..e74a8f1 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp | |||
@@ -542,7 +542,7 @@ public: | |||
542 | synchronizeMails(folderRemoteId, m); | 542 | synchronizeMails(folderRemoteId, m); |
543 | }, | 543 | }, |
544 | [=](int progress, int total) { | 544 | [=](int progress, int total) { |
545 | SinkLogCtx(mLogCtx) << "Progress: " << progress << " out of " << total; | 545 | reportProgress(progress, total); |
546 | //commit every 100 messages | 546 | //commit every 100 messages |
547 | if ((progress % 100) == 0) { | 547 | if ((progress % 100) == 0) { |
548 | commit(); | 548 | commit(); |