From 8b5474ff674566af1a8c7ec4cb8243b7acace51f Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 10 Dec 2015 10:42:49 +0100 Subject: [PATCH] SocketAPI: Don't use ERROR for SoftErrors #3944 --- src/gui/folder.cpp | 21 ++++++++++++++++++--- src/libsync/syncfileitem.h | 7 +++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index f23b5d8c8..d15efbf6c 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -622,9 +622,24 @@ void Folder::slotWatchedPathChanged(const QString& path) } } +/** + * Whether this item should get an ERROR icon through the Socket API. + * + * The Socket API should only present serious, permanent errors to the user. + * In particular SoftErrors should just retain their 'needs to be synced' + * icon as the problem is most likely going to resolve itself quickly and + * automatically. + */ +static bool showErrorInSocketApi(const SyncFileItem& item) +{ + const auto status = item._status; + return status == SyncFileItem::NormalError + || status == SyncFileItem::FatalError; +} + static void addErroredSyncItemPathsToList(const SyncFileItemVector& items, QSet* set) { - Q_FOREACH(const SyncFileItemPtr &item, items) { - if (item->hasErrorStatus()) { + foreach (const SyncFileItemPtr &item, items) { + if (showErrorInSocketApi(*item)) { set->insert(item->_file); } } @@ -1090,7 +1105,7 @@ void Folder::slotTransmissionProgress(const ProgressInfo &pi) // a item is completed: count the errors and forward to the ProgressDispatcher void Folder::slotItemCompleted(const SyncFileItem &item, const PropagatorJob& job) { - if (item.hasErrorStatus()) { + if (showErrorInSocketApi(item)) { _stateLastSyncItemsWithErrorNew.insert(item._file); } diff --git a/src/libsync/syncfileitem.h b/src/libsync/syncfileitem.h index 1642ab27f..26c9ed4ef 100644 --- a/src/libsync/syncfileitem.h +++ b/src/libsync/syncfileitem.h @@ -118,6 +118,13 @@ public: return _file.isEmpty(); } + /** + * True if the item had any kind of error. + * + * Used for deciding whether an item belongs to the protocol or the + * issues list on the activity page and for checking whether an + * item should be announced in the notification message. + */ bool hasErrorStatus() const { return _status == SyncFileItem::SoftError || _status == SyncFileItem::NormalError -- 2.30.2