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 @ 2f8c7f

lite_0.1multiEditng_0.6ng_0.6_helpng_0.8ng_0.9
Last change on this file since 2f8c7f was 2f8c7f, checked in by rene <rene@…>, 14 years ago

collection of changes to 0.6 branch

  • Property mode set to 100644
File size: 20.0 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="autoReplyTo" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
38    <content>
39        <children />
40        <xul:label class="menupopup_clone-description" value="autoReplyTo" />
41        <xul:observes element="msgIdentity_clone" attribute="label" onbroadcast="alert(document.getBindingParent(this).label); document.getBindingParent(this).value = document.getBindingParent(this).label" />
42    </content>
43    </binding>
44   
45    <binding id="tooltipPopupset">
46    <implementation>
47    <method name="addTooltip">
48    <parameter name="elem" />
49    <parameter name="permanent" />
50            <body><![CDATA[
51        var randID = elem.tooltipElem.getAttribute("tooltip");
52        this.removeTooltip(randID);
53        if (!randID) {
54            randID = "tooltip_" + parseInt((new Date()).getTime());
55            elem.tooltipElem.setAttribute("tooltip", randID);
56        }
57        var toolTip = document.createElement("tooltip");
58        toolTip.setAttribute("class", "identityDataTooltip");
59        toolTip.setAttribute("id", randID);
60        toolTip.elem = elem;
61        toolTip.permanent = permanent;
62        this.appendChild(toolTip);
63        ]]></body>
64    </method>
65    <method name="removeTooltip">
66    <parameter name="randID" />
67            <body><![CDATA[
68        if (randID) this.removeChild(document.getElementById(randID))
69        ]]></body>
70    </method>
71    </implementation>
72    </binding>
73   
74    <binding id="vI_identityDataTooltip" extends="chrome://global/content/bindings/popup.xml#tooltip">
75    <content onpopuphidden="popuphidden();" onpopupshowing="this.popupshowing();this.resize()" onpopupshown="this.resize()" >
76            <xul:browser style="overflow:hidden" anonid="tooltipBrowser" class="vI_htmlTextBox" cssSource="vI_TooltipBrowser.css" flex="1" disablehistory="true" onoverflow="document.getBindingParent(this).resize()"/>
77            <children />
78    </content>
79    <implementation>
80    <method name="popupshowing">
81            <body><![CDATA[
82        if (!this._identityInfo) {
83            this._identityInfo =
84                "<table>" +
85                "<tr>" +
86                    "<td colspan='2' class='name'>" + this.elem.identityData.combinedNameHtml + "</td>" +
87                "</tr><tr>" +
88                    "<td class='image'><img src='chrome://v_identity/skin/vi-info.png' /></td>" +
89                    "<td class='identityTable'><table><tbody>" + this.elem.identityData.getMatrix() + "</tbody></table></td>" +
90                "</tr>" +
91                "</table>"
92            this._tooltipBrowser.outputString = this._identityInfo;
93        }
94        ]]></body>
95    </method>
96    <method name ="popuphidden">
97            <body><![CDATA[
98        if (!this.permanent) this._identityInfo = null;
99        ]]></body>
100    </method>   
101    <method name="resize">
102        <body><![CDATA[
103        if (!this._identityInfo) return;
104        var width = document.getElementById("msgIdentity_clone").boxObject.width * 0.7;
105        var height = this._tooltipBrowser.contentDocument.lastChild.scrollHeight + 5;
106        this.sizeTo(width, height);
107        width = document.getElementById("msgIdentity_clone").boxObject.width * 0.75;
108        this.sizeTo(width, height);
109        ]]></body>
110    </method>
111    <field name="permanent" />
112    <field name="elem" />
113<!--    <field name="identityData">this.elem.identityData</field> -->
114    <field name="_identityInfo">false</field>
115<!--    <field name="_initialized">false</field> -->
116    <field name="_tooltipBrowser">document.getAnonymousElementByAttribute(this, "anonid", "tooltipBrowser")</field>
117    </implementation>
118    </binding> 
119   
120    <binding id="fromPopupItem_clone" extends="chrome://global/content/bindings/menu.xml#menuitem">
121    <content excludes="template,observes,menupopup">
122        <xul:image class="menupopup_clone-icon" xbl:inherits="src"/>
123        <xul:label class="menupopup_clone-text" xbl:inherits="value=label,accesskey,crop" crop="right" flex="1"/>
124        <xul:label value="&vident.accPane.prettyName.prefix;" class="menu_clone-description virtIdLabel" vid="false" xbl:inherits="vid" crop="right"/>
125            <xul:label class="menupopup_clone-description" xbl:inherits="value=description" crop="right"/>
126    </content>
127    <implementation>
128    <constructor>
129        <![CDATA[
130        this._identityDataStorage = this.identityData;
131       
132        this.label = this._identityDataStorage.combinedName;
133        this.value = this._identityDataStorage.id;
134        this.description = this._identityDataStorage.sideDescription;
135       
136        document.getElementById("vI_tooltipPopupset").addTooltip(this, true);
137        ]]>
138    </constructor>
139    <method name="clean">
140            <body><![CDATA[
141        document.getElementById("vI_tooltipPopupset")
142            .removeTooltip(this.tooltipElem.getAttribute("tooltip"));
143        ]]></body>
144    </method>
145    <destructor>
146        <![CDATA[
147        this.clean();
148        ]]>
149    </destructor>
150    <property name="_identityData" onget="return this._identityDataStorage;" />
151    <field name="tooltipElem">this</field>
152    <property name="vid" onget="return this.getAttribute('vid');" onset="this.setAttribute('vid', val); return val;" />
153    <property name="label" onget="return this.getAttribute('label');" onset="this.setAttribute('label', val); return val;" />
154    <property name="value" onget="return this.getAttribute('value');" onset="this.setAttribute('value', val); return val;" />
155    <property name="description" onget="return this.getAttribute('description');" onset="this.setAttribute('description', val); return val;" />
156    </implementation>
157    </binding>
158
159    <binding id="smtpServerList" >
160    <resources>
161            <stylesheet src="chrome://global/skin/menu.css"/>
162    </resources>
163    <content sizetopopup="pref">
164        <xul:spacer flex="1" />
165            <xul:menulist class="smtpServerMenuList" anonid="smtpServerMenuList" allowevents="true" id="smtp_server_list">
166                <xul:menupopup anonid="smtp_server_list_popup" />
167            </xul:menulist>
168    </content>
169    <implementation>
170    <method name="_addDefaultServer">
171            <body><![CDATA[
172        var listitem = document.createElement("menuitem");
173        listitem.setAttribute("label", document.getElementById("bundle_messenger").getString("defaultServerTag"));
174        this._smtpPopup.appendChild(listitem);
175        this._smtpMenu.selectedItem = listitem;
176        ]]></body>
177    </method>
178    <method name="_addServer">
179        <parameter name="server" />
180            <body><![CDATA[
181        if (server instanceof Components.interfaces.nsISmtpServer && !server.redirectorType) {
182            var listitem = document.createElement("menuitem");
183            listitem.setAttribute("label", (server.description?server.description:server.hostname));
184            listitem.setAttribute("key", server.key);
185            this._smtpPopup.appendChild(listitem);
186        }
187        ]]></body>
188    </method>   
189    <constructor>
190        <![CDATA[       
191        this._addDefaultServer();
192        this._smtpPopup.appendChild(document.createElement("menuseparator"));
193
194        var servers = Components.classes["@mozilla.org/messengercompose/smtp;1"]
195            .getService(Components.interfaces.nsISmtpService).smtpServers;
196       
197        if (typeof(servers.Count) == "undefined")       // TB 3.x
198            while (servers && servers.hasMoreElements())
199                this._addServer(servers.getNext());
200        else                            // TB 2.x
201            for (var i=0 ; i<servers.Count(); i++)
202                this._addServer(servers.QueryElementAt(i, Components.interfaces.nsISmtpServer));
203       
204        this._prefroot.addObserver("extensions.virtualIdentity.show_smtp", this._observer, false);
205        this._observer.observe();
206        ]]>
207    </constructor>
208    <destructor>
209        <![CDATA[
210        this._prefroot.removeObserver("extensions.virtualIdentity.show_smtp", this._observer);
211        ]]>
212    </destructor>
213    <property name="smtp" onget="return this._smtpMenu.selectedItem.getAttribute('key');" >
214        <setter><![CDATA[
215        var MenuItems = this._smtpPopup.childNodes
216        for (var index = 0; index < MenuItems.length; index++) {
217            if (MenuItems[index].localName == "menuseparator") continue;
218            if (MenuItems[index].getAttribute("key") == val?val:"") {
219                this._smtpMenu.selectedItem = MenuItems[index];
220                break;
221            }
222        }
223        ]]></setter>
224    </property>
225    <field name="_observer"><![CDATA[({
226        _self: this,
227            observe: function(aSubject, aTopic, aPrefName) {
228            if (this._self._prefroot)
229                this._self.showSmtp =
230                this._self._prefroot.getBoolPref("extensions.virtualIdentity.show_smtp")
231        }
232        })]]></field>
233    <property name="showSmtp" onget="return (this.getAttribute('showSmtp') == 'true');" onset="this.setAttribute('showSmtp',val?'true':'false'); return val;" />
234    <field name="_prefroot">Components.classes["@mozilla.org/preferences-service;1"]
235            .getService(Components.interfaces.nsIPrefService)
236            .getBranch(null).QueryInterface(Components.interfaces.nsIPrefBranch2)</field>
237    <field name="_smtpPopup">document.getAnonymousElementByAttribute(this, "anonid", "smtp_server_list_popup")</field>
238    <field name="_smtpMenu">document.getAnonymousElementByAttribute(this, "anonid", "smtpServerMenuList")</field>
239    <field name="_smtpService"></field>
240
241    </implementation>
242    </binding>
243   
244   
245   
246   
247    <binding id="fromMenuList_clone" display="xul:menu" extends="chrome://global/content/bindings/menulist.xml#menulist-description">
248    <resources>
249            <stylesheet src="chrome://global/skin/menu.css"/>
250    </resources>
251    <content sizetopopup="pref">
252        <xul:hbox anonid="contentHBox" flex="1"  >
253                <xul:vbox><xul:spacer flex="1" />
254                    <xul:image class="menulist_clone-icon" id="msgIdentity_clone_image" xbl:inherits="src"/>
255                <xul:spacer flex="1" /></xul:vbox>
256                <xul:vbox flex="1"><xul:spacer flex="1" />
257                    <xul:textbox anonid="textBox" type="search" id="msgIdentity_clonetextBoxElem" class="plain menulist_clone-textbox" xbl:inherits="value=label,crop,accesskey,vid" allowevents="true" oncommand="event.stopPropagation();document.getBindingParent(this).inputEvent();" crop="right" />
258                <xul:spacer flex="1" /></xul:vbox>
259            <xul:vbox><xul:spacer flex="1" />
260                <xul:hbox>
261                    <xul:label value="&vident.accPane.prettyName.prefix;" class="menu_clone-description virtIdLabel" xbl:inherits="vid" crop="right"/>
262                    <xul:label id="msgIdentity_clone_label" class="menu_clone-description" xbl:inherits="value=description" crop="right"/>
263                    <xul:label id="msgIdentity_base_id_label" class="menu_clone-description" xbl:inherits="value,hidden=base_id_key_hidden" crop="right" hidden="true"/>
264                </xul:hbox>
265            <xul:spacer flex="1" /></xul:vbox>
266        </xul:hbox>
267        <xul:hbox oncommand="event.stopPropagation();document.getBindingParent(this).smtp = this.smtp" anonid="smtpServerListHbox" class="smtpServerListHbox" />
268        <children />
269    </content>
270        <implementation>
271    <constructor>
272        <![CDATA[       
273        var inputTextbox = document.getAnonymousElementByAttribute(this, "class", "plain menulist_clone-textbox");
274       
275        // check if 'search' textboxes are implemented, if not change to 'timed'
276        if (!inputTextbox.timeout) inputTextbox.setAttribute("type", "timed");
277        inputTextbox.setAttribute("timeout", "300")
278       
279        document.getElementById("vI_tooltipPopupset").addTooltip(this, false);
280        ]]>
281    </constructor>
282    <destructor>
283        <![CDATA[
284        document.getElementById("vI_tooltipPopupset")
285            .removeTooltip(this.tooltipElem.getAttribute("tooltip"));
286        ]]>
287    </destructor>
288
289    <!--
290    double the Identity-Select Dropdown-Menu to be more flexible with modifying it
291    the original Identity Dropdown Menu is hidden and stores the base Identity, on which one
292    the Virtual Identity is build upon
293    -->
294    <method name="command">
295        <body><![CDATA[
296        this.identityData = this.selectedMenuItem.identityData.getDuplicate();
297        // clean reply-to fields before reinit
298        vI_msgIdentityCloneTools.cleanupReplyTo();
299        // set orignal Identity-Menu to the selected Identity
300        vI_msgIdentityCloneTools.copySelectedIdentity(this.value);
301        // recognize reply-to fields for auto-reply
302        vI_msgIdentityCloneTools.initReplyToFields(this.value);
303        ]]></body>
304    </method>   
305    <method name="init">
306        <body><![CDATA[
307        var MenuItems = this._msgIdentityPopupElem.childNodes
308        for (var index = 0; index < MenuItems.length; index++) {
309            var identity = gAccountManager.getIdentity(MenuItems[index].getAttribute("value"));
310           
311            var newIdentity = new identityData(identity.email, identity.fullName, identity.key,
312                        identity.smtpServerKey, null,
313                        identity.description?"- "+identity.description:identity.accountname)
314            newIdentity.extras.readIdentityValues(identity);
315
316            var menuItem = this.addIdentityToCloneMenu(newIdentity)
317
318            if (this._msgIdentity_selectedItem == MenuItems[index]) {
319                this.selectedItem = menuItem;
320                this.identityData = newIdentity.getDuplicate();
321            }
322        }
323        this._popupMenu_separator = true;
324       
325        vI_msgIdentityCloneTools.initReplyToFields(this.value);
326        ]]></body>
327    </method>
328    <method name="clean">
329        <body><![CDATA[
330        var MenuItems = this._popupElem.childNodes;
331        while (MenuItems.length > 0) {
332            try {MenuItems[0].clean();} catch (e) { };
333            this._popupElem.removeChild(MenuItems[0])
334        }
335        this.selectedItem = null;
336        this.identityData = null;
337        ]]></body>
338    </method>   
339    <method name="addIdentityToCloneMenu">
340        <parameter name="localIdentityData" />
341        <body><![CDATA[
342        var existingItem = this._isExistingCloneMenuItem(localIdentityData);
343        if (!existingItem) {
344            var MenuItem = document.createElement("menuitem");
345                MenuItem.identityData = localIdentityData;
346            MenuItem.setAttribute("class", "identity_clone-popup-item");
347            MenuItem.value = localIdentityData.id;
348
349            // set vid explicitely
350            if (this._popupMenu_separator) MenuItem.setAttribute("vid", "true");
351            else    MenuItem.setAttribute("vid", "false");
352                       
353            this._popupElem.appendChild(MenuItem);
354            return MenuItem;
355        }
356        else return existingItem;
357        ]]></body>
358    </method>
359    <method name="addIdentitiesToCloneMenu">
360        <parameter name="identityCollection" />
361        <body><![CDATA[
362        for (var index = 0; index < identityCollection.number; index++)
363            identityCollection.menuItems[index] =
364                this.addIdentityToCloneMenu(identityCollection.identityDataCollection[index])
365        ]]></body>
366    </method>
367    <method name="_getMenuItemForIdentity">
368        <parameter name="identitykey" />
369        <body><![CDATA[
370        var MenuItems = this._popupElem.childNodes;
371        for (var index = 0; index < MenuItems.length; index++) {
372            if (MenuItems[index].value == identitykey)
373                return MenuItems[index]
374        }
375        return null;
376        ]]></body>
377    </method>
378    <property name="_popupMenu_separator" >
379        <getter><![CDATA[
380            if (this._menu_separator) this._menu_separator.removeAttribute("hidden");
381            return this._menu_separator;
382        ]]></getter>
383        <setter><![CDATA[
384            if (!val) return;
385            // add hidden separator as indicator that now only virtual identities are added
386            this._menu_separator = document.createElement("menuseparator");
387            this._menu_separator.setAttribute("id", "vid_separator");
388            this._menu_separator.setAttribute("hidden", "true");
389            this._popupElem.appendChild(this._menu_separator)
390        ]]></setter>   
391    </property>
392    <property name="selectedMenuItem" >
393        <getter><![CDATA[
394            return this.selectedItem;
395        ]]></getter>
396        <setter><![CDATA[
397            if (typeof(val) == "object") this.selectedItem = val
398            else if (val == "default")
399                this.selectedItem = this._getMenuItemForIdentity(gAccountManager.defaultAccount.defaultIdentity.key)
400            else this.selectedItem = this._getMenuItemForIdentity(val)
401            this.doCommand();
402        ]]></setter>   
403    </property>
404    <method name="_isExistingCloneMenuItem">
405        <parameter name="localIdentityData" />
406        <body><![CDATA[
407        var MenuItems = this._popupElem.childNodes
408        for (var j = 0; j < MenuItems.length; j++) {
409            if (MenuItems[j].localName == "menuseparator") continue;
410            if (MenuItems[j].identityData.equals(localIdentityData)) return MenuItems[j];
411        }
412        return null;
413        ]]></body>
414    </method>
415    <field name="_msgIdentityElem">document.getElementById("msgIdentity")</field>
416    <field name="_msgIdentityPopupElem">document.getElementById("msgIdentityPopup")</field>
417    <property name="_msgIdentity_selectedItem" >
418        <getter><![CDATA[
419            if (!this._msgIdentityElem.selectedItem) {
420                vI_notificationBar.dump("** v_identity.xml: msgIdentityElem.selectedItem not set, using first Menuitem\n");
421                this._msgIdentityElem.selectedItem = this._msgIdentityPopupElem.firstChild
422                vI_notificationBar.dump("** v_identity.xml: msgIdentityElem.doCommand()\n");
423                this._msgIdentityElem.doCommand();
424            }
425            return this._msgIdentityElem.selectedItem;
426        ]]></getter>
427    </property>
428   
429    <method name="inputEvent">
430            <body><![CDATA[     
431        this.identityData.combinedName = this.label;
432        this.label = this.identityData.combinedName; // reset to possibly changed value
433        this.setAttribute("label", this.label);
434       
435        var existingIdentity = this.checkForVirtualIdentity();
436        if (existingIdentity) this.selectedMenuItem = existingIdentity;
437       
438        vI_msgIdentityCloneTools.updateReplyTo();
439        ]]></body>
440    </method>
441    <method name="checkForVirtualIdentity">
442        <body><![CDATA[
443        var existingIdentity = this.identityData.isExistingIdentity();
444        if (!existingIdentity) { this.vid = true; vI_msgIdentityCloneTools.updateReplyTo(); }
445        else this.vid = false;
446       
447        vI_msgIdentityCloneTools.signatureSwitch(existingIdentity);
448       
449        return existingIdentity;
450        ]]></body>
451    </method>
452    <property name="smtp" onget="return this.identityData.smtp;" >
453        <setter><![CDATA[
454        this.identityData.smtp = val;
455       
456        document.getElementById("vI_tooltipPopupset").addTooltip(this);
457
458        var existingIdentity = this.checkForVirtualIdentity();
459        if (existingIdentity) this.selectedMenuItem = existingIdentity;
460        ]]></setter>
461    </property>
462    <property name="identityData">
463        <getter><![CDATA[
464        this._identityDataStorage.extras.readValues(); // update with current data
465        return this._identityDataStorage;
466        ]]></getter>
467        <setter><![CDATA[
468        if (!val) this._identityDataStorage = null
469        else {
470            var oldIdentityData = this._identityDataStorage;
471            this._identityDataStorage = val;
472           
473            if (oldIdentityData) { // indicates that it's not first time after clean
474                if (!this._identityDataStorage.id) {
475                    this._identityDataStorage.id = oldIdentityData.id;
476                    var idName = this._identityDataStorage.idName;
477                    this._identityDataStorage.sideDescription = (idName)?" - "+idName:"";
478                }
479                this._identityDataStorage.extras.setValues();
480           
481                this.checkForVirtualIdentity();
482            }
483            else    this.vid = false;       // first time after clean it's always a real identity
484           
485            this.label = this._identityDataStorage.combinedName;
486            this.value = this._identityDataStorage.id;
487            this.description = this._identityDataStorage.sideDescription;
488            document.getAnonymousElementByAttribute(this, "anonid", "smtpServerListHbox").smtp = this._identityDataStorage.smtp;
489           
490        }
491        ]]></setter>
492    </property>
493    <field name="_popupElem">document.getElementById("msgIdentityPopup_clone")</field>
494    <field name="tooltipElem">document.getAnonymousElementByAttribute(this, "anonid", "contentHBox")</field>
495    <field name="textBoxElem">document.getAnonymousElementByAttribute(this, "anonid", "textBox");</field>
496    <property name="email" onset="this.identityData.email = val; this.label = this.identityData.combinedName; this.inputEvent()" />
497    <property name="vid" onget="return (this.getAttribute('vid') == 'true');" onset="this.setAttribute('vid',val?'true':'false'); return val;" />
498    <property name="label" onget="return this.textBoxElem.value;" onset="this.textBoxElem.value = val; return val;" />
499    <property name="value" onget="return this.getAttribute('value');" onset="this.setAttribute('value', val); return val;" />
500    <property name="extras" onget="return this.identityData.extras;" />
501    <property name="description" onget="return this.getAttribute('description');" onset="this.setAttribute('description', val); return val;" />
502    </implementation>
503    </binding>
504</bindings>
Note: See TracBrowser for help on using the repository browser.