Grammalecte  Check-in [66ee6776cc]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[tb] gc options: ui update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tb | tbme
Files: files | file ages | folders
SHA3-256:66ee6776cc25895a64db954e8e65fa7ec437996f71cae47a446fc7ef0f6312a1
User & Date: olr 2019-09-05 06:56:14
Context
2019-09-05
06:57
[tb] gc options: ui update check-in: 780895ad13 user: olr tags: tb, tbme
06:56
[tb] gc options: ui update check-in: 66ee6776cc user: olr tags: tb, tbme
06:00
[tb] code cleaning check-in: 6a95ec929e user: olr tags: tb, tbme
Changes

Changes to gc_lang/fr/mailext/content/gc_options.js.

6
7
8
9
10
11
12

13








14

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

30
31
32
33
34
35
36
37
38
39
40
41

42
43
44
45
46
const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker.");


var oOptControl = {
    oOptions: null,
    load: function () {
        this._setDialogOptions(false);

    },








    _setDialogOptions: function (bDefaultOptions=false) {

        try {
            sOptions = bDefaultOptions ? prefs.getCharPref("sGCDefaultOptions") : prefs.getCharPref("sGCOptions");
            this.oOptions = JSON.parse(sOptions);
            for (let sParam in this.oOptions) {
                if (document.getElementById("option_"+sParam) !== null) {
                    document.getElementById("option_"+sParam).checked = this.oOptions[sParam];
                }
            }
        }
        catch (e) {
            console.error(e);
            // Cu.reportError(e);
        }
    },
    save: function () {

        try {
            for (let xNode of document.getElementsByClassName("option")) {
                this.oOptions[xNode.id.slice(7)] = xNode.checked;
            }
            prefs.setCharPref("sGCOptions", JSON.stringify(this.oOptions));
        }
        catch (e) {
            console.error(e);
            // Cu.reportError(e);
        }
    },
    reset: function () {

        this._setDialogOptions(true);
    }
}

oOptControl.load();







>

>
>
>
>
>
>
>
>

>











<



>








<



>





6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
56
const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker.");


var oOptControl = {
    oOptions: null,
    load: function () {
        this._setDialogOptions(false);
        this.listen();
    },
    listen: function () {
        document.addEventListener("dialogaccept", (event) => {
            this.save();
        });
        document.addEventListener("dialogextra1", (event) => {
            this.reset();
        });
    },
    _setDialogOptions: function (bDefaultOptions=false) {
        console.log("_setDialogOptions");
        try {
            sOptions = bDefaultOptions ? prefs.getCharPref("sGCDefaultOptions") : prefs.getCharPref("sGCOptions");
            this.oOptions = JSON.parse(sOptions);
            for (let sParam in this.oOptions) {
                if (document.getElementById("option_"+sParam) !== null) {
                    document.getElementById("option_"+sParam).checked = this.oOptions[sParam];
                }
            }
        }
        catch (e) {
            console.error(e);

        }
    },
    save: function () {
        console.log("save");
        try {
            for (let xNode of document.getElementsByClassName("option")) {
                this.oOptions[xNode.id.slice(7)] = xNode.checked;
            }
            prefs.setCharPref("sGCOptions", JSON.stringify(this.oOptions));
        }
        catch (e) {
            console.error(e);

        }
    },
    reset: function () {
        console.log("reset");
        this._setDialogOptions(true);
    }
}

oOptControl.load();

Changes to gc_lang/fr/mailext/content/gc_options.xul.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE dialog SYSTEM "chrome://grammarchecker/locale/gc_options.dtd">

<dialog
  id="grammalecte-gcoptions-window"
  title="&window.title;"
  orient="vertical"
  buttons="accept, cancel, extra1"
  ondialogaccept="oOptControl.save();"
  ondialogcancel="return;"
  buttonlabelextra1="&defaultbutton.label;"
  ondialogextra1="oOptControl.reset();"
  defaultButton="accept"
  width="400"
  onload="document.getElementById('grammalecte-gcoptions-window').centerWindowOnScreen();"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <!-- Other elements go here -->








<
<

<







5
6
7
8
9
10
11


12

13
14
15
16
17
18
19
<!DOCTYPE dialog SYSTEM "chrome://grammarchecker/locale/gc_options.dtd">

<dialog
  id="grammalecte-gcoptions-window"
  title="&window.title;"
  orient="vertical"
  buttons="accept, cancel, extra1"


  buttonlabelextra1="&defaultbutton.label;"

  defaultButton="accept"
  width="400"
  onload="document.getElementById('grammalecte-gcoptions-window').centerWindowOnScreen();"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <!-- Other elements go here -->