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="vI_menupopupItem" extends="chrome://global/content/bindings/menu.xml#menuitem"> |
---|
120 | <content excludes="template,observes,menupopup"> |
---|
121 | <xul:image class="vI_menupopup-icon" xbl:inherits="src"/> |
---|
122 | <xul:label class="vI_menupopup-text" xbl:inherits="value=label,accesskey,crop" crop="right" flex="1"/> |
---|
123 | <xul:label value="&vident.accPane.prettyName.prefix;" class="vI_menupopup-vid virtIdLabel" vid="false" xbl:inherits="vid" crop="right"/> |
---|
124 | <xul:label class="vI_menupopup-description" xbl:inherits="value=description" crop="right"/> |
---|
125 | <xul:label class="vI_menupopup-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 vI_menupopupItem 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 vI_menupopupItem 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" 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="vI_menu-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="vI_menu-description" xbl:inherits="hidden=base_id_key_hidden" crop="right" hidden="true"/>--> |
---|
190 | <xul:label id="virtualIdentityExtension_msgIdentity_label" class="vI_menu-description" |
---|
191 | xbl:inherits="value=description, vid" crop="right"/> |
---|
192 | <xul:label id="virtualIdentityExtension_msgIdentity_idLabel" class="vI_menu-idDescription" |
---|
193 | xbl:inherits="value=idDescription, vid" crop="right"/> |
---|
194 | <!-- <xul:label class="vI_menupopup-smtp virtualIdentityExtension_debug_interface" |
---|
195 | xbl:inherits="value=smtp,style=smtpStyle" crop="right"/> |
---|
196 | <xul:label class="vI_menupopup-accountkey virtualIdentityExtension_debug_interface" |
---|
197 | xbl:inherits="value=accountkey" crop="right"/> |
---|
198 | <xul:label class="vI_menupopup-identitykey virtualIdentityExtension_debug_interface" |
---|
199 | xbl:inherits="value=identitykey" crop="right"/>--> |
---|
200 | </xul:hbox> |
---|
201 | <xul:spacer flex="1" /></xul:vbox> |
---|
202 | <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveBaseID" attribute="checked" /> |
---|
203 | <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveBaseID" attribute="disabled" /> |
---|
204 | </xul:hbox> |
---|
205 | </xul:moz-input-box> |
---|
206 | <xul:dropmarker class="menulist-dropmarker" type="menu" xbl:inherits="open,disabled,parentfocused=focused"/> |
---|
207 | <xul:popupset id="virtualIdentityExtension_tooltipPopupset" /> |
---|
208 | <children includes="menupopup"/> |
---|
209 | </content> |
---|
210 | <implementation> |
---|
211 | |
---|
212 | <constructor> |
---|
213 | <![CDATA[ |
---|
214 | var inputTextbox = document.getAnonymousElementByAttribute(this, "class", "plain menulist-editable-input"); |
---|
215 | |
---|
216 | // check if 'search' textboxes are not implemented change to 'timed' |
---|
217 | if (!inputTextbox.timeout) inputTextbox.setAttribute("type", "timed"); |
---|
218 | inputTextbox.setAttribute("timeout", "300") |
---|
219 | |
---|
220 | // too early to access virtualIdentityExtension_tooltipPopupset, this might break the interface |
---|
221 | // it will be done in v_identity.js init |
---|
222 | // document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, false); |
---|
223 | ]]> |
---|
224 | </constructor> |
---|
225 | <destructor> |
---|
226 | <![CDATA[ |
---|
227 | var tooltipPopupset = document.getElementById("virtualIdentityExtension_tooltipPopupset") |
---|
228 | if (tooltipPopupset) tooltipPopupset.removeTooltip(this.tooltipElem.getAttribute("tooltip")); |
---|
229 | ]]> |
---|
230 | </destructor> |
---|
231 | |
---|
232 | <method name="addIdentityToMsgIdentityMenu"> |
---|
233 | <parameter name="localIdentityData" /> |
---|
234 | <body><![CDATA[ |
---|
235 | var existingItem = this._isExistingMenuItem(localIdentityData); |
---|
236 | // var existingItem = localIdentityData.isExistingIdentity(); |
---|
237 | if (!existingItem) { |
---|
238 | var MenuItem = document.createElement("menuitem"); |
---|
239 | this._popupElem.appendChild(MenuItem); |
---|
240 | MenuItem.identityData = localIdentityData; |
---|
241 | return MenuItem; |
---|
242 | } |
---|
243 | else return existingItem; |
---|
244 | ]]></body> |
---|
245 | </method> |
---|
246 | <method name="addIdentitiesToMsgIdentityMenu"> |
---|
247 | <parameter name="identityCollection" /> |
---|
248 | <body><![CDATA[ |
---|
249 | for (var index = 0; index < identityCollection.number; index++) |
---|
250 | identityCollection.menuItems[index] = |
---|
251 | this.addIdentityToMsgIdentityMenu(identityCollection.identityDataCollection[index]) |
---|
252 | ]]></body> |
---|
253 | </method> |
---|
254 | <method name="_getMenuItemForIdentity"> |
---|
255 | <parameter name="identitykey" /> |
---|
256 | <body><![CDATA[ |
---|
257 | virtualIdentityExtension.MyLog.debug("v_identity.xml _getMenuItemForIdentity " + identitykey) |
---|
258 | var MenuItems = this._popupElem.childNodes; |
---|
259 | for (var index = 0; index < MenuItems.length; index++) { |
---|
260 | if (MenuItems[index].getAttribute("identitykey") == identitykey) |
---|
261 | return MenuItems[index] |
---|
262 | } |
---|
263 | return null; |
---|
264 | ]]></body> |
---|
265 | </method> |
---|
266 | <property name="selectedMenuItem" > |
---|
267 | <getter><![CDATA[ |
---|
268 | return this.selectedItem; |
---|
269 | ]]></getter> |
---|
270 | <setter><![CDATA[ |
---|
271 | virtualIdentityExtension.MyLog.debug("v_identity.xml selectedMenuItem setter. " + val) |
---|
272 | if (val) { |
---|
273 | // remove previous selected MenuItem, else a change to the same Item won't takeOver all settings |
---|
274 | this.setSelectionInternal(null); |
---|
275 | |
---|
276 | if (typeof(val) == "object") this.selectedItem = val |
---|
277 | else if (val == "default") |
---|
278 | this.selectedItem = this._getMenuItemForIdentity(this._AccountManager.defaultAccount.defaultIdentity.key) |
---|
279 | else this.selectedItem = this._getMenuItemForIdentity(val) |
---|
280 | |
---|
281 | this._identityDataStorage.takeOverAvailableData(this.selectedItem.identityData); |
---|
282 | |
---|
283 | LoadIdentity(); |
---|
284 | } |
---|
285 | ]]></setter> |
---|
286 | </property> |
---|
287 | <method name="_isExistingMenuItem"> |
---|
288 | <parameter name="localIdentityData" /> |
---|
289 | <body><![CDATA[ |
---|
290 | //virtualIdentityExtension.MyLog.debug("v_identity.xml _isExistingMenuItem " + localIdentityData.id) |
---|
291 | var MenuItems = this._popupElem.childNodes |
---|
292 | for (var j = 0; j < MenuItems.length; j++) { |
---|
293 | if (MenuItems[j].command == "cmd_customizeFromAddress" || |
---|
294 | MenuItems[j].tagName == "menuseparator") |
---|
295 | continue; |
---|
296 | |
---|
297 | if (MenuItems[j].identityData.equals(localIdentityData)) { |
---|
298 | virtualIdentityExtension.MyLog.debug("v_identity.xml _isExistingMenuItem found: " + MenuItems[j].value); |
---|
299 | return MenuItems[j]; |
---|
300 | } |
---|
301 | } |
---|
302 | virtualIdentityExtension.MyLog.debug("v_identity.xml _isExistingMenuItem didn't found: " + localIdentityData.email); |
---|
303 | return null; |
---|
304 | ]]></body> |
---|
305 | </method> |
---|
306 | <field name="_msgIdentityPopupElem">document.getElementById("msgIdentityPopup")</field> |
---|
307 | <property name="_AccountManager" > |
---|
308 | <getter><![CDATA[ |
---|
309 | return Components.classes["@mozilla.org/messenger/account-manager;1"] |
---|
310 | .getService(Components.interfaces.nsIMsgAccountManager); |
---|
311 | ]]></getter> |
---|
312 | </property> |
---|
313 | <method name="blurEvent"> |
---|
314 | <body><![CDATA[ |
---|
315 | virtualIdentityExtension.MyLog.debug("v_identity.xml blurEvent") |
---|
316 | |
---|
317 | if (!this.label) { // empty senders field, takeover value from base identity |
---|
318 | var identity = this._AccountManager.getIdentity(this.getAttribute("identitykey")); |
---|
319 | this.label = identity.fullName + " <" + identity.email + ">"; |
---|
320 | } |
---|
321 | |
---|
322 | this.inputEvent(); // timeout might prevent inputEvent to fire before blurEvent |
---|
323 | |
---|
324 | this.label = this.identityData.combinedName; // add "<" and ">" to email if required |
---|
325 | this.setAttribute("label", this.label); |
---|
326 | ]]></body> |
---|
327 | </method> |
---|
328 | <method name="inputEvent"> |
---|
329 | <body><![CDATA[ |
---|
330 | virtualIdentityExtension.MyLog.debug("v_identity.xml inputEvent") |
---|
331 | |
---|
332 | this.identityData.combinedName = this.label; |
---|
333 | |
---|
334 | var existingIdentity = this.checkForVirtualIdentity(); |
---|
335 | if (existingIdentity && this.selectedMenuItem.identitykey != existingIdentity) |
---|
336 | this.selectedMenuItem = existingIdentity; |
---|
337 | ]]></body> |
---|
338 | </method> |
---|
339 | <method name="checkForVirtualIdentity"> |
---|
340 | <body><![CDATA[ |
---|
341 | virtualIdentityExtension.MyLog.debug("v_identity.xml checkForVirtualIdentity: " + this.identityData.id.key + " '" + this.identityData.id.value + "'") |
---|
342 | var existingIdentity = this.identityData.isExistingIdentity(false); |
---|
343 | |
---|
344 | this.vid = (!existingIdentity); |
---|
345 | |
---|
346 | return existingIdentity; |
---|
347 | ]]></body> |
---|
348 | </method> |
---|
349 | <property name="identityData"> |
---|
350 | <getter><![CDATA[ |
---|
351 | //virtualIdentityExtension.MyLog.debug("v_identity.xml identityData getter") |
---|
352 | if (this._identityDataStorage) { |
---|
353 | this._identityDataStorage.extras.getValuesFromEnvironment(); // update with current data |
---|
354 | } |
---|
355 | else { |
---|
356 | virtualIdentityExtension.MyLog.debug("v_identity.xml identityData getter - _identityDataStorage not set") |
---|
357 | } |
---|
358 | return this._identityDataStorage; |
---|
359 | ]]></getter> |
---|
360 | <setter><![CDATA[ |
---|
361 | virtualIdentityExtension.MyLog.debug("v_identity.xml identityData setter") |
---|
362 | if (val) { |
---|
363 | this._identityDataStorage = val; |
---|
364 | } |
---|
365 | virtualIdentityExtension.MyLog.debug("v_identity.xml identityData setter done.") |
---|
366 | ]]></setter> |
---|
367 | </property> |
---|
368 | <field name="_popupElem">document.getElementById("msgIdentityPopup")</field> |
---|
369 | <field name="tooltipElem">document.getAnonymousElementByAttribute(this, "anonid", "inputBox")</field> |
---|
370 | <field name="textBoxElem">document.getAnonymousElementByAttribute(this, "anonid", "input");</field> |
---|
371 | <property name="email" onset="this.identityData.email = val; this.label = this.identityData.combinedName; this.inputEvent()" /> |
---|
372 | <property name="vid" onget="return (this.getAttribute('vid') == 'true');" onset="this.setAttribute('vid',val); return val;" /> |
---|
373 | <property name="value" onget="return this.textBoxElem.value;" onset="this.textBoxElem.value = val; return val;" /> |
---|
374 | <property name="extras" onget="return this.identityData.extras;" /> |
---|
375 | <property name="description" onget="return this.getAttribute('description');" onset="this.setAttribute('description', val); return val;" /> |
---|
376 | </implementation> |
---|
377 | </binding> |
---|
378 | |
---|
379 | |
---|
380 | <binding id="fromPopupItem" extends="chrome://global/content/bindings/menu.xml#menuitem"> |
---|
381 | <content class="vI_menupopupItem" excludes="template,observes,menupopup"> |
---|
382 | <xul:image class="vI_menupopup-icon" xbl:inherits="src"/> |
---|
383 | <xul:label class="vI_menupopup-text" xbl:inherits="value=label,accesskey,crop" crop="right" flex="1"/> |
---|
384 | <xul:label value="&vident.accPane.prettyName.prefix; - " class="vI_menupopup-vid virtIdLabel" vid="false" xbl:inherits="vid" crop="right"/> |
---|
385 | <xul:label class="vI_menupopup-description" xbl:inherits="value=description" crop="right"/> |
---|
386 | <xul:label class="vI_menupopup-idDescription" xbl:inherits="value=idDescription" crop="right"/> |
---|
387 | <!-- <xul:label class="vI_menupopup-smtp virtualIdentityExtension_debug_interface" xbl:inherits="value=smtp,style=smtpStyle" crop="right"/> |
---|
388 | <xul:label class="vI_menupopup-accountkey virtualIdentityExtension_debug_interface" xbl:inherits="value=accountkey" crop="right"/> |
---|
389 | <xul:label class="vI_menupopup-identitykey virtualIdentityExtension_debug_interface" xbl:inherits="value=identitykey" crop="right"/>--> |
---|
390 | </content> |
---|
391 | <implementation> |
---|
392 | <constructor> |
---|
393 | <![CDATA[ |
---|
394 | document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, true); |
---|
395 | this.vid = "false"; // by default the item is no virtual identity |
---|
396 | ]]> |
---|
397 | </constructor> |
---|
398 | <destructor> |
---|
399 | <![CDATA[ |
---|
400 | document.getElementById("virtualIdentityExtension_tooltipPopupset") |
---|
401 | .removeTooltip(this.tooltipElem.getAttribute("tooltip")); |
---|
402 | ]]> |
---|
403 | </destructor> |
---|
404 | <method name="createIdentityData"> |
---|
405 | <body><![CDATA[ |
---|
406 | var identity = this._AccountManager.getIdentity(this.getAttribute("identitykey")); |
---|
407 | if (identity) { |
---|
408 | this.identityData = new virtualIdentityExtension.identityData(window, identity.email, |
---|
409 | identity.fullName, identity.key, |
---|
410 | null, null, true); |
---|
411 | this._identityData.extras.readIdentityValues(identity); |
---|
412 | } |
---|
413 | ]]></body> |
---|
414 | </method> |
---|
415 | <method name="_setAttributeIfNotEmpty"> |
---|
416 | <parameter name="attribute" /> |
---|
417 | <parameter name="value" /> |
---|
418 | <body><![CDATA[ |
---|
419 | if (!this.getAttribute(attribute)) |
---|
420 | this.setAttribute(attribute, value); |
---|
421 | ]]></body> |
---|
422 | </method> |
---|
423 | <property name="identityData"> |
---|
424 | <setter><![CDATA[ |
---|
425 | // if menuitem get's initialized with identityData, |
---|
426 | // attributes (label, value, description, identitykey, accountkey) have to be set accordingly |
---|
427 | |
---|
428 | |
---|
429 | //virtualIdentityExtension.MyLog.debug("v_identity.xml fromPopupItem set identityData"); |
---|
430 | this._identityData = val; |
---|
431 | |
---|
432 | |
---|
433 | this._setAttributeIfNotEmpty("identitykey", this._identityData.id.key); |
---|
434 | this._setAttributeIfNotEmpty("accountkey", this._identityData.id.accountkey); |
---|
435 | |
---|
436 | this._setAttributeIfNotEmpty("label", this._identityData.combinedName); |
---|
437 | this._setAttributeIfNotEmpty("value", this._identityData.combinedName); |
---|
438 | this._setAttributeIfNotEmpty("smtp", this._identityData.id.smtpServerName); |
---|
439 | this._setAttributeIfNotEmpty("description", this._identityData.id.accountIncomingServerPrettyName); |
---|
440 | this._setAttributeIfNotEmpty("idDescription", this._identityData.id.value); |
---|
441 | |
---|
442 | |
---|
443 | this.setAttribute("vid", this._identityData.isExistingIdentity()?"false":"true"); |
---|
444 | |
---|
445 | //virtualIdentityExtension.MyLog.debug("v_identity.xml fromPopupItem set identityData done."); |
---|
446 | ]]></setter> |
---|
447 | <getter><![CDATA[ |
---|
448 | if (!this._identityData) |
---|
449 | this.createIdentityData(); |
---|
450 | |
---|
451 | return this._identityData; |
---|
452 | ]]></getter> |
---|
453 | </property> |
---|
454 | |
---|
455 | <property name="_AccountManager" > |
---|
456 | <getter><![CDATA[ |
---|
457 | return Components.classes["@mozilla.org/messenger/account-manager;1"] |
---|
458 | .getService(Components.interfaces.nsIMsgAccountManager); |
---|
459 | ]]></getter> |
---|
460 | </property> |
---|
461 | |
---|
462 | <field name="tooltipElem">this</field> |
---|
463 | <property name="vid" onget="return this.getAttribute('vid');" onset="this.setAttribute('vid', val); return val;" /> |
---|
464 | </implementation> |
---|
465 | </binding> |
---|
466 | </bindings> |
---|