[FileManager] updated FileManager sources
authorPiotr Dabrowski <p.dabrowski2@samsung.com>
Tue, 23 Jul 2013 10:10:16 +0000 (12:10 +0200)
committerPiotr Dabrowski <p.dabrowski2@samsung.com>
Tue, 23 Jul 2013 10:10:16 +0000 (12:10 +0200)
Change-Id: I9d87e242ad42530b60ebe8e7bc8d82c51d053506

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

index 6dd0c4a..6bcd892 100644 (file)
@@ -66,6 +66,24 @@ function Clipboard() {
                },
 
                /**
+                * Remove specified path is already in clipboard
+                * @param {string} path full path
+                * @returns {number} current length of clipboard objects
+                */
+               remove: function Clipboard_remove(path) {
+                       var index = $.inArray(path, this.data);
+                       var length;
+                       if (index >= 0) {
+                               this.data.splice(index, 1);
+                               length = this.data.length;
+                               if (length === 0) {
+                                       this.mode = this.INACTIVE_MODE;
+                               }
+                       }
+                       return length;
+               },
+
+               /**
                 * Checks if specified path is already in clipboard
                 * @param {string} path full path
                 * @returns {boolean}
index 42a2420..a66514d 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -185,6 +185,9 @@ var App = null;
                 */
                refreshCurrentPage: function App_refreshCurrentPage(refresh) {
                        refresh = refresh || false;
+                       if (this.currentPath === 'root') {
+                               return;
+                       }
                        if (this.currentPath !== '') {
                                app.model.isStorageExists(this.currentPath,
                                        app.displayFolder.bind(app, app.model.currentPath, refresh),
index cf386f2..f4ac4e0 100644 (file)
@@ -157,6 +157,9 @@ function Model() {
                                self = this,
                                onDeleteNodeSuccess = function (node, isDir, fileobject) {
                                        try {
+                                               if (app.clipboard.remove(node.uri) === 0) {
+                                                       app.ui.refreshPasteActionBtn();
+                                               }
                                                this.refreshContent(fileobject.toURI());
                                        } catch (e) {
                                                console.error(e);
@@ -217,7 +220,9 @@ function Model() {
                                        }
                                },
                                onCopyNodeFailure = function () {
-                                       app.ui.alertPopup('Copying error');
+                                       setTimeout(function () {
+                                               app.ui.alertPopup('Copying error');
+                                       }, 200);
                                },
                                i,
                                sourceName,
@@ -226,7 +231,9 @@ function Model() {
                        this.systemIO.getFilesList(dir, function (filesList) {
                                for (i = 0; i < len; i = i + 1) {
                                        if (destinationPath.indexOf(paths[i]) !== -1) {
-                                               app.ui.alertPopup('Copying error');
+                                               setTimeout(function () {
+                                                       app.ui.alertPopup('Copying error');
+                                               }, 200);
                                                return;
                                        }
                                }
index 6ff5cdd..3dfb2ae 100644 (file)
@@ -121,7 +121,11 @@ function Ui() {
                        window.addEventListener('tizenhwkey', function(e) {
                                var uri = $('#navbar span+span').attr('uri');
                                if (e.keyName == "back") {
-                                       if (!uri) {
+                                       if ($.mobile.popup.active) {
+                                               $.mobile.popup.active.close();
+                                       } else if (self.editMode === true) {
+                                               self.handleCancelEditAction();
+                                       } else if (!uri) {
                                                if ( app.ui.root === false ) {
                                                        $('#fileList').empty();
                                                        app.ui.prepareFolderRow(0, "root");
@@ -129,15 +133,9 @@ function Ui() {
                                                } else {
                                                        tizen.application.getCurrentApplication().exit();
                                                }
-                                       } else if ($.mobile.popup.active !== undefined) {
-                                               $(".ui-popup").popup('close');
                                        } else {
                                                app.goLevelUp();
                                        }
-
-                                       if (self.editMode === true) {
-                                               self.handleCancelEditAction();
-                                       }
                                }
                        });
 
@@ -270,7 +268,7 @@ function Ui() {
 
                alertPopup: function (text, callback) {
                        $("#alertPopup .text").text(text);
-                       $("#alertPopup").popup('open', {'positionTo': 'window'})
+                       $("#alertPopup").popup('open', {'positionTo': 'window'});
                        if (callback instanceof Function) {
                                $("#alertPopup").one("popupafterclose", function () {
                                        callback();