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

source: content/bindings/v_identity.xml @ 85fa10

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

removed everything related to smtp-storage

  • Property mode set to 100644
File size: 20.2 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            if (elem) {
44                var randID = elem.tooltipElem.getAttribute("tooltip");
45                this.removeTooltip(randID);
46                if (!randID) {
47                    randID = "virtualIdentityExtension_tooltip_" + parseInt((new Date()).getTime());
48                    elem.tooltipElem.setAttribute("tooltip", randID);
49                }
50                var toolTip = document.createElement("tooltip");
51                toolTip.setAttribute("class", "identityDataTooltip");
52                toolTip.setAttribute("id", randID);
53                toolTip.elem = elem;
54                toolTip.permanent = permanent;
55                this.appendChild(toolTip);
56                }
57        ]]></body>
58    </method>
59    <method name="removeTooltip">
60    <parameter name="randID" />
61        <body><![CDATA[
62        if (randID) {
63            var randIDelem = document.getElementById(randID);
64            if (randIDelem) this.removeChild(randIDelem);
65        }
66        ]]></body>
67    </method>
68    </implementation>
69    </binding>
70   
71    <binding id="vI_identityDataTooltip" extends="chrome://global/content/bindings/popup.xml#tooltip">
72    <content onpopuphidden="popuphidden();" onpopupshowing="this.popupshowing();this.resize()" onpopupshown="this.resize()" >
73            <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()"/>
74            <children />
75    </content>
76    <implementation>
77    <method name="popupshowing">
78            <body><![CDATA[
79            virtualIdentityExtension.MyLog.debug("v_identity.xml vI_tooltipPopupset popupshowing.")
80        if (!this._identityInfo) {
81            this._identityInfo =
82                "<table><tr>" +
83                    "<td class='image'><img src='chrome://v_identity/skin/vi-info.png' /></td>" +
84                    "<td class='identityTable'>" +
85                        "<div class='name'>" + this.elem.identityData.combinedNameHtml + "</div>" +
86                                                "<table><tbody>" + this.elem.identityData.getMatrix() + "</tbody></table>" +
87                    "</td>" +
88                "</tr></table>"
89            virtualIdentityExtension.MyLog.debug("v_identity.xml added tooltip with id='" +  this.elem.identityData.id.key + "'")
90            this._tooltipBrowser.outputString = this._identityInfo;
91        }
92        virtualIdentityExtension.MyLog.debug("v_identity.xml vI_tooltipPopupset popupshowing done.")
93        ]]></body>
94    </method>
95    <method name ="popuphidden">
96            <body><![CDATA[
97        if (!this.permanent) this._identityInfo = null;
98        ]]></body>
99    </method>   
100    <method name="resize">
101        <body><![CDATA[
102        if (!this._identityInfo) return;
103        var width = document.getElementById("msgIdentity").boxObject.width * 0.7;
104        var height = this._tooltipBrowser.contentDocument.lastChild.scrollHeight + 5;
105        this.sizeTo(width, height);
106        width = document.getElementById("msgIdentity").boxObject.width * 0.75;
107        this.sizeTo(width, height);
108        ]]></body>
109    </method>
110    <field name="permanent" />
111    <field name="elem" />
112<!--    <field name="identityData">this.elem.identityData</field> -->
113    <field name="_identityInfo">false</field>
114<!--    <field name="_initialized">false</field> -->
115    <field name="_tooltipBrowser">document.getAnonymousElementByAttribute(this, "anonid", "tooltipBrowser")</field>
116    </implementation>
117    </binding> 
118   
119    <binding id="fromPopupItem_clone" extends="chrome://global/content/bindings/menu.xml#menuitem">
120    <content excludes="template,observes,menupopup">
121        <xul:image class="menupopup_clone-icon" xbl:inherits="src"/>
122        <xul:label class="menupopup_clone-text" xbl:inherits="value=label,accesskey,crop" crop="right" flex="1"/>
123        <xul:label value="&vident.accPane.prettyName.prefix;" class="menupopup_clone-vid virtIdLabel" vid="false" xbl:inherits="vid" crop="right"/>
124            <xul:label class="menupopup_clone-description" xbl:inherits="value=description" crop="right"/>
125        <xul:label class="menupopup_clone-smtp" xbl:inherits="value=smtp,style=smtpStyle" 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.key;
134        // virtualIdentityExtension.MyLog.debug("v_identity.xml fromPopupItem_clone constructor id='" + this.value + "'")
135
136        this.description = this._identityDataStorage.sideDescription?this._identityDataStorage.sideDescription:"";
137        this.smtp = this._identityDataStorage.id.smtpServerName;
138
139        // virtualIdentityExtension.MyLog.debug("v_identity.xml fromPopupItem_clone constructor smtp='" + this.smtp + "'")
140        this.smtpStyle = "width:" + document.getElementById("virtualIdentityExtension_SmtpServerList").clientWidth + "px;";
141       
142        document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, true);
143        ]]>
144    </constructor>
145    <method name="clean">
146            <body><![CDATA[
147        document.getElementById("virtualIdentityExtension_tooltipPopupset")
148            .removeTooltip(this.tooltipElem.getAttribute("tooltip"));
149        ]]></body>
150    </method>
151    <destructor>
152        <![CDATA[
153        this.clean();
154        ]]>
155    </destructor>
156    <property name="_identityData" onget="return this._identityDataStorage;" />
157    <field name="tooltipElem">this</field>
158    <property name="vid" onget="return this.getAttribute('vid');" onset="this.setAttribute('vid', val); return val;" />
159    <property name="label" onget="return this.getAttribute('label');" onset="this.setAttribute('label', val); return val;" />
160    <property name="value" onget="return this.getAttribute('value');" onset="this.setAttribute('value', val); return val;" />
161    <property name="description" onget="return this.getAttribute('description');" onset="this.setAttribute('description', val); return val;" />
162    <property name="smtp" onget="return this.getAttribute('smtp');" onset="this.setAttribute('smtp', val); return val;" />
163    <property name="smtpStyle" onget="return this.getAttribute('smtpStyle');" onset="this.setAttribute('smtpStyle', val); return val;" />
164    </implementation>
165    </binding>
166   
167    <binding id="fromMenuList_new" extends="chrome://global/content/bindings/menulist.xml#menulist-editable">
168    <resources>
169            <stylesheet src="chrome://global/skin/menu.css"/>
170        <stylesheet src="chrome://global/skin/autocomplete.css"/>
171    </resources>
172    <content sizetopopup="pref">
173              <xul:moz-input-box id="identityHbox" anonid="inputBox" class="menulist-editable-box moz-input-box" xbl:inherits="context,disabled,readonly,focused" flex="1">
174                <xul:vbox flex="1">
175                  <!-- use type=search to activate trigger for inputevent -->
176                <xul:textbox class="plain menulist-editable-input" anonid="input" type="search" allowevents="true"
177                            oncommand="event.stopPropagation(); document.getBindingParent(this).inputEvent();"
178                            onblur="event.stopPropagation(); var elem = this; while (elem.localName != 'textbox') elem = elem.parentNode; document.getBindingParent(elem).blurEvent();"
179                            xbl:inherits="nomatch=vid,value=label,value,disabled,tabindex,readonly,placeholder"
180                            crop="right" highlightnonmatches="true"/>
181                </xul:vbox>
182                <xul:vbox><xul:spacer flex="1" />
183                        <xul:label value="&vident.accPane.prettyName.prefix; - " class="menu_clone-vid virtIdLabel" xbl:inherits="vid" crop="right"/>
184                <xul:spacer flex="1" /></xul:vbox>
185                <xul:observes element="virtualIdentityExtension_statusMenu_storage_save" attribute="checked" />
186                <xul:hbox id="baseIDHbox" class="baseIDHbox" >
187                        <xul:vbox><xul:spacer flex="1" />
188                                <xul:hbox>
189                                  <!--<xul:label id="msgIdentity_base_id_label" class="menu_clone-description" xbl:inherits="hidden=base_id_key_hidden" crop="right" hidden="true"/>-->
190                                        <xul:label id="virtualIdentityExtension_msgIdentityClone_label" class="menu_clone-description" xbl:inherits="value=description" crop="right"/>
191                                </xul:hbox>
192                        <xul:spacer flex="1" /></xul:vbox>
193                        <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveBaseID" attribute="checked" />
194                        <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveBaseID" attribute="disabled" />
195                </xul:hbox>
196              </xul:moz-input-box>
197              <xul:dropmarker class="menulist-dropmarker" type="menu" xbl:inherits="open,disabled,parentfocused=focused"/>
198              <xul:popupset id="virtualIdentityExtension_tooltipPopupset" />
199              <children includes="menupopup"/>
200    </content>
201        <implementation>
202         
203    <constructor>
204        <![CDATA[       
205        var inputTextbox = document.getAnonymousElementByAttribute(this, "class", "plain menulist-editable-input");
206       
207        // check if 'search' textboxes are not implemented change to 'timed'
208        if (!inputTextbox.timeout) inputTextbox.setAttribute("type", "timed");
209        inputTextbox.setAttribute("timeout", "300")
210       
211        // too early to access virtualIdentityExtension_tooltipPopupset, this might break the interface
212        // it will be done in v_identity.js init
213        // document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, false);
214        ]]>
215    </constructor>
216    <destructor>
217        <![CDATA[
218        var tooltipPopupset = document.getElementById("virtualIdentityExtension_tooltipPopupset")
219        if (tooltipPopupset) tooltipPopupset.removeTooltip(this.tooltipElem.getAttribute("tooltip"));
220        ]]>
221          </destructor>
222
223    <method name="addIdentityToCloneMenu">
224        <parameter name="localIdentityData" />
225        <body><![CDATA[
226//      var existingItem = this._isExistingCloneMenuItem(localIdentityData);
227                var existingItem = localIdentityData.isExistingIdentity();
228        if (!existingItem) {
229            var MenuItem = document.createElement("menuitem");
230            this._popupElem.appendChild(MenuItem);
231            MenuItem.identityData = localIdentityData;
232                        return MenuItem;
233        }
234        else return existingItem;
235        ]]></body>
236    </method>
237    <method name="addIdentitiesToCloneMenu">
238        <parameter name="identityCollection" />
239        <body><![CDATA[
240        for (var index = 0; index < identityCollection.number; index++)
241            identityCollection.menuItems[index] =
242                this.addIdentityToCloneMenu(identityCollection.identityDataCollection[index])
243        ]]></body>
244    </method>
245    <method name="_getMenuItemForIdentity">
246        <parameter name="identitykey" />
247        <body><![CDATA[
248                virtualIdentityExtension.MyLog.debug("v_identity.xml _getMenuItemForIdentity " + identitykey)
249        var MenuItems = this._popupElem.childNodes;
250        for (var index = 0; index < MenuItems.length; index++) {
251                  if (MenuItems[index].getAttribute("identitykey") == identitykey)
252                          return MenuItems[index]
253        }
254        return null;
255        ]]></body>
256    </method>
257    <property name="selectedMenuItem" >
258        <getter><![CDATA[
259            return this.selectedItem;
260        ]]></getter>
261        <setter><![CDATA[
262                        virtualIdentityExtension.MyLog.debug("v_identity.xml selectedMenuItem setter. " + val)
263                       
264            if (typeof(val) == "object") this.selectedItem = val
265            else if (val == "default")
266                this.selectedItem = this._getMenuItemForIdentity(this._AccountManager.defaultAccount.defaultIdentity.key)
267            else this.selectedItem = this._getMenuItemForIdentity(val)
268
269                        this._identityDataStorage.takeOverAvailableData(this.selectedItem.identityData);
270                       
271                        LoadIdentity();
272        ]]></setter>   
273    </property>
274    <method name="_isExistingCloneMenuItem">
275        <parameter name="localIdentityData" />
276        <body><![CDATA[
277        var MenuItems = this._popupElem.childNodes
278        for (var j = 0; j < MenuItems.length; j++) {
279            if (!MenuItems[j].identityKey) continue;
280            if (MenuItems[j].identityData.equals(localIdentityData)) return MenuItems[j];
281        }
282        return null;
283        ]]></body>
284    </method>
285    <field name="_msgIdentityPopupElem">document.getElementById("msgIdentityPopup")</field>
286    <property name="_AccountManager" >
287        <getter><![CDATA[
288            return Components.classes["@mozilla.org/messenger/account-manager;1"]
289              .getService(Components.interfaces.nsIMsgAccountManager);
290        ]]></getter>
291    </property>
292    <method name="blurEvent">
293            <body><![CDATA[
294        virtualIdentityExtension.MyLog.debug("v_identity.xml blurEvent")
295        this.inputEvent(); // timeout might prevent inputEvent to fire before blurEvent
296       
297        this.label = this.identityData.combinedName; // add "<" and ">" to email if required
298        this.setAttribute("label", this.label);
299        ]]></body>
300    </method>
301    <method name="inputEvent">
302            <body><![CDATA[     
303        virtualIdentityExtension.MyLog.debug("v_identity.xml inputEvent")
304       
305        this.identityData.combinedName = this.label;
306       
307        var existingIdentity = this.checkForVirtualIdentity();
308                if (existingIdentity && this.selectedMenuItem.identitykey != existingIdentity)
309                    this.selectedMenuItem = existingIdentity;           
310        ]]></body>
311    </method>
312    <method name="checkForVirtualIdentity">
313        <body><![CDATA[
314        virtualIdentityExtension.MyLog.debug("v_identity.xml checkForVirtualIdentity: " + this.identityData.id.key + " '" + this.identityData.id.value + "'")
315        var existingIdentity = this.identityData.isExistingIdentity(false);
316       
317        this.vid = (!existingIdentity);
318       
319        virtualIdentityExtension.signatureSwitch(existingIdentity);
320       
321        return existingIdentity;
322        ]]></body>
323    </method>
324    <property name="identityData">
325        <getter><![CDATA[
326                  virtualIdentityExtension.MyLog.debug("v_identity.xml identityData getter")
327                  if (this._identityDataStorage) {
328                    this._identityDataStorage.extras.getValuesFromEnvironment(); // update with current data
329                  }
330                  else {
331                    virtualIdentityExtension.MyLog.debug("v_identity.xml identityData getter - _identityDataStorage not set")
332                  }
333                  return this._identityDataStorage;
334        ]]></getter>
335        <setter><![CDATA[
336        virtualIdentityExtension.MyLog.debug("v_identity.xml identityData setter")
337        if (val) {
338            this._identityDataStorage = val;
339        }
340        virtualIdentityExtension.MyLog.debug("v_identity.xml identityData setter done.")
341        ]]></setter>
342    </property>
343    <field name="_popupElem">document.getElementById("msgIdentityPopup")</field>
344    <field name="tooltipElem">document.getAnonymousElementByAttribute(this, "anonid", "inputBox")</field>
345    <field name="textBoxElem">document.getAnonymousElementByAttribute(this, "anonid", "input");</field>
346    <property name="email" onset="this.identityData.email = val; this.label = this.identityData.combinedName; this.inputEvent()" />
347    <property name="vid" onget="return (this.getAttribute('vid') == 'true');" onset="this.setAttribute('vid',val); return val;" />
348        <property name="value" onget="return this.textBoxElem.value;" onset="this.textBoxElem.value = val; return val;" />
349    <property name="extras" onget="return this.identityData.extras;" />
350    <property name="description" onget="return this.getAttribute('description');" onset="this.setAttribute('description', val); return val;" />
351    </implementation>
352    </binding>
353
354       
355        <binding id="fromPopupItem_new" extends="chrome://global/content/bindings/menu.xml#menuitem">
356    <content excludes="template,observes,menupopup">
357        <xul:image class="menupopup_clone-icon" xbl:inherits="src"/>
358        <xul:label class="menupopup_clone-text" xbl:inherits="value=label,accesskey,crop" crop="right" flex="1"/>
359        <xul:label value="&vident.accPane.prettyName.prefix;" class="menupopup_clone-vid virtIdLabel" vid="false" xbl:inherits="vid" crop="right"/>
360            <xul:label class="menupopup_clone-description" xbl:inherits="value=description" crop="right"/>
361                <!--<xul:label class="menupopup_clone-smtp" xbl:inherits="value=smtp,style=smtpStyle" crop="right"/>-->
362    </content>
363    <implementation>
364    <constructor>
365        <![CDATA[
366                document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, true);
367                this.vid = "false"; // by default the item is no virtual identity
368        ]]>
369    </constructor>
370        <destructor>
371        <![CDATA[
372        document.getElementById("virtualIdentityExtension_tooltipPopupset")
373            .removeTooltip(this.tooltipElem.getAttribute("tooltip"));
374        ]]>
375        </destructor>
376        <method name="createIdentityData">
377        <body><![CDATA[
378            var identity = this._AccountManager.getIdentity(this.getAttribute("identitykey"));
379            if (identity) {
380              this.identityData = new virtualIdentityExtension.identityData(window, identity.email,
381                                    identity.fullName, identity.key,
382                                    null, null, true);
383              this._identityData.extras.readIdentityValues(identity);
384              }
385            ]]></body>
386        </method>
387        <method name="_setAttributeIfNotEmpty">
388            <parameter name="attribute" />
389            <parameter name="value" />
390            <body><![CDATA[
391                if (!this.getAttribute(attribute))
392                  this.setAttribute(attribute, value);
393            ]]></body>
394        </method>
395        <property name="identityData">
396          <setter><![CDATA[
397            // if menuitem get's initialized with identityData,
398            // attributes (label, value, description, identitykey, accountkey) have to be set accordingly
399           
400           
401            virtualIdentityExtension.MyLog.debug("v_identity.xml fromPopupItem_new set identityData");
402            this._identityData = val;
403             
404           
405            this._setAttributeIfNotEmpty("identitykey", this._identityData.id.key);
406            this._setAttributeIfNotEmpty("accountkey", this._identityData.id.accountkey);
407
408            this._setAttributeIfNotEmpty("label", this._identityData.combinedName);
409            this._setAttributeIfNotEmpty("value", this._identityData.combinedName);
410            this._setAttributeIfNotEmpty("smtp", this._identityData.id.smtpServerName);
411            this._setAttributeIfNotEmpty("description", "");
412           
413           
414            this.setAttribute("vid", this._identityData.isExistingIdentity()?"false":"true");
415
416            virtualIdentityExtension.MyLog.debug("v_identity.xml fromPopupItem_new set identityData done.");
417              ]]></setter>
418            <getter><![CDATA[
419              if (!this._identityData)
420                this.createIdentityData();
421
422              return this._identityData;
423            ]]></getter>
424        </property>
425       
426        <property name="_AccountManager" >
427          <getter><![CDATA[
428            return Components.classes["@mozilla.org/messenger/account-manager;1"]
429              .getService(Components.interfaces.nsIMsgAccountManager);
430          ]]></getter>
431        </property>
432
433    <field name="tooltipElem">this</field>
434    <property name="vid" onget="return this.getAttribute('vid');" onset="this.setAttribute('vid', val); return val;" />
435    </implementation>
436    </binding>
437</bindings>
Note: See TracBrowser for help on using the repository browser.