Skip to content

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

Bug fixing Improvement for mozilla AMO editors

uggrock5e52d1020577
diff --git a/build.number b/build.number
index d71078bf6..98673f686 100644
--- a/build.number
+++ b/build.number
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
-#Thu Mar 21 12:44:25 CET 2013
-build.number=1262
+#Sun Mar 24 22:27:08 CET 2013
+build.number=1268
diff --git a/data/js/core.api.js b/data/js/core.api.js
index 6974e3cfa..f3bcb00e2 100644
--- a/data/js/core.api.js
+++ b/data/js/core.api.js
@@ -79,10 +79,10 @@ define(function(require, exports, module) {
hideLoadingAnimation();
// TODO check if document.ready is really needed
-// $(document).ready(function() {
+ $(document).ready(function() {
initLayout();
-// console.debug("Layout initialized");
-// });
+ console.debug("Layout initialized");
+ });
// Show start hint
$( "#selectTagSpace" ).tooltip( "open" );
diff --git a/data/js/ioapi.mozilla.js b/data/js/ioapi.mozilla.js
index 2062bbaf8..2ffb16442 100644
--- a/data/js/ioapi.mozilla.js
+++ b/data/js/ioapi.mozilla.js
@@ -114,7 +114,7 @@ exports.selectDirectory = function() {
console.debug("Selecting directory...");
var event = document.createEvent('CustomEvent');
event.initCustomEvent("addon-message", true, true, {"detail":{
- "command": "selectDirectory"
+ "command": "selectDirectory",
}});
document.documentElement.dispatchEvent(event);
}
@@ -133,7 +133,7 @@ exports.openDirectory = function(dirPath) {
var event = document.createEvent('CustomEvent');
event.initCustomEvent("addon-message", true, true, {"detail":{
"command": "openDirectory",
- "path": dirPath
+ "path": dirPath,
}});
document.documentElement.dispatchEvent(event);
}
diff --git a/data/js/tags.ui.js b/data/js/tags.ui.js
index 2d79c9b8d..07539fa83 100644
--- a/data/js/tags.ui.js
+++ b/data/js/tags.ui.js
@@ -116,7 +116,7 @@ define(function(require, exports, module) {
break;
case "openDirectory":
console.debug("Opening parent directory...");
- IOAPI.openDirectory(TSCORE.currentPath);
+ TSCORE.IO.openDirectory(TSCORE.currentPath);
break;
case "renameFile":
console.debug("Renaming file...");
diff --git a/data/manifest.json b/data/manifest.json
index adb67102c..01be80c39 100644
--- a/data/manifest.json
+++ b/data/manifest.json
@@ -1,6 +1,6 @@
{
"name": "TagSpaces",
- "version": "1.3.1260",
+ "version": "1.3.1266",
"manifest_version": 2,
"description": "TagSpaces Explorer",
"icons": {
diff --git a/lib/ioutils.js b/lib/ioutils.js
index 2d9920705..9f7150c43 100644
--- a/lib/ioutils.js
+++ b/lib/ioutils.js
@@ -6,6 +6,26 @@ const {Cc,Ci,Cr} = require("chrome");
var filesIO = require("file");
var runtime = require("runtime");
+const { getTabs, getTabId, getOwnerWindow } = require("tabs/utils");
+
+function getWindow(worker) {
+ let { tab } = worker;
+
+ if (!tab) {
+ return null;
+ }
+
+ let rawTabs = getTabs();
+
+ for (let rawTab of rawTabs) {
+ if (getTabId(rawTab) === tab.id) {
+ return getOwnerWindow(rawTab);
+ }
+ }
+
+ return null;
+}
+
function searchDir(dirPath, index, keewords) {
// console.debug("Indexing directory: "+dirPath);
var path = "";
@@ -342,9 +362,9 @@ exports.saveTextFile = function saveTextFile(filePath, content, worker) {
* documentation is https://developer.mozilla.org/en/NsIFilePicker
*/
exports.promptFileOpenPicker = function promptFileOpenPicker(worker) {
- console.debug("Opening file selection dialog (not implemented yet)");
-/* try {
- var window = require("window-utils").activeWindow;
+ console.debug("Opening file selection dialog");
+ try {
+ var window = getWindow(worker);
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
fp.init(window, "PDF Open", Ci.nsIFilePicker.modeOpen);
fp.appendFilter("PDF files", "*.pdf");
@@ -364,7 +384,7 @@ exports.promptFileOpenPicker = function promptFileOpenPicker(worker) {
"success": false
});
console.error("File selection failed "+ex);
- }*/
+ }
};
/**
@@ -374,7 +394,8 @@ exports.promptFileOpenPicker = function promptFileOpenPicker(worker) {
exports.promptDirectorySelector = function promptDirectorySelector(worker) {
console.debug("Opening directory selection dialog...");
try {
- var window = require("window-utils").activeWindow;
+// var window = require("window/utils").getMostRecentBrowserWindow();
+ var window = getWindow(worker);
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
fp.init(window, "Directory Selection", Ci.nsIFilePicker.modeGetFolder);
var result = fp.show();
@@ -430,4 +451,4 @@ exports.openExtensionsDirectory = function openExtensionsDirectory(worker) {
} catch(ex) {
console.error("Opening extensions directory failed "+ex);
} */
-}
\ No newline at end of file
+}
diff --git a/lib/main.js b/lib/main.js
index 72353f896..4e7dc302d 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -45,6 +45,7 @@ exports.main = function(options, callbacks) {
contentScriptWhen: 'end',
onAttach: function onAttach(worker) {
console.log("Attaching worker on tab with title: "+worker.tab.title);
+
workers.push(worker);
worker.on('message', function(data) {
handleMessage(data, this);
@@ -126,6 +127,7 @@ function detachWorker(worker) {
function handleMessage(msg, worker) {
console.debug("Message in main.js: "+JSON.stringify(msg)+" from tab "+worker.tab.title);
+ //console.log("Thumbnail: "+worker.tab.getThumbnail());
switch (msg.detail.command) {
case "loadSettings":
settings.loadSettings(worker)
@@ -158,7 +160,7 @@ function handleMessage(msg, worker) {
ioutils.promptFileOpenPicker(worker);
break;
case "selectDirectory":
- ioutils.promptDirectorySelector(worker);
+ ioutils.promptDirectorySelector(worker);
break;
case "openDirectory":
ioutils.openDirectory(msg.detail.path,worker);
diff --git a/package.json b/package.json
index b3162b6e5..eb03b82e6 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "tagspaces",
"license": "AGPL 3.0",
"author": "Ugg Rock",
- "version": "1.3.1260",
+ "version": "1.3.1266",
"fullName": "TagSpaces",
"id": "jid1-FBaMKxTifTSahQ",
"description": "TagSpaces is a firefox addon, which allows you to browse your local file system and add tags to your files.",
diff --git a/update.rdf b/update.rdf
index b72a3057a..414d71925 100644
--- a/update.rdf
+++ b/update.rdf
@@ -7,13 +7,13 @@
<r:Seq>
<r:li>
<r:Description>
- <version>1.3.1260</version>
+ <version>1.3.1266</version>
<targetApplication>
<r:Description>
<id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id>
<minVersion>16.0</minVersion>
<maxVersion>*</maxVersion>
- <updateLink>http://tagspaces.com/releases/1.3/tagspaces.1.3.1260.xpi</updateLink>
+ <updateLink>http://tagspaces.com/releases/1.3/tagspaces.1.3.1266.xpi</updateLink>
<updateInfoURL>http://tagspaces.com/releases/1.3/updateInfo.xml</updateInfoURL>
</r:Description>
</targetApplication>