1 | var spmOptionsDialog = { |
---|
2 | |
---|
3 | ///////////////////////////////////////////////////////////////////// |
---|
4 | get STRING() { return document.getElementById("spmOptionsDialogString"); }, |
---|
5 | get DataSource() { return window.opener.top.bitsObjectMng.DataSource; }, |
---|
6 | get Common() { return window.opener.top.bitsObjectMng.Common; }, |
---|
7 | get XPath() { return window.opener.top.bitsObjectMng.XPath; }, |
---|
8 | get Database() { return window.opener.top.bitsObjectMng.Database; }, |
---|
9 | get gBrowser() { return window.opener.top.bitsObjectMng.getBrowser();}, |
---|
10 | |
---|
11 | get ConditionMarker() { return document.getElementById("spmConditionMarker"); }, |
---|
12 | get ConditionMarkerAll() { return document.getElementById("spmConditionMarkerAll"); }, |
---|
13 | get ConditionMarkerSt() { return document.getElementById("spmConditionMarkerSt"); }, |
---|
14 | get ConditionMarkerEn() { return document.getElementById("spmConditionMarkerEn"); }, |
---|
15 | get ConfirmMerge() { return document.getElementById("spmConfirmMerge"); }, |
---|
16 | |
---|
17 | prefs : {}, |
---|
18 | |
---|
19 | ///////////////////////////////////////////////////////////////////// |
---|
20 | initPrefs : function(){ |
---|
21 | this.prefs.conditionMerge = nsPreferences.getIntPref("wiredmarker.merge.conditionMerge", 0); |
---|
22 | this.prefs.confirmMerge = nsPreferences.getBoolPref("wiredmarker.merge.confirmMerge", true); |
---|
23 | }, |
---|
24 | |
---|
25 | ///////////////////////////////////////////////////////////////////// |
---|
26 | init : function(){ |
---|
27 | if(spmOptionsDialog._init) return; |
---|
28 | try{ |
---|
29 | this._init = true; |
---|
30 | this.initPrefs(); |
---|
31 | switch(this.prefs.conditionMerge){ |
---|
32 | case 1: |
---|
33 | this.ConditionMarkerSt.setAttribute("selected",true); |
---|
34 | this.ConditionMarkerEn.removeAttribute("selected"); |
---|
35 | this.ConditionMarkerAll.removeAttribute("selected"); |
---|
36 | break; |
---|
37 | case 2: |
---|
38 | this.ConditionMarkerEn.setAttribute("selected",true); |
---|
39 | this.ConditionMarkerSt.removeAttribute("selected"); |
---|
40 | this.ConditionMarkerAll.removeAttribute("selected"); |
---|
41 | break; |
---|
42 | default: |
---|
43 | this.ConditionMarkerAll.setAttribute("selected",true); |
---|
44 | this.ConditionMarkerSt.removeAttribute("selected"); |
---|
45 | this.ConditionMarkerEn.removeAttribute("selected"); |
---|
46 | break; |
---|
47 | } |
---|
48 | this.ConfirmMerge.setAttribute("checked",this.prefs.confirmMerge); |
---|
49 | |
---|
50 | }catch(ex){ |
---|
51 | this.Common.alert("spmOptionsDialog.init():"+ex); |
---|
52 | } |
---|
53 | }, |
---|
54 | |
---|
55 | ///////////////////////////////////////////////////////////////////// |
---|
56 | done : function(event){ |
---|
57 | if(this._init){ |
---|
58 | this._init = false; |
---|
59 | } |
---|
60 | }, |
---|
61 | |
---|
62 | ///////////////////////////////////////////////////////////////////// |
---|
63 | commandCondition : function(aEvent){ |
---|
64 | this.prefs.conditionMerge = this.ConditionMarker.value; |
---|
65 | }, |
---|
66 | |
---|
67 | ///////////////////////////////////////////////////////////////////// |
---|
68 | commandConfirm : function(aEvent){ |
---|
69 | this.prefs.confirmMerge = this.ConfirmMerge.checked; |
---|
70 | }, |
---|
71 | |
---|
72 | ///////////////////////////////////////////////////////////////////// |
---|
73 | accept : function(aEvent){ |
---|
74 | nsPreferences.setIntPref("wiredmarker.merge.conditionMerge", this.prefs.conditionMerge); |
---|
75 | nsPreferences.setBoolPref("wiredmarker.merge.confirmMerge", this.prefs.confirmMerge); |
---|
76 | }, |
---|
77 | |
---|
78 | ///////////////////////////////////////////////////////////////////// |
---|
79 | cancel : function(aEvent){ |
---|
80 | }, |
---|
81 | |
---|
82 | ///////////////////////////////////////////////////////////////////// |
---|
83 | _dump : function(aString){ |
---|
84 | if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(aString+"\n"); |
---|
85 | }, |
---|
86 | }; |
---|