/**
* @type {string}
*/
- currentPath: '',
+ currentPath: 'root',
/**
*
* @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 {
} else {
tizen.application.getCurrentApplication().exit();
}
- } else {
+ } else if ($.mobile.popup.active !== undefined) {
$(".ui-popup").popup('close');
+ } else {
app.goLevelUp();
}
$('#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 {
},
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) {