diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-28 17:19:51 -0600 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-28 17:19:51 -0600 |
commit | 1ba34f8b16cd06a74ff96dfae803ce4b0521652b (patch) | |
tree | 7ace2b8ef72a5af1ce76d426974e148a982d2406 /common | |
parent | 7669eeecdd394e1dd9ee8c2fa06edb948a410f6b (diff) | |
download | sink-1ba34f8b16cd06a74ff96dfae803ce4b0521652b.tar.gz sink-1ba34f8b16cd06a74ff96dfae803ce4b0521652b.zip |
Detect connection lost so we can go to offline state
kimap should really have better error codes...
Diffstat (limited to 'common')
-rw-r--r-- | common/domain/applicationdomaintype.h | 1 | ||||
-rw-r--r-- | common/synchronizer.cpp | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index 518f6d5..f7fd07e 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -101,6 +101,7 @@ enum SINK_EXPORT ErrorCode { | |||
101 | LoginError, | 101 | LoginError, |
102 | ConfigurationError, | 102 | ConfigurationError, |
103 | TransmissionError, | 103 | TransmissionError, |
104 | ConnectionLostError, | ||
104 | }; | 105 | }; |
105 | 106 | ||
106 | enum SINK_EXPORT SuccessCode { | 107 | enum SINK_EXPORT SuccessCode { |
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index b6e33d5..46d3980 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp | |||
@@ -344,8 +344,11 @@ void Synchronizer::setStatusFromResult(const KAsync::Error &error, const QString | |||
344 | } else if (error.errorCode == ApplicationDomain::LoginError) { | 344 | } else if (error.errorCode == ApplicationDomain::LoginError) { |
345 | //If we failed to login altough we could connect that indicates a problem with our setup. | 345 | //If we failed to login altough we could connect that indicates a problem with our setup. |
346 | setStatus(ApplicationDomain::ErrorStatus, s, requestId); | 346 | setStatus(ApplicationDomain::ErrorStatus, s, requestId); |
347 | } else if (error.errorCode == ApplicationDomain::ConnectionLostError) { | ||
348 | //We've lost the connection so we assume the connection to the server broke. | ||
349 | setStatus(ApplicationDomain::OfflineStatus, s, requestId); | ||
347 | } | 350 | } |
348 | //We don't know what kind of error this was, so we assume it's transient and don't change ou status. | 351 | //We don't know what kind of error this was, so we assume it's transient and don't change our status. |
349 | } else { | 352 | } else { |
350 | //An operation against the server worked, so we're probably online. | 353 | //An operation against the server worked, so we're probably online. |
351 | setStatus(ApplicationDomain::ConnectedStatus, s, requestId); | 354 | setStatus(ApplicationDomain::ConnectedStatus, s, requestId); |