summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/domain/applicationdomaintype.h12
-rw-r--r--common/notification.h16
-rw-r--r--common/synchronizer.cpp3
-rw-r--r--examples/imapresource/imapresource.cpp4
-rw-r--r--examples/mailtransportresource/mailtransportresource.cpp4
5 files changed, 18 insertions, 21 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h
index 8ff3e8b..ae8e6bc 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -92,6 +92,18 @@
92namespace Sink { 92namespace Sink {
93namespace ApplicationDomain { 93namespace ApplicationDomain {
94 94
95enum ErrorCode {
96 NoError = 0,
97 UnknownError,
98 NoServerError,
99 LoginError,
100 TransmissionError,
101};
102
103enum SuccessCode {
104 TransmissionSuccess
105};
106
95struct SINK_EXPORT Error { 107struct SINK_EXPORT Error {
96 108
97}; 109};
diff --git a/common/notification.h b/common/notification.h
index 87c22db..4b52274 100644
--- a/common/notification.h
+++ b/common/notification.h
@@ -49,22 +49,6 @@ public:
49 Success = 0, 49 Success = 0,
50 Failure 50 Failure
51 }; 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 };
68 52
69 QByteArray id; 53 QByteArray id;
70 int type = 0; 54 int type = 0;
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp
index ff13783..4ed6e3a 100644
--- a/common/synchronizer.cpp
+++ b/common/synchronizer.cpp
@@ -391,7 +391,7 @@ KAsync::Job<void> Synchronizer::processSyncQueue()
391 mSyncInProgress = true; 391 mSyncInProgress = true;
392 }) 392 })
393 .then(processRequest(request)) 393 .then(processRequest(request))
394 .then<void>([this](const KAsync::Error &error) { 394 .then<void>([this, request](const KAsync::Error &error) {
395 SinkTraceCtx(mLogCtx) << "Sync request processed"; 395 SinkTraceCtx(mLogCtx) << "Sync request processed";
396 mEntityStore->abortTransaction(); 396 mEntityStore->abortTransaction();
397 mSyncTransaction.abort(); 397 mSyncTransaction.abort();
@@ -403,6 +403,7 @@ KAsync::Job<void> Synchronizer::processSyncQueue()
403 } 403 }
404 if (error) { 404 if (error) {
405 SinkWarningCtx(mLogCtx) << "Error during sync: " << error; 405 SinkWarningCtx(mLogCtx) << "Error during sync: " << error;
406 emitNotification(Notification::Error, error.errorCode, error.errorMessage, request.requestId);
406 } 407 }
407 //In case we got more requests meanwhile. 408 //In case we got more requests meanwhile.
408 return processSyncQueue(); 409 return processSyncQueue();
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp
index fff4dc7..b27c2b2 100644
--- a/examples/imapresource/imapresource.cpp
+++ b/examples/imapresource/imapresource.cpp
@@ -488,7 +488,7 @@ public:
488 SinkWarning() << "Error during folder sync: " << error.errorMessage; 488 SinkWarning() << "Error during folder sync: " << error.errorMessage;
489 } 489 }
490 return imap->logout() 490 return imap->logout()
491 .then(KAsync::error(error)); 491 .then(KAsync::error(ApplicationDomain::LoginError, error.errorMessage));
492 }); 492 });
493 } else if (query.type() == ApplicationDomain::getTypeName<ApplicationDomain::Mail>()) { 493 } else if (query.type() == ApplicationDomain::getTypeName<ApplicationDomain::Mail>()) {
494 //TODO 494 //TODO
@@ -560,7 +560,7 @@ public:
560 SinkWarning() << "Error during sync: " << error.errorMessage; 560 SinkWarning() << "Error during sync: " << error.errorMessage;
561 } 561 }
562 return imap->logout() 562 return imap->logout()
563 .then(KAsync::error(error)); 563 .then(KAsync::error(ApplicationDomain::LoginError, error.errorMessage));
564 }); 564 });
565 } 565 }
566 return KAsync::error<void>("Nothing to do"); 566 return KAsync::error<void>("Nothing to do");
diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp
index 72fe59d..6beb4e8 100644
--- a/examples/mailtransportresource/mailtransportresource.cpp
+++ b/examples/mailtransportresource/mailtransportresource.cpp
@@ -81,10 +81,10 @@ public:
81 } 81 }
82 if (!MailTransport::sendMessage(msg, settings.server.toUtf8(), settings.username.toUtf8(), settings.password.toUtf8(), settings.cacert.toUtf8(), options)) { 82 if (!MailTransport::sendMessage(msg, settings.server.toUtf8(), settings.username.toUtf8(), settings.password.toUtf8(), settings.cacert.toUtf8(), options)) {
83 SinkWarning() << "Failed to send message: " << mail; 83 SinkWarning() << "Failed to send message: " << mail;
84 emitNotification(Notification::Warning, Notification::TransmissionFailed, "Failed to send message."); 84 emitNotification(Notification::Warning, ApplicationDomain::TransmissionError, "Failed to send message.");
85 return KAsync::error("Failed to send the message."); 85 return KAsync::error("Failed to send the message.");
86 } else { 86 } else {
87 emitNotification(Notification::Info, Notification::TransmissionSucceeded, "Message successfully sent."); 87 emitNotification(Notification::Info, ApplicationDomain::TransmissionSuccess, "Message successfully sent.");
88 } 88 }
89 } 89 }
90 syncStore().writeValue(mail.identifier(), "sent"); 90 syncStore().writeValue(mail.identifier(), "sent");