diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-17 14:16:43 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-17 14:16:43 +0100 |
commit | eecf234e4fc79320fc74f2e917b9e9777f0761af (patch) | |
tree | 4ec041d5d905dbc3d7be71570cab4bd2b61ff2a2 | |
parent | d40710eb005cde8c6962d6f5689bc63a4745b1c1 (diff) | |
download | sink-eecf234e4fc79320fc74f2e917b9e9777f0761af.tar.gz sink-eecf234e4fc79320fc74f2e917b9e9777f0761af.zip |
Added notification code for mailtransport
-rw-r--r-- | common/notification.h | 21 | ||||
-rw-r--r-- | common/resourceaccess.cpp | 1 | ||||
-rw-r--r-- | examples/mailtransportresource/mailtransportresource.cpp | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/common/notification.h b/common/notification.h index b67a84a..87c22db 100644 --- a/common/notification.h +++ b/common/notification.h | |||
@@ -36,21 +36,42 @@ public: | |||
36 | Status, | 36 | Status, |
37 | Info, | 37 | Info, |
38 | Warning, | 38 | Warning, |
39 | Error, | ||
39 | Progress, | 40 | Progress, |
40 | Inspection, | 41 | Inspection, |
41 | RevisionUpdate, | 42 | RevisionUpdate, |
42 | FlushCompletion | 43 | FlushCompletion |
43 | }; | 44 | }; |
45 | /** | ||
46 | * Used as code for Inspection type notifications | ||
47 | */ | ||
44 | enum InspectionCode { | 48 | enum InspectionCode { |
45 | Success = 0, | 49 | Success = 0, |
46 | Failure | 50 | Failure |
47 | }; | 51 | }; |
52 | /** | ||
53 | * Used as code for Warning/Error type notifications | ||
54 | */ | ||
55 | enum ErrorCode { | ||
56 | NoError = 0, | ||
57 | UnknownError, | ||
58 | NoServerAvailable, | ||
59 | LoginFailed, | ||
60 | TransmissionFailed, | ||
61 | }; | ||
62 | /** | ||
63 | * Used as code for Info type notifications | ||
64 | */ | ||
65 | enum SuccessCode { | ||
66 | TransmissionSucceeded | ||
67 | }; | ||
48 | 68 | ||
49 | QByteArray id; | 69 | QByteArray id; |
50 | int type = 0; | 70 | int type = 0; |
51 | QString message; | 71 | QString message; |
52 | //A return code. Zero typically indicates success. | 72 | //A return code. Zero typically indicates success. |
53 | int code = 0; | 73 | int code = 0; |
74 | QByteArray resource; | ||
54 | }; | 75 | }; |
55 | } | 76 | } |
56 | 77 | ||
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 4831c72..6f7d039 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp | |||
@@ -615,6 +615,7 @@ bool ResourceAccess::processMessageBuffer() | |||
615 | case Sink::Notification::Progress: { | 615 | case Sink::Notification::Progress: { |
616 | auto n = getNotification(buffer); | 616 | auto n = getNotification(buffer); |
617 | SinkTrace() << "Received notification: Type:" << n.type << "Message: " << n.message << "Code: " << n.code; | 617 | SinkTrace() << "Received notification: Type:" << n.type << "Message: " << n.message << "Code: " << n.code; |
618 | n.resource = d->resourceInstanceIdentifier; | ||
618 | emit notification(n); | 619 | emit notification(n); |
619 | } break; | 620 | } break; |
620 | case Sink::Notification::RevisionUpdate: | 621 | case Sink::Notification::RevisionUpdate: |
diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index cd7f4a7..a6460f1 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp | |||
@@ -85,6 +85,7 @@ public: | |||
85 | Sink::Notification n; | 85 | Sink::Notification n; |
86 | n.type = Notification::Warning; | 86 | n.type = Notification::Warning; |
87 | n.message = "Failed to send message."; | 87 | n.message = "Failed to send message."; |
88 | n.code = Notification::TransmissionFailed; | ||
88 | emit notify(n); | 89 | emit notify(n); |
89 | return KAsync::error("Failed to send the message."); | 90 | return KAsync::error("Failed to send the message."); |
90 | } else { | 91 | } else { |
@@ -92,6 +93,7 @@ public: | |||
92 | Sink::Notification n; | 93 | Sink::Notification n; |
93 | n.type = Notification::Info; | 94 | n.type = Notification::Info; |
94 | n.message = "Message successfully sent."; | 95 | n.message = "Message successfully sent."; |
96 | n.code = Notification::TransmissionSucceeded; | ||
95 | emit notify(n); | 97 | emit notify(n); |
96 | } | 98 | } |
97 | } | 99 | } |