From 11013bbf6d25a54a0a0124a9fc1c74d0bcb8e00c Mon Sep 17 00:00:00 2001
From: Piotr Dabrowski
Date: Tue, 16 Jul 2013 10:14:04 +0200
Subject: [PATCH] [FileManager] updated FileManager sources
Change-Id: I62fb3d1d64da1b763b3292ed3ecf89eb63228147
---
js/app.js | 6 +++---
js/app.ui.js | 56 ++++++++++++++++++++++++++++----------------------------
2 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/js/app.js b/js/app.js
index eb80f3c..42a2420 100644
--- a/js/app.js
+++ b/js/app.js
@@ -58,7 +58,7 @@ var App = null;
/**
* @type {string}
*/
- currentPath: '',
+ currentPath: 'root',
/**
*
@@ -163,14 +163,14 @@ var App = null;
* @param {string} dirName
* @return {boolean} return status
*/
- createDir: function App_createDir(dirName) {
+ createDir: function App_createDir(dirName, callback) {
var status = true;
if (this.currentDirPath !== '') {
try {
this.currentDirHandle.createDirectory(dirName);
} catch (e) {
status = false;
- app.ui.alertPopup(e.message);
+ app.ui.alertPopup(e.message, callback);
}
this.refreshCurrentPage();
} else {
diff --git a/js/app.ui.js b/js/app.ui.js
index 2a861cd..36f27e4 100644
--- a/js/app.ui.js
+++ b/js/app.ui.js
@@ -128,8 +128,9 @@ function Ui() {
} else {
tizen.application.getCurrentApplication().exit();
}
- } else {
+ } else if ($.mobile.popup.active !== undefined) {
$(".ui-popup").popup('close');
+ } else {
app.goLevelUp();
}
@@ -170,7 +171,9 @@ function Ui() {
$('#navbar').on('tap', 'span', function () {
var uri = $(this).attr('uri');
if (uri === 'home') {
- app.displayStorages();
+ if (app.currentPath !== '') {
+ app.displayStorages();
+ }
} else if (uri === app.model.currentPath) {
app.displayFolder(uri,true);
} else {
@@ -240,41 +243,38 @@ function Ui() {
},
saveNewFolder: function Ui_saveNewFolder(e) {
- var folderName = $('#newFolderName').val().trim(), status = true;
- e.preventDefault();
- e.stopPropagation();
- if (folderName === '') {
- this.alertPopup("Empty folder name");
- status = false;
- } else if (folderName.match(/[\*\.\/\\\?\"\'\:<>|]/)) {
- this.alertPopup("The following special characters are not allowed: *./\\?:<>|'\"");
- status = false;
- } else {
- status = app.createDir(folderName);
- if (status === true) {
+ var folderName = $('#newFolderName').val().trim(), status = true,
+ open = function () {
$("#addFolderPopup").popup('open', {
positionTo: "window"
});
- setTimeout(function () {
- $("#addFolderPopup").popup('close');
- }, 200);
+ }, self = this;
+ e.preventDefault();
+ e.stopPropagation();
+ $("#addFolderPopup").one("popupafterclose", function () {
+ if (folderName === '') {
+ self.alertPopup("Empty folder name", open);
+ status = false;
+ } else if (folderName.match(/[\*\.\/\\\?\"\'\:<>|]/)) {
+ self.alertPopup("The following special characters "
+ +"are not allowed: *./\\?:<>|'\"", open);
+ status = false;
+ } else {
+ status = app.createDir(folderName, open);
}
- }
+ });
+ $("#addFolderPopup").popup('close');
return status;
},
- alertPopup: function (text) {
- var lastActivePopup = $.mobile.popup.active;
-
+ alertPopup: function (text, callback) {
$("#alertPopup .text").text(text);
-
- $("#alertPopup").popup('close')
- .popup('open', {'positionTo': 'window'})
- .one("popupafterclose", function () {
- if (lastActivePopup) {
- $.mobile.popup.active = lastActivePopup;
- }
+ $("#alertPopup").popup('open', {'positionTo': 'window'})
+ if (callback instanceof Function) {
+ $("#alertPopup").one("popupafterclose", function () {
+ callback();
});
+ }
},
confirmPopup: function (text, confirmCallback, completeCallback) {
--
2.7.4