Added folder name to 'file not found' error message
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / SynchronizeFolderOperation.java
index 97ee18d..088c578 100644 (file)
@@ -160,6 +160,10 @@ public class SynchronizeFolderOperation extends SyncOperation {
                 if (result.isSuccess()) {
                     syncContents(client);
                 }
+
+                if (mFilesForDirectDownload.isEmpty()) {
+                    sendBroadcastForNotifyingUIUpdate(result.isSuccess());
+                }
             }
         } catch (OperationCancelledException e) {
             result = new RemoteOperationResult(e);
@@ -211,6 +215,8 @@ public class SynchronizeFolderOperation extends SyncOperation {
                 Log_OC.e(TAG, "Checked " + mAccount.name + mRemotePath + " : " +
                         result.getLogMessage());
             }
+
+            sendBroadcastForNotifyingUIUpdate(result.isSuccess());
         }
 
         return result;
@@ -519,6 +525,16 @@ public class SynchronizeFolderOperation extends SyncOperation {
         }
     }
 
+    private void sendBroadcastForNotifyingUIUpdate(boolean result) {
+        // Send a broadcast message for notifying UI update
+        Intent uiUpdate = new Intent(FileDownloader.getDownloadFinishMessage());
+        uiUpdate.putExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, result);
+        uiUpdate.putExtra(FileDownloader.ACCOUNT_NAME, mAccount.name);
+        uiUpdate.putExtra(FileDownloader.EXTRA_REMOTE_PATH, mRemotePath);
+        uiUpdate.putExtra(FileDownloader.EXTRA_FILE_PATH, mLocalFolder.getRemotePath());
+        mContext.sendStickyBroadcast(uiUpdate);
+    }
+
     
     /**
      * Cancel operation
@@ -526,4 +542,12 @@ public class SynchronizeFolderOperation extends SyncOperation {
     public void cancel() {
         mCancellationRequested.set(true);
     }
+
+    public String getFolderPath() {
+        String path = mLocalFolder.getStoragePath();
+        if (path != null && path.length() > 0) {
+            return path;
+        }
+        return FileStorageUtils.getDefaultSavePathFor(mAccount.name, mLocalFolder);
+    }
 }