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.smtp.value; |
---|
138 | // virtualIdentityExtension.MyLog.debug("v_identity.xml fromPopupItem_clone constructor smtp='" + this.smtp + "'") |
---|
139 | this.smtpStyle = "width:" + document.getElementById("virtualIdentityExtension_SmtpServerList").clientWidth + "px;"; |
---|
140 | this._identityDataStorage.smtp.value; |
---|
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="smtpServerList"> |
---|
168 | <resources> |
---|
169 | <stylesheet src="chrome://global/skin/menu.css"/> |
---|
170 | </resources> |
---|
171 | <content sizetopopup="pref"> |
---|
172 | <xul:hbox id="smtpServerHbox" class="smtpServerHbox"> |
---|
173 | <xul:menulist class="smtpServerMenuList" anonid="smtpServerMenuList" allowevents="true" id="virtualIdentityExtension_SmtpServerList"> |
---|
174 | <xul:menupopup anonid="virtualIdentityExtension_SmtpServerList_popup" /> |
---|
175 | </xul:menulist> |
---|
176 | <xul:checkbox id="virtualIdentityExtension_SaveSmtpSwitch" class="vI_plain" allowevents="true" oncommand="event.stopPropagation();virtualIdentityExtension.vIprefs.set('storage_store_SMTP', this.checked);" > |
---|
177 | <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="checked" /> |
---|
178 | <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="disabled" /> |
---|
179 | </xul:checkbox> |
---|
180 | <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="checked" /> |
---|
181 | <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="disabled" /> |
---|
182 | </xul:hbox> |
---|
183 | </content> |
---|
184 | <implementation> |
---|
185 | <method name="addNoneServer"> |
---|
186 | <body><![CDATA[ |
---|
187 | var listitem = document.createElement("menuitem"); |
---|
188 | listitem.setAttribute("class", "menuitem-non-iconic"); |
---|
189 | listitem.setAttribute("type", "non-iconic-noaccel"); |
---|
190 | listitem.setAttribute("label", " "); |
---|
191 | listitem.setAttribute("key", virtualIdentityExtension.NO_SMTP_TAG); |
---|
192 | this._smtpPopup.insertBefore(listitem, this._smtpPopup.firstChild); |
---|
193 | this._smtpMenu.selectedItem = listitem; |
---|
194 | ]]></body> |
---|
195 | </method> |
---|
196 | <method name="_addDefaultServer"> |
---|
197 | <body><![CDATA[ |
---|
198 | var listitem = document.createElement("menuitem"); |
---|
199 | listitem.setAttribute("class", "menuitem-non-iconic"); |
---|
200 | listitem.setAttribute("type", "non-iconic-noaccel"); |
---|
201 | listitem.setAttribute("label", |
---|
202 | Components.classes["@mozilla.org/intl/stringbundle;1"] |
---|
203 | .getService(Components.interfaces.nsIStringBundleService) |
---|
204 | .createBundle("chrome://messenger/locale/messenger.properties") |
---|
205 | .GetStringFromName("defaultServerTag")); |
---|
206 | this._smtpPopup.appendChild(listitem); |
---|
207 | this._smtpMenu.selectedItem = listitem; |
---|
208 | ]]></body> |
---|
209 | </method> |
---|
210 | <method name="_addServer"> |
---|
211 | <parameter name="server" /> |
---|
212 | <body><![CDATA[ |
---|
213 | if (server instanceof Components.interfaces.nsISmtpServer && !server.redirectorType) { |
---|
214 | var listitem = document.createElement("menuitem"); |
---|
215 | listitem.setAttribute("class", "menuitem-non-iconic"); |
---|
216 | listitem.setAttribute("type", "non-iconic-noaccel"); |
---|
217 | listitem.setAttribute("label", (server.description?server.description:server.hostname)); |
---|
218 | listitem.setAttribute("key", server.key); |
---|
219 | this._smtpPopup.appendChild(listitem); |
---|
220 | } |
---|
221 | ]]></body> |
---|
222 | </method> |
---|
223 | <method name="refresh"> |
---|
224 | <body><![CDATA[ |
---|
225 | this.unload(); |
---|
226 | this.load(); |
---|
227 | ]]></body> |
---|
228 | </method> |
---|
229 | <method name="load"> |
---|
230 | <body><![CDATA[ |
---|
231 | this._addDefaultServer(); |
---|
232 | this._smtpPopup.appendChild(document.createElement("menuseparator")); |
---|
233 | |
---|
234 | var servers, smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"] |
---|
235 | .getService(Components.interfaces.nsISmtpService); |
---|
236 | // check for new https://hg.mozilla.org/comm-central/rev/fab9e5145cd4 smtpService |
---|
237 | if (typeof(smtpService.servers) == "object") servers = smtpService.servers; |
---|
238 | else servers = smtpService.smtpServers; |
---|
239 | |
---|
240 | while (servers && servers.hasMoreElements()) |
---|
241 | this._addServer(servers.getNext()); |
---|
242 | ]]></body> |
---|
243 | </method> |
---|
244 | <method name="unload"> |
---|
245 | <body><![CDATA[ |
---|
246 | var MenuItems = this._smtpPopup.childNodes |
---|
247 | while (MenuItems.length > 0) { this._smtpPopup.removeChild(MenuItems[0]) } |
---|
248 | this._smtpMenu.selectedItem = null; |
---|
249 | ]]></body> |
---|
250 | </method> |
---|
251 | <constructor> |
---|
252 | <![CDATA[ |
---|
253 | this.load(); |
---|
254 | ]]> |
---|
255 | </constructor> |
---|
256 | <property name="smtp" onget="return this._smtpMenu.selectedItem.getAttribute('key');" > |
---|
257 | <setter><![CDATA[ |
---|
258 | if (val == virtualIdentityExtension.NO_SMTP_TAG) return; // dont overwrite if not set |
---|
259 | virtualIdentityExtension.MyLog.debug("v_identity.xml smtp set to '" + val + "'") |
---|
260 | var MenuItems = this._smtpPopup.childNodes |
---|
261 | for (var index = 0; index < MenuItems.length; index++) { |
---|
262 | if (MenuItems[index].localName == "menuseparator") continue; |
---|
263 | if (MenuItems[index].getAttribute("key") == val) { |
---|
264 | this._smtpMenu.selectedItem = MenuItems[index]; |
---|
265 | break; |
---|
266 | } |
---|
267 | } |
---|
268 | ]]></setter> |
---|
269 | </property> |
---|
270 | <field name="_smtpPopup">document.getAnonymousElementByAttribute(this, "anonid", "virtualIdentityExtension_SmtpServerList_popup")</field> |
---|
271 | <field name="_smtpMenu">document.getAnonymousElementByAttribute(this, "anonid", "smtpServerMenuList")</field> |
---|
272 | <field name="_smtpService"></field> |
---|
273 | |
---|
274 | </implementation> |
---|
275 | </binding> |
---|
276 | |
---|
277 | |
---|
278 | <binding id="fromMenuList_new" extends="chrome://global/content/bindings/menulist.xml#menulist-editable"> |
---|
279 | <resources> |
---|
280 | <stylesheet src="chrome://global/skin/menu.css"/> |
---|
281 | <stylesheet src="chrome://global/skin/autocomplete.css"/> |
---|
282 | </resources> |
---|
283 | <content sizetopopup="pref"> |
---|
284 | <xul:moz-input-box id="identityHbox" anonid="inputBox" class="menulist-editable-box moz-input-box" xbl:inherits="context,disabled,readonly,focused" flex="1"> |
---|
285 | <xul:vbox flex="1"> |
---|
286 | <!-- use type=search to activate trigger for inputevent --> |
---|
287 | <xul:textbox class="plain menulist-editable-input" anonid="input" type="search" allowevents="true" |
---|
288 | oncommand="event.stopPropagation(); document.getBindingParent(this).inputEvent();" |
---|
289 | onblur="event.stopPropagation(); var elem = this; while (elem.localName != 'textbox') elem = elem.parentNode; document.getBindingParent(elem).blurEvent();" |
---|
290 | xbl:inherits="nomatch=vid,value=label,value,disabled,tabindex,readonly,placeholder" |
---|
291 | crop="right" highlightnonmatches="true"/> |
---|
292 | </xul:vbox> |
---|
293 | <xul:vbox><xul:spacer flex="1" /> |
---|
294 | <xul:label value="&vident.accPane.prettyName.prefix; - " class="menu_clone-vid virtIdLabel" xbl:inherits="vid" crop="right"/> |
---|
295 | <xul:spacer flex="1" /></xul:vbox> |
---|
296 | <xul:observes element="virtualIdentityExtension_statusMenu_storage_save" attribute="checked" /> |
---|
297 | <xul:hbox id="baseIDHbox" class="baseIDHbox" > |
---|
298 | <xul:vbox><xul:spacer flex="1" /> |
---|
299 | <xul:hbox> |
---|
300 | <!--<xul:label id="msgIdentity_base_id_label" class="menu_clone-description" xbl:inherits="hidden=base_id_key_hidden" crop="right" hidden="true"/>--> |
---|
301 | <xul:label id="virtualIdentityExtension_msgIdentityClone_label" class="menu_clone-description" xbl:inherits="value=description" crop="right"/> |
---|
302 | </xul:hbox> |
---|
303 | <xul:spacer flex="1" /></xul:vbox> |
---|
304 | <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveBaseID" attribute="checked" /> |
---|
305 | <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveBaseID" attribute="disabled" /> |
---|
306 | </xul:hbox> |
---|
307 | </xul:moz-input-box> |
---|
308 | <!--<xul:hbox oncommand="event.stopPropagation();document.getBindingParent(this).smtp = this.smtp" xbl:inherits="showSmtp" anonid="smtpServerListHbox" class="smtpServerListHbox" />--> |
---|
309 | <xul:dropmarker class="menulist-dropmarker" type="menu" xbl:inherits="open,disabled,parentfocused=focused"/> |
---|
310 | <xul:popupset id="virtualIdentityExtension_tooltipPopupset" /> |
---|
311 | <children includes="menupopup"/> |
---|
312 | </content> |
---|
313 | <implementation> |
---|
314 | |
---|
315 | <constructor> |
---|
316 | <![CDATA[ |
---|
317 | var inputTextbox = document.getAnonymousElementByAttribute(this, "class", "plain menulist-editable-input"); |
---|
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 | // too early to access virtualIdentityExtension_tooltipPopupset, this might break the interface |
---|
324 | // it will be done in v_identity.js init |
---|
325 | // document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, false); |
---|
326 | |
---|
327 | virtualIdentityExtension.vIprefs.addObserver("show_smtp", this.observe, this); |
---|
328 | this.observe(this); |
---|
329 | ]]> |
---|
330 | </constructor> |
---|
331 | <destructor> |
---|
332 | <![CDATA[ |
---|
333 | var tooltipPopupset = document.getElementById("virtualIdentityExtension_tooltipPopupset") |
---|
334 | if (tooltipPopupset) tooltipPopupset.removeTooltip(this.tooltipElem.getAttribute("tooltip")); |
---|
335 | virtualIdentityExtension.vIprefs.removeObserver("show_smtp", this.observe); |
---|
336 | ]]> |
---|
337 | </destructor> |
---|
338 | |
---|
339 | <method name="addIdentityToCloneMenu"> |
---|
340 | <parameter name="localIdentityData" /> |
---|
341 | <body><![CDATA[ |
---|
342 | // var existingItem = this._isExistingCloneMenuItem(localIdentityData); |
---|
343 | var existingItem = localIdentityData.isExistingIdentity(); |
---|
344 | if (!existingItem) { |
---|
345 | var MenuItem = document.createElement("menuitem"); |
---|
346 | this._popupElem.appendChild(MenuItem); |
---|
347 | MenuItem.identityData = localIdentityData; |
---|
348 | return MenuItem; |
---|
349 | } |
---|
350 | else return existingItem; |
---|
351 | ]]></body> |
---|
352 | </method> |
---|
353 | <method name="addIdentitiesToCloneMenu"> |
---|
354 | <parameter name="identityCollection" /> |
---|
355 | <body><![CDATA[ |
---|
356 | for (var index = 0; index < identityCollection.number; index++) |
---|
357 | identityCollection.menuItems[index] = |
---|
358 | this.addIdentityToCloneMenu(identityCollection.identityDataCollection[index]) |
---|
359 | ]]></body> |
---|
360 | </method> |
---|
361 | <method name="_getMenuItemForIdentity"> |
---|
362 | <parameter name="identitykey" /> |
---|
363 | <body><![CDATA[ |
---|
364 | virtualIdentityExtension.MyLog.debug("v_identity.xml _getMenuItemForIdentity " + identitykey) |
---|
365 | var MenuItems = this._popupElem.childNodes; |
---|
366 | for (var index = 0; index < MenuItems.length; index++) { |
---|
367 | if (MenuItems[index].getAttribute("identitykey") == identitykey) |
---|
368 | return MenuItems[index] |
---|
369 | } |
---|
370 | return null; |
---|
371 | ]]></body> |
---|
372 | </method> |
---|
373 | <property name="selectedMenuItem" > |
---|
374 | <getter><![CDATA[ |
---|
375 | return this.selectedItem; |
---|
376 | ]]></getter> |
---|
377 | <setter><![CDATA[ |
---|
378 | virtualIdentityExtension.MyLog.debug("v_identity.xml selectedMenuItem setter. " + val) |
---|
379 | |
---|
380 | if (typeof(val) == "object") this.selectedItem = val |
---|
381 | else if (val == "default") |
---|
382 | this.selectedItem = this._getMenuItemForIdentity(this._AccountManager.defaultAccount.defaultIdentity.key) |
---|
383 | else this.selectedItem = this._getMenuItemForIdentity(val) |
---|
384 | |
---|
385 | this._identityDataStorage.takeOverAvailableData(this.selectedItem.identityData); |
---|
386 | |
---|
387 | LoadIdentity(); |
---|
388 | ]]></setter> |
---|
389 | </property> |
---|
390 | <method name="_isExistingCloneMenuItem"> |
---|
391 | <parameter name="localIdentityData" /> |
---|
392 | <body><![CDATA[ |
---|
393 | var MenuItems = this._popupElem.childNodes |
---|
394 | for (var j = 0; j < MenuItems.length; j++) { |
---|
395 | if (!MenuItems[j].identityKey) continue; |
---|
396 | if (MenuItems[j].identityData.equals(localIdentityData)) return MenuItems[j]; |
---|
397 | } |
---|
398 | return null; |
---|
399 | ]]></body> |
---|
400 | </method> |
---|
401 | <field name="_msgIdentityPopupElem">document.getElementById("msgIdentityPopup")</field> |
---|
402 | <property name="_AccountManager" > |
---|
403 | <getter><![CDATA[ |
---|
404 | return Components.classes["@mozilla.org/messenger/account-manager;1"] |
---|
405 | .getService(Components.interfaces.nsIMsgAccountManager); |
---|
406 | ]]></getter> |
---|
407 | </property> |
---|
408 | <method name="blurEvent"> |
---|
409 | <body><![CDATA[ |
---|
410 | virtualIdentityExtension.MyLog.debug("v_identity.xml blurEvent") |
---|
411 | this.inputEvent(); // timeout might prevent inputEvent to fire before blurEvent |
---|
412 | |
---|
413 | this.label = this.identityData.combinedName; // add "<" and ">" to email if required |
---|
414 | this.setAttribute("label", this.label); |
---|
415 | ]]></body> |
---|
416 | </method> |
---|
417 | <method name="inputEvent"> |
---|
418 | <body><![CDATA[ |
---|
419 | virtualIdentityExtension.MyLog.debug("v_identity.xml inputEvent") |
---|
420 | |
---|
421 | this.identityData.combinedName = this.label; |
---|
422 | |
---|
423 | var existingIdentity = this.checkForVirtualIdentity(); |
---|
424 | if (existingIdentity && this.selectedMenuItem.identitykey != existingIdentity) |
---|
425 | this.selectedMenuItem = existingIdentity; |
---|
426 | ]]></body> |
---|
427 | </method> |
---|
428 | <method name="checkForVirtualIdentity"> |
---|
429 | <body><![CDATA[ |
---|
430 | virtualIdentityExtension.MyLog.debug("v_identity.xml checkForVirtualIdentity: " + this.identityData.id.key + " '" + this.identityData.id.value + "'") |
---|
431 | var existingIdentity = this.identityData.isExistingIdentity(false); |
---|
432 | |
---|
433 | this.vid = (!existingIdentity); |
---|
434 | |
---|
435 | virtualIdentityExtension.signatureSwitch(existingIdentity); |
---|
436 | |
---|
437 | return existingIdentity; |
---|
438 | ]]></body> |
---|
439 | </method> |
---|
440 | <property name="smtp" onget="return this.identityData.smtp.key;" > // used to detect changes from SMTP-Menu |
---|
441 | <setter><![CDATA[ |
---|
442 | this.identityData.smtp.key = val; |
---|
443 | |
---|
444 | document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this); |
---|
445 | |
---|
446 | var existingIdentity = this.checkForVirtualIdentity(); |
---|
447 | if (existingIdentity) this.selectedMenuItem = existingIdentity; |
---|
448 | ]]></setter> |
---|
449 | </property> |
---|
450 | <property name="identityData"> |
---|
451 | <getter><![CDATA[ |
---|
452 | virtualIdentityExtension.MyLog.debug("v_identity.xml identityData getter") |
---|
453 | if (this._identityDataStorage) { |
---|
454 | this._identityDataStorage.extras.getValuesFromEnvironment(); // update with current data |
---|
455 | } |
---|
456 | else { |
---|
457 | virtualIdentityExtension.MyLog.debug("v_identity.xml identityData getter - _identityDataStorage not set") |
---|
458 | } |
---|
459 | return this._identityDataStorage; |
---|
460 | ]]></getter> |
---|
461 | <setter><![CDATA[ |
---|
462 | virtualIdentityExtension.MyLog.debug("v_identity.xml identityData setter") |
---|
463 | if (val) { |
---|
464 | this._identityDataStorage = val; |
---|
465 | } |
---|
466 | virtualIdentityExtension.MyLog.debug("v_identity.xml identityData setter done.") |
---|
467 | ]]></setter> |
---|
468 | </property> |
---|
469 | <field name="_popupElem">document.getElementById("msgIdentityPopup")</field> |
---|
470 | <field name="tooltipElem">document.getAnonymousElementByAttribute(this, "anonid", "inputBox")</field> |
---|
471 | <field name="textBoxElem">document.getAnonymousElementByAttribute(this, "anonid", "input");</field> |
---|
472 | <method name="observe"> |
---|
473 | <parameter name="self" /> |
---|
474 | <parameter name="aSubject" /> |
---|
475 | <parameter name="aTopic" /> |
---|
476 | <parameter name="aPrefName" /> |
---|
477 | <body><![CDATA[ |
---|
478 | self.showSmtp = |
---|
479 | virtualIdentityExtension.vIprefs.get("show_smtp"); |
---|
480 | var MenuItems = self._popupElem.childNodes; |
---|
481 | for (var j = 0; j < MenuItems.length; j++) { |
---|
482 | if (MenuItems[j].localName == "menuseparator") continue; |
---|
483 | MenuItems[j].smtpStyle = "width:" + document.getElementById("virtualIdentityExtension_SmtpServerList").clientWidth + "px;"; |
---|
484 | } |
---|
485 | ]]></body> |
---|
486 | </method> |
---|
487 | <property name="email" onset="this.identityData.email = val; this.label = this.identityData.combinedName; this.inputEvent()" /> |
---|
488 | <property name="vid" onget="return (this.getAttribute('vid') == 'true');" onset="this.setAttribute('vid',val); return val;" /> |
---|
489 | <property name="value" onget="return this.textBoxElem.value;" onset="this.textBoxElem.value = val; return val;" /> |
---|
490 | <property name="extras" onget="return this.identityData.extras;" /> |
---|
491 | <property name="description" onget="return this.getAttribute('description');" onset="this.setAttribute('description', val); return val;" /> |
---|
492 | <!--<property name="showSmtp" onget="return (this.getAttribute('showSmtp') == 'true');" onset="this.setAttribute('showSmtp',val?'true':'false'); return val;" />--> |
---|
493 | </implementation> |
---|
494 | </binding> |
---|
495 | |
---|
496 | |
---|
497 | <binding id="fromPopupItem_new" extends="chrome://global/content/bindings/menu.xml#menuitem"> |
---|
498 | <content excludes="template,observes,menupopup"> |
---|
499 | <xul:image class="menupopup_clone-icon" xbl:inherits="src"/> |
---|
500 | <xul:label class="menupopup_clone-text" xbl:inherits="value=label,accesskey,crop" crop="right" flex="1"/> |
---|
501 | <xul:label value="&vident.accPane.prettyName.prefix;" class="menupopup_clone-vid virtIdLabel" vid="false" xbl:inherits="vid" crop="right"/> |
---|
502 | <xul:label class="menupopup_clone-description" xbl:inherits="value=description" crop="right"/> |
---|
503 | <!--<xul:label class="menupopup_clone-smtp" xbl:inherits="value=smtp,style=smtpStyle" crop="right"/>--> |
---|
504 | </content> |
---|
505 | <implementation> |
---|
506 | <constructor> |
---|
507 | <![CDATA[ |
---|
508 | document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, true); |
---|
509 | this.vid = "false"; // by default the item is no virtual identity |
---|
510 | ]]> |
---|
511 | </constructor> |
---|
512 | <destructor> |
---|
513 | <![CDATA[ |
---|
514 | document.getElementById("virtualIdentityExtension_tooltipPopupset") |
---|
515 | .removeTooltip(this.tooltipElem.getAttribute("tooltip")); |
---|
516 | ]]> |
---|
517 | </destructor> |
---|
518 | <method name="createIdentityData"> |
---|
519 | <body><![CDATA[ |
---|
520 | var identity = this._AccountManager.getIdentity(this.getAttribute("identitykey")); |
---|
521 | if (identity) { |
---|
522 | this.identityData = new virtualIdentityExtension.identityData(window, identity.email, |
---|
523 | identity.fullName, identity.key, |
---|
524 | identity.smtpServerKey, null, null, true); |
---|
525 | this._identityData.extras.readIdentityValues(identity); |
---|
526 | } |
---|
527 | ]]></body> |
---|
528 | </method> |
---|
529 | <method name="_setAttributeIfNotEmpty"> |
---|
530 | <parameter name="attribute" /> |
---|
531 | <parameter name="value" /> |
---|
532 | <body><![CDATA[ |
---|
533 | if (!this.getAttribute(attribute)) |
---|
534 | this.setAttribute(attribute, value); |
---|
535 | ]]></body> |
---|
536 | </method> |
---|
537 | <property name="identityData"> |
---|
538 | <setter><![CDATA[ |
---|
539 | // if menuitem get's initialized with identityData, |
---|
540 | // attributes (label, value, description, identitykey, accountkey) have to be set accordingly |
---|
541 | |
---|
542 | |
---|
543 | virtualIdentityExtension.MyLog.debug("v_identity.xml fromPopupItem_new set identityData"); |
---|
544 | this._identityData = val; |
---|
545 | |
---|
546 | |
---|
547 | this._setAttributeIfNotEmpty("identitykey", this._identityData.id.key); |
---|
548 | this._setAttributeIfNotEmpty("accountkey", this._identityData.id.accountkey); |
---|
549 | |
---|
550 | this._setAttributeIfNotEmpty("label", this._identityData.combinedName); |
---|
551 | this._setAttributeIfNotEmpty("value", this._identityData.combinedName); |
---|
552 | this._setAttributeIfNotEmpty("smtp", this._identityData.smtp.value); |
---|
553 | this._setAttributeIfNotEmpty("description", ""); |
---|
554 | |
---|
555 | |
---|
556 | this.setAttribute("vid", this._identityData.isExistingIdentity()?"false":"true"); |
---|
557 | |
---|
558 | virtualIdentityExtension.MyLog.debug("v_identity.xml fromPopupItem_new set identityData done."); |
---|
559 | ]]></setter> |
---|
560 | <getter><![CDATA[ |
---|
561 | if (!this._identityData) |
---|
562 | this.createIdentityData(); |
---|
563 | |
---|
564 | return this._identityData; |
---|
565 | ]]></getter> |
---|
566 | </property> |
---|
567 | |
---|
568 | <property name="_AccountManager" > |
---|
569 | <getter><![CDATA[ |
---|
570 | return Components.classes["@mozilla.org/messenger/account-manager;1"] |
---|
571 | .getService(Components.interfaces.nsIMsgAccountManager); |
---|
572 | ]]></getter> |
---|
573 | </property> |
---|
574 | |
---|
575 | <field name="tooltipElem">this</field> |
---|
576 | <property name="vid" onget="return this.getAttribute('vid');" onset="this.setAttribute('vid', val); return val;" /> |
---|
577 | </implementation> |
---|
578 | </binding> |
---|
579 | </bindings> |
---|