Skip to content

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

perspectiveList - new promise api impl.

Borislav Sapundzhievf0c263401d0b
diff --git a/data/ext/perspectiveList/perspectiveUI.js b/data/ext/perspectiveList/perspectiveUI.js
index ef90b04cb..1e2b58675 100644
--- a/data/ext/perspectiveList/perspectiveUI.js
+++ b/data/ext/perspectiveList/perspectiveUI.js
@@ -8,6 +8,7 @@ define(function(require, exports, module) {
console.log("Loading UI for perspectiveList");
var TSCORE = require("tscore");
+ var TSPOSTIO = require("tspostioapi");
var TMB_SIZES = ["100px", "200px", "300px", "400px", "500px"];
var supportedFileTypeThumnailing = ['jpg', 'jpeg', 'png', 'gif'];
@@ -77,8 +78,14 @@ define(function(require, exports, module) {
$.i18n.t(dlgConfirmMsgId, {
selectedFiles: selFiles.toString()
}), function() {
- TSCORE.selectedFiles.forEach(function(file) {
- TSCORE.IO.deleteElement(file);
+ TSCORE.selectedFiles.forEach(function(path) {
+ TSCORE.IO.deleteFilePromise(path).then(function() {
+ TSPOSTIO.deleteElement(path);
+ }, function(error) {
+ TSCORE.hideLoadingAnimation();
+ TSCORE.showAlertDialog("Deleting file " + path + " failed.");
+ console.error("Deleting file " + path + " failed " + error);
+ });
});
});
});
diff --git a/data/node-webkit/node-webkit.api.js b/data/node-webkit/node-webkit.api.js
index 6315c9fc3..6e97494af 100644
--- a/data/node-webkit/node-webkit.api.js
+++ b/data/node-webkit/node-webkit.api.js
@@ -747,6 +747,11 @@ define(function(require, exports, module) {
function deleteFilePromise(path) {
+
+ if (TSCORE.PRO && TSCORE.Config.getUseTrashCan()) {
+ return trash([path]);
+ }
+
return new Promise(function(resolve, reject) {
fs.unlink(path, function(error) {
if (error) {
@@ -760,9 +765,6 @@ define(function(require, exports, module) {
/** @deprecated */
function deleteElement(path) {
- if (TSCORE.PRO && TSCORE.Config.getUseTrashCan()) {
- return trash([path]);
- }
deleteFilePromise(path).then(function() {
TSPOSTIO.deleteElement(path);