Bug 581073 - Search pane needs to expose the relevancy sort order. r=dtownsend, a=blocking-beta5

This commit is contained in:
Blair McBride 2010-08-28 10:01:36 +12:00
parent b2536d0df5
commit c89bea4e77
3 changed files with 18 additions and 4 deletions

View File

@ -94,8 +94,8 @@
<!ENTITY sort.name.tooltip "Sort by name">
<!ENTITY sort.dateUpdated.label "Last Updated">
<!ENTITY sort.dateUpdated.tooltip "Sort by date updated">
<!ENTITY sort.rating.label "Rating">
<!ENTITY sort.rating.tooltip "Sort by average rating">
<!ENTITY sort.relevance.label "Best match">
<!ENTITY sort.relevance.tooltip "Sort by relevance">
<!ENTITY search.filter2.label "Search:">
<!ENTITY search.filter2.installed.label "My Add-ons">

View File

@ -244,6 +244,10 @@
label="&sort.dateUpdated.label;"
tooltiptext="&sort.dateUpdated.tooltip;"
oncommand="this.parentNode._handleChange('dateUpdated');"/>
<xul:button anonid="btn-relevance" class="sorter" hidden="true"
label="&sort.relevance.label;"
tooltiptext="&sort.relevance.tooltip;"
oncommand="this.parentNode._handleChange('relevancescore');"/>
</content>
<implementation>
@ -251,6 +255,9 @@
if (!this.hasAttribute("sortby"))
this.setAttribute("sortby", "name");
if (this.getAttribute("showrelevance") == "true")
this._btnRelevance.hidden = false;
this._refreshState();
]]></constructor>
@ -261,6 +268,9 @@
<field name="_btnDate">
document.getAnonymousElementByAttribute(this, "anonid", "btn-date");
</field>
<field name="_btnRelevance">
document.getAnonymousElementByAttribute(this, "anonid", "btn-relevance");
</field>
<property name="sortBy">
<getter><![CDATA[
@ -337,6 +347,10 @@
else
this._btnDate.checkState = 0;
if (sortBy == "relevancescore")
this._btnRelevance.checkState = checkState;
else
this._btnRelevance.checkState = 0;
if (this.handler && "onSortChanged" in this.handler)
this.handler.onSortChanged(sortBy, this.ascending);

View File

@ -215,8 +215,8 @@
</radiogroup>
</hbox>
<hbox class="view-header" pack="end">
<hbox id="search-sorters" class="sort-controls" sortby="name"
ascending="true"/>
<hbox id="search-sorters" class="sort-controls"
showrelevance="true" sortby="relevancescore" ascending="false"/>
</hbox>
<richlistbox id="search-list" class="list" flex="1">
<vbox id="search-list-empty" class="empty-list-notice"