<string name="prefs_category_security">Security</string>
<string name="prefs_instant_video_upload_path_title">Upload Video Path</string>
+ <string name="download_folder_not_found">The folder is no longer available on the server</string>
+ <string name="downloader_download_folder_failed_content">Download of %1$s folder could not be completed</string>
</resources>
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);
+ }
}
}
if (mCurrentSyncOperation != null) {
+ RemoteOperationResult result = null;
try {
mService.getContentResolver()
);
- mCurrentSyncOperation.execute(mOwnCloudClient, mStorageManager);
+ result = mCurrentSyncOperation.execute(mOwnCloudClient, mStorageManager);
} catch (AccountsException e) {
Log_OC.e(TAG, "Error while trying to get autorization", e);
synchronized(mPendingOperations) {
mPendingOperations.remove(syncKey);
}
+
+ mService.dispatchResultToOperationListeners(null, mCurrentSyncOperation, result);
}
}
}
/**
* Notifies the currently subscribed listeners about the end of an operation.
- *
+ *
* @param target Account or URL pointing to an OC server.
* @param operation Finished operation.
* @param result Result of the operation.
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.operations.CreateShareOperation;
+import com.owncloud.android.operations.SynchronizeFolderOperation;
import com.owncloud.android.operations.UnshareLinkOperation;
import com.owncloud.android.services.OperationsService;
} else if (operation instanceof UnshareLinkOperation) {
onUnshareLinkOperationFinish((UnshareLinkOperation)operation, result);
- }
+ } else if (operation instanceof SynchronizeFolderOperation) {
+ onSynchronizeFolderOperationFinish((SynchronizeFolderOperation)operation, result);
+
+ }
}
protected void requestCredentialsUpdate() {
t.show();
}
}
-
+
+ private void onSynchronizeFolderOperationFinish(SynchronizeFolderOperation operation, RemoteOperationResult result) {
+ if (!result.isSuccess()){
+ Toast t = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
+ Toast.LENGTH_LONG);
+ t.show();
+ }
+ }
protected void updateFileFromDB(){
OCFile file = getFile();
import com.owncloud.android.operations.RemoveFileOperation;
import com.owncloud.android.operations.RenameFileOperation;
import com.owncloud.android.operations.SynchronizeFileOperation;
+import com.owncloud.android.operations.SynchronizeFolderOperation;
import com.owncloud.android.operations.UnshareLinkOperation;
import com.owncloud.android.operations.UploadFileOperation;
// Show a Message, operation finished without success
message = res.getString(R.string.move_file_error);
}
+ } else if (operation instanceof SynchronizeFolderOperation) {
+
+ if (!result.isSuccess()) {
+ if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
+ message = res.getString(R.string.download_folder_not_found);
+
+ } else { // Generic error
+ // Show a Message, operation finished without success
+ message = String.format(res.getString(R.string.downloader_download_folder_failed_content), new File(
+ ((SynchronizeFolderOperation) operation).getFolderPath()).getName());
+ }
+ }
}
return message;