Grammalecte  Check-in [ebf940de4a]

Overview
Comment:[tb] lexicon editor: useless import
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tb | multid
Files: files | file ages | folders
SHA3-256: ebf940de4ae6542678b2112913753b1afa85e0bd9267ec320cd8208b15ee713b
User & Date: olr on 2018-03-17 16:51:29
Other Links: branch diff | manifest | tags
Context
2018-03-18
17:27
[tb] lexicon editor: update check-in: d61338b1a8 user: olr tags: tb, multid
2018-03-17
16:51
[tb] lexicon editor: useless import check-in: ebf940de4a user: olr tags: tb, multid
16:50
[tb] lexicon editor: useless function check-in: 187891a915 user: olr tags: tb, multid
Changes

Modified gc_lang/fr/tb/content/lex_editor.js from [0c72453f10] to [89f16a45e4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// JavaScript

"use strict";

const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker.");

var FileUtils = Cu.import("resource://gre/modules/FileUtils.jsm").FileUtils
var NetUtil = Cu.import("resource://gre/modules/NetUtil.jsm").NetUtil;


/*
    Common functions
*/

function showError (e) {
    Cu.reportError(e);









<
<
<







1
2
3
4
5
6
7
8
9



10
11
12
13
14
15
16
// JavaScript

"use strict";

const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker.");





/*
    Common functions
*/

function showError (e) {
    Cu.reportError(e);
492
493
494
495
496
497
498


499
500
501
502
503
504
505
        xFilePicker.init(window, "Enregistrer sous", Ci.nsIFilePicker.modeSave);
        xFilePicker.appendFilters(Ci.nsIFilePicker.filterAll | Ci.nsIFilePicker.filterText);
        xFilePicker.open(function (nReturnValue) {
            if (nReturnValue == Ci.nsIFilePicker.returnOK || nReturnValue == Ci.nsIFilePicker.returnReplace) {
                // https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/OSFile.jsm
                OS.File.writeAtomic(xFilePicker.file.path, sJSON, {tmpPath: "file.txt.tmp"}); 
                /*


                // You can also optionally pass a flags parameter here. It defaults to
                // FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE;
                let xOutStream = FileUtils.openSafeFileOutputStream(xFilePicker.file);
                let xConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter);
                xConverter.charset = "UTF-8";
                let xInStream = xConverter.convertToInputStream(sJSON);
                // The last argument (the callback) is optional.







>
>







489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
        xFilePicker.init(window, "Enregistrer sous", Ci.nsIFilePicker.modeSave);
        xFilePicker.appendFilters(Ci.nsIFilePicker.filterAll | Ci.nsIFilePicker.filterText);
        xFilePicker.open(function (nReturnValue) {
            if (nReturnValue == Ci.nsIFilePicker.returnOK || nReturnValue == Ci.nsIFilePicker.returnReplace) {
                // https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/OSFile.jsm
                OS.File.writeAtomic(xFilePicker.file.path, sJSON, {tmpPath: "file.txt.tmp"}); 
                /*
                var FileUtils = Cu.import("resource://gre/modules/FileUtils.jsm").FileUtils
                var NetUtil = Cu.import("resource://gre/modules/NetUtil.jsm").NetUtil;
                // You can also optionally pass a flags parameter here. It defaults to
                // FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE;
                let xOutStream = FileUtils.openSafeFileOutputStream(xFilePicker.file);
                let xConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter);
                xConverter.charset = "UTF-8";
                let xInStream = xConverter.convertToInputStream(sJSON);
                // The last argument (the callback) is optional.