[FileManager] updated FileManager sources
authorPiotr Dabrowski <p.dabrowski2@samsung.com>
Tue, 27 Aug 2013 08:38:39 +0000 (10:38 +0200)
committerPiotr Dabrowski <p.dabrowski2@samsung.com>
Tue, 27 Aug 2013 08:38:39 +0000 (10:38 +0200)
Change-Id: Ibb12227a5fa07929f155b9a0d14228b37d201826

js/app.clipboard.js
js/app.model.js

index 6bcd892..cee9925 100644 (file)
@@ -84,6 +84,22 @@ function Clipboard() {
                },
 
                /**
+                * Remove specified path and all children paths if already in clipboard
+                * @param {string} path full path
+                * @returns {number} current length of clipboard objects
+                */
+               removeRecursively: function Clipboard_removeRecursively(path) {
+                       var childPattern = new RegExp(path),
+                               index = this.data.length;
+                       while (index--) {
+                               if(childPattern.test(this.data[index])) {
+                                       this.data.splice(index, 1);
+                               }
+                       }
+                       return this.data.length;
+               },
+
+               /**
                 * Checks if specified path is already in clipboard
                 * @param {string} path full path
                 * @returns {boolean}
index d29aaf6..aca30fe 100644 (file)
@@ -157,9 +157,9 @@ function Model() {
                                self = this,
                                onDeleteNodeSuccess = function (node, isDir, fileobject) {
                                        try {
-                                               if (app.clipboard.remove(node.uri) === 0) {
-                                                       app.ui.refreshPasteActionBtn();
-                                               }
+                                               app.clipboard.removeRecursively(node.uri);
+                                               app.ui.refreshPasteActionBtn();
+
                                                this.refreshContent(fileobject.toURI());
                                        } catch (e) {
                                                console.error(e);