Skip to content

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

cleaning up postio usage

Ilian Sapundshiev73c1e1cd430c
diff --git a/data/chromium/chrome.api.js b/data/chromium/chrome.api.js
index 72bedbbb5..4f5ef8107 100644
--- a/data/chromium/chrome.api.js
+++ b/data/chromium/chrome.api.js
@@ -20,7 +20,6 @@ define(function(require, exports, module) {
//$("#logo").text("TagSpaces Lite");
var TSCORE = require("tscore");
- var TSPOSTIO = require("tspostioapi");
var saveAs = require("libs/filesaver.js/FileSaver.min");
var dataBegin = "<script>addRow(";
@@ -79,7 +78,7 @@ define(function(require, exports, module) {
type: 'GET'
})
.done(function(data) {
- TSPOSTIO.checkNewVersion(data);
+ TSCORE.updateNewVersionData(data);
})
.fail(function(data) {
console.log("AJAX failed " + data);
diff --git a/data/electron/electron.api.js b/data/electron/electron.api.js
index 9891f1d6f..ed7aadf91 100644
--- a/data/electron/electron.api.js
+++ b/data/electron/electron.api.js
@@ -43,7 +43,7 @@ define(function(require, exports, module) {
function handleStartParameters() {
var filePath = TSCORE.Utils.getURLParameter("open");
- if (filePath && (filePath.length > 0)) {
+ if (filePath && filePath.length) {
filePath = decodeURIComponent(filePath);
console.log("Opening file from command line: " + filePath);
TSCORE.FileOpener.openFileOnStartup(filePath);
@@ -847,6 +847,8 @@ define(function(require, exports, module) {
* @returns {Promise.<Success, Error>}
*/
function saveFilePromise(filePath, content, overwrite) {
+ overwrite = overwrite || true; // TODO check if true should the default value
+
return new Promise(function(resolve, reject) {
function saveFile(filePath, content, isNewFile) {
fs.writeFile(filePath, content, 'utf8', function(error) {
@@ -859,7 +861,6 @@ define(function(require, exports, module) {
}
getPropertiesPromise(filePath).then(function(entry) {
- overwrite = overwrite || true;
if (entry && entry.isFile && overwrite) {
saveFile(filePath, content, false);
} else {
diff --git a/data/js/postioapi.js b/data/js/postioapi.js
index e70293bd2..25b91547e 100644
--- a/data/js/postioapi.js
+++ b/data/js/postioapi.js
@@ -42,23 +42,6 @@ define(function(require, exports, module) {
TSCORE.hideWaitingDialog();
};
- exports.loadTextFile = function(content) {
- TSCORE.FileOpener.updateEditorContent(content);
- TSCORE.hideLoadingAnimation();
- };
-
- exports.saveTextFile = function(filePath, isNewFile) {
- TSCORE.PerspectiveManager.refreshFileListContainer();
- if (isNewFile) {
- TSCORE.showSuccessDialog("File created successfully.");
- // If file is new open it in edit mode
- TSCORE.FileOpener.openFile(filePath, true);
- } else {
- TSCORE.showSuccessDialog("File saved successfully.");
- }
- TSCORE.FileOpener.setFileChanged(false);
- };
-
exports.listDirectory = function(anotatedDirList) {
TSCORE.PerspectiveManager.updateFileBrowserData(anotatedDirList);
TSCORE.updateSubDirs(anotatedDirList);
@@ -95,10 +78,6 @@ define(function(require, exports, module) {
TSCORE.hideLoadingAnimation();
};
- exports.checkNewVersion = function(data) {
- TSCORE.updateNewVersionData(data);
- };
-
exports.selectDirectory = function(dirPath) {
// TODO make the use of this function more general
if (!TSCORE.TagUtils.stringEndsWith(dirPath, TSCORE.dirSeparator)) {
@@ -112,5 +91,4 @@ define(function(require, exports, module) {
$('#folderLocation2').blur();
$('#moveCopyDirectoryPath').val(dirPath);
};
-
});
diff --git a/data/mozilla/mozilla.api.js b/data/mozilla/mozilla.api.js
index e2298d3e3..c728e2959 100644
--- a/data/mozilla/mozilla.api.js
+++ b/data/mozilla/mozilla.api.js
@@ -61,7 +61,7 @@ define(function(require, exports, module) {
break;
case "checkNewVersion":
if (message.success) {
- TSPOSTIO.checkNewVersion(message.content);
+ TSCORE.updateNewVersionData(message.content);
} else {
console.error("Checking for new version failed.");
}
diff --git a/data/node-webkit/node-webkit.api.js b/data/node-webkit/node-webkit.api.js
index c1179a756..21e905cfc 100644
--- a/data/node-webkit/node-webkit.api.js
+++ b/data/node-webkit/node-webkit.api.js
@@ -219,7 +219,7 @@ define(function(require, exports, module) {
type: 'GET'
})
.done(function(data) {
- TSPOSTIO.checkNewVersion(data);
+ TSCORE.updateNewVersionData(data);
})
.fail(function(data) {
console.log("AJAX failed " + data);