diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2011-07-26 16:47:28 +0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2011-07-26 16:47:28 +0200 |
commit | b73fd3dfce08c64aeb92d67ff2ee0b23212b00a7 (patch) | |
tree | 778e3ff81def32c3fce9ba767fc4a15eb4cfdc29 | |
parent | 79b65dff05322d97106d91f5fee8f9d70e638c0c (diff) |
auto sync: show all failed syncs except for temporary network errors (BMC #21888)bmc21888
Notifications were meant to be shown for all errors except temporary
ones (http://bugzilla.moblin.org/web/bug_report_10000.html). This has
never been implemented correctly since the feature was introduced:
instead of hiding known temporary errors, all errors except 500 (fatal
error) were suppressed.
This commit switches to white listing the known errors which are
temporary and suppresses those. Right now that happens to be only one,
network problems.
-rw-r--r-- | src/syncevo-dbus-server.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/syncevo-dbus-server.cpp b/src/syncevo-dbus-server.cpp index b3ccde2c..2b645736 100644 --- a/src/syncevo-dbus-server.cpp +++ b/src/syncevo-dbus-server.cpp @@ -6764,6 +6764,22 @@ void AutoSyncManager::syncSuccessStart() } } +/** + * True if the error is likely to go away by itself when continuing + * with auto-syncing. This errs on the side of showing notifications + * too often rather than not often enough. + */ +static bool ErrorIsTemporary(SyncMLStatus status) +{ + switch (status) { + case STATUS_TRANSPORT_FAILURE: + return true; + default: + // pretty much everying this not temporary + return false; + } +} + void AutoSyncManager::syncDone(SyncMLStatus status) { SE_LOG_INFO(NULL, NULL,"Automatic sync for '%s' has been done.\n", m_activeTask->m_peer.c_str()); @@ -6776,8 +6792,9 @@ void AutoSyncManager::syncDone(SyncMLStatus status) body = StringPrintf(_("We have just finished syncing your computer with the %s sync service."), m_activeTask->m_peer.c_str()); //TODO: set config information for 'sync-ui' m_notificationManager->publish(summary, body); - } else if(m_syncSuccessStart || (!m_syncSuccessStart && status == STATUS_FATAL)) { - //if sync is successfully started and has errors, or not started successful with a fatal problem + } else if (m_syncSuccessStart || !ErrorIsTemporary(status)) { + // if sync is successfully started and has errors, or not started successful with a permanent error + // that needs attention summary = StringPrintf(_("Sync problem.")); body = StringPrintf(_("Sorry, there's a problem with your sync that you need to attend to.")); //TODO: set config information for 'sync-ui' |