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

source: chrome/content/v_identity/v_identity.xml @ 3f9026

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

changed preferences dialog

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