Changeset 85fa10 for content/bindings/vI_rdfAccountMismatchDialog.xml
- Timestamp:
- Sep 9, 2018, 2:36:02 AM (4 years ago)
- Branches:
- ng_0.9
- Children:
- c5860f
- Parents:
- bc6c6b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
content/bindings/vI_rdfAccountMismatchDialog.xml
rbc6c6b r85fa10 74 74 <implementation> 75 75 <constructor> 76 <![CDATA[ 76 <![CDATA[ 77 77 var menuitem = document.createElement("menuitem"); 78 78 menuitem.setAttribute("class", "mismatchMenuitem"); … … 95 95 if (oldval) { 96 96 oldval.removeAttribute('selected'); 97 if ( document instanceof Components.interfaces.nsIDOMXULDocument) {97 if (ChromeUtils.getClassName(document) == "XULDocument") { 98 98 document.removeBroadcastListenerFor(oldval, this, "value"); 99 99 document.removeBroadcastListenerFor(oldval, this, "label"); … … 116 116 // DOMAttrModified listeners slow down setAttribute calls within 117 117 // the document, see bug 395496 118 if ( document instanceof Components.interfaces.nsIDOMXULDocument) {118 if (ChromeUtils.getClassName(document) == "XULDocument") { 119 119 document.addBroadcastListenerFor(val, this, "value"); 120 120 document.addBroadcastListenerFor(val, this, "label"); … … 156 156 <body><![CDATA[ 157 157 virtualIdentityExtension.Log.debug("rdfAccountMismatchDialog.xml mismatchID-menupopup: _addIdentities."); 158 Components.utils.import("resource://v_identity/vI_accountUtils.js", virtualIdentityExtension); 158 159 var accounts = virtualIdentityExtension.getAccountsArray(); 159 160 for (let acc = 0; acc < accounts.length; acc++) { … … 174 175 ]]></body> 175 176 </method> 176 <method name="_addSmtp"> 177 <parameter name="server" /> 177 <method name="_addIdentitiesWithSmtp"> 178 178 <body><![CDATA[ 179 virtualIdentityExtension.Log.debug("rdfAccountMismatchDialog.xml mismatchID-menupopup: _addSmtp."); 180 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 181 var menuitem = document.createElementNS(XUL_NS, "menuitem"); // create a new XUL menuitem 182 menuitem.setAttribute("class", "mismatchMenuitem"); 183 menuitem.setAttribute("label", (server.description?server.description:server.hostname)); 184 menuitem.setAttribute("ext1", server.hostname); 185 menuitem.setAttribute("ext2", server.username); 186 menuitem.setAttribute("key", server.key); 187 this.appendChild(menuitem); 179 virtualIdentityExtension.Log.debug("rdfAccountMismatchDialog.xml mismatchID-menupopup: _addIdentitiesWithSmtp."); 180 Components.utils.import("resource://v_identity/vI_accountUtils.js", virtualIdentityExtension); 181 var accounts = virtualIdentityExtension.getAccountsArray(); 182 for (let acc = 0; acc < accounts.length; acc++) { 183 let account = accounts[acc]; 184 let identities = virtualIdentityExtension.getIdentitiesArray(account); 185 for (let i = 0; i < identities.length; i++) { 186 let identity = identities[i]; 187 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 188 var menuitem = document.createElementNS(XUL_NS, "menuitem"); // create a new XUL menuitem 189 menuitem.setAttribute("class", "mismatchMenuitem"); 190 menuitem.setAttribute("label", identity.identityName); 191 192 ChromeUtils.import("resource:///modules/mailServices.js"); 193 var servers = MailServices.smtp.servers; 194 195 var smtpName; 196 while (servers && servers.hasMoreElements()) { 197 var server = servers.getNext(); 198 if (server instanceof Components.interfaces.nsISmtpServer && 199 !server.redirectorType && identity.smtpServerKey == server.key) { 200 smtpName = server.description ? server.description : server.hostname; 201 break; 202 } 203 } 204 205 menuitem.setAttribute("ext1", smtpName); 206 menuitem.setAttribute("key", identity.key); 207 this.appendChild(menuitem); 208 } 209 } 210 virtualIdentityExtension.Log.debug("rdfAccountMismatchDialog.xml mismatchID-menupopup: _addIdentitiesWithSmtp done."); 188 211 ]]></body> 189 </method>190 <method name="_addSmtpServers">191 <body><![CDATA[192 virtualIdentityExtension.Log.debug("rdfAccountMismatchDialog.xml mismatchID-menupopup: _addSmtpServers.");193 194 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";195 var menuitem = document.createElementNS(XUL_NS, "menuitem"); // create a new XUL menuitem196 menuitem.setAttribute("class", "mismatchMenuitem");197 menuitem.setAttribute("key", virtualIdentityExtension.identityData.DEFAULT_SMTP_TAG);198 199 menuitem.setAttribute("label", Components.classes["@mozilla.org/intl/stringbundle;1"]200 .getService(Components.interfaces.nsIStringBundleService)201 .createBundle("chrome://v_identity/locale/v_identity.properties")202 .GetStringFromName("defaultServerTag"));203 204 this.appendChild(menuitem);205 206 var servers, smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"]207 .getService(Components.interfaces.nsISmtpService);208 // check for new https://hg.mozilla.org/comm-central/rev/fab9e5145cd4 smtpService209 if (typeof(smtpService.servers) == "object") servers = smtpService.servers;210 else servers = smtpService.smtpServers;211 212 while (servers && servers.hasMoreElements()) {213 var server = servers.getNext();214 if (server instanceof Components.interfaces.nsISmtpServer && !server.redirectorType) this._addSmtp(server);215 }216 ]]></body>217 212 </method> 218 213 <constructor> … … 221 216 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 222 217 this.appendChild(document.createElementNS(XUL_NS, "menuseparator")); // create a new XUL menuseparator 223 if (this.getAttribute("type") == "identity") this._addIdentities(); 224 else this._addSmtpServers(); 225 ]]> 218 switch (this.getAttribute("type")) { 219 case "identity": 220 this._addIdentities(); 221 break; 222 case "smtpid": 223 this._addIdentitiesWithSmtp(); 224 break; 225 } 226 ]]> 226 227 </constructor> 227 228 </implementation>
Note: See TracChangeset
for help on using the changeset viewer.