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

source: content/bindings/v_identity.xml @ 184c6c

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

rearranged tree structure / added build-script

  • Property mode set to 100644
File size: 28.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<!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) {
458              this._menu_separator.removeAttribute("hidden");
459              return this._menu_separator;
460            }
461            else return null;
462        ]]></getter>
463        <setter><![CDATA[
464            if (!val) return;
465            // add hidden separator as indicator that now only virtual identities are added
466            this._menu_separator = document.createElement("menuseparator");
467            this._menu_separator.setAttribute("id", "vid_separator");
468            this._menu_separator.setAttribute("hidden", "true");
469            this._popupElem.appendChild(this._menu_separator)
470        ]]></setter>   
471    </property>
472    <property name="selectedMenuItem" >
473        <getter><![CDATA[
474            return this.selectedItem;
475        ]]></getter>
476        <setter><![CDATA[
477            if (typeof(val) == "object") this.selectedItem = val
478            else if (val == "default")
479                this.selectedItem = this._getMenuItemForIdentity(gAccountManager.defaultAccount.defaultIdentity.key)
480            else this.selectedItem = this._getMenuItemForIdentity(val)
481            this.doCommand();
482        ]]></setter>   
483    </property>
484    <method name="_isExistingCloneMenuItem">
485        <parameter name="localIdentityData" />
486        <body><![CDATA[
487        var MenuItems = this._popupElem.childNodes
488        for (var j = 0; j < MenuItems.length; j++) {
489            if (MenuItems[j].localName == "menuseparator") continue;
490            if (MenuItems[j].identityData.equals(localIdentityData)) return MenuItems[j];
491        }
492        return null;
493        ]]></body>
494    </method>
495    <field name="_msgIdentityElem">document.getElementById("msgIdentity")</field>
496    <field name="_msgIdentityPopupElem">document.getElementById("msgIdentityPopup")</field>
497    <property name="_msgIdentity_selectedItem" >
498        <getter><![CDATA[
499            if (!this._msgIdentityElem.selectedItem) {
500                virtualIdentityExtension.notificationBar.dump("** v_identity.xml: msgIdentityElem.selectedItem not set, using first Menuitem\n");
501                this._msgIdentityElem.selectedItem = this._msgIdentityPopupElem.firstChild
502                virtualIdentityExtension.notificationBar.dump("** v_identity.xml: msgIdentityElem.doCommand()\n");
503                this._msgIdentityElem.doCommand();
504            }
505            return this._msgIdentityElem.selectedItem;
506        ]]></getter>
507    </property> 
508    <method name="blurEvent">
509            <body><![CDATA[
510        virtualIdentityExtension.notificationBar.dump("\n** v_identity.xml blurEvent")
511        this.inputEvent(); // timeout might prevent inputEvent to fire before blurEvent
512       
513        this.label = this.identityData.combinedName; // add "<" and ">" to email if required
514        this.setAttribute("label", this.label);
515        ]]></body>
516    </method>
517    <method name="inputEvent">
518            <body><![CDATA[     
519        virtualIdentityExtension.notificationBar.dump("\n** v_identity.xml inputEvent\n")
520       
521        this.identityData.combinedName = this.label;
522       
523        var existingIdentity = this.checkForVirtualIdentity();
524        if (existingIdentity && this.selectedMenuItem.value != existingIdentity) this.selectedMenuItem = existingIdentity;
525        ]]></body>
526    </method>
527    <method name="checkForVirtualIdentity">
528        <body><![CDATA[
529        virtualIdentityExtension.notificationBar.dump("** v_identity.xml checkForVirtualIdentity: " + this.identityData.id.key + " '" + this.identityData.id.value + "'\n")
530        var existingIdentity = this.identityData.isExistingIdentity(false);
531       
532        this.vid = (!existingIdentity);
533       
534        virtualIdentityExtension.msgIdentityCloneTools.signatureSwitch(existingIdentity);
535       
536        return existingIdentity;
537        ]]></body>
538    </method>
539    <property name="smtp" onget="return this.identityData.smtp.key;" > // used to detect changes from SMTP-Menu
540        <setter><![CDATA[
541        this.identityData.smtp.key = val;
542       
543        document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this);
544
545        var existingIdentity = this.checkForVirtualIdentity();
546        if (existingIdentity) this.selectedMenuItem = existingIdentity;
547        ]]></setter>
548    </property>
549    <property name="identityData">
550        <getter><![CDATA[
551        this._identityDataStorage.extras.readValues(); // update with current data
552        return this._identityDataStorage;
553        ]]></getter>
554        <setter><![CDATA[
555        virtualIdentityExtension.notificationBar.dump("** v_identity.xml identityData setter\n")
556        if (!val) this._identityDataStorage = null
557        else {
558            var oldIdentityData = this._identityDataStorage;
559            this._identityDataStorage = val;
560            if (oldIdentityData) { // indicates that it's not first time after clean
561                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");
562                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");
563                if (!this._identityDataStorage.existingID && !this._identityDataStorage.combinedName)
564                    this._identityDataStorage.fullName = oldIdentityData.fullName;
565                if (!this._identityDataStorage.existingID && !this._identityDataStorage.email)
566                    this._identityDataStorage.email = oldIdentityData.email;
567                if (!this._identityDataStorage.smtp.key) this._identityDataStorage.smtp.key = oldIdentityData.smtp.key;
568                if (!this._identityDataStorage.id.key) this._identityDataStorage.id.key = oldIdentityData.id.key;
569                this._identityDataStorage.extras.setValues();
570                if (this._identityDataStorage.existingID) this.vid = false;
571                else this.checkForVirtualIdentity();
572            }
573            else    this.vid = false;       // first time after clean it's always a real identity
574           
575            this.label = this._identityDataStorage.combinedName;
576            this.value = this._identityDataStorage.id.key;
577            this.description = this._identityDataStorage.sideDescription;
578            document.getAnonymousElementByAttribute(this, "anonid", "smtpServerListHbox").smtp = this._identityDataStorage.smtp.keyNice;
579            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");         
580        }
581        virtualIdentityExtension.notificationBar.dump("** v_identity.xml identityData setter done.'\n")
582        ]]></setter>
583    </property>
584    <field name="_popupElem">document.getElementById("msgIdentityPopup_clone")</field>
585    <field name="tooltipElem">document.getAnonymousElementByAttribute(this, "anonid", "contentHBox")</field>
586    <field name="textBoxElem">document.getAnonymousElementByAttribute(this, "anonid", "textBox");</field>
587    <field name="_prefroot">Components.classes["@mozilla.org/preferences-service;1"]
588        .getService(Components.interfaces.nsIPrefService)
589        .getBranch(null).QueryInterface(Components.interfaces.nsIPrefBranch2)</field>
590    <field name="_observer"><![CDATA[({
591        _self: this,
592            observe: function(aSubject, aTopic, aPrefName) {
593            if (this._self._prefroot)
594                this._self.showSmtp =
595                this._self._prefroot.getBoolPref("extensions.virtualIdentity.show_smtp");
596                var MenuItems = this._self._popupElem.childNodes;
597                for (var j = 0; j < MenuItems.length; j++) {
598                    if (MenuItems[j].localName == "menuseparator") continue;
599                    MenuItems[j].smtpStyle = "width:" + document.getElementById("smtp_server_list").clientWidth + "px;";
600                }
601        }
602        })]]></field>
603    <property name="email" onset="this.identityData.email = val; this.label = this.identityData.combinedName; this.inputEvent()" />
604    <property name="vid" onget="return (this.getAttribute('vid') == 'true');" onset="this.setAttribute('vid',val?'true':'false'); return val;" />
605    <property name="label" onget="return this.textBoxElem.value;" onset="this.textBoxElem.value = val; return val;" />
606    <property name="value" onget="return this.getAttribute('value');" onset="this.setAttribute('value', val); return val;" />
607    <property name="extras" onget="return this.identityData.extras;" />
608    <property name="description" onget="return this.getAttribute('description');" onset="this.setAttribute('description', val); return val;" />
609    <property name="showSmtp" onget="return (this.getAttribute('showSmtp') == 'true');" onset="this.setAttribute('showSmtp',val?'true':'false'); return val;" />
610    </implementation>
611    </binding>
612</bindings>
Note: See TracBrowser for help on using the repository browser.