RetroZilla/extensions/inspector/resources/content/search/modules/findFiles/findFiles.xml
2015-10-20 23:03:22 -04:00

113 lines
3.0 KiB
XML

<?xml version="1.0"?>
<search
title="Find Files"
xmlns="http://www.mozilla.org/inspector/isml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<dialog elements="txfSearchPath,txfSearchFor,cbRecurse"
href="chrome://inspector/content/search/modules/findFiles/dialog.xul"/>
<columns delimiter="">
<column title="File" name="path" flex="1" copy="true"/>
</columns>
<implementation>
<property name="progressPercent">
<getter><![CDATA[
return (100 * (this.mFileSearch.directoriesSearched+1)) / this.mDirDepth;
]]></getter>
</property>
<property name="progressText">
<getter><![CDATA[
return "blah";
]]></getter>
</property>
<property name="isPastMilestone">
<getter><![CDATA[
if (this.mDirDepth = 1) return true; // always update on a single dir search
var search = this.mFileSearch.directoriesSearched;
var is = search > this.mDirsSearched;
if (is)
this.mDirsSearched = search;
return is;
]]></getter>
</property>
<method name="searchStart">
<parameter name="aMap"/>
<body><![CDATA[
if (!aMap.txfSearchPath) return false;
var fsearch = inSearchUtils.createSearchHelper("file");
this.mFileSearch = fsearch;
var root = inSearchUtils.createLocalFile(aMap.txfSearchPath);
fsearch.searchPath = root;
fsearch.filenameCriteria = aMap.txfSearchFor ? aMap.txfSearchFor : "*";
fsearch.holdResults = false;
fsearch.basePath = aMap.txfSearchPath;
fsearch.returnRelativePaths = true;
fsearch.searchRecursive = aMap.cbRecurse;
this.mDirDepth = fsearch.getDirectoryDepth(root);
var observer = inSearchUtils.createSearchObserver(this, "File");
fsearch.searchAsync(observer);
]]></body>
</method>
<method name="searchStop">
<body><![CDATA[
if (this.mFileSearch)
this.mFileSearch.searchStop();
]]></body>
</method>
<method name="returnSearchResult">
<parameter name="aPath"/>
<body><![CDATA[
this.module.setResultProperty("path", aPath);
this.module.searchResultReady();
]]></body>
</method>
<!-- FileSearch observer -->
<method name="onFileSearchStart">
<parameter name="aProcess"/>
<body/>
</method>
<method name="onFileSearchResult">
<parameter name="aProcess"/>
<body><![CDATA[
var idx = aProcess.resultCount-1;
this.returnSearchResult(aProcess.getStringResultAt(idx));
]]></body>
</method>
<method name="onFileSearchEnd">
<parameter name="aProcess"/>
<parameter name="aResult"/>
<body><![CDATA[
this.module.searchEnd();
]]></body>
</method>
<method name="onFileSearchError">
<parameter name="aProcess"/>
<parameter name="aMsg"/>
<body/>
</method>
</implementation>
</search>