[Pkg-owncloud-commits] [owncloud-client] 136/219: Notifications: Don't emit one per error. #1777

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:19 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit fa881ba1c70362ac6f7fa1c0c36b70a601dd8917
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Fri Sep 19 15:58:27 2014 +0200

    Notifications: Don't emit one per error. #1777
---
 src/mirall/folder.cpp | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp
index 61a382d..9c88ffe 100644
--- a/src/mirall/folder.cpp
+++ b/src/mirall/folder.cpp
@@ -314,11 +314,13 @@ void Folder::bubbleUpSyncResult()
     int updatedItems = 0;
     int ignoredItems = 0;
     int renamedItems = 0;
+    int errorItems = 0;
 
     SyncFileItem firstItemNew;
     SyncFileItem firstItemDeleted;
     SyncFileItem firstItemUpdated;
     SyncFileItem firstItemRenamed;
+    SyncFileItem firstItemError;
     Logger *logger = Logger::instance();
 
     SyncRunFileLog syncFileLog;
@@ -335,7 +337,10 @@ void Folder::bubbleUpSyncResult()
         // and process the item to the gui
         if( item._status == SyncFileItem::FatalError || item._status == SyncFileItem::NormalError ) {
             slotSyncError( tr("%1: %2").arg(item._file, item._errorString) );
-            logger->postOptionalGuiLog(item._file, item._errorString);
+            errorItems++;
+            if (firstItemError.isEmpty()) {
+                firstItemError = item;
+            }
         } else {
             // add new directories or remove gone away dirs to the watcher
             if (item._isDirectory && item._instruction == CSYNC_INSTRUCTION_NEW ) {
@@ -388,9 +393,9 @@ void Folder::bubbleUpSyncResult()
     qDebug() << "Processing result list and logging took " << timer.elapsed() << " Milliseconds.";
     _syncResult.setWarnCount(ignoredItems);
 
-    createGuiLog( firstItemNew._file,     SyncFileStatus(SyncFileStatus::STATUS_NEW), newItems );
-    createGuiLog( firstItemDeleted._file, SyncFileStatus(SyncFileStatus::STATUS_REMOVE), removedItems );
-    createGuiLog( firstItemUpdated._file, SyncFileStatus(SyncFileStatus::STATUS_UPDATED), updatedItems );
+    createGuiLog( firstItemNew._file,     SyncFileStatus::STATUS_NEW, newItems );
+    createGuiLog( firstItemDeleted._file, SyncFileStatus::STATUS_REMOVE, removedItems );
+    createGuiLog( firstItemUpdated._file, SyncFileStatus::STATUS_UPDATED, updatedItems );
 
     if( !firstItemRenamed.isEmpty() ) {
         SyncFileStatus status(SyncFileStatus::STATUS_RENAME);
@@ -403,6 +408,8 @@ void Folder::bubbleUpSyncResult()
         createGuiLog( firstItemRenamed._file, status, renamedItems, firstItemRenamed._renameTarget );
     }
 
+    createGuiLog( firstItemError._file,   SyncFileStatus::STATUS_ERROR, errorItems );
+
     qDebug() << "OO folder slotSyncFinished: result: " << int(_syncResult.status());
 }
 
@@ -453,6 +460,13 @@ void Folder::createGuiLog( const QString& filename, SyncFileStatus status, int c
                 text = tr("%1 has been moved to %2.").arg(file).arg(renameTarget);
             }
             break;
+        case SyncFileStatus::STATUS_ERROR:
+            if( count > 1 ) {
+                text = tr("%1 and %2 other files could not be synced due to errors. See the log for details.", "%1 names a file.").arg(file).arg(count-1);
+            } else {
+                text = tr("%1 could not be synced due to an error. See the log for details.").arg(file);
+            }
+            break;
         default:
             break;
         }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list