Skip to content

TagSpaces is an offline, open source, document manager with tagging support

merge with develop

mladensap07275f6144f1
diff --cc data/locales/en_US/ns.pro.json
index a4a47496b,a4a47496b..959722a32
--- a/data/locales/en_US/ns.pro.json
+++ b/data/locales/en_US/ns.pro.json
@@@ -2,5 -2,5 +2,6 @@@
"trashDeleteContentConfirm": "Do you want to move '__filePath__' to the trash bin ?",
"trashDirectoryContentConfirm": "Do you want to move the directory '__dirPath__' to the trash bin ?",
"trashFilesDeleteContentConfirm": "Do you want to move these files '__selectedFiles__' to the trash bin ?",
++ "loadLocationMetadata": "Loads location meta data (currently only tag groups)1",
"-": "-"
}
diff --cc data/node-webkit/node-webkit.api.js
index a8675e485,9b8fde15d..91eca28a5
--- a/data/node-webkit/node-webkit.api.js
+++ b/data/node-webkit/node-webkit.api.js
@@@ -305,15 -282,7 +305,16 @@@ define(function(require, exports, modul
});
}
+ /**
+ * List directory
+ * @name listDirectoryPromise
+ * @method
+ * @memberof nwjs.ioapi
+ * @param {string} path - the directory path which is listed
++ * @param {boolean} lite - TODO the directory path which is listed
+ * @returns {Promise.<Success, Error>}
+ */
- function listDirectoryPromise(path) {
+ function listDirectoryPromise(path, lite) {
console.time("listDirectoryPromise");
return new Promise(function(resolve, reject) {
var enhancedEntries = [];
@@@ -693,62 -594,47 +714,67 @@@ TO DO * @param {string} isPreview
return saveFilePromise(filePath, buff, overwrite);
}
-
+ /**
+ * Delete file
+ * @name deleteFilePromise
+ * @method
+ * @memberof nwjs.ioapi
+ * @param {string} path - the full path of the file which will be deleted
+ * @returns {Promise.<Success, Error>}
+ */
function deleteFilePromise(path) {
-
+ //TODO Handling the trash can case
if (TSCORE.PRO && TSCORE.Config.getUseTrashCan()) {
- return trash([path]);
- }
-
- return new Promise(function(resolve, reject) {
- fs.unlink(path, function(error) {
- if (error) {
- reject(error);
- } else {
- resolve();
- }
+ return new Promise(function(resolve, reject) {
+ trash([path]).then(function() {
+ resolve(path);
+ }, function(err) {
+ reject(err);
+ });
});
- });
+ } else {
+ return new Promise(function(resolve, reject) {
+ fs.unlink(path, function(error) {
+ if (error) {
+ reject(error);
+ } else {
+ resolve(path);
+ }
+ });
+ });
+ }
}
+ /**
+ * Delete a directory
+ * @name deleteDirectoryPromise
+ * @method
+ * @memberof nwjs.ioapi
+ * @param {string} path - the full path of the directory which will be deleted
+ * @returns {Promise.<Success, Error>}
+ */
function deleteDirectoryPromise(path) {
-
if (TSCORE.PRO && TSCORE.Config.getUseTrashCan()) {
return trash([path]);
- }
-
- return new Promise(function(resolve, reject) {
- fs.rmdir(path, function(error) {
- if (error) {
- reject(error);
- } else {
- resolve();
- }
+ } else {
+ return new Promise(function(resolve, reject) {
+ fs.rmdir(path, function(error) {
+ if (error) {
+ reject(error);
+ } else {
+ resolve(path);
+ }
+ });
});
- });
+ }
}
-
+ /**
+ * Select a directory
+ * @name selectDirectory
+ * @method
+ * @memberof nwjs.ioapi
+ */
function selectDirectory() {
if (document.getElementById('folderDialogNodeWebkit') === null) {
$("body").append('<input style="display:none;" id="folderDialogNodeWebkit" type="file" nwdirectory />');