Merge branch 'master' into develop
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / RenameFileOperation.java
index bd60e1f..aa98607 100644 (file)
@@ -51,7 +51,6 @@ public class RenameFileOperation extends SyncOperation {
      * Constructor
      * 
      * @param remotePath            RemotePath of the OCFile instance describing the remote file or folder to rename
      * Constructor
      * 
      * @param remotePath            RemotePath of the OCFile instance describing the remote file or folder to rename
-     * @param account               OwnCloud account containing the remote file 
      * @param newName               New name to set as the name of file.
      */
     public RenameFileOperation(String remotePath, String newName) {
      * @param newName               New name to set as the name of file.
      */
     public RenameFileOperation(String remotePath, String newName) {
@@ -117,7 +116,7 @@ public class RenameFileOperation extends SyncOperation {
 
     private void saveLocalFile() {
         mFile.setFileName(mNewName);
 
     private void saveLocalFile() {
         mFile.setFileName(mNewName);
-        
+
         // try to rename the local copy of the file
         if (mFile.isDown()) {
             String oldPath = mFile.getStoragePath();
         // try to rename the local copy of the file
         if (mFile.isDown()) {
             String oldPath = mFile.getStoragePath();
@@ -129,8 +128,8 @@ public class RenameFileOperation extends SyncOperation {
                 String newPath = parentStoragePath + mNewName;
                 mFile.setStoragePath(newPath);
 
                 String newPath = parentStoragePath + mNewName;
                 mFile.setStoragePath(newPath);
 
-                // notify MediaScanner about removed file - TODO really works?
-                getStorageManager().triggerMediaScan(oldPath);
+                // notify MediaScanner about removed file
+                getStorageManager().deleteFileInMediaScan(oldPath);
                 // notify to scan about new file
                 getStorageManager().triggerMediaScan(newPath);
             }
                 // notify to scan about new file
                 getStorageManager().triggerMediaScan(newPath);
             }
@@ -158,7 +157,7 @@ public class RenameFileOperation extends SyncOperation {
      */
     private boolean isValidNewName() throws IOException {
         // check tricky names
      */
     private boolean isValidNewName() throws IOException {
         // check tricky names
-        if (mNewName == null || mNewName.length() <= 0 || mNewName.contains(File.separator) || mNewName.contains("%")) { 
+        if (mNewName == null || mNewName.length() <= 0 || mNewName.contains(File.separator)) {
             return false;
         }
         // create a test file
             return false;
         }
         // create a test file