diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-24 22:15:18 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-24 22:15:18 +0100 |
commit | 9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a (patch) | |
tree | 41fef7daac9e5ae64d61452a3f38c82243d29fdd /common/domain | |
parent | 84d70933c0cd0987d5fee5a78f413fec82bb1288 (diff) | |
download | sink-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.h | 48 |
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 @@ | |||
93 | namespace Sink { | 93 | namespace Sink { |
94 | namespace ApplicationDomain { | 94 | namespace ApplicationDomain { |
95 | 95 | ||
96 | enum ErrorCode { | 96 | enum 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 | ||
104 | enum SuccessCode { | 104 | enum SINK_EXPORT SuccessCode { |
105 | TransmissionSuccess | 105 | TransmissionSuccess |
106 | }; | 106 | }; |
107 | 107 | ||
108 | enum 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 | */ | ||
124 | enum SINK_EXPORT Status { | ||
125 | OfflineStatus, | ||
126 | ConnectedStatus, | ||
127 | BusyStatus, | ||
128 | ErrorStatus | ||
129 | }; | ||
130 | |||
108 | struct SINK_EXPORT Error { | 131 | struct 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 | */ | ||
116 | struct BLOB { | 144 | struct 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 | ||
411 | SINK_EXPORT QDebug operator<< (QDebug d, const Mail::Contact &c); | 439 | SINK_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 | */ | ||
422 | enum SINK_EXPORT Status { | ||
423 | OfflineStatus, | ||
424 | ConnectedStatus, | ||
425 | BusyStatus, | ||
426 | ErrorStatus | ||
427 | }; | ||
428 | |||
429 | struct SINK_EXPORT Identity : public ApplicationDomainType { | 441 | struct 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; |