зеркало из https://github.com/mozilla/pjs.git
implement typedown feature
This commit is contained in:
Родитель
fe9b145470
Коммит
640b66585b
|
@ -6,6 +6,7 @@ var RDF = null;
|
||||||
var gSubscribeDS = null;
|
var gSubscribeDS = null;
|
||||||
var gStatusBar = null;
|
var gStatusBar = null;
|
||||||
var gNameField = null;
|
var gNameField = null;
|
||||||
|
var gFolderDelimiter = ".";
|
||||||
|
|
||||||
function Stop()
|
function Stop()
|
||||||
{
|
{
|
||||||
|
@ -90,7 +91,7 @@ function SubscribeOnLoad()
|
||||||
{
|
{
|
||||||
dump("SubscribeOnLoad()\n");
|
dump("SubscribeOnLoad()\n");
|
||||||
|
|
||||||
gSubscribeTree = document.getElementById('subscribetree');
|
gSubscribeTree = document.getElementById('subscribetree');
|
||||||
gStatusBar = document.getElementById('statusbar-icon');
|
gStatusBar = document.getElementById('statusbar-icon');
|
||||||
gNameField = document.getElementById('namefield');
|
gNameField = document.getElementById('namefield');
|
||||||
|
|
||||||
|
@ -127,6 +128,8 @@ function SubscribeOnLoad()
|
||||||
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
||||||
|
|
||||||
gSubscribeDS = RDF.GetDataSource("rdf:subscribe");
|
gSubscribeDS = RDF.GetDataSource("rdf:subscribe");
|
||||||
|
|
||||||
|
gNameField.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function subscribeOK()
|
function subscribeOK()
|
||||||
|
@ -262,3 +265,54 @@ function RefreshList()
|
||||||
dump("refresh list\n");
|
dump("refresh list\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function trackGroupInTree()
|
||||||
|
{
|
||||||
|
var portion = gNameField.value;
|
||||||
|
selectNodeByName( portion );
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectNodeByName( aMatchString )
|
||||||
|
{
|
||||||
|
var lastDot = aMatchString.lastIndexOf(gFolderDelimiter);
|
||||||
|
var nodeValue = lastDot != -1 ? aMatchString.substring(0, lastDot) : aMatchString;
|
||||||
|
|
||||||
|
var chain = aMatchString.split(gFolderDelimiter);
|
||||||
|
if( chain.length == 1 ) {
|
||||||
|
var node = getTreechildren(gSubscribeTree);
|
||||||
|
if( !node )
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var node = gSubscribeTree.getElementsByAttribute("name",nodeValue)[0];
|
||||||
|
if( node.getAttribute("container") == "true" &&
|
||||||
|
node.getAttribute("open") != "true" )
|
||||||
|
node.setAttribute("open","true");
|
||||||
|
node = getTreechildren(node);
|
||||||
|
dump("*** node = " + node.nodeName + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
for( var i = 0; i < node.childNodes.length; i++ )
|
||||||
|
{
|
||||||
|
var currItem = node.childNodes[i];
|
||||||
|
dump("*** chain = " + chain[chain.length-1] + "\n");
|
||||||
|
if( !currItem.getAttribute("name").indexOf( aMatchString ) ) {
|
||||||
|
gSubscribeTree.selectItem( currItem );
|
||||||
|
gSubscribeTree.ensureElementIsVisible( currItem );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTreechildren( aTreeNode )
|
||||||
|
{
|
||||||
|
if( aTreeNode.childNodes )
|
||||||
|
{
|
||||||
|
for( var i = 0; i < aTreeNode.childNodes.length; i++ )
|
||||||
|
{
|
||||||
|
if( aTreeNode.childNodes[i].nodeName.toLowerCase() == "treechildren" )
|
||||||
|
return aTreeNode.childNodes[i];
|
||||||
|
}
|
||||||
|
return aTreeNode;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
|
@ -56,7 +56,7 @@ Rights Reserved.
|
||||||
|
|
||||||
<rows>
|
<rows>
|
||||||
<row>
|
<row>
|
||||||
<text class="label" value="&server.label;"/>
|
<text class="label" value="&server.label;" for="serverMenu"/>
|
||||||
<menulist oncommand="onServerClick(event);" id="serverMenu"
|
<menulist oncommand="onServerClick(event);" id="serverMenu"
|
||||||
rdf:datasources="rdf:msgaccountmanager rdf:mailnewsfolders"
|
rdf:datasources="rdf:msgaccountmanager rdf:mailnewsfolders"
|
||||||
rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
|
rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
|
||||||
|
@ -72,8 +72,8 @@ Rights Reserved.
|
||||||
</menulist>
|
</menulist>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<text class="label" id="foldertextlabel" value="..." for="name"/>
|
<text class="label" id="foldertextlabel" value="..." for="namefield"/>
|
||||||
<textfield id="namefield" flex="1"/>
|
<textfield id="namefield" flex="1" oninput="trackGroupInTree();"/>
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче