[Pkg-owncloud-commits] [owncloud-client] 271/470: Folder: After sync, fire up tray notification if conflicts happened.

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:25:12 UTC 2016


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 efb0faa14e91143110c1a7d77b2188adbdb31154
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Tue Apr 5 16:37:54 2016 +0200

    Folder: After sync, fire up tray notification if conflicts happened.
    
    If there were conflicts, users want to have a tray notification that warn
    about.
    This will help for #3222
---
 src/gui/folder.cpp | 18 +++++++++++++++++-
 src/gui/folder.h   |  1 +
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index c00b95d..0ecee3a 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -356,12 +356,14 @@ void Folder::bubbleUpSyncResult()
     int updatedItems = 0;
     int ignoredItems = 0;
     int renamedItems = 0;
+    int conflictItems = 0;
     int errorItems = 0;
 
     SyncFileItemPtr firstItemNew;
     SyncFileItemPtr firstItemDeleted;
     SyncFileItemPtr firstItemUpdated;
     SyncFileItemPtr firstItemRenamed;
+    SyncFileItemPtr firstConflictItem;
     SyncFileItemPtr firstItemError;
 
     SyncRunFileLog syncFileLog;
@@ -385,6 +387,11 @@ void Folder::bubbleUpSyncResult()
         } else if( item->_status == SyncFileItem::FileIgnored ) {
             // ignored files don't show up in notifications
             continue;
+        } else if( item->_status == SyncFileItem::Conflict ) {
+            conflictItems++;
+            if (!firstConflictItem) {
+                firstConflictItem = item;
+            }
         } else {
             // add new directories or remove gone away dirs to the watcher
             if (item->_isDirectory && item->_instruction == CSYNC_INSTRUCTION_NEW ) {
@@ -407,7 +414,6 @@ void Folder::bubbleUpSyncResult()
                     if (!firstItemDeleted)
                         firstItemDeleted = item;
                     break;
-                case CSYNC_INSTRUCTION_CONFLICT:
                 case CSYNC_INSTRUCTION_SYNC:
                     if (!item->_isDirectory) {
                         updatedItems++;
@@ -461,6 +467,9 @@ void Folder::bubbleUpSyncResult()
         createGuiLog( firstItemRenamed->_originalFile, status, renamedItems, firstItemRenamed->_renameTarget );
     }
 
+    if( firstConflictItem ) {
+        createGuiLog( firstConflictItem->_file, LogStatusConflict, conflictItems );
+    }
     createGuiLog( firstItemError->_file, LogStatusError, errorItems );
 
     qDebug() << "OO folder slotSyncFinished: result: " << int(_syncResult.status());
@@ -511,6 +520,13 @@ void Folder::createGuiLog( const QString& filename, LogStatus status, int count,
                 text = tr("%1 has been moved to %2.").arg(file).arg(renameTarget);
             }
             break;
+        case LogStatusConflict:
+            if( count > 1 ) {
+                text = tr("%1 has and %2 other files have sync conflict.").arg(file, count-1);
+            } else {
+                text = tr("%1 has a sync conflict. Please check the conflict file!").arg(file);
+            }
+            break;
         case LogStatusError:
             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);
diff --git a/src/gui/folder.h b/src/gui/folder.h
index 55035c4..c0c3580 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -271,6 +271,7 @@ private:
         LogStatusMove,
         LogStatusNew,
         LogStatusError,
+        LogStatusConflict,
         LogStatusUpdated
     };
 

-- 
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