Grammalecte  Diff

Differences From Artifact [3be1484aff]:

To Artifact [225bd1d02e]:


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm").AddonManager;

/*
const parser = Cc["@mozilla.org/parserutils;1"].getService(Ci.nsIParserUtils);
const persodict = Cc["@mozilla.org/spellchecker/personaldictionary;1"].getService(Ci.mozIPersonalDictionary);
*/

const system = require("sdk/system");


var oSpellControl = {
	xSCEngine: null,
	init: function () {
		if (this.xSCEngine === null) {
			try {







|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm").AddonManager;

/*
const parser = Cc["@mozilla.org/parserutils;1"].getService(Ci.nsIParserUtils);
const persodict = Cc["@mozilla.org/spellchecker/personaldictionary;1"].getService(Ci.mozIPersonalDictionary);
*/

//const system = require("sdk/system");


var oSpellControl = {
	xSCEngine: null,
	init: function () {
		if (this.xSCEngine === null) {
			try {
129
130
131
132
133
134
135
136
137
138

139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
	},
	setExtensionDictFolder: function (sDictName, bActivate) {
		try {
			let that = this;
			let sPath = "/content/dictionaries/" + sDictName;
			AddonManager.getAddonByID("French-GC-TB@grammalecte.net", function (addon) {
				let xURI = addon.getResourceURI(sPath);
				//console.log("> " + xURI.path);
				let sFolder = xURI.path;
				if (system.platform === "winnt") {

					sFolder = sFolder.slice(1).replace(/\//g, "\\\\");
				}
				//console.log("> " + sFolder);
				if (bActivate) {
					that.addDirectory(sFolder);
				} else {
					that.removeDirectory(sFolder);
				}
			});
		}
		catch (e) {
			echo("Unable to add extension folder");
			Cu.reportError(e);
		}
	}
};







|

|
>


|













129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
	},
	setExtensionDictFolder: function (sDictName, bActivate) {
		try {
			let that = this;
			let sPath = "/content/dictionaries/" + sDictName;
			AddonManager.getAddonByID("French-GC-TB@grammalecte.net", function (addon) {
				let xURI = addon.getResourceURI(sPath);
				console.log("> " + xURI.path);
				let sFolder = xURI.path;
				//if (system.platform === "winnt") {
				if (sFolder) {
					sFolder = sFolder.slice(1).replace(/\//g, "\\\\");
				}
				console.log("> " + sFolder);
				if (bActivate) {
					that.addDirectory(sFolder);
				} else {
					that.removeDirectory(sFolder);
				}
			});
		}
		catch (e) {
			echo("Unable to add extension folder");
			Cu.reportError(e);
		}
	}
};