+++ /dev/null
-<?xml version="1.0"?>\r
-\r
-<bindings id="mailBindings"\r
- xmlns="http://www.mozilla.org/xbl"\r
- xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">\r
- \r
- <!-- Message Pane Widgets -->\r
- <binding id="mail-emailaddress" extends="chrome://global/content/xulBindings.xml#basetext">\r
- <content excludes="observes,template">\r
- <xul:box inherits="orient" autostretch="never" flex="1">\r
- <xul:box orient="vertical" autostretch="never" flex="1">\r
- <xul:text class="emailDisplayButton" context="emailAddressPopup" inherits="value,accesskey,crop"/>\r
- </xul:box>\r
- <xul:image class="emailDisplayImage" inherits="src"/>\r
- </xul:box>\r
- </content>\r
- \r
- <interface> \r
- <method name="setTextAttribute">\r
- <argument name="attributeName"/>\r
- <argument name="attributeValue"/>\r
- <body>\r
- <![CDATA[ \r
- var textNode = document.getAnonymousNodes(this)[0].firstChild.firstChild;\r
- textNode.setAttribute(attributeName, attributeValue);\r
- ]]>\r
- </body>\r
- </method>\r
-\r
- <method name="getTextAttribute">\r
- <argument name="attributeName"/>\r
- <argument name="attributeValue"/>\r
- <body>\r
- <![CDATA[ \r
- var textNode = document.getAnonymousNodes(this)[0].firstChild.firstChild;\r
- return textNode.getAttribute(attributeName, attributeValue);\r
- ]]>\r
- </body>\r
- </method>\r
- </interface>\r
- </binding>\r
-\r
- <binding id="search-menulist-abstract" extends="xul:box">\r
- <content>\r
- <xul:menulist inherits="flex" oncommand="this.parentNode.onSelect(event)">\r
- <xul:menupopup/>\r
- </xul:menulist>\r
- </content>\r
-\r
- <interface>\r
- <property readonly="true" name="validityManager">\r
- <![CDATA[\r
- Components.classes['mozilla.mail.search.validityManager.1'].getService(Components.interfaces.nsIMsgSearchValidityManager);\r
- ]]>\r
- </property>\r
- <property name="searchScope" onget="return this.internalScope;">\r
- <!-- scope ID - retrieve the table -->\r
- <setter>\r
- <![CDATA[\r
- // if scope isn't changing this is a noop\r
- if (this.internalScope == val) return;\r
-\r
- this.internalScope = val;\r
- this.refreshList();\r
- var targets = this.targets;\r
- if (targets) {\r
- for (var i=0; i< targets.length; i++) {\r
- targets[i].searchScope = val;\r
- }\r
- }\r
- ]]>\r
- </setter>\r
- </property>\r
-\r
- <property name="validityTable" readonly="true" onget="return this.validityManager.getTable(this.searchScope)"/>\r
-\r
- <property name="valueStrings" readonly="true">\r
- <getter>\r
- <![CDATA[\r
- var strings = new Array;\r
- var ids = this.valueIds;\r
- var bundle = this.stringBundle;\r
- for (var i=0; i<ids.length; i++)\r
- strings[i] = this.stringBundle.GetStringFromID(ids[i]);\r
- return strings;\r
- ]]>\r
- </getter>\r
- </property>\r
- <property name="targets" readonly="true">\r
- <getter>\r
- <![CDATA[\r
- var forAttrs = this.getAttribute("for");\r
- if (!forAttrs) return null;\r
- var targetIds = forAttrs.split(",");\r
- if (targetIds.length == 0) return null;\r
-\r
- var targets = new Array;\r
- var j=0;\r
- for (var i=0; i<targetIds.length;i++) {\r
- var target = document.getElementById(targetIds[i]);\r
- if (target) targets[j++] = target;\r
- }\r
- return targets;\r
- ]]>\r
- </getter>\r
- </property>\r
-\r
- <!-- value forwards to the internal menulist's "data" attribute -->\r
- <property name="value" onget="return document.getAnonymousNodes(this)[0].selectedItem.getAttribute('data');">\r
- <setter>\r
- <![CDATA[\r
- var menulist = document.getAnonymousNodes(this)[0];\r
- var dataItems = menulist.getElementsByAttribute("data", val);\r
- if (dataItems.length > 0)\r
- menulist.selectedItem = dataItems[0];\r
- ]]>\r
- </setter>\r
- </property>\r
- <method name="refreshList">\r
- <body>\r
- <![CDATA[\r
- var menuItemIds = this.valueIds;\r
- var menuItemStrings = this.valueStrings;\r
-\r
- var menulist = document.getAnonymousNodes(this)[0];\r
- var popup = menulist.firstChild;\r
-\r
- // save our old "data" so we can restore it later\r
- var oldData = menulist.data;\r
-\r
- // remove the old popup children\r
- while (popup.hasChildNodes())\r
- popup.removeChild(popup.lastChild);\r
-\r
- var newSelection;\r
- for (var i=0; i<menuItemIds.length; i++) {\r
- // create the menuitem\r
- var menuitem = document.createElement("menuitem");\r
- menuitem.setAttribute("value", menuItemStrings[i]);\r
- menuitem.setAttribute("data", menuItemIds[i]);\r
- popup.appendChild(menuitem);\r
-\r
- // try to restore the selection\r
- if (!newSelection || oldData == menuItemIds[i].toString()) {\r
- newSelection = menuitem;\r
- }\r
- }\r
-\r
- // now restore the selection\r
- menulist.selectedItem = newSelection\r
- ]]>\r
- </body>\r
- </method>\r
- <method name="onSelect">\r
- <argument name="event"/>\r
- <body>\r
- <![CDATA[\r
- var menulist = document.getAnonymousNodes(this)[0];\r
-\r
- // notify targets\r
- var targets = this.targets;\r
- if (targets) {\r
- for (var i=0; i< targets.length; i++) {\r
- targets[i].parentValue = menulist.data;\r
- }\r
- }\r
- ]]>\r
- </body>\r
- </method>\r
- </interface>\r
- </binding>\r
-\r
- <!-- searchattribute - Subject, Sender, To, CC, etc. -->\r
- <binding id="searchattribute"\r
- extends="chrome://messenger/skin/mailWidgets.xml#search-menulist-abstract">\r
- <interface>\r
- <property name="stringBundle">\r
- <![CDATA[\r
- srGetStrBundle("chrome://messenger/locale/search-attributes.properties");\r
- ]]>\r
- </property>\r
- <property name="valueIds" readonly="true">\r
- <getter>\r
- <![CDATA[\r
- var length = new Object;\r
- return this.validityTable.getAvailableAttributes(length);\r
- ]]>\r
- </getter>\r
- </property>\r
- </interface>\r
- </binding>\r
-\r
- <!-- searchoperator - Contains, Is Less than, etc -->\r
- <binding id="searchoperator"\r
- extends="chrome://messenger/skin/mailWidgets.xml#search-menulist-abstract">\r
- <interface>\r
- <property name="stringBundle">\r
- <![CDATA[\r
- srGetStrBundle("chrome://messenger/locale/search-operators.properties");\r
- ]]>\r
- </property>\r
- <property name="valueIds" readonly="true">\r
- <getter>\r
- <![CDATA[\r
- var length = new Object;\r
- return this.validityTable.getAvailableOperators(this.searchAttribute,length);\r
- ]]>\r
- </getter>\r
- </property>\r
- <property name="parentValue">\r
- <setter>\r
- <![CDATA[\r
- if (this.searchAttribute == val) return;\r
- this.searchAttribute = val;\r
- this.refreshList();\r
- ]]>\r
- </setter>\r
- <getter>\r
- <![CDATA[\r
- return this.searchAttribute;\r
- ]]>\r
- </getter>\r
- </property>\r
- </interface>\r
- </binding>\r
-\r
- <!-- searchvalue - a widget which dynamically changes it's user interface\r
- depending on what type of data it's supposed to be showing\r
- currently handles arbitrary text entry, and menulists for priority and\r
- status\r
- -->\r
- <binding id="searchvalue" extends="xul:deck">\r
- <!-- yeah yeah, this stuff needs to be localized. I'm working on it! -->\r
- <content>\r
- <xul:textfield flex="1" />\r
- <xul:menulist flex="1" >\r
- <xul:menupopup>\r
- <xul:menuitem value="Lowest"/>\r
- <xul:menuitem value="Low"/>\r
- <xul:menuitem value="Normal"/>\r
- <xul:menuitem value="High"/>\r
- <xul:menuitem value="Highest"/>\r
- </xul:menupopup>\r
- </xul:menulist>\r
- <xul:menulist flex="1" >\r
- <xul:menupopup>\r
- <xul:menuitem value="read"/>\r
- <xul:menuitem value="replied"/>\r
- </xul:menupopup>\r
- </xul:menulist>\r
- </content>\r
- <interface>\r
- <!-- parentValue forwards to the attribute -->\r
- <property name="parentValue" onset="this.searchAttribute=val;"\r
- onget="return this.searchAttribute;"/>\r
- <property name="searchAttribute" onget="return this.internalAttribute;">\r
- <setter>\r
- <![CDATA[\r
- // noop if we're not changing it\r
- if (this.internalAttribute == val) return;\r
- this.internalAttribute = val;\r
- // we inherit from a deck, so just use it's index attribute\r
- // to hide/show widgets\r
- if (val == Components.interfaces.nsMsgSearchAttrib.Priority)\r
- this.setAttribute("index", "1");\r
- else if (val == Components.interfaces.nsMsgSearchAttrib.MsgStatus)\r
- this.setAttribute("index", "2");\r
- else\r
- this.setAttribute("index", "0");\r
- ]]>\r
- </setter>\r
- </property>\r
- <property name="value" onget="return this.internalValue;">\r
- <setter>\r
- <![CDATA[\r
- // val is a nsIMsgSearchValue object\r
- this.internalValue = val;\r
- var attrib = val.attrib;\r
- this.searchAttribute = attrib;\r
- if (attrib == Components.interfaces.nsMsgSearchAttrib.Priority)\r
- document.getAnonymousNodes(this)[1].data=val.priority;\r
- else if (attrib == Components.interfaces.nsMsgSearchAttrib.MsgStatus)\r
- document.getAnonymousNodes(this)[2].data=val.status;\r
- else\r
- document.getAnonymousNodes(this)[0].value = val.str;\r
- ]]>\r
- </setter>\r
- </property>\r
- <method name="save">\r
- <body>\r
- <![CDATA[\r
- var searchValue = this.value;\r
- var searchAttribute = this.searchAttribute;\r
- var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;\r
-\r
- searchValue.attrib = searchAttribute;\r
- if (searchAttribute == nsMsgSearchAttrib.Priority)\r
- searchValue.priority = document.getAnonymousNodes(this)[1].selectedItem.data;\r
- else if (searchAttribute == nsMsgSearchAttrib.MsgStatus)\r
- searchValue.status = document.getAnonymousNodes(this)[2].selectedItem.data;\r
- else\r
- searchValue.str = document.getAnonymousNodes(this)[0].value;\r
- ]]>\r
- </body>\r
- </method>\r
- <method name="saveTo">\r
- <argument name="searchValue"/>\r
- <body>\r
- <![CDATA[\r
- this.internalValue = searchValue;\r
- this.save();\r
- ]]>\r
- </body>\r
- </method>\r
- </interface>\r
- </binding>\r
- <binding id="searchterm" extends="xul:box">\r
- <interface>\r
- <!-- the actual nsIMsgSearchTerm object -->\r
- <property name="searchTerm" onget="return this.internalSearchTerm">\r
- <setter>\r
- <![CDATA[\r
- this.internalSearchTerm = val;\r
-\r
- var term = val;\r
- // val is a nsIMsgSearchTerm\r
- var searchAttribute=this.searchattribute;\r
- var searchOperator=this.searchoperator;\r
- var searchValue=this.searchvalue;\r
-\r
- // now reflect all attributes of the searchterm into the widgets\r
- if (searchAttribute) searchAttribute.value = term.attrib;\r
- if (searchOperator) searchOperator.value = val.op;\r
- if (searchValue) searchValue.value = term.value;\r
-\r
- this.booleanAnd = val.booleanAnd;\r
- ]]>\r
- </setter>\r
- </property>\r
- \r
- <property name="searchScope">\r
- <getter>\r
- <![CDATA[\r
- var searchAttribute = this.searchattribute;\r
- if (searchAttribute)\r
- return searchAttribute.searchScope;\r
- return undefined;\r
- ]]>\r
- </getter>\r
- <setter>\r
- <![CDATA[\r
- var searchAttribute = this.searchattribute;\r
- if (searchAttribute) searchAttribute.searchScope=val;\r
- ]]>\r
- </setter>\r
- </property>\r
- <!-- the three tags that make up a term - to use, set the\r
- attribute in the XUL to the ID of the term.\r
- -->\r
- <property name="searchattribute" \r
- onget="return document.getElementById(this.getAttribute('searchattribute'));"\r
- onset="this.setAttribute('searchattribute',val.id)"/>\r
-\r
- <property name="searchoperator" \r
- onget="return document.getElementById(this.getAttribute('searchoperator'));"\r
- onset="this.setAttribute('searchoperator',val.id)"/>\r
-\r
- <property name="searchvalue" \r
- onget="return document.getElementById(this.getAttribute('searchvalue'));"\r
- onset="this.setAttribute('searchvalue',val.id)"/>\r
- <property name="booleanNodes">\r
- <![CDATA[\r
- null;\r
- ]]>\r
- </property>\r
- <property name="stringBundle">\r
- <![CDATA[\r
- srGetStrBundle("chrome://messenger/locale/search.properties");\r
- ]]>\r
- </property>\r
- <property name="booleanAnd" onget="return this.internalBooleanAnd">\r
- <setter>\r
- <![CDATA[\r
- // whenever you set this, all nodes in booleanNodes\r
- // are updated to reflect the string\r
-\r
- if (this.internalBooleanAnd == val) return;\r
- this.internalBooleanAnd = val;\r
-\r
- var booleanNodes = this.booleanNodes;\r
- if (!booleanNodes) return;\r
-\r
- var stringBundle = this.stringBundle;\r
- var andString = val ? "And" : "Or";\r
- for (var i=0; i<booleanNodes.length; i++) {\r
- try { \r
- var staticString =\r
- stringBundle.GetStringFromName("search" + andString + i);\r
- if (staticString && staticString.length>0)\r
- booleanNodes[i].setAttribute("value", staticString);\r
- } catch (ex) { /* no error, means string not found */}\r
- }\r
- ]]>\r
- </setter>\r
- </property>\r
- <method name="save">\r
- <body>\r
- <![CDATA[\r
- var searchTerm = this.searchTerm;\r
- searchTerm.attrib = this.searchattribute.value;\r
- searchTerm.op = this.searchoperator.value;\r
- if (this.searchvalue.value)\r
- this.searchvalue.save();\r
- else\r
- this.searchvalue.saveTo(searchTerm.value);\r
- searchTerm.value = this.searchvalue.value;\r
- searchTerm.booleanAnd = this.booleanAnd;\r
- ]]>\r
- </body>\r
- </method>\r
- <!-- if you have a search term element with no search term -->\r
- <method name="saveTo">\r
- <argument name="searchTerm"/>\r
- <body>\r
- <![CDATA[\r
- this.internalSearchTerm = searchTerm;\r
- this.save();\r
- ]]>\r
- </body>\r
- </method>\r
- </interface>\r
- </binding>\r
-</bindings>\r