Skip to content

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

Adding the functionality to reload a opened file, which has been renamed/tagged

uggrock0b2b9b5c1d5c
diff --git a/data/js/ioapi.chrome.js b/data/js/ioapi.chrome.js
index 57392f07c..8af323cda 100644
--- a/data/js/ioapi.chrome.js
+++ b/data/js/ioapi.chrome.js
@@ -279,7 +279,7 @@ Still Missing:
if(nativeIO.fileExists(newFilePath)) {
nativeIO.removeRecursively(filePath);
}
- TSPOSTIO.renameFile();
+ TSPOSTIO.renameFile(filePath,newFilePath);
}
reader.readAsArrayBuffer(b);
} else {
diff --git a/data/js/ioapi.mozilla.js b/data/js/ioapi.mozilla.js
index 2960aa641..8b2f9d41e 100644
--- a/data/js/ioapi.mozilla.js
+++ b/data/js/ioapi.mozilla.js
@@ -42,7 +42,7 @@ document.documentElement.addEventListener("tsMessage", function(event) {
break;
case "rename":
if(message.success){
- TSPOSTIO.renameFile();
+ TSPOSTIO.renameFile(message.content[0],message.content[1]);
} else {
TSCORE.updateLogger("Rename failed");
}
diff --git a/data/js/ioapi.node.js b/data/js/ioapi.node.js
index af62f9c65..b42dfea2f 100644
--- a/data/js/ioapi.node.js
+++ b/data/js/ioapi.node.js
@@ -127,7 +127,7 @@ define(function(require, exports, module) {
console.log("Renaming file failed "+error);
return;
}
- TSPOSTIO.renameFile();
+ TSPOSTIO.renameFile(filePath, newFilePath);
});
}
diff --git a/data/js/postioapi.js b/data/js/postioapi.js
index a425f4434..1654a965a 100644
--- a/data/js/postioapi.js
+++ b/data/js/postioapi.js
@@ -22,11 +22,11 @@ define(function(require, exports, module) {
// TSCORE.openFavorite(TSCORE.Config.Settings["tagspacesList"][0].path, TSCORE.Config.Settings["tagspacesList"][0].name);
}
- exports.renameFile = function() {
- // message.content contains the name of the file after the rename
- //if(TSCORE.FileOpener.isFileOpened()) {
- // TSCORE.FileOpener.openFile(message.content);
- //}
+ exports.renameFile = function(oldFilePath, newFilePath) {
+ // TODO handle case in which a file opened for editing and a tag has been added
+ if(TSCORE.FileOpener.isFileOpened() && (oldFilePath == TSCORE.FileOpener.getOpenedFilePath()) ) {
+ TSCORE.FileOpener.openFile(newFilePath);
+ }
// TODO to be replaced with a function which replaced the
// renamed file in the model of the perspective
TSCORE.PerspectiveManager.refreshFileListContainer();
diff --git a/data/js/settings.api.js b/data/js/settings.api.js
index 18e3d9bc4..14cc10b50 100644
--- a/data/js/settings.api.js
+++ b/data/js/settings.api.js
@@ -493,12 +493,12 @@ define(function(require, exports, module) {
}
}
- // Save setting and Reloads the app
+ // Save setting
var saveSettings = function() {
// Storing setting in the local storage of mozilla and chorme
localStorage.setItem('tagSpacesSettings', JSON.stringify(exports.Settings));
- // Storing settings in mozilla native preferences
+ // Storing settings in firefox native preferences
if(isFirefox) {
IOAPI.saveSettings(JSON.stringify(exports.Settings));
}
diff --git a/data/loader.js b/data/loader.js
index 3d2554d33..5d3434d2e 100644
--- a/data/loader.js
+++ b/data/loader.js
@@ -61,11 +61,10 @@ try {
var fs = require('fs');
var pathUtils = require('path');
var gui = require('nw.gui');
-// var openEntry = require('open');
IO_JS = "js/ioapi.node";
isNode = true;
} catch(e) {
- console.log("node.js not found!");
+ console.log("node-webkit not found!");
}
requirejs.config({
diff --git a/lib/ioutils.js b/lib/ioutils.js
index 182a04510..d63b07007 100644
--- a/lib/ioutils.js
+++ b/lib/ioutils.js
@@ -341,7 +341,7 @@ exports.rename = function rename(filePath, newFilePath, worker) {
worker.postMessage({
"command": "rename",
"success": true,
- "content": targetPath
+ "content": [filePath, targetPath]
});
} catch(ex) {
worker.postMessage({