From eecf234e4fc79320fc74f2e917b9e9777f0761af Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 17 Mar 2017 14:16:43 +0100 Subject: Added notification code for mailtransport --- common/notification.h | 21 +++++++++++++++++++++ common/resourceaccess.cpp | 1 + .../mailtransportresource/mailtransportresource.cpp | 2 ++ 3 files changed, 24 insertions(+) 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: Status, Info, Warning, + Error, Progress, Inspection, RevisionUpdate, FlushCompletion }; + /** + * Used as code for Inspection type notifications + */ enum InspectionCode { Success = 0, Failure }; + /** + * Used as code for Warning/Error type notifications + */ + enum ErrorCode { + NoError = 0, + UnknownError, + NoServerAvailable, + LoginFailed, + TransmissionFailed, + }; + /** + * Used as code for Info type notifications + */ + enum SuccessCode { + TransmissionSucceeded + }; QByteArray id; int type = 0; QString message; //A return code. Zero typically indicates success. int code = 0; + QByteArray resource; }; } 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() case Sink::Notification::Progress: { auto n = getNotification(buffer); SinkTrace() << "Received notification: Type:" << n.type << "Message: " << n.message << "Code: " << n.code; + n.resource = d->resourceInstanceIdentifier; emit notification(n); } break; 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: Sink::Notification n; n.type = Notification::Warning; n.message = "Failed to send message."; + n.code = Notification::TransmissionFailed; emit notify(n); return KAsync::error("Failed to send the message."); } else { @@ -92,6 +93,7 @@ public: Sink::Notification n; n.type = Notification::Info; n.message = "Message successfully sent."; + n.code = Notification::TransmissionSucceeded; emit notify(n); } } -- cgit v1.2.3