Fix for bug 162542. Quick Search bar for Bookmarks Manager

r=timeless, sr=jag
This commit is contained in:
varga%netscape.com 2002-11-06 12:07:38 +00:00
Родитель 8f45d55129
Коммит 6a8aae7f71
8 изменённых файлов: 76 добавлений и 3 удалений

Просмотреть файл

@ -1061,8 +1061,11 @@ nsXULTreeBuilder::Rebuild()
nsresult rv;
PRInt32 count = mRows.Count();
mRows.Clear();
mConflictSet.Clear();
if (mBoxObject)
mBoxObject->RowCountChanged(0, -count);
rv = CompileRules();
if (NS_FAILED(rv)) return rv;

Просмотреть файл

@ -65,7 +65,8 @@
list-style-image : url("chrome://communicator/skin/bookmarks/schedule.gif");
}
#panel-bar
#panel-bar,
#search-bar
{
border-top: 1px solid ThreeDHighlight;
border-bottom: 1px solid ThreeDShadow;

Просмотреть файл

@ -81,6 +81,13 @@
<toolbarbutton id="btnFindBookmarks" label="&command.findBookmarks.label;"
oncommand="document.getElementById('bookmarks-view').openFindDialog();"/>
</hbox>
<hbox id="search-bar" class="toolbar" align="center">
<label value="&find.label;" accesskey="&find.accesskey;" control="search-box"/>
<textbox id="search-box" flex="1"
type="timed" timeout="500"
callback="document.getElementById('bookmarks-view').searchBookmarks(document.getElementById('search-box').value)"/>
</hbox>
<bookmarks-tree id="bookmarks-view" class="sidebar" type="single-column" flex="1"/>

Просмотреть файл

@ -902,9 +902,11 @@
{
this.mOuter.onCommandUpdate();
const kStatusBar = document.getAnonymousElementByAttribute(this.mOuter, "anonid", "statusbar-text");
if (!kStatusBar)
return;
const currentIndex = this.mOuter.currentIndex;
var displayValue = "";
if (kStatusBar && this.mOuter.treeBoxObject.selection.count == 1) {
if (this.mOuter.treeBoxObject.selection.count == 1) {
if (this.mOuter.treeBoxObject.view.isContainer(currentIndex)) {
const kRDFCContractID = "@mozilla.org/rdf/container;1";
const kRDFCIID = Components.interfaces.nsIRDFContainer;
@ -930,8 +932,8 @@
}
if (displayValue.substring(0, 3) == "NC:")
displayValue = "";
kStatusBar.label = displayValue;
}
kStatusBar.label = displayValue;
},
isEditable: function BMOLBuilderObserver_isEditable(aItemIndex, aColumnID)
@ -1899,6 +1901,17 @@
return true;
]]></body>
</method>
<method name="searchBookmarks">
<parameter name="aInput"/>
<body><![CDATA[
if (!aInput)
this.tree.setAttribute("ref", "NC:BookmarksRoot");
else {
const ref = "find:datasource=rdf:bookmarks&match=http://home.netscape.com/NC-rdf#Name&method=contains&text=";
this.tree.setAttribute("ref", ref + escape(aInput));
}
]]></body>
</method>
</implementation>
</binding>
<!-- Full Bookmarks Tree, multi-columned -->

Просмотреть файл

@ -244,6 +244,13 @@
<toolbarbutton id="delete" label="&command.delete.label;"
command="cmd_bm_delete"/>
</toolbar>
<toolbar id="bookmarks-search">
<label value="&find.label;" accesskey="&find.accesskey;" control="search-box"/>
<textbox id="search-box" flex="1"
type="timed" timeout="500"
callback="document.getElementById('bookmarks-view').searchBookmarks(document.getElementById('search-box').value)"/>
</toolbar>
</toolbox>
<bookmarks-tree id="bookmarks-view" flex="1"/>

Просмотреть файл

@ -85,3 +85,5 @@
<!ENTITY bookmarksWindowTitle.label "Bookmark Manager">
<!ENTITY find.label "Find">
<!ENTITY find.accesskey "F">

Просмотреть файл

@ -100,6 +100,42 @@
</handlers>
</binding>
<binding id="timed-textbox" extends="chrome://global/content/bindings/textbox.xml#textbox">
<content>
<xul:hbox class="textbox-input-box" flex="1">
<html:input class="textbox-input" flex="1" anonid="input"
xbl:inherits="onfocus,onblur,value,type,maxlength,disabled,size,readonly,tabindex"/>
</xul:hbox>
</content>
<implementation>
<field name="_timer">null</field>
<property name="callback"
onset="this.setAttribute('callback', val); return val;"
onget="return this.getAttribute('callback');"/>
<property name="timeout"
onset="this.setAttribute('timeout', val); return val;"
onget="var t = parseInt(this.getAttribute('timeout')); return t ? t : 0;"/>
</implementation>
<handlers>
<handler event="input">
<![CDATA[
if (this._timer)
clearTimeout(this._timer);
this._timer = setTimeout(this.callback, this.timeout);
]]>
</handler>
<handler event="keypress">
<![CDATA[
if (event.keyCode == 13) {
if (this._timer)
clearTimeout(this._timer);
eval(this.callback);
}
]]>
</handler>
</handlers>
</binding>
<binding id="textarea" extends="chrome://global/content/bindings/textbox.xml#textbox">
<content>
<xul:hbox class="textbox-input-box" flex="1">

Просмотреть файл

@ -624,6 +624,10 @@ html|*.textbox-textarea {
-moz-binding: url("chrome://global/content/bindings/textbox.xml#input-box");
}
textbox[type="timed"] {
-moz-binding: url("chrome://global/content/bindings/textbox.xml#timed-textbox");
}
/********** autocomplete textbox **********/
textbox[type="autocomplete"] {