Bug 896768 Allow autocompletesearch="file" results to be styled r=Mossop

--HG--
extra : rebase_source : 1e710d9308c037c9037fe00e9360eb1ee0131408
This commit is contained in:
Neil Rashbrook 2013-08-12 23:52:44 +01:00
Родитель ac7bb3d0aa
Коммит 10282e0d27
4 изменённых файлов: 19 добавлений и 3 удалений

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

@ -84,11 +84,15 @@ nsFileResult::nsFileResult(const nsAString& aSearchString,
nextFile->GetLeafName(fileName);
if (StringBeginsWith(fileName, prefix)) {
fileName.Insert(parent, 0);
mValues.AppendElement(fileName);
if (mSearchResult == RESULT_NOMATCH && fileName.Equals(mSearchString))
mSearchResult = RESULT_IGNORED;
else
mSearchResult = RESULT_SUCCESS;
bool isDirectory = false;
nextFile->IsDirectory(&isDirectory);
if (isDirectory)
fileName.Append('/');
mValues.AppendElement(fileName);
}
}
mValues.Sort();
@ -138,6 +142,8 @@ NS_IMETHODIMP nsFileResult::GetTypeAheadResult(bool *aTypeAheadResult)
NS_IMETHODIMP nsFileResult::GetValueAt(int32_t index, nsAString & aValue)
{
aValue = mValues[index];
if (aValue.Last() == '/')
aValue.Truncate(aValue.Length() - 1);
return NS_OK;
}
@ -154,7 +160,10 @@ NS_IMETHODIMP nsFileResult::GetCommentAt(int32_t index, nsAString & aComment)
NS_IMETHODIMP nsFileResult::GetStyleAt(int32_t index, nsAString & aStyle)
{
aStyle.Truncate();
if (mValues[index].Last() == '/')
aStyle.AssignLiteral("directory");
else
aStyle.AssignLiteral("file");
return NS_OK;
}

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

@ -20,6 +20,7 @@
/* ::::: file/directory items ::::: */
treechildren::-moz-tree-image(treecolAutoCompleteValue),
treechildren::-moz-tree-image(FilenameColumn) {
padding-right: 2px;
margin: 0px 2px;
@ -27,10 +28,12 @@ treechildren::-moz-tree-image(FilenameColumn) {
height: 16px;
}
treechildren::-moz-tree-image(treecolAutoCompleteValue, directory),
treechildren::-moz-tree-image(FilenameColumn, directory) {
list-style-image: url("moz-icon://stock/gtk-directory?size=menu");
}
treechildren::-moz-tree-image(treecolAutoCompleteValue, file),
treechildren::-moz-tree-image(FilenameColumn, file) {
list-style-image: url("moz-icon://stock/gtk-file?size=menu");
}

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

@ -16,11 +16,13 @@
/* ::::: file/directory items ::::: */
treechildren::-moz-tree-image(treecolAutoCompleteValue, directory),
treechildren::-moz-tree-image(FilenameColumn, directory) {
margin-right: 2px;
list-style-image: url("chrome://global/skin/filepicker/dir-closed.gif");
}
treechildren::-moz-tree-image(treecolAutoCompleteValue, file),
treechildren::-moz-tree-image(FilenameColumn, file) {
list-style-image: url("chrome://global/skin/filepicker/blank.gif");
}

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

@ -20,11 +20,13 @@
/* ::::: file/directory items ::::: */
treechildren::-moz-tree-image(treecolAutoCompleteValue, directory),
treechildren::-moz-tree-image(FilenameColumn, directory) {
list-style-image: url("chrome://global/skin/icons/folder-item.png");
-moz-image-region: rect(0px, 32px, 16px, 16px);
}
treechildren::-moz-tree-image(treecolAutoCompleteValue, file),
treechildren::-moz-tree-image(FilenameColumn, file) {
list-style-image: url("chrome://global/skin/icons/folder-item.png");
-moz-image-region: rect(16px, 16px, 32px, 0px);
@ -72,4 +74,4 @@ treechildren::-moz-tree-image(FilenameColumn, file) {
list-style-image: url("chrome://global/skin/Filepicker.png");
-moz-image-region: rect(24px 72px 48px 48px);
max-width: 36px;
}
}