source: content/prefDialog/vI_prefDialog.xml @ fe0698

ng_0.9
Last change on this file since fe0698 was fe0698, checked in by rene <rene@…>, 8 years ago

cleaned debugging from newline - thats standard

  • Property mode set to 100644
File size: 5.6 KB
Line 
1<?xml version="1.0"?>
2<!-- ***** BEGIN LICENSE BLOCK *****
3   - This program is free software; you can redistribute it and/or modify
4   - it under the terms of the GNU General Public License as published by
5   - the Free Software Foundation; either version 2 of the License, or
6   - (at your option) any later version.
7
8   - This program is distributed in the hope that it will be useful,
9   - but WITHOUT ANY WARRANTY; without even the implied warranty of
10   - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11   - GNU General Public License for more details.
12
13   - You should have received a copy of the GNU General Public License
14   - along with this program; if not, write to the Free Software
15   - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16
17   - The Original Code is the Virtual Identity Extension.
18
19   - The Initial Developer of the Original Code is Rene Ejury.
20   - Portions created by the Initial Developer are Copyright (C) 2007
21   - the Initial Developer. All Rights Reserved.
22
23   - Contributor(s):
24   - ***** END LICENSE BLOCK ***** -->
25
26<bindings id="prefDialogBindings"
27          xmlns="http://www.mozilla.org/xbl"
28          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
29          xmlns:xbl="http://www.mozilla.org/xbl">
30   
31    <binding id="identitySelector" extends="chrome://global/content/bindings/listbox.xml#listbox">
32    <implementation>
33    <constructor>
34        <![CDATA[
35        with (virtualIdentityExtension.LIB) {
36        virtualIdentityExtension.MyLog.debug("prefDialog.xml identitySelector: constructor");
37        var AccountManager = Components.classes["@mozilla.org/messenger/account-manager;1"]
38            .getService(Components.interfaces.nsIMsgAccountManager);
39        var debugNotes = vI.prefDialog.preferences.getBoolPref("debug_notification");
40
41        for (let i = AccountManager.accounts.Count() - 1; i >= 0 ; i--) {
42            var account = AccountManager.accounts.QueryElementAt(i, Components.interfaces.nsIMsgAccount);
43            for (let j = account.identities.Count() - 1; j >= 0 ; j--) {
44                var identity = account.identities.QueryElementAt(j, Components.interfaces.nsIMsgIdentity);
45                const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
46                var listitem = document.createElementNS(XUL_NS, "listitem"); // create a new XUL listitem
47                listitem.setAttribute("class", "selectorListitem");
48                listitem.setAttribute("label", identity.identityName);
49                listitem.setAttribute("value", identity.key);
50                listitem.setAttribute("description", " - " + account.incomingServer.prettyName);
51                listitem.setAttribute("debugNotesHidden", !debugNotes);
52                if (this.firstChild) this.insertBefore(listitem, this.firstChild);      // ensure that new elements are visible
53                else this.appendChild(listitem);                                        // otherwise checkbox will not be initialized
54            }
55        }
56        if (debugNotes)
57            document.getAnonymousElementByAttribute(this, "id", "ignoreIDs_debug").removeAttribute("hidden")
58        }
59        ]]>
60    </constructor>
61    <property name="value" >
62        <setter><![CDATA[
63        with (virtualIdentityExtension.LIB) {
64        virtualIdentityExtension.MyLog.debug("prefDialog.xml identitySelector: setting value to '" + val + "'");
65        var listItems = this.childNodes;
66        for (var index = 0; index < listItems.length; index++) {
67            var key = listItems[index].getAttribute("value");
68            listItems[index].checked = (val.indexOf(":" + key + ":") == -1);
69            virtualIdentityExtension.MyLog.debug("prefDialog.xml identitySelector: setting value, '" + listItems[index].getAttribute("value") + "' '" + listItems[index].checked + "' '" + listItems[index].getAttribute("checked") + "'")
70        }
71        this._value = val;
72        }
73        ]]></setter>
74        <getter><![CDATA[
75        with (virtualIdentityExtension.LIB) {
76        virtualIdentityExtension.MyLog.debug("prefDialog.xml identitySelector: getting value");
77        var returnVal = "";
78        var listItems = this.childNodes;
79        for (var index = 0; index < listItems.length; index++) {
80            virtualIdentityExtension.MyLog.debug("prefDialog.xml identitySelector: getting value, '" + listItems[index].getAttribute("value") + "' '" + listItems[index].checked + "' '" + listItems[index].getAttribute("checked") + "'");
81            if (!listItems[index].checked) returnVal += " :" + listItems[index].getAttribute("value") + ": "
82        }
83        virtualIdentityExtension.MyLog.debug("prefDialog.xml identitySelector: getting value, result '" + returnVal + "'");
84        return returnVal;
85        }
86        ]]></getter>       
87    </property>
88    </implementation>
89    </binding>
90
91    <binding id="selectorListitem" extends="chrome://global/content/bindings/listbox.xml#listitem">
92    <content allowevents="true">
93        <xul:checkbox anonid="selector_checkbox" />
94        <xul:label class="menupopup_clone-text" xbl:inherits="value=label,accesskey,crop" />
95        <xul:label class="menupopup_clone-description" anonid="debugNote" xbl:inherits="value=value, hidden=debugNotesHidden" hidden="true" />
96        <xul:label class="menupopup_clone-description" xbl:inherits="value=description" flex="1" />
97    </content>
98    <implementation>
99    <property name="checked" onget="return this._checkbox.checked;" onset="this._checkbox.checked = val;" />
100    <field name="_checkbox">document.getAnonymousElementByAttribute(this, "anonid", "selector_checkbox")</field>
101    </implementation>
102    </binding>
103
104</bindings>
Note: See TracBrowser for help on using the repository browser.