Index: gc_lang/fr/mailext/content/overlay.js ================================================================== --- gc_lang/fr/mailext/content/overlay.js +++ gc_lang/fr/mailext/content/overlay.js @@ -7,11 +7,11 @@ const Ci = Components.interfaces; //const Cu = Components.utils; //const { require } = Cu.import("resource://gre/modules/commonjs/toolkit/require.js", {}); const { BasePromiseWorker } = ChromeUtils.import('resource://gre/modules/PromiseWorker.jsm', {}); -const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker."); +const xGrammalectePrefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker."); //const text = require("resource://grammalecte/text.js"); //const tf = require("resource://grammalecte/fr/textformatter.js"); @@ -37,24 +37,24 @@ if (this.xGCEWorker === null) { // Grammar checker console.log('Loading Grammalecte'); this.xGCEWorker = new BasePromiseWorker('chrome://promiseworker/content/gce_worker.js'); let that = this; - let xPromise = this.xGCEWorker.post('loadGrammarChecker', [prefs.getCharPref("sGCOptions"), "Thunderbird"]); + let xPromise = this.xGCEWorker.post('loadGrammarChecker', [xGrammalectePrefs.getCharPref("sGCOptions"), "Thunderbird"]); xPromise.then( function (aVal) { console.log(aVal); - prefs.setCharPref("sGCOptions", aVal); + xGrammalectePrefs.setCharPref("sGCOptions", aVal); // spelling dictionary - if (prefs.getCharPref("sMainDicName")) { - let sMainDicName = prefs.getCharPref("sMainDicName"); + if (xGrammalectePrefs.getCharPref("sMainDicName")) { + let sMainDicName = xGrammalectePrefs.getCharPref("sMainDicName"); if (sMainDicName == "fr-classic.json" || sMainDicName == "fr-reform.json") { that.xGCEWorker.post("setDictionary", ["main", sMainDicName]); } } // personal dictionary - if (prefs.getBoolPref("bPersonalDictionary")) { + if (xGrammalectePrefs.getBoolPref("bPersonalDictionary")) { let sDicJSON = oFileHandler.loadFile("fr.personal.json"); if (sDicJSON) { that.xGCEWorker.post('setDictionary', ["personal", sDicJSON]); } } @@ -97,15 +97,15 @@ function (aCaught) { console.log('Promise Error', aCaught); } ); }, setOptions: function () { console.log('Set options'); - let xPromise = this.xGCEWorker.post('setOptions', [prefs.getCharPref("sGCOptions")]); + let xPromise = this.xGCEWorker.post('setOptions', [xGrammalectePrefs.getCharPref("sGCOptions")]); xPromise.then( function (aVal) { console.log(aVal); - prefs.setCharPref("sGCOptions", aVal); + xGrammalectePrefs.setCharPref("sGCOptions", aVal); }, function (aReason) { console.log('Promise rejected', aReason); } ).catch( function (aCaught) { console.log('Promise Error', aCaught); } ); @@ -113,11 +113,11 @@ resetOptions: function () { let xPromise = this.xGCEWorker.post('resetOptions'); xPromise.then( function (aVal) { console.log(aVal); - prefs.setCharPref("sGCOptions", aVal); + xGrammalectePrefs.setCharPref("sGCOptions", aVal); }, function (aReason) { console.log('Promise rejected', aReason); } ).catch( function (aCaught) { console.log('Promise Error', aCaught); } ); @@ -444,11 +444,11 @@ let that = this; let xPromise = this.xGCEWorker.post('getDefaultOptions'); xPromise.then( function (aVal) { console.log(aVal); - prefs.setCharPref("sGCDefaultOptions", aVal); + xGrammalectePrefs.setCharPref("sGCDefaultOptions", aVal); }, function (aReason) { console.log('Promise rejected', aReason); } ).catch( function (aCaught) { console.log('Promise Error', aCaught); } ).then( @@ -485,11 +485,11 @@ var oTextFormatter = { init: function () { try { this.closePanel(); this.listen(); - let sTFOptions = prefs.getCharPref("sTFOptions"); + let sTFOptions = xGrammalectePrefs.getCharPref("sTFOptions"); if (sTFOptions !== "") { this.setOptionsInPanel(JSON.parse(sTFOptions)); this.resetProgressBar(); } else { this.reset(); @@ -529,11 +529,11 @@ let oOptions = {}; for (let xNode of document.getElementsByClassName("option")) { oOptions[xNode.id] = xNode.checked; } //console.log("save options: " + JSON.stringify(oOptions)); - prefs.setCharPref("sTFOptions", JSON.stringify(oOptions)); + xGrammalectePrefs.setCharPref("sTFOptions", JSON.stringify(oOptions)); }, setOptionsInPanel: function (oOptions) { for (let sOptName in oOptions) { //console.log(sOptName + ":" + oOptions[sOptName]); if (document.getElementById(sOptName) !== null) {