summaryrefslogtreecommitdiffstats
path: root/common/domain
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-24 22:15:18 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-24 22:15:18 +0100
commit9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a (patch)
tree41fef7daac9e5ae64d61452a3f38c82243d29fdd /common/domain
parent84d70933c0cd0987d5fee5a78f413fec82bb1288 (diff)
downloadsink-9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a.tar.gz
sink-9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a.zip
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.
Diffstat (limited to 'common/domain')
-rw-r--r--common/domain/applicationdomaintype.h48
1 files changed, 30 insertions, 18 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h
index ef38d58..6fd2b90 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -93,7 +93,7 @@
93namespace Sink { 93namespace Sink {
94namespace ApplicationDomain { 94namespace ApplicationDomain {
95 95
96enum ErrorCode { 96enum SINK_EXPORT ErrorCode {
97 NoError = 0, 97 NoError = 0,
98 UnknownError, 98 UnknownError,
99 NoServerError, 99 NoServerError,
@@ -101,10 +101,33 @@ enum ErrorCode {
101 TransmissionError, 101 TransmissionError,
102}; 102};
103 103
104enum SuccessCode { 104enum SINK_EXPORT SuccessCode {
105 TransmissionSuccess 105 TransmissionSuccess
106}; 106};
107 107
108enum SINK_EXPORT SyncStatus {
109 NoSyncStatus,
110 SyncInProgress,
111 SyncError,
112 SyncSuccess
113};
114
115/**
116 * The status of an account or resource.
117 *
118 * It is set as follows:
119 * * By default the status is offline.
120 * * If a connection to the server could be established the status is Connected.
121 * * If an error occurred that keeps the resource from operating (so non transient), the resource enters the error state.
122 * * If a long running operation is started the resource goes to the busy state (and return to the previous state after that).
123 */
124enum SINK_EXPORT Status {
125 OfflineStatus,
126 ConnectedStatus,
127 BusyStatus,
128 ErrorStatus
129};
130
108struct SINK_EXPORT Error { 131struct SINK_EXPORT Error {
109 132
110}; 133};
@@ -113,6 +136,11 @@ struct SINK_EXPORT Progress {
113 136
114}; 137};
115 138
139/**
140 * Internal type.
141 *
142 * Represents a BLOB property.
143 */
116struct BLOB { 144struct BLOB {
117 BLOB() = default; 145 BLOB() = default;
118 BLOB(const BLOB &) = default; 146 BLOB(const BLOB &) = default;
@@ -410,22 +438,6 @@ struct SINK_EXPORT Mail : public Entity {
410 438
411SINK_EXPORT QDebug operator<< (QDebug d, const Mail::Contact &c); 439SINK_EXPORT QDebug operator<< (QDebug d, const Mail::Contact &c);
412 440
413/**
414 * The status of an account or resource.
415 *
416 * It is set as follows:
417 * * By default the status is offline.
418 * * If a connection to the server could be established the status is Connected.
419 * * If an error occurred that keeps the resource from operating (so non transient), the resource enters the error state.
420 * * If a long running operation is started the resource goes to the busy state (and return to the previous state after that).
421 */
422enum SINK_EXPORT Status {
423 OfflineStatus,
424 ConnectedStatus,
425 BusyStatus,
426 ErrorStatus
427};
428
429struct SINK_EXPORT Identity : public ApplicationDomainType { 441struct SINK_EXPORT Identity : public ApplicationDomainType {
430 static constexpr const char *name = "identity"; 442 static constexpr const char *name = "identity";
431 typedef QSharedPointer<Identity> Ptr; 443 typedef QSharedPointer<Identity> Ptr;