This is just some static backup of the original site, don't expect every link to work!

source: chrome/content/v_identity/bindings/v_identity.xml @ 718c41

ng_0.9
Last change on this file since 718c41 was 284956, checked in by rene <rene@…>, 11 years ago

moved some files to increase overview

  • Property mode set to 100644
File size: 28.5 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<!DOCTYPE overlay [
27<!ENTITY % vIdentDTD SYSTEM "chrome://v_identity/locale/v_identity.dtd">
28%vIdentDTD;
29]>
30
31
32<bindings id="mailComposeBindings"
33          xmlns="http://www.mozilla.org/xbl"
34          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
35          xmlns:xbl="http://www.mozilla.org/xbl">
36   
37    <binding id="vI_tooltipPopupset">
38    <implementation>
39    <method name="addTooltip">
40    <parameter name="elem" />
41    <parameter name="permanent" />
42            <body><![CDATA[
43        var randID = elem.tooltipElem.getAttribute("tooltip");
44        this.removeTooltip(randID);
45        if (!randID) {
46            randID = "virtualIdentityExtension_tooltip_" + parseInt((new Date()).getTime());
47            elem.tooltipElem.setAttribute("tooltip", randID);
48        }
49        var toolTip = document.createElement("tooltip");
50        toolTip.setAttribute("class", "identityDataTooltip");
51        toolTip.setAttribute("id", randID);
52        toolTip.elem = elem;
53        toolTip.permanent = permanent;
54        this.appendChild(toolTip);
55        ]]></body>
56    </method>
57    <method name="removeTooltip">
58    <parameter name="randID" />
59        <body><![CDATA[
60        if (randID) {
61            var randIDelem = document.getElementById(randID);
62            if (randIDelem) this.removeChild(randIDelem);
63        }
64        ]]></body>
65    </method>
66    </implementation>
67    </binding>
68   
69    <binding id="vI_identityDataTooltip" extends="chrome://global/content/bindings/popup.xml#tooltip">
70    <content onpopuphidden="popuphidden();" onpopupshowing="this.popupshowing();this.resize()" onpopupshown="this.resize()" >
71            <xul:browser style="overflow:hidden" anonid="tooltipBrowser" type="chrome" class="vI_htmlTextBox" cssSource="vI_TooltipBrowser.css" flex="1" disablehistory="true" onoverflow="document.getBindingParent(this).resize()"/>
72            <children />
73    </content>
74    <implementation>
75    <method name="popupshowing">
76            <body><![CDATA[
77            virtualIdentityExtension.notificationBar.dump("** v_identity.xml vI_tooltipPopupset popupshowing.\n")
78        if (!this._identityInfo) {
79            this._identityInfo =
80                "<table><tr>" +
81                    "<td class='image'><img src='chrome://v_identity/skin/vi-info.png' /></td>" +
82                    "<td class='identityTable'>" +
83                        "<div class='name'>" + this.elem.identityData.combinedNameHtml + "</div>" +
84                        "<table><tbody>" + this.elem.identityData.getMatrix() + "</tbody></table>" +
85                    "</td>" +
86                "</tr></table>"
87            virtualIdentityExtension.notificationBar.dump("** v_identity.xml added tooltip with id='" +  this.elem.identityData.id.key + "'\n")
88            this._tooltipBrowser.outputString = this._identityInfo;
89        }
90        virtualIdentityExtension.notificationBar.dump("** v_identity.xml vI_tooltipPopupset popupshowing done.\n")
91        ]]></body>
92    </method>
93    <method name ="popuphidden">
94            <body><![CDATA[
95        if (!this.permanent) this._identityInfo = null;
96        ]]></body>
97    </method>   
98    <method name="resize">
99        <body><![CDATA[
100        if (!this._identityInfo) return;
101        var width = document.getElementById("msgIdentity_clone").boxObject.width * 0.7;
102        var height = this._tooltipBrowser.contentDocument.lastChild.scrollHeight + 5;
103        this.sizeTo(width, height);
104        width = document.getElementById("msgIdentity_clone").boxObject.width * 0.75;
105        this.sizeTo(width, height);
106        ]]></body>
107    </method>
108    <field name="permanent" />
109    <field name="elem" />
110<!--    <field name="identityData">this.elem.identityData</field> -->
111    <field name="_identityInfo">false</field>
112<!--    <field name="_initialized">false</field> -->
113    <field name="_tooltipBrowser">document.getAnonymousElementByAttribute(this, "anonid", "tooltipBrowser")</field>
114    </implementation>
115    </binding> 
116   
117    <binding id="fromPopupItem_clone" extends="chrome://global/content/bindings/menu.xml#menuitem">
118    <content excludes="template,observes,menupopup">
119        <xul:image class="menupopup_clone-icon" xbl:inherits="src"/>
120        <xul:label class="menupopup_clone-text" xbl:inherits="value=label,accesskey,crop" crop="right" flex="1"/>
121        <xul:label value="&vident.accPane.prettyName.prefix;" class="menupopup_clone-vid virtIdLabel" vid="false" xbl:inherits="vid" crop="right"/>
122            <xul:label class="menupopup_clone-description" xbl:inherits="value=description" crop="right"/>
123        <xul:label class="menupopup_clone-smtp" xbl:inherits="value=smtp,style=smtpStyle" crop="right"/>
124    </content>
125    <implementation>
126    <constructor>
127        <![CDATA[
128        this._identityDataStorage = this.identityData;
129       
130        this.label = this._identityDataStorage.combinedName;
131        this.value = this._identityDataStorage.id.key;
132        virtualIdentityExtension.notificationBar.dump("** v_identity.xml fromPopupItem_clone constructor id='" + this.value + "'.\n")
133
134        this.description = this._identityDataStorage.sideDescription;
135        this.smtp = this._identityDataStorage.smtp.value;
136        virtualIdentityExtension.notificationBar.dump("** v_identity.xml fromPopupItem_clone constructor smtp='" + this.smtp + "'.\n")
137        this.smtpStyle = "width:" + document.getElementById("smtp_server_list").clientWidth + "px;";
138        this._identityDataStorage.smtp.value;
139       
140        document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, true);
141        ]]>
142    </constructor>
143    <method name="clean">
144            <body><![CDATA[
145        document.getElementById("virtualIdentityExtension_tooltipPopupset")
146            .removeTooltip(this.tooltipElem.getAttribute("tooltip"));
147        ]]></body>
148    </method>
149    <destructor>
150        <![CDATA[
151        this.clean();
152        ]]>
153    </destructor>
154    <property name="_identityData" onget="return this._identityDataStorage;" />
155    <field name="tooltipElem">this</field>
156    <property name="vid" onget="return this.getAttribute('vid');" onset="this.setAttribute('vid', val); return val;" />
157    <property name="label" onget="return this.getAttribute('label');" onset="this.setAttribute('label', val); return val;" />
158    <property name="value" onget="return this.getAttribute('value');" onset="this.setAttribute('value', val); return val;" />
159    <property name="description" onget="return this.getAttribute('description');" onset="this.setAttribute('description', val); return val;" />
160    <property name="smtp" onget="return this.getAttribute('smtp');" onset="this.setAttribute('smtp', val); return val;" />
161    <property name="smtpStyle" onget="return this.getAttribute('smtpStyle');" onset="this.setAttribute('smtpStyle', val); return val;" />
162    </implementation>
163    </binding>
164
165    <binding id="smtpServerList">
166    <resources>
167            <stylesheet src="chrome://global/skin/menu.css"/>
168    </resources>
169    <content sizetopopup="pref">
170        <xul:hbox id="smtpServerHbox" class="smtpServerHbox">
171            <xul:menulist class="smtpServerMenuList" anonid="smtpServerMenuList" allowevents="true" id="smtp_server_list">
172                <xul:menupopup anonid="smtp_server_list_popup" />
173            </xul:menulist>
174            <xul:checkbox  id="saveSMTPSwitch" class="vI_plain" allowevents="true" oncommand="event.stopPropagation();virtualIdentityExtension.statusmenu.changeSMTPStatus(this);" >
175                <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="checked" />
176                <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="disabled" />
177            </xul:checkbox>
178            <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="checked" />
179            <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="disabled" />
180        </xul:hbox>
181    </content>
182    <implementation>
183    <method name="addNoneServer">
184        <body><![CDATA[
185        var listitem = document.createElement("menuitem");
186        listitem.setAttribute("class", "menuitem-non-iconic");
187        listitem.setAttribute("type", "non-iconic-noaccel");
188        listitem.setAttribute("label", " ");
189        listitem.setAttribute("key", virtualIdentityExtension.NO_SMTP_TAG);
190        this._smtpPopup.insertBefore(listitem, this._smtpPopup.firstChild);
191        this._smtpMenu.selectedItem = listitem;
192        ]]></body>
193    </method>
194    <method name="_addDefaultServer">
195            <body><![CDATA[
196        var listitem = document.createElement("menuitem");
197        listitem.setAttribute("class", "menuitem-non-iconic");
198        listitem.setAttribute("type", "non-iconic-noaccel");
199        listitem.setAttribute("label", document.getElementById("bundle_messenger").getString("defaultServerTag"));
200        this._smtpPopup.appendChild(listitem);
201        this._smtpMenu.selectedItem = listitem;
202        ]]></body>
203    </method>
204    <method name="_addServer">
205        <parameter name="server" />
206            <body><![CDATA[
207        if (server instanceof Components.interfaces.nsISmtpServer && !server.redirectorType) {
208            var listitem = document.createElement("menuitem");
209            listitem.setAttribute("class", "menuitem-non-iconic");
210            listitem.setAttribute("type", "non-iconic-noaccel");
211            listitem.setAttribute("label", (server.description?server.description:server.hostname));
212            listitem.setAttribute("key", server.key);
213            this._smtpPopup.appendChild(listitem);
214        }
215        ]]></body>
216    </method>
217    <method name="refresh">
218        <body><![CDATA[
219            this.unload();
220            this.load();
221        ]]></body>
222    </method>
223    <method name="load">
224        <body><![CDATA[
225            this._addDefaultServer();
226            this._smtpPopup.appendChild(document.createElement("menuseparator"));
227
228            var servers = Components.classes["@mozilla.org/messengercompose/smtp;1"]
229                .getService(Components.interfaces.nsISmtpService).smtpServers;
230           
231            while (servers && servers.hasMoreElements())
232                this._addServer(servers.getNext());
233        ]]></body>
234    </method>
235    <method name="unload">
236        <body><![CDATA[
237            var MenuItems = this._smtpPopup.childNodes
238            while (MenuItems.length > 0) { this._smtpPopup.removeChild(MenuItems[0]) }
239            this._smtpMenu.selectedItem = null;
240        ]]></body>
241    </method>
242    <constructor>
243        <![CDATA[
244            this.load();
245        ]]>
246    </constructor>
247    <property name="smtp" onget="return this._smtpMenu.selectedItem.getAttribute('key');" >
248        <setter><![CDATA[
249        if (val == virtualIdentityExtension.NO_SMTP_TAG) return; // dont overwrite if not set
250        virtualIdentityExtension.notificationBar.dump("** v_identity.xml smtp set to '" + val + "'\n")
251        var MenuItems = this._smtpPopup.childNodes
252        for (var index = 0; index < MenuItems.length; index++) {
253            if (MenuItems[index].localName == "menuseparator") continue;
254            if (MenuItems[index].getAttribute("key") == val) {
255                this._smtpMenu.selectedItem = MenuItems[index];
256                break;
257            }
258        }
259        ]]></setter>
260    </property>
261    <field name="_smtpPopup">document.getAnonymousElementByAttribute(this, "anonid", "smtp_server_list_popup")</field>
262    <field name="_smtpMenu">document.getAnonymousElementByAttribute(this, "anonid", "smtpServerMenuList")</field>
263    <field name="_smtpService"></field>
264
265    </implementation>
266    </binding>
267   
268   
269   
270   
271    <binding id="fromMenuList_clone" display="xul:menu" extends="chrome://global/content/bindings/menulist.xml#menulist-description">
272    <resources>
273            <stylesheet src="chrome://global/skin/menu.css"/>
274        <stylesheet src="chrome://global/skin/autocomplete.css"/>
275    </resources>
276    <content sizetopopup="pref">
277        <xul:hbox class="contentHBox" anonid="contentHBox" flex="1"  >
278            <xul:hbox id="identityHbox" class="identityHbox" flex="1">
279                <xul:vbox><xul:spacer flex="1" />
280                    <xul:image class="menulist_clone-icon" id="msgIdentity_clone_image" xbl:inherits="src"/>
281                <xul:spacer flex="1" /></xul:vbox>
282                <xul:vbox flex="1" id="msgIdentity_clone_fromVbox"><xul:spacer flex="1" />
283<!--                    textbox is internally an html:input field which inherits the onblur event.
284                    Thats why we have to search the textbox before calling blurEvent() -->
285                    <xul:textbox anonid="textBox" type="search" id="msgIdentity_clonetextBoxElem" class="plain menulist_clone-textbox" allowevents="true" xbl:inherits="value=label,crop,accesskey,nomatch=vid" oncommand="event.stopPropagation(); document.getBindingParent(this).inputEvent();"
286                    onblur="event.stopPropagation(); var elem = this; while (elem.localName != 'textbox') elem = elem.parentNode; document.getBindingParent(elem).blurEvent();"
287                    crop="right" highlightnonmatches="true"/>
288                <xul:spacer flex="1" /></xul:vbox>
289                <xul:vbox id="saveSwitch"><xul:spacer flex="1" />
290                    <xul:checkbox class="vI_plain" allowevents="true" oncommand="event.stopPropagation();virtualIdentityExtension.statusmenu.changeSaveStatus(this);" >
291                        <xul:observes element="virtualIdentityExtension_statusMenu_storage_save" attribute="checked" />
292                    </xul:checkbox>
293                <xul:spacer flex="1" /></xul:vbox>
294                <xul:vbox><xul:spacer flex="1" />
295                    <xul:label value="&vident.accPane.prettyName.prefix;" class="menu_clone-vid virtIdLabel" xbl:inherits="vid" crop="right"/>
296                <xul:spacer flex="1" /></xul:vbox>
297                <xul:observes element="virtualIdentityExtension_statusMenu_storage_save" attribute="checked" />
298            </xul:hbox>
299            <xul:hbox id="baseIDHbox" class="baseIDHbox" >
300                <xul:vbox><xul:spacer flex="1" />
301                    <xul:hbox>
302                        <xul:label id="msgIdentity_base_id_label" class="menu_clone-description" xbl:inherits="value,hidden=base_id_key_hidden" crop="right" hidden="true"/>
303                        <xul:label id="msgIdentity_clone_label" class="menu_clone-description" xbl:inherits="value=description" crop="right"/>
304                    </xul:hbox>
305                <xul:spacer flex="1" /></xul:vbox>
306                <xul:vbox id="saveBaseIDSwitch"><xul:spacer flex="1" />
307                    <xul:checkbox class="vI_plain" allowevents="true" oncommand="event.stopPropagation();virtualIdentityExtension.statusmenu.changeBaseIDStatus(this);" >
308                        <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveBaseID" attribute="checked" />
309                        <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveBaseID" attribute="disabled" />
310                    </xul:checkbox>
311                <xul:spacer flex="1" /></xul:vbox>
312                <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveBaseID" attribute="checked" />
313                <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveBaseID" attribute="disabled" />
314            </xul:hbox>
315            <xul:hbox oncommand="event.stopPropagation();document.getBindingParent(this).smtp = this.smtp" xbl:inherits="showSmtp" anonid="smtpServerListHbox" class="smtpServerListHbox" />
316        </xul:hbox>
317        <children />
318    </content>
319        <implementation>
320    <constructor>
321        <![CDATA[       
322        var inputTextbox = document.getAnonymousElementByAttribute(this, "class", "plain menulist_clone-textbox");
323       
324        // check if 'search' textboxes are not implemented change to 'timed'
325        if (!inputTextbox.timeout) inputTextbox.setAttribute("type", "timed");
326        inputTextbox.setAttribute("timeout", "300")
327       
328        // too early to access virtualIdentityExtension_tooltipPopupset, this might break the interface
329        // it will be done in v_identity.js init
330        // document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, false);
331       
332        this._prefroot.addObserver("extensions.virtualIdentity.show_smtp", this._observer, false);
333        this._observer.observe();
334        ]]>
335    </constructor>
336    <destructor>
337        <![CDATA[
338        var tooltipPopupset = document.getElementById("virtualIdentityExtension_tooltipPopupset")
339        if (tooltipPopupset) tooltipPopupset.removeTooltip(this.tooltipElem.getAttribute("tooltip"));
340        this._prefroot.removeObserver("extensions.virtualIdentity.show_smtp", this._observer);
341        ]]>
342    </destructor>
343
344    <!--
345    double the Identity-Select Dropdown-Menu to be more flexible with modifying it
346    the original Identity Dropdown Menu is hidden and stores the base Identity, on which one
347    the Virtual Identity is build upon
348    -->
349    <method name="command">
350        <body><![CDATA[
351        virtualIdentityExtension.notificationBar.dump("\n** v_identity.xml msgIdentityCloneElem.doCommand() \n")
352        virtualIdentityExtension.notificationBar.dump("\n** v_identity.xml msgIdentityCloneElem.doCommand() \n")
353        // copy selected Menu-Value from clone to orig.
354        virtualIdentityExtension.notificationBar.dump("** v_identity.xmlcopy selected Menu-Value from clone to orig. Searching for id=" + this.selectedMenuItem.identityData.id.key + " \n")
355        if ( this.selectedMenuItem.identityData.id.key != null ) {
356            var MenuItems = this._msgIdentityPopupElem.childNodes
357            for (var index = 0; index < MenuItems.length; index++) {
358                if ( MenuItems[index].getAttribute("value") == this.selectedMenuItem.identityData.id.key ) {
359                    this._msgIdentityElem.selectedItem = MenuItems[index];
360                    this._msgIdentityElem.value = MenuItems[index].getAttribute("value");
361                    break;
362                }
363            }
364            this._msgIdentityPopupElem.doCommand();
365        }
366        this.identityData = this.selectedMenuItem.identityData.getDuplicate();
367        virtualIdentityExtension.notificationBar.dump("\n** v_identity.xml msgIdentityCloneElem.doCommand() this.value=" + this.value + "\n");
368        // if current SMTP is empty, take the one from current Identity
369        if (this.identityData.smtp.hasNoDefinedSMTP()) {
370            this.identityData.smtp.key = gAccountManager.getIdentity(this.value).smtpServerKey;
371            document.getAnonymousElementByAttribute(this, "anonid", "smtpServerListHbox").smtp = this.identityData.smtp.keyNice;
372            this.checkForVirtualIdentity();
373        }
374    ]]></body>
375    </method>   
376    <method name="init">
377        <body><![CDATA[
378        var MenuItems = this._msgIdentityPopupElem.childNodes
379        for (var index = 0; index < MenuItems.length; index++) {
380            var identity = gAccountManager.getIdentity(MenuItems[index].getAttribute("value"));
381           
382            var description;
383            var server = gAccountManager.GetServersForIdentity(identity).QueryElementAt(0, Components.interfaces.nsIMsgIncomingServer);
384            // if (server.type == "nntp")
385                description = server.prettyName
386            // else description = identity.description?"- "+identity.description:identity.accountname
387           
388            var newIdentity = new virtualIdentityExtension.identityData(identity.email, identity.fullName, identity.key,
389                        identity.smtpServerKey, null, description, true)
390            newIdentity.extras.readIdentityValues(identity);
391               
392            var menuItem = this.addIdentityToCloneMenu(newIdentity)
393
394            if (this._msgIdentity_selectedItem == MenuItems[index]) {
395                this.selectedItem = menuItem;
396                this.identityData = newIdentity.getDuplicate();
397            }
398        }
399        this._popupMenu_separator = true;
400        ]]></body>
401    </method>
402    <method name="clean">
403        <body><![CDATA[
404        var MenuItems = this._popupElem.childNodes;
405        while (MenuItems.length > 0) {
406            try {MenuItems[0].clean();} catch (e) { };
407            this._popupElem.removeChild(MenuItems[0])
408        }
409        this.selectedItem = null;
410        this.identityData = null;
411       
412        this._menu_separator = null;
413        ]]></body>
414    </method>   
415    <method name="addIdentityToCloneMenu">
416        <parameter name="localIdentityData" />
417        <body><![CDATA[
418        var existingItem = this._isExistingCloneMenuItem(localIdentityData);
419        if (!existingItem) {
420            var MenuItem = document.createElement("menuitem");
421                MenuItem.identityData = localIdentityData;
422            MenuItem.setAttribute("class", "identity_clone-popup-item");
423            MenuItem.setAttribute("type", "vIdentity"); // to prevent overriding with menuitem:not([type])
424            MenuItem.value = localIdentityData.id.key; // might be accessed before item is constructed
425
426            // set vid explicitely
427            if (this._popupMenu_separator) MenuItem.setAttribute("vid", "true");
428            else    MenuItem.setAttribute("vid", "false");
429                       
430            this._popupElem.appendChild(MenuItem);
431            return MenuItem;
432        }
433        else return existingItem;
434        ]]></body>
435    </method>
436    <method name="addIdentitiesToCloneMenu">
437        <parameter name="identityCollection" />
438        <body><![CDATA[
439        for (var index = 0; index < identityCollection.number; index++)
440            identityCollection.menuItems[index] =
441                this.addIdentityToCloneMenu(identityCollection.identityDataCollection[index])
442        ]]></body>
443    </method>
444    <method name="_getMenuItemForIdentity">
445        <parameter name="identitykey" />
446        <body><![CDATA[
447        var MenuItems = this._popupElem.childNodes;
448        for (var index = 0; index < MenuItems.length; index++) {
449            if (MenuItems[index].value == identitykey)
450                return MenuItems[index]
451        }
452        return null;
453        ]]></body>
454    </method>
455    <property name="_popupMenu_separator" >
456        <getter><![CDATA[
457            if (this._menu_separator) this._menu_separator.removeAttribute("hidden");
458            return this._menu_separator;
459        ]]></getter>
460        <setter><![CDATA[
461            if (!val) return;
462            // add hidden separator as indicator that now only virtual identities are added
463            this._menu_separator = document.createElement("menuseparator");
464            this._menu_separator.setAttribute("id", "vid_separator");
465            this._menu_separator.setAttribute("hidden", "true");
466            this._popupElem.appendChild(this._menu_separator)
467        ]]></setter>   
468    </property>
469    <property name="selectedMenuItem" >
470        <getter><![CDATA[
471            return this.selectedItem;
472        ]]></getter>
473        <setter><![CDATA[
474            if (typeof(val) == "object") this.selectedItem = val
475            else if (val == "default")
476                this.selectedItem = this._getMenuItemForIdentity(gAccountManager.defaultAccount.defaultIdentity.key)
477            else this.selectedItem = this._getMenuItemForIdentity(val)
478            this.doCommand();
479        ]]></setter>   
480    </property>
481    <method name="_isExistingCloneMenuItem">
482        <parameter name="localIdentityData" />
483        <body><![CDATA[
484        var MenuItems = this._popupElem.childNodes
485        for (var j = 0; j < MenuItems.length; j++) {
486            if (MenuItems[j].localName == "menuseparator") continue;
487            if (MenuItems[j].identityData.equals(localIdentityData)) return MenuItems[j];
488        }
489        return null;
490        ]]></body>
491    </method>
492    <field name="_msgIdentityElem">document.getElementById("msgIdentity")</field>
493    <field name="_msgIdentityPopupElem">document.getElementById("msgIdentityPopup")</field>
494    <property name="_msgIdentity_selectedItem" >
495        <getter><![CDATA[
496            if (!this._msgIdentityElem.selectedItem) {
497                virtualIdentityExtension.notificationBar.dump("** v_identity.xml: msgIdentityElem.selectedItem not set, using first Menuitem\n");
498                this._msgIdentityElem.selectedItem = this._msgIdentityPopupElem.firstChild
499                virtualIdentityExtension.notificationBar.dump("** v_identity.xml: msgIdentityElem.doCommand()\n");
500                this._msgIdentityElem.doCommand();
501            }
502            return this._msgIdentityElem.selectedItem;
503        ]]></getter>
504    </property> 
505    <method name="blurEvent">
506            <body><![CDATA[
507        virtualIdentityExtension.notificationBar.dump("\n** v_identity.xml blurEvent")
508        this.inputEvent(); // timeout might prevent inputEvent to fire before blurEvent
509       
510        this.label = this.identityData.combinedName; // add "<" and ">" to email if required
511        this.setAttribute("label", this.label);
512        ]]></body>
513    </method>
514    <method name="inputEvent">
515            <body><![CDATA[     
516        virtualIdentityExtension.notificationBar.dump("\n** v_identity.xml inputEvent\n")
517       
518        this.identityData.combinedName = this.label;
519       
520        var existingIdentity = this.checkForVirtualIdentity();
521        if (existingIdentity && this.selectedMenuItem.value != existingIdentity) this.selectedMenuItem = existingIdentity;
522        ]]></body>
523    </method>
524    <method name="checkForVirtualIdentity">
525        <body><![CDATA[
526        virtualIdentityExtension.notificationBar.dump("** v_identity.xml checkForVirtualIdentity: " + this.identityData.id.key + " '" + this.identityData.id.value + "'\n")
527        var existingIdentity = this.identityData.isExistingIdentity(false);
528       
529        this.vid = (!existingIdentity);
530       
531        virtualIdentityExtension.msgIdentityCloneTools.signatureSwitch(existingIdentity);
532       
533        return existingIdentity;
534        ]]></body>
535    </method>
536    <property name="smtp" onget="return this.identityData.smtp.key;" > // used to detect changes from SMTP-Menu
537        <setter><![CDATA[
538        this.identityData.smtp.key = val;
539       
540        document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this);
541
542        var existingIdentity = this.checkForVirtualIdentity();
543        if (existingIdentity) this.selectedMenuItem = existingIdentity;
544        ]]></setter>
545    </property>
546    <property name="identityData">
547        <getter><![CDATA[
548        this._identityDataStorage.extras.readValues(); // update with current data
549        return this._identityDataStorage;
550        ]]></getter>
551        <setter><![CDATA[
552        virtualIdentityExtension.notificationBar.dump("** v_identity.xml identityData setter\n")
553        if (!val) this._identityDataStorage = null
554        else {
555            var oldIdentityData = this._identityDataStorage;
556            this._identityDataStorage = val;
557            if (oldIdentityData) { // indicates that it's not first time after clean
558                virtualIdentityExtension.notificationBar.dump("** v_identity.xml previousID: fullName='" + oldIdentityData.fullName + "' email='" + oldIdentityData.email + "' smtp='" + oldIdentityData.smtp.key + "' id='" + oldIdentityData.id.key + "' existingID='" + oldIdentityData.existingID + "'\n");
559                virtualIdentityExtension.notificationBar.dump("** v_identity.xml newID: fullName='" + this._identityDataStorage.fullName + "' email='" + this._identityDataStorage.email + "' smtp='" + this._identityDataStorage.smtp.key + "' id='" + this._identityDataStorage.id.key + "' existingID='" + this._identityDataStorage.existingID + "'\n");
560                if (!this._identityDataStorage.existingID && !this._identityDataStorage.combinedName)
561                    this._identityDataStorage.fullName = oldIdentityData.fullName;
562                if (!this._identityDataStorage.existingID && !this._identityDataStorage.email)
563                    this._identityDataStorage.email = oldIdentityData.email;
564                if (!this._identityDataStorage.smtp.key) this._identityDataStorage.smtp.key = oldIdentityData.smtp.key;
565                if (!this._identityDataStorage.id.key) this._identityDataStorage.id.key = oldIdentityData.id.key;
566                this._identityDataStorage.extras.setValues();
567                if (this._identityDataStorage.existingID) this.vid = false;
568                else this.checkForVirtualIdentity();
569            }
570            else    this.vid = false;       // first time after clean it's always a real identity
571           
572            this.label = this._identityDataStorage.combinedName;
573            this.value = this._identityDataStorage.id.key;
574            this.description = this._identityDataStorage.sideDescription;
575            document.getAnonymousElementByAttribute(this, "anonid", "smtpServerListHbox").smtp = this._identityDataStorage.smtp.keyNice;
576            virtualIdentityExtension.notificationBar.dump("** v_identity.xml resultingID: fullName='" + this._identityDataStorage.fullName + "' email='" + this._identityDataStorage.email + "' smtp='" + this._identityDataStorage.smtp.key + "' id='" + this._identityDataStorage.id.key + "' existingID='" + this._identityDataStorage.existingID + "'\n");         
577        }
578        virtualIdentityExtension.notificationBar.dump("** v_identity.xml identityData setter done.'\n")
579        ]]></setter>
580    </property>
581    <field name="_popupElem">document.getElementById("msgIdentityPopup_clone")</field>
582    <field name="tooltipElem">document.getAnonymousElementByAttribute(this, "anonid", "contentHBox")</field>
583    <field name="textBoxElem">document.getAnonymousElementByAttribute(this, "anonid", "textBox");</field>
584    <field name="_prefroot">Components.classes["@mozilla.org/preferences-service;1"]
585        .getService(Components.interfaces.nsIPrefService)
586        .getBranch(null).QueryInterface(Components.interfaces.nsIPrefBranch2)</field>
587    <field name="_observer"><![CDATA[({
588        _self: this,
589            observe: function(aSubject, aTopic, aPrefName) {
590            if (this._self._prefroot)
591                this._self.showSmtp =
592                this._self._prefroot.getBoolPref("extensions.virtualIdentity.show_smtp");
593                var MenuItems = this._self._popupElem.childNodes;
594                for (var j = 0; j < MenuItems.length; j++) {
595                    if (MenuItems[j].localName == "menuseparator") continue;
596                    MenuItems[j].smtpStyle = "width:" + document.getElementById("smtp_server_list").clientWidth + "px;";
597                }
598        }
599        })]]></field>
600    <property name="email" onset="this.identityData.email = val; this.label = this.identityData.combinedName; this.inputEvent()" />
601    <property name="vid" onget="return (this.getAttribute('vid') == 'true');" onset="this.setAttribute('vid',val?'true':'false'); return val;" />
602    <property name="label" onget="return this.textBoxElem.value;" onset="this.textBoxElem.value = val; return val;" />
603    <property name="value" onget="return this.getAttribute('value');" onset="this.setAttribute('value', val); return val;" />
604    <property name="extras" onget="return this.identityData.extras;" />
605    <property name="description" onget="return this.getAttribute('description');" onset="this.setAttribute('description', val); return val;" />
606    <property name="showSmtp" onget="return (this.getAttribute('showSmtp') == 'true');" onset="this.setAttribute('showSmtp',val?'true':'false'); return val;" />
607    </implementation>
608    </binding>
609</bindings>
Note: See TracBrowser for help on using the repository browser.