Bug 449317 – Use the new search textbox binding in the Add-ons manager. r=mossop

This commit is contained in:
Dão Gottwald 2008-08-07 23:16:01 +02:00
parent 16d48cecb4
commit 190db00476
11 changed files with 12 additions and 241 deletions

View File

@ -147,10 +147,6 @@ richlistitem[opType="needs-disable"] hbox.addon-description {
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#addon-needs-disable");
}
#searchbox {
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#search-textbox");
}
#viewGroup radio {
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#viewbutton");
-moz-box-orient: vertical;

View File

@ -355,7 +355,7 @@ function showView(aView) {
[ ["statusMessage", "true", null] ] ];
var displays = [ "richlistitem", "vbox" ];
showCheckUpdatesAll = false;
document.getElementById("searchbox").disabled = isOffline("offlineSearchMsg");
document.getElementById("searchfield").disabled = isOffline("offlineSearchMsg");
break;
case "extensions":
prefURL = PREF_EXTENSIONS_GETMOREEXTENSIONSURL;
@ -643,9 +643,9 @@ function displaySearchThrobber(aKey) {
// Clears the search box and updates the result list
function resetSearch() {
var searchbox = document.getElementById("searchbox");
searchbox.value = "";
searchbox.focus();
var searchfield = document.getElementById("searchfield");
searchfield.value = "";
searchfield.focus();
retrieveRepositoryAddons("");
}
@ -798,9 +798,8 @@ function displaySearchResults(addons, count, isRecommended) {
gRDF.GetResource(PREFIX_NS_EM + "count"),
gRDF.GetIntLiteral(count),
true);
var searchbox = document.getElementById("searchbox");
// The value attribute will be the persisted value of the last search run
url = gAddonRepository.getSearchURL(searchbox.getAttribute("value"));
var searchfield = document.getElementById("searchfield");
url = gAddonRepository.getSearchURL(searchfield.value);
}
gSearchDS.Assert(labelNode,
gRDF.GetResource(PREFIX_NS_EM + "link"),
@ -875,7 +874,7 @@ function initSearchDS() {
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(nsIIOService);
if (!ioService.offline)
retrieveRepositoryAddons(document.getElementById("searchbox").value);
retrieveRepositoryAddons(document.getElementById("searchfield").value);
}
function initPluginsDS()
@ -1969,9 +1968,9 @@ const gAddonsMsgObserver = {
ioService.offline = false;
// If no results have been retrieved start pulling some
if (!gRetrievedResults)
retrieveRepositoryAddons(document.getElementById("searchbox").value);
retrieveRepositoryAddons(document.getElementById("searchfield").value);
if (gView == "search")
document.getElementById("searchbox").disabled = false;
document.getElementById("searchfield").disabled = false;
break;
case "addons-message-dismiss":
break;

View File

@ -879,115 +879,6 @@
</content>
</binding>
<binding id="search-textbox" extends="xul:box">
<resources>
<stylesheet src="chrome://global/skin/textbox.css"/>
</resources>
<content align="center">
<xul:textbox class="plain"
xbl:inherits="emptytext,onfocus,onblur,spellcheck,value,maxlength,disabled,size,readonly,tabindex,accesskey"/>
<xul:button class="searchbox-search" xbl:inherits="disabled" oncommand="this.parentNode.startSearch()" chromedir="&locale.dir;"/>
<xul:button class="searchbox-cancel" xbl:inherits="disabled" hidden="true" oncommand="this.parentNode.clearSearch()"/>
</content>
<implementation>
<field name="textbox">
document.getAnonymousNodes(this)[0];
</field>
<field name="_searchButton">
document.getAnonymousElementByAttribute(this, "class", "searchbox-search");
</field>
<field name="_cancelButton">
document.getAnonymousElementByAttribute(this, "class", "searchbox-cancel");
</field>
<property name="value" onget="return this.textbox.value">
<setter>
this.textbox.value = val;
this.setAttribute("value", val);
this._cancelButton.hidden = !val;
this._searchButton.hidden = !!val;
</setter>
</property>
<property name="disabled" onget="return this.textbox.disabled">
<setter>
if (val)
this.setAttribute("disabled", "true");
else
this.removeAttribute("disabled");
</setter>
</property>
<constructor>
if (this.value) {
this._cancelButton.hidden = false;
this._searchButton.hidden = true;
}
</constructor>
<method name="startSearch">
<body>
if (this.value) {
this._cancelButton.hidden = false;
this._searchButton.hidden = true;
}
this.setAttribute("value", this.value);
</body>
</method>
<method name="clearSearch">
<body>
this.value = "";
this.setAttribute("value", "");
this._cancelButton.hidden = true;
this._searchButton.hidden = false;
this.focus();
</body>
</method>
<method name="_dispatchCommandEvent">
<parameter name="aEvent"/>
<body>
var event = document.createEvent("commandevent");
event.initCommandEvent("command", true, true, window, null,
false, false, false, false, aEvent);
this.dispatchEvent(event);
</body>
</method>
</implementation>
<handlers>
<handler event="focus" phase="capturing">
if (event.originalTarget == this)
this.textbox.focus(); // Forward focus to actual textbox
</handler>
<handler event="keypress" keycode="VK_ENTER">
if (event.originalTarget == this.textbox.inputField) {
this.startSearch();
this._dispatchCommandEvent(event);
}
</handler>
<handler event="keypress" keycode="VK_RETURN">
if (event.originalTarget == this.textbox.inputField) {
this.startSearch();
this._dispatchCommandEvent(event);
}
</handler>
<handler event="input">
this._cancelButton.hidden = true;
this._searchButton.hidden = false;
</handler>
</handlers>
</binding>
<!-- based on preferences.xml paneButton -->
<binding id="viewbutton" extends="chrome://global/content/bindings/radio.xml#radio">
<resources>

View File

@ -183,9 +183,9 @@
<notificationbox id="addonsMsg" flex="1">
<vbox id="extensionsBox" flex="1">
<hbox id="searchPanel" align="center">
<textbox id="searchbox" emptytext="&searchAddons.label;"
oncommand="retrieveRepositoryAddons(this.value);"
persist="value"/>
<textbox id="searchfield" emptytext="&searchAddons.label;"
type="search" searchbutton="true"
oncommand="retrieveRepositoryAddons(this.value);"/>
<spacer flex="1"/>
<label id="browseAddons" class="text-link" value="&browseAddons.label;"
onclick="openURL(this.getAttribute('homepageURL'));"/>

View File

@ -338,26 +338,6 @@ vbox[typeName="status"][type="header-recommended"] {
background: -moz-dialog;
}
.searchbox-search, .searchbox-cancel {
-moz-appearance: none;
cursor: default;
background-color: transparent;
margin: 0;
border: 0;
padding: 0;
width: 16px;
height: 16px;
min-width: 16px;
}
.searchbox-search {
list-style-image: url("chrome://mozapps/skin/extensions/searchIcons.png");
}
.searchbox-cancel {
list-style-image: url("moz-icon://stock/gtk-clear?size=menu");
}
#progressBox {
padding: 5px 5px 5px 5px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

View File

@ -5,7 +5,6 @@ classic.jar:
+ skin/classic/mozapps/downloads/downloads.css (downloads/downloads.css)
+ skin/classic/mozapps/extensions/notifyBadges.png (extensions/notifyBadges.png)
+ skin/classic/mozapps/extensions/extensionIcons.png (extensions/extensionIcons.png)
+ skin/classic/mozapps/extensions/searchIcons.png (extensions/searchIcons.png)
+ skin/classic/mozapps/extensions/extensions.css (extensions/extensions.css)
+ skin/classic/mozapps/extensions/ratings.png (extensions/ratings.png)
+ skin/classic/mozapps/extensions/themeGeneric.png (extensions/themeGeneric.png)

View File

@ -350,46 +350,6 @@ vbox[typeName="status"][type="header-recommended"] {
border-bottom: 1px solid #878787;
}
#searchbox {
-moz-appearance: none;
border: 3px solid;
-moz-border-top-colors: #5F5F5F #CFCFCF -moz-Field;
-moz-border-bottom-colors: #9F9F9F #EEE -moz-Field;
-moz-border-right-colors: #7F7F7F #EEE -moz-Field;
-moz-border-left-colors: #7F7F7F #EFEFEF -moz-Field;
-moz-border-radius: 11px;
-moz-background-clip: border !important;
padding: 0 8px;
}
#searchbox[focused="true"] {
outline: 2px solid #4A8BC7;
outline-offset: -2px;
-moz-outline-radius: 11px;
}
.searchbox-search, .searchbox-cancel {
list-style-image: url(chrome://mozapps/skin/extensions/searchIcons.png);
-moz-appearance: none;
cursor: default;
margin: 0;
border: 0;
padding: 0;
width: 16px;
height: 16px;
min-width: 16px;
min-height: 16px;
}
.searchbox-search {
-moz-image-region: rect(0px 16px 16px 0px);
}
.searchbox-cancel {
-moz-image-region: rect(0px 32px 16px 16px);
}
#progressBox {
padding: 5px 5px 5px 5px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 841 B

View File

@ -13,7 +13,6 @@ classic.jar:
skin/classic/mozapps/extensions/viewButtons.png (extensions/viewButtons.png)
skin/classic/mozapps/extensions/ratings.png (extensions/ratings.png)
skin/classic/mozapps/extensions/extensionIcons.png (extensions/extensionIcons.png)
skin/classic/mozapps/extensions/searchIcons.png (extensions/searchIcons.png)
skin/classic/mozapps/extensions/about.css (extensions/about.css)
skin/classic/mozapps/extensions/extensions.css (extensions/extensions.css)
skin/classic/mozapps/extensions/extensions.xml (extensions/extensions.xml)

View File

@ -330,59 +330,6 @@ vbox[typeName="status"][type="header-recommended"] {
background: -moz-dialog;
}
#searchbox {
padding: 2px;
}
.searchbox-search,
.searchbox-cancel {
-moz-appearance: none;
cursor: default;
margin: 0;
border: 0;
padding: 0;
width: 16px;
height: 16px;
min-width: 16px;
background-color: -moz-field;
}
.searchbox-search {
list-style-image: url("chrome://global/skin/icons/Search-glass.png");
-moz-image-region: rect(0px 16px 16px 0px);
}
.searchbox-search[chromedir="rtl"] {
list-style-image: url("chrome://global/skin/icons/Search-glass-rtl.png");
}
.searchbox-search:hover {
-moz-image-region: rect(0px 32px 16px 16px);
}
.searchbox-search:hover:active {
-moz-image-region: rect(0px 48px 16px 32px);
}
.searchbox-cancel {
list-style-image: url("chrome://global/skin/icons/Search-close.png");
-moz-image-region: rect(0px 16px 16px 0px);
}
.searchbox-cancel:hover {
-moz-image-region: rect(0px 32px 16px 16px);
}
.searchbox-cancel:hover:active {
-moz-image-region: rect(0px 48px 16px 32px);
}
.searchbox-search .button-box,
.searchbox-cancel .button-box {
border: 0px;
padding: 0px;
}
#progressBox {
padding: 5px 5px 5px 5px;
}