From c22c91df4a35ce8fefad409f1ae265c74b8ede14 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 11 Aug 2017 20:16:20 -0600 Subject: Cleanup --- common/synchronizer.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'common/synchronizer.cpp') diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index 3b32e68..d6b1c1f 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp @@ -593,17 +593,13 @@ KAsync::Job Synchronizer::replay(const QByteArray &type, const QByteArray KAsync::Job job = KAsync::null(); //TODO This requires supporting every domain type here as well. Can we solve this better so we can do the dispatch somewhere centrally? if (type == ApplicationDomain::getTypeName()) { - auto folder = store().readEntity(key); - job = replay(folder, operation, oldRemoteId, modifiedProperties); + job = replay(store().readEntity(key), operation, oldRemoteId, modifiedProperties); } else if (type == ApplicationDomain::getTypeName()) { - auto mail = store().readEntity(key); - job = replay(mail, operation, oldRemoteId, modifiedProperties); + job = replay(store().readEntity(key), operation, oldRemoteId, modifiedProperties); } else if (type == ApplicationDomain::getTypeName()) { - auto mail = store().readEntity(key); - job = replay(mail, operation, oldRemoteId, modifiedProperties); + job = replay(store().readEntity(key), operation, oldRemoteId, modifiedProperties); } else if (type == ApplicationDomain::getTypeName()) { - auto mail = store().readEntity(key); - job = replay(mail, operation, oldRemoteId, modifiedProperties); + job = replay(store().readEntity(key), operation, oldRemoteId, modifiedProperties); } else { SinkErrorCtx(mLogCtx) << "Replayed unknown type: " << type; } -- cgit v1.2.3 From ea75d4bdba79d2a879c2ed31564928d4ef3cd9b1 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 25 Aug 2017 18:21:15 -0600 Subject: Default to NoStatus for resources until we know more. This allows the aggregation to ignore resources where we don't have any status information yet, so the account doesn't always end up being offline. --- common/synchronizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/synchronizer.cpp') diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index d6b1c1f..b6e33d5 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp @@ -40,7 +40,7 @@ Synchronizer::Synchronizer(const Sink::ResourceContext &context) mSyncStorage(Sink::storageLocation(), mResourceContext.instanceId() + ".synchronization", Sink::Storage::DataStore::DataStore::ReadWrite), mSyncInProgress(false) { - mCurrentState.push(ApplicationDomain::Status::OfflineStatus); + mCurrentState.push(ApplicationDomain::Status::NoStatus); SinkTraceCtx(mLogCtx) << "Starting synchronizer: " << mResourceContext.resourceType << mResourceContext.instanceId(); } -- cgit v1.2.3 From 1ba34f8b16cd06a74ff96dfae803ce4b0521652b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 28 Aug 2017 17:19:51 -0600 Subject: Detect connection lost so we can go to offline state kimap should really have better error codes... --- common/synchronizer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common/synchronizer.cpp') 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 } else if (error.errorCode == ApplicationDomain::LoginError) { //If we failed to login altough we could connect that indicates a problem with our setup. setStatus(ApplicationDomain::ErrorStatus, s, requestId); + } else if (error.errorCode == ApplicationDomain::ConnectionLostError) { + //We've lost the connection so we assume the connection to the server broke. + setStatus(ApplicationDomain::OfflineStatus, s, requestId); } - //We don't know what kind of error this was, so we assume it's transient and don't change ou status. + //We don't know what kind of error this was, so we assume it's transient and don't change our status. } else { //An operation against the server worked, so we're probably online. setStatus(ApplicationDomain::ConnectedStatus, s, requestId); -- cgit v1.2.3